Annotating actionpoint for my action

Hi Team,

I have to register actionpoint for the action “clear-diagnostics”(highlighted in yang below) in my annotation file but I am unable to do it. Can someone share how to specify actionpoint in annotations file for below yang?

Yang Model:

module: org-openroadm-otn-odu-interfaces
  augment /org-openroadm-device:org-openroadm-device/org-openroadm-device:interface:
    +--rw odu!
       +--rw maint-testsignal
          **+---x clear-diagnostics** --> ACTION
          |  +---w input
          |  |  +---w type?   testsig-type
          |  +--ro output
          |     +--ro status            org-openroadm-common-types:rpc-status
          |     +--ro status-message?   string
          +--rw enabled?             boolean
          +--rw testPattern          enumeration
          +--rw type?                testsig-type
          +--ro inSync?              boolean
          +--ro seconds              uint32
          +--ro bitErrors?           uint32
          +--ro bitErrorRate?        decimal64

What I have tried :

module org-openroadm-maintenance-testsignal-ann { 
namespace "http://org/openroadm/maintenance-testsignal";
prefix org-openroadm-maint-testsignal-ann;
   
import tailf-common { prefix tailf; }
import org-openroadm-device { prefix org-openroadm-device; }
import org-openroadm-otn-odu-interfaces { prefix org-openroadm-otn-odu-interfaces; }
import org-openroadm-maintenance-testsignal { prefix org-openroadm-maint-testsignal; }

tailf:annotate "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface/org-openroadm-otn-odu-interfaces:odu/org-openroadm-maint-testsignal:maint-testsignal/org-openroadm-maint-testsignal:clear-diagnostics" {
    tailf:actionpoint clear_diagnostics_actionpoint;
    }
 }
   

Error I get :

yang/org-openroadm-maintenance-testsignal-ann.yang:10: error: node 'maint-testsignal' in module 'org-openroadm-maintenance-testsignal' not found

Shouldn’t last part of path org-openroadm-maint-testsignal:maint-testsignal/org-openroadm-maint-testsignal:clear-diagnostics be changed to org-openroadm-otn-odu-interfaces:maint-testsignal/org-openroadm-otn-odu-interfaces:clear-diagnostics ?

Where does namespace org-openroadm-maint-testsigna come from? Isn’t maint-testsignal in the same module like odu?

I would like to add to @mnovak’s correct comment that you should prefer tailf:annotate-module and tailf:annotate-statement to tailf:annotate; among other reasons, you would probably have avoided the mistake you made. With those two statements your annotation may look like

  tailf:annotate-module org-openroadm-maintenance-testsignal {
    tailf:annotate-statement "grouping[name='maint-testsignal']" {
      tailf:annotate-statement "container[name='maint-testsignal']" {
        tailf:annotate-statement "action[name='clear-diagnostics']" {
          tailf:actionpoint clear_diagnostics_actionpoint;
        }
      }
    }
  }

Note that in your case the predicates (the part [name=...]) are not necessary, but in general they may be needed to address the right container/grouping/action etc.

Also note that with annotation like that you don’t need to import the target module(s) to your annotation module, it is all resolved without any imports.