10-08-2022 05:28 PM
I am trying to create SNMP trap configuration service on IOS XR device controlled by cisco-iosxr-nc NED. It can be done by building template based on Cisco-IOS-XR-um-snmp-server-cfg YANG model. But I found that although this module is present in capabilities from version 7.0.1 it really supports configuration of snmp-server only from 7.5.1. Therefore before applying a service template I need to check not only device capabilities, but also if it supports some snmp-server configuration. From CLI I can issue a command that gives me perfect answer:
admin@ncs# show devices device iosxr-nc live-status Cisco-IOS-XR-um-snmp-server-cfg:snmp-server community
COMMUNITY
STRING VIEW RO RW SDROWNER SYSTEMOWNER IPV4 IPV6
------------------------------------------------------------
public - X - - X - -
or if not supported:
admin@ncs# show devices device xr-33 live-status Cisco-IOS-XR-um-snmp-server-cfg:snmp-server community.
---------------------------------------------------------------------------------------------^
syntax error: unknown argument
But unfortunately I could not figure out how to implement this show command in Python API. I would really appreciate your help.
Thank you,
Yan
10-10-2022 07:46 AM
It is possible to show data as maagic API commands. You can do this by enabling devtools and then piping the show output with "display maagic":
admin@ncs> set devtools true
[ok][2022-10-10 16:43:13]
admin@ncs> show devices device ex0 live-status Cisco-IOS-XR-um-snmp-server-cfg:snmp-server community | display maagic
Which should give you something like:
root.ncs__devices.device['ex0'].live-status.Cisco-IOS-XR-um-snmp-server-cfg.snmp_server. You might need to change the hyphens to underscores though.
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