cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
290
Views
7
Helpful
6
Replies

Move Part of Config from Device to Another Device

Hi Team,

Would it be possible to use NSO to copy part of configuration from device (say JunOS) to another device with the same vendor?

I need to migrate a bunch of policy-options defined under one of Mx to another one and I need to utilize NSO to execute this task. what i have done so far is adding both devices to NSO using netconf and able to sync-from them. However I don't know how to instruct the NSO to copy config under specific tree to the another device

Also I need to remove the original configuration from the source device to clean it

appreciate your help

Regards

Bassim

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: Move Part of Config from Device to Another Device

That works, but only if the source device and target device models are identical, i.e. same brand, same os version etc.

If you build a service model that captures the *service intent*, you can move across vendors and versions very nicely.

6 REPLIES 6
Cisco Employee

Re: Move Part of Config from Device to Another Device

One way of doing this is to save the required config to a file, editing the device name, and then loading it back in again and committing, e.g.

1. admin@ncs(config)# show full-configuration devices device ce0 config ios:snmp-server | save blah

1. edit “blah” to change ce0 to ce1

1. admin@ncs(config)# load merge blah

1. admin@ncs(config)# commit

Cheers,

KJ.

Re: Move Part of Config from Device to Another Device

Hello Kjetil

This is good approach, do you think that can be modeled into a service inside NSO?

Cisco Employee

Re: Move Part of Config from Device to Another Device

I thought what you were trying to achieve was on an ad-hoc basis moving parts of config from one device to another. If you want to automate the repeated moving of certain config from one device to another then you can of course do this in a service.

Cheers,

KJ.

Cisco Employee

Re: Move Part of Config from Device to Another Device

Hi Bassim

This is a really nice question that introduces, really, a "broad" set of use-cases that i would put under the "migration" umbrella. "Migration" in general (typically) involves MOVING configuration(s)… from an old device

(or a set of old devices)…  to a different new device (or a set of new devices)…


Customers have used this for tasks like swapping old hardware or upgrading OS's in the network…

e.g. move configs associated with old/legacy TDM circuits to configs matching new GE circuits ...

e.g. for services deployed with configs for old OS that need conversion/modification to new OS…

Migrations can be vendor-to-vendor is the same (and OS), or vendor-to-vendor is different (or even different OS same vendor).  With NSO it's (mostly) straightforward to read the old source device config -- it's in YANG schema in CDB,

and re-factor this config for writing to _ANY_ target device output...


While there are many options for selecting and building models, if you're trying to get a simple idea together,

probably the simplest approach is to build a "template-only" service model (*caveats), with inputs of "source-device"

and "target-device", and then in the XML template, just use the "device" tree side of CDB to pull out all the "source" configs, and write them to the "target" configs..

Caveats:

a) with this simple model, you'll will end up with a "service instance" that includes both old and new device;

if the old device is removed then the service instance becomes broken. (but if you don't really need the service instance after its use, you can just delete it "no-networking")

b) there may be configs to move that require a bit more manipulation (situational), in which case you could

add python (or java) to support this.

c) adding pre- and post-checks could lead you into more complex models as well...

Assuming you're good on building the template-only service model, in the XML you'd have something like this:

<config-template xmlns="http://tail-f.com/ns/config/1.0"

                 servicepoint="migration">

  <devices xmlns="http://tail-f.com/ns/ncs">

    <device>

      <name>{/dest-device}</name>

      <config>

        <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">

          <policy-options>

            <community>

              <name>{/../../ncs:devices/ncs:device[ncs:name=/src-device] \

                     /ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet-subinterface \

                     /cisco-ios-xr:GigabitEthernet[id=/src-interface]/cisco-ios-xr:vrf}_Hub</name>

            </community>

          </policy-options>

        </configuration>

      </config>

    </device>

  </devices>

</config-template>

** this example moves cisco-ios-xr policies to a juniper MX device.

** this is a couple years old.. so the NED device structure likely has changed...

   use:

         admin@ncs% show devices device <old-device> config | display xpath

   to give hints on all the "locations" in the source device for where the variables live...

   and:

         admin@ncs% show devices device <new-device> config | display xml | save newdev.xml

   (and then edit it) to save the target device xml for the model...

hope this helps

gregg

Beginner

Re: Move Part of Config from Device to Another Device

Hi! Maybe it would be possible using 'copy cfg' command from CLI, or using 'copy_tree' method in a python script if you want to automate the thing.

Simon

Highlighted
Cisco Employee

Re: Move Part of Config from Device to Another Device

That works, but only if the source device and target device models are identical, i.e. same brand, same os version etc.

If you build a service model that captures the *service intent*, you can move across vendors and versions very nicely.