09-03-2024 09:13 AM
NSO considers non in sync a service that configures static routes because of a different order. The order on the configuration is not relevant (non in this specific case, nor in general) since the router behaviour is specified by the ip routing IP rule(prefix-length, metric, ...), so I would expect NSO would not considere oroute ordering.
Am I wrong? How can I avoid to generate an out-of sync for such a service?
user152@ncs-2> request l3pe internet Jpe-54:gr-9/3/0:1138 check-sync outformat cli
cli {
local-node {
data devices {
device Jpe-54 {
config {
configuration {
routing-options {
static {
- route 7.98.67.238/31 {
- next-hop [ 10.200.107.155 ];
- tag {
- metric-value 1200;
- }
- preference {
- metric-value 171;
- }
- }
+ # after route 123.75.18.160/28
+ route 7.98.67.238/31 {
+ next-hop [ 10.200.107.155 ];
+ tag {
+ metric-value 1200;
+ }
+ preference {
+ metric-value 171;
+ }
+ }
}
}
}
}
}
}
}
}
[ok][2024-09-03 17:52:26]
user152@ncs-2> request l3pe internet Jpe-54:gr-9/3/0:1138 check-sync outformat ?
Possible completions:
boolean
cli NCS CLI curly bracket format.
cli-c CLI format (Cisco style).
native The actual data in native format that would be sent to the device
xml NETCONF XML edit-config format, i.e., the edit-config that would be applied locally (at NCS) to get a config that is
equal to that of the managed device.
user152@ncs-2> request l3pe internet Jpe-54:gr-9/3/0:1138 check-sync outformat xml
result-xml {
local-node {
data <devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>Jpe-54</name>
<config>
<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">
<routing-options>
<static>
<route xmlns:yang="urn:ietf:params:xml:ns:yang:1"
xmlns:junos="http://xml.juniper.net/xnm/1.1/xnm"
yang:insert="after"
yang:key="[junos:name='123.75.18.160/28']">
<name>7.98.67.238/31</name>
</route>
</static>
</routing-options>
</configuration>
</config>
</device>
</devices>
}
}
09-10-2024 01:54 AM
I believe that if a service is out of sync because of the ordering in a list, then the service logic is imposing some ordering. So I would check if there is anything probably in the templates or maybe in the code of the service that is expressing ordering requirements. That can then be removed because as you mention the ordering is inconsequential, even though the NED has an ordered-by-user list.
It seems that the NED could also be changed to not have an ordered-by-user list here. With this service I expect that would change the behaviour, so that you would get an error in the create, when trying to impose ordering requirements on a list where you don't have that control. I would think such a non backward compatible change would break any service where the templates specified ordering info.
09-10-2024 02:18 AM
The answer is in the template developer guide: https://developer.cisco.com/docs/nso/guides/templates/#operations-on-ordered-lists-and-leaf-lists
NSO has the concept of "guard" for "order-by user" lists to prevent this specific problem. With the guard setting, you can control when a position in the ordered list should be considered in-sync or out-of-sync.
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