Python maagic merge?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2022 06:24 AM
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?
- Labels:
-
Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 11:44 AM
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
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.
