Consuming NETCONF On Nexus
Consuming NETCONF On Nexus
All Nexus labs for this course are using NX-OS version 7.3(1)D1(1) for the Nexus 7000. Specifically, the
course is using NX-OSv which has a limited feature set, so please be aware actual API requests and
response may diff on other versions of NX-OS and on other Nexus hardware platforms.
Topology
Step 2
Enter the xmlagent service in one of the terminal windows.
In order to break out of the xmlagent service, you need to use CTRL+C.
Step 3
https://learningspace.cisco.com/dkitserver/content/show?x=imJWUu5OsNNO8gyL&isLat... 4/11/2018
Designing and Implementing Cisco Network Programmability - Lab Guide Page 2 of 3
Using the xmlagent service, retrieve the XML response document for the show hostname command. Respond
to the Nexus switch using the following capabilities after receiving the hello from the Nexus switch:
After you send your capabilities to the switch, you can use the other terminal session to generate
NETCONF request objects using the built-in NETCONF tools on the Nexus platform and paste in the
request objects into the xmlagent service session.
<?xml version="1.0"?>
<nc:hello xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<nc:capabilities>
<nc:capability>urn:ietf:params:xml:ns:netconf:base:1.0</nc:capability>
</nc:capabilities>
</nc:hello>]]>]]>
Step 4
Using the xmlagent service, retrieve the XML response document for the show version command.
Step 5
Using the xmlagent service, retrieve the XML response document for the show vlan brief command.
Add VLANs 20 and 30 manually using the network CLI (using the other terminal session) prior to
executing this step.
Step 6
Add VLAN 40 using the xmlagent service.
Step 2
In the same directory, execute and fix the nxos_nc_show_version.py script.
Step 3
Create a script that configures Ethernet2/6. The script should make it a switchport and add a description
“Configured by Python ncclient”. Finally, it should print the NETCONF RPC reply as an XML string.
Use the exec_command method of the device object. Also note that his method accepts a Python list.
Verification
Step 1
Missing VLAN or interface configurations.
Substep 1
Simply ensure that the following configuration commands exist on the device:
https://learningspace.cisco.com/dkitserver/content/show?x=imJWUu5OsNNO8gyL&isLat... 4/11/2018
Designing and Implementing Cisco Network Programmability - Lab Guide Page 3 of 3
vlan 40
interface Eth2/6
switchport
description Configured by Python ncclient
© 2018Cisco and/or its affiliates. All rights reserved. Printed contents of kartick.siddhartha
https://learningspace.cisco.com/dkitserver/content/show?x=imJWUu5OsNNO8gyL&isLat... 4/11/2018