12-20-2022 06:42 AM
interface-configurations:
interface-configuration:
- interface-name: TenGigE0/0/0/0.901250000
description: PW-40
ethernet-service:
rewrite:
rewrite-type: pop1
encapsulation:
outer-tag-type: match-dot1q
outer-range1-low: 125
active: act
interface-mode-non-physical: l2-transport
mtus:
mtu:
- mtu: 1504
owner: sub_vlan
Any help would be greatly appreciated.
-Anders
Solved! Go to Solution.
01-11-2023 01:29 AM
Including this as it might help someone else in the future.
I´ve been experimenting a bit more and it seems to be working as per the standard, when using replace all none specified values should be deleted or set to their default values, therefor replacing a single element in a list (the interface list) has the unfortunate consequence of deleting all the others.
However I also found out that in the gnmi spec the set request has support for doing multiple operations in a single transaction, with an honored order, so in a single set request I'm able to delete the specific interface and then do an update action to recreate it with only the specified config. That solves the issue for me.
12-20-2022 08:58 AM
Ive not used this method, however i do not think this is any different to how NAPALM (documentation) would work in its two methods
Hope this helps.
12-21-2022 12:10 AM
While the replace config in napalm replaces the whole configuration, as I understand it,
the replace config in gnmi should and indeed does only replace the configuration in the tree that is being modified.
So when I do a replace config in the example above, all of the interfaces are deleted but none of the system or router configuration is deleted as those are on seperate trees.
What I'm trying to achieve is to be able to replace all configuration for a specific interface only.
Currently it seems like I've modified the Interfaces-config list of interfaces and therefor it replaces the interface list with a new list with only this interface, however I would like for this to happen one step further down the tree.
I suppose I could fetch the current tree, and do the comparison locally, it just seemed like this was the intended purpose of the config replace method.
Reading through this again I suspect replacing just one element int the list is not possible, its either the whole list or do an update on individual leaf values, or indeed do a merge.
https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#344-modes-of-update-replace-versus-update
-Anders
12-21-2022 12:16 AM
Yes the whole configuration, i was wonder if this was doing the same - but your last post/update above seems this is different, and really cool if possible - but wonder if this is, as is this under the hood just using the built in replace config in XR commands - IDK guessing here? I have always done the diff compare, even on full replace - with napalm it was pretty fugly and ended up writing our own diff.
01-11-2023 01:29 AM
Including this as it might help someone else in the future.
I´ve been experimenting a bit more and it seems to be working as per the standard, when using replace all none specified values should be deleted or set to their default values, therefor replacing a single element in a list (the interface list) has the unfortunate consequence of deleting all the others.
However I also found out that in the gnmi spec the set request has support for doing multiple operations in a single transaction, with an honored order, so in a single set request I'm able to delete the specific interface and then do an update action to recreate it with only the specified config. That solves the issue for me.
01-11-2023 03:40 AM
"therefor replacing a single element in a list (the interface list) has the unfortunate consequence of deleting all the others"
Wow... thats not thing you want to find out in production!
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