cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
354
Views
0
Helpful
1
Replies

Python maagic merge?

R-8
Level 1
Level 1

Is there an option to do a merge instead of create with the maagic api? The use case is multiple services are modifying a rfs service and the one with the .create() removes the other services additions.

Something like svc = root.ncs__services.foo.create("bar", merge=True) or .merge, .patch.
Or is the only option to call the rfs service with a XML template from the cfs?

1 Reply 1

Alex Stevenson
Cisco Employee
Cisco Employee

Hi @R-8,

Let me preface this by stating I'm not an NSO expert. I found the following, which may be helpful:

 

Merge multiple services creation under single API REST call

https://community.cisco.com/t5/nso-developer-hub-discussions/merge-multiple-services-creation-under-single-api-rest-call/td-p/3498791

 

The Python API Overview for NSO 6.0 mentions (about 2/3 down into the page) using this template:

 

Add a template to packages/pyservice/templates/service.template.xml:

<config-template xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <device tags="nocreate">
      <name>{$CE}</name>
      <config tags="merge">
      <interface xmlns="urn:ios">
        <FastEthernet>
          <name>0/{$INTERFACE}</name>
          <description>The maagic: {$MAGIC}</description>
        </FastEthernet>
      </interface>
      </config>
    </device>
  </devices>
</config-template>

Notice this tag:

<config tags="merge">

 

I'm not sure if this will be helpful to you, but it's worth a look, at least.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: