cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
763
Views
25
Helpful
5
Replies

GNMI - XRGRPC using replaceconfig on interface tree, deletes all other

SA2
Level 1
Level 1
Hi, we´re currently using the XRGRPC library to interface with our IOS XR equipment.
Currently we are configuring L2 pseudowires from our aggregation devices to our SE on PW-HE interfaces.
While this currently works fine using the merge config, I want to move to the replace config instead.

 

The main reason being that we have a git repository hosting the yang models and we want the network to reflect this at all times.
currently we're deleting unwanted configuration and merging new values. However doing a simple replace for the configuration tree seems like a much simpler operation.

 

Initial testing with the config replace however seems to delete all other interfaces on the device as I suspect it sees the interface-configuration list as "touched" and therefor any element not in the list should be deleted/defaulted.

 

Is there anyway around this, so that only the specific interface is replaced and not all interfaces?

 

example yaml:



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

1 Accepted Solution

Accepted Solutions

SA2
Level 1
Level 1

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.

View solution in original post

5 Replies 5

Ive not used this method, however i do not think this is any different to how NAPALM (documentation) would work in its two methods

  • replace: completely removes the existing configuration and puts in a new one
  • merge: add configuration statements to the current configuration

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

SA2
Level 1
Level 1

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

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.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

SA2
Level 1
Level 1

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.

"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! 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io