cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
433
Views
0
Helpful
6
Replies

NSO: how to monitor service re-deploy from northbound?

kassemm
Level 1
Level 1

Hello,

I have a CFS service which is dependent on another service ( like an inventory ).

My goal is when I make any change on this inventory, the changes should be reflected to the CFS service instances.

We thought of using a kicker to monitor this inventory which will trigger a custom action to re-deploy the CFS service. 

We have commit-queue enabled and we are monitoring ncs-events, if the re-deploy is successful, it's great, we can see

ietf-restconf:notification/tailf-ncs:ncs-commit-queue-progress-event/"state": "completed".  BUT, if the re-deploy fails because of whatever reason in the CFS logic, we have no way to monitor this (beside waiting and not seeing any notification of the completion). 
I'm looking for an idea how to handle this case.
 
thank you
2 Accepted Solutions

Accepted Solutions

Hello @kassemm,

The custom python action that re-deploy service A instance should then be responsible for sending a stream notification to northbound interfaces if the re-deploy fails.
For an example of sending your own custom northbound stream notification, see the examples.ncs/northbound-interfaces/restconf-netconf-notifications example.
The ncs.conf settings for the dummy example stream.

View solution in original post

Hi @kassemm 

The documentation does not say that there is no such as C_LIST, and C_LIST is mentioned in that page too. However, it is not documented how to create one. Example:

l = [ncs.Value(-42, ncs.C_INT32),
     ncs.Value(0, ncs.C_INT32),
     ncs.Value(42, ncs.C_INT32)]
ll_value = ncs.Value(l, ncs.C_LIST)

 

View solution in original post

6 Replies 6

cohult
Cisco Employee
Cisco Employee

A re-deploy starts a transaction just as a transaction that changes the configuration (commit). If the commit queue is enabled, the transaction ends where the commit queue takes over. If the transaction fails before the commit queue takes over, the error is reported in the status code and text of the RESTCONF response to the RESTCONF re-deploy request.
For example, if there is a validation error:

 

POST http://localhost:8080/restconf/operations/m:my-services/my-service=42/re-deploy
{
  "ietf-restconf:errors": {
    "error": [
      {
        "error-type": "application",
        "error-tag": "malformed-message",
        "error-path": "",
        "error-message": "/my-services/my-service{42}/value: Some validation error"
      }
    ]
  }
}
Status code: 400

 

 

Hello @cohult,

My issue is a bit different. We are not trying to re-deploy an instance directly from the northbound but rather we update a leaf in service B (like an inventory), We receive back 200 as the value has been successfully updated, and within NSO, this will trigger a kicker for a custom python action to re-deploy service A instance. If service A is re-deployed successfully with commit-queue enabled, then we can see it in /restconf/streams/ncs-events/json otherwise if it fails, we cant find a way to monitor it

Hello @kassemm,

The custom python action that re-deploy service A instance should then be responsible for sending a stream notification to northbound interfaces if the re-deploy fails.
For an example of sending your own custom northbound stream notification, see the examples.ncs/northbound-interfaces/restconf-netconf-notifications example.
The ncs.conf settings for the dummy example stream.

Hello @cohult,

Thank you for your input, this is exactly what I was looking for.

tho im hitting a small issue with populating the notification. 

the following works when we have dummy-value as just a leaf.

scs = _ncs.cs_node_cd(None, "/dummy-notif/dummy-value")
sns = scs.ns()
stag = scs.tag()
tvs = [
ncs.TagValue(xmltag=ncs.XmlTag(ns, tag),
v=ncs.Value((tag, ns), ncs.C_XMLBEGIN)),
ncs.TagValue(xmltag=ncs.XmlTag(sns, stag),
v=ncs.Value(f"hello world {now}", ncs.C_BUF)),
ncs.TagValue(xmltag=ncs.XmlTag(ns, tag),
v=ncs.Value((tag, ns), ncs.C_XMLEND))
]

but how to achieve the same result for a leaf-list? there is no such as C_LIST in class Value(init, type) based on https://developer.cisco.com/docs/nso/api/_ncs/#package-_ncs

Hi @kassemm 

The documentation does not say that there is no such as C_LIST, and C_LIST is mentioned in that page too. However, it is not documented how to create one. Example:

l = [ncs.Value(-42, ncs.C_INT32),
     ncs.Value(0, ncs.C_INT32),
     ncs.Value(42, ncs.C_INT32)]
ll_value = ncs.Value(l, ncs.C_LIST)

 

Hello @cohult,

Thanks alot for your support! everything is great now. much appreciated.