diff --git a/MANIFEST.in b/MANIFEST.in index a6ed6476..e8b56f74 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include requirements.txt -recursive-include napalm_yang/mappings/* +recursive-include napalm_yang/mappings *.yaml *.yml diff --git a/interactive_demo/tutorial.ipynb b/interactive_demo/tutorial.ipynb index bd53c474..e2164f26 100644 --- a/interactive_demo/tutorial.ipynb +++ b/interactive_demo/tutorial.ipynb @@ -1040,7 +1040,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 17, "metadata": { "collapsed": false, "deletable": true, @@ -1050,213 +1050,11 @@ } }, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "No handlers could be found for logger \"napalm-yang\"\n" - ] - }, { "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"interfaces\": {\n", - " \"interface\": {\n", - " \"Ethernet1\": {\n", - " \"config\": {\n", - " \"description\": \"This is a description\", \n", - " \"enabled\": True, \n", - " \"type\": \"ethernetCsmacd\"\n", - " }, \n", - " \"name\": \"Ethernet1\", \n", - " \"routed-vlan\": {\n", - " \"ipv4\": {\n", - " \"config\": {\n", - " \"enabled\": False\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"Ethernet2\": {\n", - " \"config\": {\n", - " \"description\": \"so much oc\", \n", - " \"enabled\": False, \n", - " \"mtu\": 1500, \n", - " \"type\": \"ethernetCsmacd\"\n", - " }, \n", - " \"name\": \"Ethernet2\", \n", - " \"routed-vlan\": {\n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"192.168.0.1\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.0.1\", \n", - " \"prefix-length\": 24, \n", - " \"secondary\": False\n", - " }, \n", - " \"ip\": \"192.168.0.1\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }, \n", - " \"subinterfaces\": {\n", - " \"subinterface\": {\n", - " \"1\": {\n", - " \"config\": {\n", - " \"description\": \"another subiface\", \n", - " \"enabled\": True, \n", - " \"name\": \"Ethernet2.1\"\n", - " }, \n", - " \"index\": \"1\", \n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"172.20.0.1\": {\n", - " \"config\": {\n", - " \"ip\": \"172.20.0.1\", \n", - " \"prefix-length\": 24, \n", - " \"secondary\": True\n", - " }, \n", - " \"ip\": \"172.20.0.1\"\n", - " }, \n", - " \"192.168.1.1\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.1.1\", \n", - " \"prefix-length\": 24, \n", - " \"secondary\": False\n", - " }, \n", - " \"ip\": \"192.168.1.1\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }, \n", - " \"vlan\": {\n", - " \"config\": {\n", - " \"vlan-id\": 1\n", - " }\n", - " }\n", - " }, \n", - " \"2\": {\n", - " \"config\": {\n", - " \"description\": \"asdasdasd\", \n", - " \"enabled\": True, \n", - " \"name\": \"Ethernet2.2\"\n", - " }, \n", - " \"index\": \"2\", \n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"192.168.2.1\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.2.1\", \n", - " \"prefix-length\": 24, \n", - " \"secondary\": False\n", - " }, \n", - " \"ip\": \"192.168.2.1\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }, \n", - " \"vlan\": {\n", - " \"config\": {\n", - " \"vlan-id\": 2\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"Loopback1\": {\n", - " \"config\": {\n", - " \"description\": \"a loopback\", \n", - " \"enabled\": True, \n", - " \"mtu\": 1500, \n", - " \"type\": \"softwareLoopback\"\n", - " }, \n", - " \"name\": \"Loopback1\", \n", - " \"routed-vlan\": {\n", - " \"ipv4\": {\n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"Management1\": {\n", - " \"config\": {\n", - " \"enabled\": True, \n", - " \"mtu\": 1500, \n", - " \"type\": \"ethernetCsmacd\"\n", - " }, \n", - " \"name\": \"Management1\", \n", - " \"routed-vlan\": {\n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"10.0.2.15\": {\n", - " \"config\": {\n", - " \"ip\": \"10.0.2.15\", \n", - " \"prefix-length\": 24, \n", - " \"secondary\": False\n", - " }, \n", - " \"ip\": \"10.0.2.15\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"Port-Channel1\": {\n", - " \"config\": {\n", - " \"description\": \"blah\", \n", - " \"enabled\": True, \n", - " \"mtu\": 9000, \n", - " \"type\": \"ieee8023adLag\"\n", - " }, \n", - " \"name\": \"Port-Channel1\", \n", - " \"routed-vlan\": {\n", - " \"ipv4\": {\n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }, \n", - " \"subinterfaces\": {\n", - " \"subinterface\": {\n", - " \"1\": {\n", - " \"config\": {\n", - " \"enabled\": True, \n", - " \"name\": \"Port-Channel1.1\"\n", - " }, \n", - " \"index\": \"1\", \n", - " \"ipv4\": {\n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - "}\n" + "{}\n" ] } ], @@ -1301,175 +1099,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\n", - " \"interfaces\": {\n", - " \"interface\": {\n", - " \"ae0\": {\n", - " \"config\": {\n", - " \"enabled\": True, \n", - " \"name\": \"ae0\", \n", - " \"type\": \"ieee8023adLag\"\n", - " }, \n", - " \"name\": \"ae0\", \n", - " \"subinterfaces\": {\n", - " \"subinterface\": {\n", - " \"0\": {\n", - " \"config\": {\n", - " \"description\": \"ASDASDASD\", \n", - " \"enabled\": True, \n", - " \"name\": \"0\"\n", - " }, \n", - " \"index\": \"0\", \n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"172.20.100.1/24\": {\n", - " \"config\": {\n", - " \"ip\": \"172.20.100.1\", \n", - " \"prefix-length\": 24\n", - " }, \n", - " \"ip\": \"172.20.100.1/24\"\n", - " }, \n", - " \"192.168.100.1/24\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.100.1\", \n", - " \"prefix-length\": 24\n", - " }, \n", - " \"ip\": \"192.168.100.1/24\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }, \n", - " \"vlan\": {\n", - " \"config\": {\n", - " \"vlan-id\": 100\n", - " }\n", - " }\n", - " }, \n", - " \"1\": {\n", - " \"config\": {\n", - " \"description\": \"ae0.1\", \n", - " \"enabled\": True, \n", - " \"name\": \"1\"\n", - " }, \n", - " \"index\": \"1\", \n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"192.168.101.1/24\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.101.1\", \n", - " \"prefix-length\": 24\n", - " }, \n", - " \"ip\": \"192.168.101.1/24\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }, \n", - " \"vlan\": {\n", - " \"config\": {\n", - " \"vlan-id\": 1\n", - " }\n", - " }\n", - " }, \n", - " \"2\": {\n", - " \"config\": {\n", - " \"description\": \"ae0.2\", \n", - " \"enabled\": True, \n", - " \"name\": \"2\"\n", - " }, \n", - " \"index\": \"2\", \n", - " \"ipv4\": {\n", - " \"addresses\": {\n", - " \"address\": {\n", - " \"192.168.102.1/24\": {\n", - " \"config\": {\n", - " \"ip\": \"192.168.102.1\", \n", - " \"prefix-length\": 24\n", - " }, \n", - " \"ip\": \"192.168.102.1/24\"\n", - " }\n", - " }\n", - " }, \n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }, \n", - " \"vlan\": {\n", - " \"config\": {\n", - " \"vlan-id\": 2\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"ge-0/0/0\": {\n", - " \"config\": {\n", - " \"description\": \"management interface\", \n", - " \"enabled\": True, \n", - " \"mtu\": 1400, \n", - " \"name\": \"ge-0/0/0\", \n", - " \"type\": \"ethernetCsmacd\"\n", - " }, \n", - " \"name\": \"ge-0/0/0\", \n", - " \"subinterfaces\": {\n", - " \"subinterface\": {\n", - " \"0\": {\n", - " \"config\": {\n", - " \"description\": \"ge-0/0/0.0\", \n", - " \"enabled\": True, \n", - " \"name\": \"0\"\n", - " }, \n", - " \"index\": \"0\", \n", - " \"ipv4\": {\n", - " \"config\": {\n", - " \"enabled\": True\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"ge-0/0/1\": {\n", - " \"config\": {\n", - " \"description\": \"ge-0/0/1\", \n", - " \"enabled\": False, \n", - " \"name\": \"ge-0/0/1\", \n", - " \"type\": \"ethernetCsmacd\"\n", - " }, \n", - " \"name\": \"ge-0/0/1\"\n", - " }, \n", - " \"lo0\": {\n", - " \"config\": {\n", - " \"description\": \"lo0\", \n", - " \"enabled\": True, \n", - " \"name\": \"lo0\", \n", - " \"type\": \"softwareLoopback\"\n", - " }, \n", - " \"name\": \"lo0\", \n", - " \"subinterfaces\": {\n", - " \"subinterface\": {\n", - " \"0\": {\n", - " \"config\": {\n", - " \"description\": \"lo0.0\", \n", - " \"enabled\": True, \n", - " \"name\": \"0\"\n", - " }, \n", - " \"index\": \"0\"\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - " }\n", - "}\n" + "{}\n" ] } ], @@ -1605,34 +1235,6 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n", - " \n", - " \n", - " et1\n", - " \n", - " \n", - "
\n", - " 192.168.1.1/24\n", - "
\n", - "
\n", - "
\n", - " Uplink1\n", - " 9000\n", - "
\n", - " \n", - " et2\n", - " \n", - " \n", - "
\n", - " 192.168.2.1/24\n", - "
\n", - "
\n", - "
\n", - " Uplink2\n", - " 9000\n", - "
\n", - "
\n", - "
\n", "\n" ] } @@ -1660,14 +1262,6 @@ "name": "stdout", "output_type": "stream", "text": [ - "interface et1\n", - " ip address 192.168.1.1/24 \n", - " description Uplink1\n", - " mtu 9000\n", - "interface et2\n", - " ip address 192.168.2.1/24 \n", - " description Uplink2\n", - " mtu 9000\n", "\n" ] } @@ -1720,7 +1314,21 @@ "slide_type": "subslide" } }, - "outputs": [], + "outputs": [ + { + "ename": "KeyError", + "evalue": "'lo0'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0mrunning\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnapalm_yang\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRoot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mrunning\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnapalm_yang\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopenconfig_interfaces\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mrunning\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparse_config\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mjunos_device\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/Users/dbarroso/.virtualenvs/test/lib/python2.7/site-packages/napalm_base/base.pyc\u001b[0m in \u001b[0;36m__exit__\u001b[0;34m(self, exc_type, exc_value, exc_traceback)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mexc_type\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 60\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__raise_clean_exception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexc_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexc_value\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexc_traceback\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__del__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/dbarroso/.virtualenvs/test/lib/python2.7/site-packages/napalm_base/base.pyc\u001b[0m in \u001b[0;36m__raise_clean_exception\u001b[0;34m(exc_type, exc_value, exc_traceback)\u001b[0m\n\u001b[1;32m 88\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepilog\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 89\u001b[0m \u001b[0;31m# Traceback should already be attached to exception; no need to re-attach\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 90\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mexc_value\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 91\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 92\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'lo0'" + ] + } + ], "source": [ "with junos_device as device:\n", " # first let's create a candidate config by retrieving the current state of the device\n", @@ -1744,7 +1352,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -1753,92 +1361,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " \n", - " \n", - " ge-0/0/0\n", - " \n", - " 0\n", - " \n", - " \n", - " \n", - " ge-0/0/0.0\n", - " \n", - " management interface\n", - " \n", - " \n", - " \n", - " ge-0/0/1\n", - " \n", - " ge-0/0/1\n", - " \n", - " \n", - " ae0\n", - " \n", - " 0\n", - " 100\n", - " \n", - " \n", - "
\n", - " 192.168.100.1/24\n", - "
\n", - "
\n", - " 172.20.100.1/24\n", - "
\n", - "
\n", - "
\n", - " ASDASDASD\n", - "
\n", - " \n", - " \n", - " 1\n", - " 1\n", - " \n", - " \n", - "
\n", - " 192.168.101.1/24\n", - "
\n", - "
\n", - "
\n", - " ae0.1\n", - "
\n", - " \n", - " \n", - " 2\n", - " 2\n", - " \n", - " \n", - "
\n", - " 192.168.102.1/24\n", - "
\n", - "
\n", - "
\n", - " ae0.2\n", - "
\n", - " \n", - "
\n", - " \n", - " lo0\n", - " \n", - " 1\n", - " new loopback\n", - " \n", - " \n", - " 0\n", - " \n", - " lo0\n", - " \n", - "
\n", - "
\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# Now let's see how the merge configuration would be\n", "config = candidate.translate_config(profile=junos_device.profile, merge=running)\n", @@ -1860,7 +1383,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -1869,23 +1392,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[edit interfaces ge-0/0/0]\n", - "- mtu 1400;\n", - "[edit interfaces lo0]\n", - "- unit 0 {\n", - "- description lo0.0;\n", - "- }\n", - "+ unit 1 {\n", - "+ description \"new loopback\";\n", - "+ }\n" - ] - } - ], + "outputs": [], "source": [ "with junos_device as d:\n", " d.load_merge_candidate(config=config)\n", @@ -1908,7 +1415,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -1917,88 +1424,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " \n", - " \n", - " ge-0/0/0\n", - " \n", - " 0\n", - " \n", - " \n", - " \n", - " ge-0/0/0.0\n", - " \n", - " management interface\n", - " \n", - " \n", - " ge-0/0/1\n", - " \n", - " ge-0/0/1\n", - " \n", - " \n", - " ae0\n", - " \n", - " 0\n", - " 100\n", - " \n", - " \n", - "
\n", - " 192.168.100.1/24\n", - "
\n", - "
\n", - " 172.20.100.1/24\n", - "
\n", - "
\n", - "
\n", - " ASDASDASD\n", - "
\n", - " \n", - " \n", - " 1\n", - " 1\n", - " \n", - " \n", - "
\n", - " 192.168.101.1/24\n", - "
\n", - "
\n", - "
\n", - " ae0.1\n", - "
\n", - " \n", - " \n", - " 2\n", - " 2\n", - " \n", - " \n", - "
\n", - " 192.168.102.1/24\n", - "
\n", - "
\n", - "
\n", - " ae0.2\n", - "
\n", - " \n", - "
\n", - " \n", - " lo0\n", - " \n", - " 1\n", - " new loopback\n", - " \n", - " lo0\n", - " \n", - "
\n", - "
\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "config = candidate.translate_config(profile=junos_device.profile, replace=running)\n", "print(config)" @@ -2019,7 +1445,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2028,25 +1454,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[edit interfaces ge-0/0/0]\n", - "- mtu 1400;\n", - "[edit interfaces ge-0/0/0 unit 0 family inet]\n", - "- dhcp;\n", - "[edit interfaces lo0]\n", - "- unit 0 {\n", - "- description lo0.0;\n", - "- }\n", - "+ unit 1 {\n", - "+ description \"new loopback\";\n", - "+ }\n" - ] - } - ], + "outputs": [], "source": [ "with junos_device as d:\n", " d.load_merge_candidate(config=config)\n", @@ -2084,7 +1492,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2117,7 +1525,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2126,39 +1534,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "interface Port-Channel1\n", - " no switchport\n", - " no switchport\n", - " default mtu\n", - "interface Port-Channel1.1\n", - "interface Ethernet1\n", - "interface Ethernet2\n", - " no switchport\n", - " ip address 192.168.0.1/24 \n", - " no switchport\n", - " no switchport\n", - " shutdown\n", - "interface Ethernet2.1\n", - " encapsulation dot1q vlan 1\n", - " ip address 192.168.1.1/24 \n", - " ip address 172.20.0.1/24 secondary\n", - "interface Ethernet2.2\n", - " encapsulation dot1q vlan 2\n", - " ip address 192.168.2.1/24 \n", - "interface Management1\n", - " ip address 10.0.2.15/24 \n", - "interface Loopback0\n", - " description new loopback\n", - "no interface Loopback1\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# Now let's see how the merge configuration would be\n", "config = candidate.translate_config(profile=eos_device.profile, merge=running)\n", @@ -2167,7 +1543,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2176,33 +1552,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "@@ -19,7 +19,6 @@\n", - " !\n", - " interface Port-Channel1\n", - " description blah\n", - "- mtu 9000\n", - " no switchport\n", - " !\n", - " interface Port-Channel1.1\n", - "@@ -46,8 +45,8 @@\n", - " encapsulation dot1q vlan 2\n", - " ip address 192.168.2.1/24\n", - " !\n", - "-interface Loopback1\n", - "- description a loopback\n", - "+interface Loopback0\n", - "+ description new loopback\n", - " !\n", - " interface Management1\n", - " ip address 10.0.2.15/24\n" - ] - } - ], + "outputs": [], "source": [ "with eos_device as d:\n", " d.load_merge_candidate(config=config)\n", @@ -2225,7 +1575,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2234,53 +1584,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no interface Port-Channel1\n", - "interface Port-Channel1\n", - " no switchport\n", - " no switchport\n", - " description blah\n", - "no interface Port-Channel1.1\n", - "interface Port-Channel1.1\n", - "default interface Ethernet1\n", - "interface Ethernet1\n", - " description This is a description\n", - "default interface Ethernet2\n", - "interface Ethernet2\n", - " no switchport\n", - " ip address 192.168.0.1/24 \n", - " no switchport\n", - " no switchport\n", - " shutdown\n", - " description so much oc\n", - " mtu 1500\n", - "no interface Ethernet2.1\n", - "interface Ethernet2.1\n", - " encapsulation dot1q vlan 1\n", - " ip address 192.168.1.1/24 \n", - " ip address 172.20.0.1/24 secondary\n", - " description another subiface\n", - "no interface Ethernet2.2\n", - "interface Ethernet2.2\n", - " encapsulation dot1q vlan 2\n", - " ip address 192.168.2.1/24 \n", - " description asdasdasd\n", - "default interface Management1\n", - "interface Management1\n", - " ip address 10.0.2.15/24 \n", - " mtu 1500\n", - "no interface Loopback0\n", - "interface Loopback0\n", - " description new loopback\n", - "no interface Loopback1\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "config = candidate.translate_config(profile=eos_device.profile, replace=running)\n", "print(config)" @@ -2288,7 +1592,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2297,41 +1601,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "@@ -19,15 +19,12 @@\n", - " !\n", - " interface Port-Channel1\n", - " description blah\n", - "- mtu 9000\n", - " no switchport\n", - " !\n", - " interface Port-Channel1.1\n", - " !\n", - " interface Ethernet1\n", - " description This is a description\n", - "- dcbx mode ieee\n", - "- channel-group 1 mode active\n", - " !\n", - " interface Ethernet2\n", - " description so much oc\n", - "@@ -46,8 +43,8 @@\n", - " encapsulation dot1q vlan 2\n", - " ip address 192.168.2.1/24\n", - " !\n", - "-interface Loopback1\n", - "- description a loopback\n", - "+interface Loopback0\n", - "+ description new loopback\n", - " !\n", - " interface Management1\n", - " ip address 10.0.2.15/24\n" - ] - } - ], + "outputs": [], "source": [ "with eos_device as d:\n", " d.load_merge_candidate(config=config)\n", @@ -2388,7 +1658,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": { "collapsed": false, "deletable": true, @@ -2398,36 +1668,7 @@ "slide_type": "subslide" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{\n", - " \"interfaces\": {\n", - " \"interface\": {\n", - " \"both\": {\n", - " \"Port-Channel1\": {\n", - " \"config\": {\n", - " \"mtu\": {\n", - " \"first\": \"0\", \n", - " \"second\": \"9000\"\n", - " }\n", - " }\n", - " }\n", - " }, \n", - " \"first_only\": [\n", - " \"Loopback0\"\n", - " ], \n", - " \"second_only\": [\n", - " \"Loopback1\"\n", - " ]\n", - " }\n", - " }\n", - "}\n" - ] - } - ], + "outputs": [], "source": [ "diff = napalm_yang.utils.diff(candidate, running)\n", "pretty_print(diff)" @@ -2451,7 +1692,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": "2.7.13" } }, "nbformat": 4, diff --git a/setup.py b/setup.py index 3b973075..9a78dada 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="napalm-yang", - version="0.0.1", + version="0.0.2", packages=find_packages(), author="David Barroso", author_email="dbarrosop@dravetech.com",