YANG Suite is HTML5-based tooling that is available for working with the YANG-based programmable interfaces on Cisco IOS XE, XR, and NX network operating systems. It has plug-ins that allow for interacting with the programmable interfaces and supports downloading YANG files directly from network devices. In this tutorial, we will explore using NETCONF to configure a switch.
What You’ll Learn
- NETCONF with Border Gateway Protocol (BGP) Ethernet VPN (EVPN) operation
- NETCONF GET Gigabit interface configuration
- NETCONF update interface into shutdown state
- NETCONF GET loopback interface
- NETCONF update interface description
- NETCONF delete interface description
What You’ll Need
NETCONF: GET BGP EVPN
Reserve your dCloud instance if you don’t have a device to work with.
Once your YANG Suite environment has booted up, navigate to Chrome and the tab localhost:8480.
- On the left blue navigation bar, select Protocols > NETCONF.
- YANG Set: 198-18-1-21-default-yangset
- Modules: Cisco-IOS-XE-bgp-oper. (Note: Start typing bgp to filter through the options in the drop-down menu.)
Click the blue Load Module(s) button.
NETCONF Operation: get
Device: 198.18.1.21
- Wait for the tree to appear in the gray box on the left. (Note: If you get an Error 500 pop-up message, just ignore it, and close the pop-up.)
- Select the check box next to bgp-state-data.
- If there is a previous remote procedure call (RPC) in the RPC window, click the red Clear RPC(s) button.
- Click the blue Build RPC button.
- Click the blue Run RPC(s) button.
- Validate that data is coming in from the device in a new window.
For a full view, see the following example:
In this step, you will use NETCONF to make an application programming interface (API) call to the network device to read the description of an interface.
Navigate to http://localhost:18480 in the browser. Note: Safari will not work because it uses HTTPS (rather than HTTP) by default.
Select the following in YANG Suite. (Assuming that you are using a Catalyst 9300 switch, adapt based on which device you have available with NETCONF.)
- Protocol: NETCONF
- YANG Set: c9300-default-yangset
- Modules: Cisco-IOS-XE-native. (Note: Start typing native to filter through the options in the drop-down menu.)
- Click the blue Load Module(s) button.
- NETCONF Operation: get-config
- Device: c9300
- Wait for the tree to appear in the gray box on the left. (Note: If you get an Error 500 pop-up message, just ignore it, and close the pop-up.)
- Once the YANG tree is created, select interface. (Note: Select Ctrl + F to find “interface” on the page.)
- From within the interface drop-down, select GigabitEthernet. (Note: Select Ctrl + F to find “GigabitEthernet” on the page.)
- In the “name” section under GigabitEthernet, enter 1/0/1.
The screen should look similar to the following:
- Click the blue Build RPC button to generate the XML RPC that is based on the YANG model and inputs provided. The XML can be reviewed, edited, or used in other tooling or orchestration systems as needed.
Click the blue Run RPC(s) button to send the XML RPC to the switch’s NETCONF interface in order to retrieve the configuration as requested.
In the new tab that has opened, notice that the description of GigabitEthernet1/0/1 has changed. (Note: You may need to scroll up.)
In this step, you will make an API call that edits the interface to “shutdown” state. (Note: If you have completed the NETCONF GET task above, you can skip to step 1.5 below.)
The principles that you learn here can be applied to any other YANG model and device that supports NETCONF.
Select the following in YANG Suite:
- Protocol: NETCONF
- YANG Set: c9300-default-yangset
- Modules: Cisco-IOS-XE-native
- Click the blue Load Module(s) button. (Note: Please be patient! It may take about 2 minutes to load.)
- NETCONF Operation: edit-config
- Device: c9300
- Once the YANG tree is created, select interface. (Note: Select Ctrl + F to find “interface” on the page.)
- From within the “interface” drop-down, select GigabitEthernet. (Note: Select Ctrl + F to find “GigabitEthernet” on the page.)
- In the “name” section under GigabitEthernet, enter 1/0/2.
- Select the check box next to shutdown.
- If there is a previous RPC in the RPC window, click the red Clear RPC(s) button.
- Click the blue Build RPC button.
- Click the blue Run RPC(s) button.
In this step, you will make an API call to get the Loopback 0 configuration data. This would be the same as doing a show run interface loopback0
on the device.
- Protocol: NETCONF
- YANG Set: c9300-default-yangset
- Modules: Cisco-IOS-XE-native
- Click the blue Load Module(s) button.
- NETCONF Operation: get-config
- Device: c9300
- Clear all the currently selected values in the tree by selecting the YANG Tree button and, from the drop-down, Clear Values and Operations.
- Once the YANG tree is created, select interface. (Note: Select Ctrl + F to find “interface” on the page.)
- From within the “interface” drop-down, select Loopback. (Note: Select Ctrl + F to find “Loopback” on the page.)
- In the “name” section under Loopback, enter 0.
- Click the red Clear RPC(s) button.
- Click the blue Build RPC button.
- Click the blue Run RPC(s) button.
In this step, you will use YANG Suite to make an API call using NETCONF that edits the Loopback 0 interface description.
- Protocol: NETCONF
- YANG Set: c9300-default-yangset
- Modules: Cisco-IOS-XE-native
- Click the blue Load Module(s) button.
- NETCONF Operation: edit-config
- Device: c9300
- Once the YANG tree is created, select interface. (Note: Select Ctrl + F to find “interface” on the page.)
- From within the “interface” drop-down, select Loopback. (Note: Select Ctrl + F to find “Loopback” on the page.)
- In the “name” section under Loopback, enter 1.
- Select description, and add a string of text such as Configured by YANG Suite.
- Click the red Clear RPC(s) button to remove any previous RPC.
- Click the blue Build RPC button.
- Click the blue Run RPC(s) button.
In this step, you will make an API call to delete the interface description. This would be the same as doing a no description
on the device’s interface.
- Protocol: NETCONF
- YANG Set: c9300-default-yangset
- Modules: Cisco-IOS-XE-native
- Click the blue Load Module(s) button.
- NETCONF Operation: edit-config
- Device: c9300
- Once the YANG tree is created, select interface. (Note: Select Ctrl + F to find “interface” on the page.)
- From within the “interface” drop-down, select Loopback. (Note: Select Ctrl + F to find “Loopback” on the page.)
- In the “name” section under Loopback, enter 1.
- Select description, and click the right of the text box with the description string to expand the drop-down menu. Select delete from the drop-down.
- Click the red Clear RPC(s) button to remove any previous RPC.
- Click the blue Build RPC button.
- Click the blue Run RPC(s) button.
Learn More