10-24-2018 05:48 AM - edited 03-01-2019 04:14 AM
Hello,
I would like to perform over JUNIPER devices :
rguilloux@ncs(config)# deactivate devices device ysty....
I wants to use ncs maapi/maagic python API to perform it but I don't find any command in root object for it :
with ncs.maapi.Maapi() as m: with ncs.maapi.Session(m, "nso", "pyNORTHNSO"): with m.start_write_trans() as t: root = ncs.maagic.get_root(t) out = root.devices.device["RNET-M6"] for i in out.config: print i
Any idea of how to launch deactivate using NSO python API ?
Thanks,
Romain
10-26-2018 02:00 AM
You would have to use the low-level MAAPI (not MAAGIC) API to set attributes ("inactive" is an attribute). Setting attributes from a service does not work the way you'd expect, however, so I can't recommend this approach.
08-28-2023 08:23 AM
Hello Jan ,
Could you pls suggest How to perform the same using restconf .
this /restconf/data/tailf-ncs:devices/device=junos1/config/junos:configuration/groups=BASE-SYSTEM/system/commit/synchronize
to
inactive: /restconf/data/tailf-ncs:devices/device=junos1/config/junos:configuration/groups=BASE-SYSTEM/system/commit/synchronize
to this
08-29-2023 12:38 AM
As far as I am aware, there is no ready made YANG rpc/action to set (and remove) the inactive flag on some data tree path. The good news is that you can (easily?) write such an action with the YANG interface of your choice. That action would then use the low level MAAPI interface to set (or remove) the inactive attribute. The action could be specific to the path you mention, or you could make it more generic, accepting a data tree path to the element to be inactivated.
08-29-2023 01:14 AM
Hi,
Thanks for the prompt reply Jan .
I have got a one way of doing that is using inactive and using content-type as +xml instead +json
url = "http://X.X.X.X:Port/restconf/data/"
08-29-2023 01:40 AM
The request message to reactivate <commit> looks right to me (assuming that was the element deactivated earlier). If the device doesn't behave as expected when you send this message, maybe posing a question to the device vendor's support organization might give some clue as to what is wrong? Or you could resort to classical management operations like create/delete.
08-29-2023 01:53 AM
As mentioned above your assumption is correct I have sent you a sample of reactivation.
However when I m performing the same with .
......above similar code
admin@ncs(config)# deactivate devices device junos1 config configuration groups BASE-SYSTEM system commit synchronize
admin@ncs(config)# show full-configuration devices device junos1 config configuration groups BASE-SYSTEM system commit synchronize | display xml
admin@ncs(config)# show full-configuration devices device junos1 config configuration groups BASE-SYSTEM system commit synchronize | display xml
```
<config xmlns="http://tail-f.com/ns/config/1.0">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>junos1</name>
<config>
<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">
<groups>
<name>BASE-SYSTEM</name>
<system>
<commit>
<synchronize inactive="inactive"/>
</commit>
</system>
</groups>
</configuration>
</config>
</device>
</devices>
</config>
```
08-29-2023 02:11 AM
I would suggest connecting with the device vendor to find out how the inactive mechanism works in this part of the data tree. Once we know that, we can try to make NSO send the right thing. Or, as there doesn't seem to be tons of config below <synchronize> that you are trying to preserve temporarily by marking it as inactive, maybe delete and create may be a more suitable choice of operations.
08-29-2023 02:31 AM
THanks Jan Probably will try for TAC or device vendor as there are couple of more commands need to be executed .
08-30-2023 06:31 AM
Works fine on real devices where as problem or limitation on netsim devices
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