Вы находитесь на странице: 1из 3

Designing and Implementing Cisco Network Programmability - Lab Guide Page 1 of 3

Challenge 3: Consuming NETCONF on Nexus


Scenario
NETCONF has been around for years and you finally get time to demo it for your team. You need to prepare a
demo specifically around the NETCONF features the Nexus platform has. This lab will ensure that you have what it
takes to get the demo done immediately.

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

Task 1: Using the xmlagent Service


Activity
Step 1
SSH to nxosv in two different terminal sessions. One will be used for interactive CLI and the other will be used to
access the xmlagent service.

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.

Task 2: Consuming NETCONF in Python


Activity
Step 1
Navigate to the proper directory files/module2/lab3, open, and examine the script that is called
nxos_nc_show_hostname.py. Review and execute the script.

Pay special attention to namespaces and URLs.

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

Missing VLAN or interface configurations.

© 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

Вам также может понравиться