07-29-2019 04:37 AM
How plan-outline should be defined if I want to do staged delete with nano services and a no-op action?
I have managed to make "staged create" with no-op. However, the staged delete creates zombie services.
Sharing the service model:
tailf:action no-op {
tailf:actionpoint no-op-actionpoint;
// input {}
// output {}
}
}
}
ncs:plan-outline service-plan {
description
"Make before brake vlan plan";
ncs:component-type "ncs:self" {
ncs:state "ncs:init" {
ncs:create {
ncs:nano-callback;
ncs:post-action-node "/rpcs" {
ncs:action-name "no-op";
// ncs:result-expr "*";
}
}
ncs:delete {
ncs:pre-condition {
ncs:monitor "$PLAN/component[type='ncs:self'][name='self']/state"
+ "[name='ncs:ready']" {
ncs:trigger-expr "post-action-status = 'delete-reached'";
}
}
}
}
ncs:state "ncs:ready" {
ncs:create {
ncs:nano-callback;
ncs:pre-condition {
ncs:monitor "$PLAN/component[type='ncs:self'][name='self']/state"
+ "[name='ncs:init']" {
ncs:trigger-expr "post-action-status = 'create-reached'";
}
}
}
ncs:delete {
ncs:post-action-node "/rpcs" {
ncs:action-name "no-op";
// ncs:result-expr "*";
}
}
}
}
}
ncs:service-behavior-tree service-servicepoint {
ncs:plan-outline-ref service-plan;
ncs:selector {
ncs:create-component "'self'" {
ncs:component-type-ref "ncs:self";
}
}
}
Solved! Go to Solution.
07-29-2019 11:50 AM - edited 07-29-2019 11:51 AM
Hi, there is $ZOMBIE variable that connects you with the plan on the delete sequence:
ncs:delete {
ncs:pre-condition {
ncs:monitor "$ZOMBIE/plan/component[type='ncs:self'][name='self']/state[name='nokiadm:cross-connect']" {
ncs:trigger-expr "post-action-status = 'delete-reached'";
}
}
ncs:post-action-node "$SERVICE" {
ncs:action-name "reactive-re-deploy";
}
}
07-29-2019 11:50 AM - edited 07-29-2019 11:51 AM
Hi, there is $ZOMBIE variable that connects you with the plan on the delete sequence:
ncs:delete {
ncs:pre-condition {
ncs:monitor "$ZOMBIE/plan/component[type='ncs:self'][name='self']/state[name='nokiadm:cross-connect']" {
ncs:trigger-expr "post-action-status = 'delete-reached'";
}
}
ncs:post-action-node "$SERVICE" {
ncs:action-name "reactive-re-deploy";
}
}
08-01-2019 07:31 AM
Hi,
I have a follow-up question.
$ZOMBIE only works when the entire service is being deleted, but if i have a component in the nano-service that is being deleted I would have to use $PLAN (or $SERVICE) in the delete pre-condition. But as stated, that wont work when I'm deleting the entire service.
How can I monitor both $ZOMBIE and $SERVICE in the same pre-condition?
Simple example:
ncs:plan-outline deployment-plan {
ncs:component-type "ncs:self" {
ncs:state "ncs:init" {
ncs:create {
ncs:nano-callback;
}
}
ncs:state "ncs:ready" {
ncs:create {
ncs:pre-condition {
ncs:monitor "$PLAN" {
ncs:trigger-expr
"not(component/state[name != 'ncs:ready'][status != 'reached'])";
}
}
}
}
}
ncs:component-type "abc:extra" {
ncs:state "ncs:init" {
ncs:create {
ncs:nano-callback;
}
ncs:delete {
ncs:pre-condition {
ncs:monitor "$SERVICE/plan/component[name='extra'][type='abc:extra']/state[name='ncs:ready']" { // HERE IS THE PROBLEM
ncs:trigger-expr "post-action-status = 'delete-reached'";
}
}
}
}
ncs:state "ncs:ready" {
ncs:delete {
ncs:post-action-node "$ZOMBIE" {
ncs:action-name "re-deploy";
}
}
}
}
}
ncs:service-behavior-tree abc-servicepoint {
description
"Informative description";
ncs:plan-outline-ref deployment-plan;
ncs:selector {
ncs:variable "ABC_NAME" {
ncs:value-expr "name";
}
ncs:create-component "'self'" {
ncs:component-type-ref "ncs:self";
}
ncs:create-component "'extra'" {
ncs:component-type-ref "abc:extra";
ncs:pre-condition {
ncs:monitor "$SERVICE/extra" {
}
}
}
}
}
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