|
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": { |
6 | | - "jp-MarkdownHeadingCollapsed": true, |
7 | 6 | "tags": [] |
8 | 7 | }, |
9 | 8 | "source": [ |
|
402 | 401 | "\n", |
403 | 402 | "Import the following Python modules:\n", |
404 | 403 | "* **ncclient** - NETCONF manager (client) to connect to NETCONF agents (network devices).\n", |
405 | | - "* **pprint.pprint** - Method to print output in a more friendly format than the standard Python print() function.\n", |
| 404 | + "* **pprint.pprint** - Method to print output in a more friendly format than the standard Python `print()` function.\n", |
406 | 405 | "* **xmltodict** - Module to convert between XML and Python Dictionary encoding formats, bidirectionally." |
407 | 406 | ] |
408 | 407 | }, |
|
459 | 458 | "* Use the **with** keyword in order to allow the Python *Context Manager* to automatically close the NETCONF session, after the code runs.\n", |
460 | 459 | " * The alternative is to manually close a NETCONF session.\n", |
461 | 460 | "* Use the **connect** method of the **ncclient manager** class to initiate a connection to **R1**.\n", |
462 | | - " * Pass the **r1** dictionary as an argument to the **connect** method with the syntax **\\*\\*r1**.\n", |
| 461 | + " * Pass the **r1** dictionary as an argument to the **connect** method with the syntax `**r1`.\n", |
463 | 462 | " * This technique is caled *Dictionary Unpacking* and converts each dictionary key to a keyword argument, with their corresponding values.\n", |
464 | 463 | "* Assign the result of the **connect** method to the variable **conn** (short for 'connection').\n", |
465 | 464 | "* Assign the value of the **conn.server_capabilities** attribute to the variable **caps** (short for 'capabilities')\n", |
|
511 | 510 | "\n", |
512 | 511 | "\n", |
513 | 512 | "* Use YANG Suite to build an RPC filter as follows:\n", |
514 | | - " * YANG Model - **Cisco-IOS-XE-interfaces-oper**\n", |
515 | | - " * XPath - **/interfaces/interface/v4-protocol-stats**\n", |
516 | | - " * Optional - filter on interface **GigabitEthernet1**\n", |
| 513 | + " * YANG Model - `Cisco-IOS-XE-interfaces-oper`\n", |
| 514 | + " * XPath - `/interfaces/interface/v4-protocol-stats`\n", |
| 515 | + " * Optional - filter on interface `GigabitEthernet1`\n", |
517 | 516 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below." |
518 | 517 | ] |
519 | 518 | }, |
|
603 | 602 | "\n", |
604 | 603 | "\n", |
605 | 604 | "* Use YANG Suite to build an RPC filter as follows:\n", |
606 | | - " * YANG Model - **ietf-interfaces**\n", |
607 | | - " * XPath - **/interfaces/interface/ip:ipv4**\n", |
608 | | - " * Optional - filter on interface **GigabitEthernet1**\n", |
| 605 | + " * YANG Model - `ietf-interfaces`\n", |
| 606 | + " * XPath - `/interfaces/interface/ip:ipv4`\n", |
| 607 | + " * Optional - filter on interface `GigabitEthernet1`\n", |
609 | 608 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below." |
610 | 609 | ] |
611 | 610 | }, |
|
677 | 676 | "\n", |
678 | 677 | "\n", |
679 | 678 | "* Use YANG Suite to build an RPC configuration for a new Loopback interface (Loopback 0) as follows:\n", |
680 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
681 | | - " * XPath - **/native/interface/Loopback/name**\n", |
682 | | - " * Interface Name - **0**\n", |
| 679 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 680 | + " * XPath - `/native/interface/Loopback/name`\n", |
| 681 | + " * Interface Name - `0`\n", |
683 | 682 | " * Copy and paste the data in the **\\<config\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
684 | 683 | ] |
685 | 684 | }, |
|
731 | 730 | "This NETCONF request will use the **get-config** RPC to determine whether or not the previous operation added the **Loopback 0** interface to **R1**.\n", |
732 | 731 | "\n", |
733 | 732 | "* Use YANG Suite to build a build an RPC which gets configuration data for the **R1** interfaces:\n", |
734 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
735 | | - " * XPath - **/native/interface**\n", |
| 733 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 734 | + " * XPath - `/native/interface`\n", |
736 | 735 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
737 | 736 | ] |
738 | 737 | }, |
|
784 | 783 | "This NETCONF request will use the **edit-config** RPC to add more configuration detail to the new **Loopback 0** interface on **R1**.\n", |
785 | 784 | "\n", |
786 | 785 | "* Use YANG Suite to build an RPC which configures a new **IP address**, **description,** and **load interval** to the new **Loopback 0** interface:\n", |
787 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
| 786 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
788 | 787 | " * XPaths:\n", |
789 | | - " * **/native/interface/Loopback/name**\n", |
790 | | - " * **/native/interface/Loopback/description**\n", |
791 | | - " * **/native/interface/Loopback/ip/address/primary**\n", |
792 | | - " * **/native/interface/Loopback/load-interval**\n", |
793 | | - " * Description - Added by NETCONF\n", |
794 | | - " * IPv4 Address - **172.16.10.10**\n", |
795 | | - " * Subnet Mask - **255.255.255.255**\n", |
796 | | - " * Load Interval - **30**\n", |
| 788 | + " * `/native/interface/Loopback/name`\n", |
| 789 | + " * `/native/interface/Loopback/description`\n", |
| 790 | + " * `/native/interface/Loopback/ip/address/primary`\n", |
| 791 | + " * `/native/interface/Loopback/load-interval`\n", |
| 792 | + " * Description - `Added by NETCONF``\n", |
| 793 | + " * IPv4 Address - `172.16.10.10`\n", |
| 794 | + " * Subnet Mask - `255.255.255.255`\n", |
| 795 | + " * Load Interval - `30`\n", |
797 | 796 | " * Copy and paste the data in the **\\<config\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
798 | 797 | ] |
799 | 798 | }, |
|
834 | 833 | "This NETCONF request will use the **get-config** RPC to determine whether or not the previous operation added configuration elements to the **Loopback 0** interface on **R1**.\n", |
835 | 834 | "\n", |
836 | 835 | "* Use YANG Suite to build a build an RPC which gets configuration data for the **R1** interfaces:\n", |
837 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
838 | | - " * XPath - **/native/interface**\n", |
| 836 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 837 | + " * XPath - `/native/interface`\n", |
839 | 838 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
840 | 839 | ] |
841 | 840 | }, |
|
885 | 884 | "This NETCONF request will use the **edit-config** RPC with the **delete operation** to remove the new **Loopback 0** interface from **R1**.\n", |
886 | 885 | "\n", |
887 | 886 | "* Use YANG Suite to build an RPC which deletes interface **Loopback 0**:\n", |
888 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
889 | | - " * XPath - **/native/interface/Loopback**\n", |
890 | | - " * Loopback Operation - **delete**\n", |
891 | | - " * Interface Name - **0**\n", |
| 887 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 888 | + " * XPath - `/native/interface/Loopback`\n", |
| 889 | + " * Loopback Operation - `delete`\n", |
| 890 | + " * Interface Name - `0`\n", |
892 | 891 | " * Copy and paste the data in the **\\<config\\>** tag from YANG Suite to the **payload** variable (multiline string) below." |
893 | 892 | ] |
894 | 893 | }, |
|
929 | 928 | "This NETCONF request will use the **get-config** RPC to determine whether or not the previous operation removed the **Loopback 0** interface from **R1**.\n", |
930 | 929 | "\n", |
931 | 930 | "* Use YANG Suite to build a build an RPC which gets configuration data for the **R1** interfaces:\n", |
932 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
933 | | - " * XPath - **/native/interface**\n", |
| 931 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 932 | + " * XPath - `/native/interface`\n", |
934 | 933 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
935 | 934 | ] |
936 | 935 | }, |
|
985 | 984 | "\n", |
986 | 985 | "\n", |
987 | 986 | "* Use YANG Suite to build a configuration for a new Loopback interrface as follows:\n", |
988 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
989 | | - " * XPath - **/native/interface/Loopback**\n", |
990 | | - " * Interface Name - **10**\n", |
| 987 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 988 | + " * XPath - `/native/interface/Loopback`\n", |
| 989 | + " * Interface Name - `10`\n", |
991 | 990 | " * Copy and paste the data in the **\\<config\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
992 | 991 | ] |
993 | 992 | }, |
|
1023 | 1022 | "\n", |
1024 | 1023 | "\n", |
1025 | 1024 | "* Use YANG Suite to build a configuration for a new Loopback interrface as follows:\n", |
1026 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
1027 | | - " * XPath - **/native/interface/Loopback**\n", |
1028 | | - " * Interface Name - **10**\n", |
| 1025 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 1026 | + " * XPath - `/native/interface/Loopback`\n", |
| 1027 | + " * Interface Name - `10`\n", |
1029 | 1028 | " * Copy and paste the data in the **\\<config\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
1030 | 1029 | ] |
1031 | 1030 | }, |
|
1076 | 1075 | "This NETCONF request will confirm the change to the **candidate** datastore does not appear in the **running** datastore on **R2**, yet.\n", |
1077 | 1076 | "\n", |
1078 | 1077 | "* Use YANG Suite to build a build an RPC which gets configuration data for the **R2** interfaces:\n", |
1079 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
1080 | | - " * XPath - **/native/interface**\n", |
| 1078 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 1079 | + " * XPath - `/native/interface`\n", |
1081 | 1080 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
1082 | 1081 | ] |
1083 | 1082 | }, |
|
1172 | 1171 | "This NETCONF request will confirm the change to the **candidate** datastore now *does* appear in the **running** datastore on **R2**.\n", |
1173 | 1172 | "\n", |
1174 | 1173 | "* Use YANG Suite to build a build an RPC which gets configuration data for the **R2** interfaces:\n", |
1175 | | - " * YANG Model - **Cisco-IOS-XE-native**\n", |
1176 | | - " * XPath - **/native/interface**\n", |
| 1174 | + " * YANG Model - `Cisco-IOS-XE-native`\n", |
| 1175 | + " * XPath - `/native/interface`\n", |
1177 | 1176 | " * Copy and paste the data in the **\\<filter\\>** tag from YANG Suite to the **payload** variable (multiline string) below. " |
1178 | 1177 | ] |
1179 | 1178 | }, |
|
0 commit comments