03-14-2025 06:38 AM
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
Solved! Go to Solution.
03-17-2025 04:10 AM - edited 03-17-2025 04:36 AM
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.
03-19-2025 08:44 AM - edited 03-19-2025 08:47 AM
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)
03-14-2025 11:20 PM - edited 03-14-2025 11:27 PM
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
03-17-2025 01:20 AM
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
03-17-2025 04:10 AM - edited 03-17-2025 04:36 AM
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.
03-19-2025 05:58 AM
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
03-19-2025 08:44 AM - edited 03-19-2025 08:47 AM
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)
03-19-2025 09:00 AM
Hello @cohult,
Thanks alot for your support! everything is great now. much appreciated.
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