Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Modify NAPALM lesson to use new verification capabilities #178

Merged
merged 4 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 2 additions & 69 deletions lessons/lesson-13/stage2/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,49 +66,7 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Interface gr-0/0/0 is UP\n",
"Interface .local. is UP\n",
"Interface bme0 is UP\n",
"Interface cbp0 is UP\n",
"Interface dsc is UP\n",
"Interface em0 is UP\n",
"Interface em1 is UP\n",
"Interface em2 is UP\n",
"Interface em3 is UP\n",
"Interface em4 is UP\n",
"Interface em5 is UP\n",
"Interface em6 is UP\n",
"Interface em7 is UP\n",
"Interface em8 is UP\n",
"Interface em9 is UP\n",
"Interface em10 is UP\n",
"Interface esi is UP\n",
"Interface gre is UP\n",
"Interface ipip is UP\n",
"Interface irb is UP\n",
"Interface lo0 is UP\n",
"Interface lsi is UP\n",
"Interface mtun is UP\n",
"Interface pimd is UP\n",
"Interface pime is UP\n",
"Interface pip0 is UP\n",
"Interface tap is UP\n",
"Interface vme is DOWN\n",
"Interface vtep is UP\n",
"Interface bme0.0 is UP\n",
"Interface em0.0 is UP\n",
"Interface em1.0 is UP\n",
"Interface em2.32768 is UP\n",
"Interface lo0.0 is UP\n",
"Interface lo0.16385 is UP\n"
]
}
],
"outputs": [],
"source": [
"for if_name, if_properties in interfaces.items():\n",
" if if_properties['is_up']:\n",
Expand All @@ -128,25 +86,7 @@
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'bme0.0': {'ipv4': {'128.0.0.1': {'prefix_length': 2},\n",
" '128.0.0.4': {'prefix_length': 2},\n",
" '128.0.0.16': {'prefix_length': 2},\n",
" '128.0.0.63': {'prefix_length': 2}}},\n",
" 'em0.0': {'ipv4': {'10.0.0.15': {'prefix_length': 24}}},\n",
" 'em1.0': {'ipv4': {'10.31.0.11': {'prefix_length': 24}}},\n",
" 'em2.32768': {'ipv4': {'192.168.1.2': {'prefix_length': 24}}},\n",
" 'lo0.0': {'ipv6': {'fe80::5254:f:fcb1:f58d': {'prefix_length': 128}}}}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"device.get_interfaces_ip()"
]
Expand All @@ -159,13 +99,6 @@
"\n",
"Next, we'll cover the NAPALM CLI tool, and use it to execute some additional commands you may find useful when working with a multi-vendor environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
44 changes: 3 additions & 41 deletions lessons/lesson-13/stage4/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,7 @@
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[edit interfaces em0 unit 0]\n",
"+ description \"This is em0, and it connects to something.\";\n"
]
}
],
"outputs": [],
"source": [
"print(device.compare_config())\n"
]
Expand Down Expand Up @@ -146,18 +137,7 @@
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"'This is em0, and it connects to something.'"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"device.get_interfaces()['em0.0']['description']"
]
Expand All @@ -173,18 +153,7 @@
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"''"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"device.rollback()\n",
"device.get_interfaces()['em0.0']['description']"
Expand All @@ -200,13 +169,6 @@
"\n",
"That's it for now! In future versions of the lesson (or perhaps in other lessons) we'll dive deeper into some of the more specific tools within NAPALM for targeted workflows. For now, check out the [NAPALM documentation](https://napalm.readthedocs.io) for more information.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
5 changes: 5 additions & 0 deletions lessons/lesson-13/stage4/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import napalm
driver = napalm.get_network_driver("junos")
device = driver(hostname="vqfx1", username="antidote", password="antidotepassword")
device.open()
assert device.get_interfaces()['em1.0']['description'] == 'Hello, World!'
2 changes: 2 additions & 0 deletions lessons/lesson-13/syringe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ stages:
- id: 4
description: Make configuration changes with NAPALM
jupyterLabGuide: true
verifyCompleteness: true
verifyObjective: "Modify and re-execute the code in the Jupyter notebook so that the description for em1.0 exactly reads: 'Hello, World!'"
1 change: 1 addition & 0 deletions lessons/lesson-14/syringe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ stages:
description: Lists
- id: 2
description: Dictionaries (key/value pairs)

# 3:
# description: What about JSON?