05-10-2017 01:11 AM - edited 03-01-2019 03:48 AM
Hi Team,
I am trying to use netconf-console to retrieve a device config. I was wondering what is the correct <get-config> payload I need to use. I tried a few but I guess I am using a wrong one.
05-10-2017 01:11 AM
Here is an example from my netconf trace file. It gets the config and apply’s a filter of which capabilities to get based upon my yang models. But you can see the structure of the RPC message.
>>>>out 17-Jan-2017::08:47:36.531 device=EPNM session-id=13
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
message-id="1">
<get-config>
<source>
<running/>
</source>
<filter>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"/>
<push-change-update xmlns="urn:cisco:params:xml:ns:yang:yang-push:v1"/>
<notification-subscription xmlns="urn:cisco:params:xml:ns:yang:yang-push:v1"/>
<customer-facing-service xmlns="urn:cisco:params:xml:ns:yang:si-service:v1"/>
<provision-service-request xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<modify-service-request xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<terminate-service-request xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<provision-service-response xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<modify-service-response xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<terminate-service-response xmlns="urn:cisco:params:xml:ns:yang:service:activation:v1"/>
<network-interface xmlns="urn:cisco:params:xml:ns:yang:sb:networkinterface:v1"/>
<customer xmlns="urn:cisco:params:xml:ns:yang:sb:customer:v1"/>
<ModuleList xmlns="urn:cisco:params:xml:ns:yang:restconf:resource:physical"/>
<ChassisList xmlns="urn:cisco:params:xml:ns:yang:restconf:resource:physical"/>
<PhysicalConnectorList xmlns="urn:cisco:params:xml:ns:yang:restconf:resource:physical"/>
<EquipmentList xmlns="urn:cisco:params:xml:ns:yang:restconf:resource:physical"/>
<cli-template xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<config-request xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<config-response xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<create-resource-configuration-request xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<modify-resource-configuration-request xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<delete-resource-configuration-request xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<create-resource-configuration-response xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<modify-resource-configuration-response xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<delete-resource-configuration-response xmlns="urn:cisco:params:xml:ns:yang:ra:v1"/>
<qos-profile xmlns="urn:cisco:params:xml:ns:yang:qos:v1"/>
<qos-policy xmlns="urn:cisco:params:xml:ns:yang:qos:v1"/>
<topological-link xmlns="urn:cisco:params:xml:ns:yang:nrf-topology:v1"/>
<virtual-connection-multi-layer-route xmlns="urn:cisco:params:xml:ns:yang:nrf-topology:v1"/>
<cem-termination-point xmlns="urn:cisco:params:xml:ns:yang:nrf-tdm-cem-extension:v1"/>
<ipsla-profile-details xmlns="urn:cisco:params:xml:ns:yang:nrf-ipsla:v1"/>
<response-message xmlns="urn:cisco:params:xml:ns:yang:nrf-common:v1"/>
<ethernet-flowpoint xmlns="urn:cisco:params:xml:ns:yang:nrf-ce-extension:v1"/>
<alarm xmlns="urn:cisco:params:xml:ns:yang:alarms:v1"/>
<alarm-summary-by-category xmlns="urn:cisco:params:xml:ns:yang:alarms:v1"/>
<EntitySettingsList xmlns="urn:cisco:ns:yang:resource:config:nbi"/>
<LogicalResourceList xmlns="urn:cisco:ns:yang:resource:config:nbi"/>
<RestConfigList xmlns="urn:cisco:ns:yang:resource:config:nbi"/>
<PhysicalResourceList xmlns="urn:cisco:ns:yang:resource:config:nbi"/>
<epnm_devices xmlns="http://www.cisco.com/epnm/epnm"/>
</filter>
</get-config>
</rpc>
05-10-2017 01:11 AM
Here is an example for getting the device config data:
$ netconf-console --get-config -x "/devices/device[name='asr0']"
05-10-2017 01:11 AM
When I played with this a long time ago, what struck me was the power of using netconf-console as an ad-hoc query interface, e.g.
$ netconf-console --get-config -x //vrf-list/name
This will get the config for all vrf interfaces in your network
$ netconf-console --get-config -x "//GigabitEthernet[vrf='volvo']"
This gives you any GE interface with a vrf named “volvo”
$ netconf-console --get-config -x "/devices/device[name='ce0']/config/interface/GigabitEthernet/description"
This gives you all the interface descriptions for GE interfaces on a device named ce0
05-10-2017 01:12 AM
Thanks everyone
05-10-2017 01:12 AM
I’ve written some info about netconf-console before.
I think the interactive mode is great for learning netconf transaction.
Especially with 1.1, it helps a lot because byte length needs to be calculated for 1.1.
I hope this also helps.
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