01-14-2022 01:05 AM - edited 01-14-2022 01:19 AM
Hi,
I am new into the nano services, I am trying to write a simple plan where I have an action associated inside the service call. My YANG looks something like follows (tenants and tenant will be replaced with groups/group it's just a draft version)
container multitenancy { tailf:info "SD-WAN Multitenancy"; presence multitenancy; container tenants { tailf:info "SD-WAN Tenants Group"; list tenant { tailf:info "List of customers groupped under the tenant"; key name; leaf name { type string; } leaf deployment-kind { type enumeration { enum standalone; enum redundant; } } leaf deployment { type enumeration { enum aws; enum otc; } } leaf-list customer { type leafref { path "/map:dispatch-map/map:customer"; } } uses ncs:service-data; uses ncs:nano-plan-data; ncs:servicepoint tenant-servicepoint; //uses cfs-actions:multitenancy-grouping; action tenant-profile { tailf:hidden debug; tailf:actionpoint create-tenancy-action; } } } }
My nano looks as follow
ncs:plan-outline create-tenant-plan { description "Setup the Mutlitenant Cluster."; ncs:component-type "ncs:self" { ncs:state "ncs:init" { ncs:create { ncs:post-action-node "$SERVICE" { ncs:action-name "tenant-profile"; } } } ncs:state "cfs:tenant-created" { ncs:create { ncs:pre-condition { ncs:monitor "$SERVICE/plan/component[type='ncs:self'][name='self']/state[name='ncs:init']" { ncs:trigger-expr "post-action-status = 'create-reached'"; } } } } ncs:state "ncs:ready"; } } ncs:service-behavior-tree tenant-servicepoint { ncs:plan-outline-ref create-tenant-plan; ncs:selector { ncs:create-component "'self'" { ncs:component-type-ref "ncs:self"; } } }
I just want to monitor if the action was performed, based on that tenant-created state should be reached. My action is performed without any issues however inside the plan I see the following
admin@ncs> show infrastructure multitenancy tenants tenant infrastructure multitenancy tenants tenant foo plan-location /infrastructure/multitenancy/tenants/tenant[name='foo'] BACK POST ACTION TYPE NAME TRACK GOAL STATE STATUS WHEN ref STATUS ------------------------------------------------------------------------------------------------ self self false - init reached 2022-01-13T19:05:12 - create-reached tenant-created not-reached - - - ready not-reached - - - [ok][2022-01-13 19:05:38]
When I replace ncs:trigger-expr "post-action-status = 'create-reached'"; with
admin@ncs> show infrastructure multitenancy tenants tenant infrastructure multitenancy tenants tenant foo plan-location /infrastructure/multitenancy/tenants/tenant[name='foo'] BACK POST ACTION TYPE NAME TRACK GOAL STATE STATUS WHEN ref STATUS -------------------------------------------------------------------------------------------- self self false - init reached 2022-01-14T08:46:08 - create-reached tenant-created reached 2022-01-14T08:46:08 - - ready reached 2022-01-14T08:46:08 - - [ok][2022-01-14 08:46:17] admin@ncs> show infrastructure multitenancy tenants tenant | display xpath /infrastructure/multitenancy/tenants/tenant[name='foo']/plan-location /infrastructure/multitenancy/tenants/tenant[name='foo'] /infrastructure/multitenancy/tenants/tenant[name='foo']/plan/component[type='ncs:self'][name='self']/state[name='ncs:init']/status reached /infrastructure/multitenancy/tenants/tenant[name='foo']/plan/component[type='ncs:self'][name='self']/state[name='ncs:init']/when 2022-01-14T08:46:08 /infrastructure/multitenancy/tenants/tenant[name='foo']/plan/component[type='ncs:self'][name='self']/state[name='ncs:init']/post-action-status create-reached /infrastructure/multitenancy/tenants/tenant[name='foo']/plan/component[type='ncs:self'][name='self']/state[name='cfs:tenant-created']/status reachedAny idea what I am doing wrong? Thanks!
01-28-2022 08:28 AM
There was a similardiscussion on here Nano services trigger not working as expected in 20 - Nano Services example. As you can see, they recommend adding 'ncs:post-action' post action to the trigger.
Hope this helps
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide