08-02-2019 10:59 AM
I am trying to delete all user-defined configuration on a device using NAVU API in action package, but when I traverse the tree, I get all the default leafs as well
for example for nx device these are default configs and not done by operator explicitly:
leaf path: /ncs:devices/device{rfs1nx}/config/nx:interface/Ethernet{1/25}/mtu leaf value: 1500
leaf path: /ncs:devices/device{rfs1nx}/config/nx:interface/Ethernet{1/25}/delay leaf value: 1
.
.
.
Executing live-status action gives me the user-defined config only but then how can I create Xpath for leaf deletion using these config lines? Any suggestions?
output of live-status:
interface Ethernet1/12
description NXC
shutdown
switchport access vlan 999
speed 1000
no snmp trap link-status
Appreciate any inputs!!
Solved! Go to Solution.
08-05-2019 01:54 AM
Hello,
You can have a look at the flags for your MAAPI session in the doc: "doc/api/java/com/tailf/maapi/MaapiFlag.html". The flags NO_DEFAULT should be able to solve your problem (quoting 5.2 doc):
NO_DEFAULTS public static final MaapiFlag NO_DEFAULTS This flag specifies that we want to be informed when we read leafs with default values that have not had a value set. This is indicated by the returned value being of class ConfDefault (type J_DEFAULT) instead of the actual value. The default value for such leafs can be obtained from the Maapi.loadSchemas() tree provided by the library.
You can set the flags at transaction creation or using the setFlags function. I don't have a working example in Java but I have used similar mechanism in python in the past.
Regards
08-05-2019 01:54 AM
Hello,
You can have a look at the flags for your MAAPI session in the doc: "doc/api/java/com/tailf/maapi/MaapiFlag.html". The flags NO_DEFAULT should be able to solve your problem (quoting 5.2 doc):
NO_DEFAULTS public static final MaapiFlag NO_DEFAULTS This flag specifies that we want to be informed when we read leafs with default values that have not had a value set. This is indicated by the returned value being of class ConfDefault (type J_DEFAULT) instead of the actual value. The default value for such leafs can be obtained from the Maapi.loadSchemas() tree provided by the library.
You can set the flags at transaction creation or using the setFlags function. I don't have a working example in Java but I have used similar mechanism in python in the past.
Regards
08-05-2019 09:08 AM
@gmuloche Thanks so much! this worked perfectly.
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