Introduction to Nornir | Python Network Automation!

  Рет қаралды 14,056

IPvZero

IPvZero

Күн бұрын

IMPORTANT NOTE: Nornir has now upgraded to Nornir3. This configurations in this video worked for the previous version.
To setup Nornir3 see my newer video:
• Introduction to Nornir3!
Follow me: / ipvzero
Link to original presentation by Stuart Clark: • Managing network confi...

Пікірлер: 47
@hassinba
@hassinba 3 жыл бұрын
Watching your CBT Nuggets now, you're the first person to not just mention that it's not best practice to store credentials in plain text, but how to actually properly store them and call on them, thank you.
@IPvZero
@IPvZero 3 жыл бұрын
Hey h! Thanks so much. I really appreciate it. Trying my best to give out real world practical info!! :) -John
@frankiefuryland
@frankiefuryland 2 жыл бұрын
Nice to hear a fellow Scottish voice talking networking. Looking forward to following your content. This wis crackin'!
@aslanabdurahmanov
@aslanabdurahmanov 4 жыл бұрын
You nailed it! Awesome explanation with instant result.... bravo John!
@IPvZero
@IPvZero 4 жыл бұрын
Thanks so much, Aslan! I really appreciate it! :) -John
@alreid12345
@alreid12345 4 жыл бұрын
Great video John and good to see the difference between Ansible, NAPALM and now Nornir. If using this topology across multiple vids and sessions would you consider uploading the EVE-NG topology (these also usually contain the saved config files as part of exported zip). Thanks again and keep up the great work.
@IPvZero
@IPvZero 4 жыл бұрын
Hey Al! Good to hear your feedback again! About EVE-NG, I can upload the topology no problem, although there isn't really anything too interesting going on haha - just a single IP address on each router and the SSH login info. For the automation all I'm doing is using the EVE-NG "management" cloud so I reach the topology from my host PC and using the "Windows Subsystem For Linux" to get a Ubuntu terminal on my Windows 10 machine. The Linux Server you see in the topology is just a graphic in effect to make it easier for beginners to conceptualise what's going on, rather than see everything being controlled "from a cloud" haha. So the actual scripts etc wouldn't be saved as part of the EVE zip! But like I say, it's no problem to upload it if you'd still like to use it! Thanks again! :) -John
@BlindPigBluesBand
@BlindPigBluesBand 4 жыл бұрын
Awesome content. Thanks!
@IPvZero
@IPvZero 4 жыл бұрын
Thanks, Gerardo! Very kind of you :) -John
@HenriqueAlencarDF
@HenriqueAlencarDF 4 жыл бұрын
It's very helpful, thanks for sharing.
@IPvZero
@IPvZero 4 жыл бұрын
Thanks, Henrique!! Really appreciate hearing your feedback! -John
@JeDeXxRioProKing
@JeDeXxRioProKing 4 жыл бұрын
great vid Man thanks a lot
@IPvZero
@IPvZero 4 жыл бұрын
Thanks, Sefraoui! Really appreciate it :) -John
@IPvZero
@IPvZero 4 жыл бұрын
IMPORTANT NOTE: Nornir has now upgraded to Nornir3. This configurations in this video worked for the previous version. To setup Nornir3 see my newer video: kzfaq.info/get/bejne/m5OpoaqW08ycoJ8.html Link to my Python Network Automation course at CBT Nuggets: learn.gg/adv-net
@BorisV8V
@BorisV8V 3 жыл бұрын
Hello John, do you have a video where you show how to deal with Confirm Y/N prompts after you send a command?
@avinashshankarpalli2130
@avinashshankarpalli2130 3 жыл бұрын
when i executed the script2 in pycharm connecting to gns3, for "nr = InitNornir()" it was throwing a hosts file not found error so i replaced it with "nr = InitNornir(config_file='config.yml')" and then the error went away.Is it compulsory to add config .yml in initnornir?As I see you ran it without it and it did not throw any error for you
@IPvZero
@IPvZero 3 жыл бұрын
Hey, Avinash. You don't need to explictly state the config file - although I almost always do. Nornir should automatically look in this current directory for "hosts.yaml" etc. I suspect that your hosts file etc is named "hosts.yml" - ie yml, not yaml. It didn't find it. I'd need to lab that just to be sure but that's my suspicion :) -John
@preetkochar
@preetkochar 4 жыл бұрын
How about putting links to specific youtube videos on github so that i can reference videos from github back to youtube.
@IPvZero
@IPvZero 4 жыл бұрын
Hey, GuRpReEt! Good thinking, that's exactly what I'm doing. I'm gradually copying over each videos configs and giving it its own repo! I've started doing this since submitting my material to Cisco Code Exchange to make things cleaner! For example: github.com/IPvZero/Archiving_Telemetry So we're definitely thinking the same thing haha! Thanks for the feedback, let's me know it's a good move! -John
@SoulJah876
@SoulJah876 4 жыл бұрын
I tried doing this in a GNS docker image (Python,Go,Perl,PHP) but got nowhere. Got bogged down just trying to get the correct pip version installed because Nornir wouldn't run
@IPvZero
@IPvZero 4 жыл бұрын
Hey, SoulJah. Sorry to hear you're having issues. I just tried installing it on a new VM there and it worked okay. What I did was install pip3, and then pip3 installed Nornir: 1) sudo apt install python3-pip 2) pip3 install nornir Hopefully that helps! -John
@SoulJah876
@SoulJah876 4 жыл бұрын
@@IPvZero I did this but hit an error on the first line at import. I'll try again in a couple hours but with the stock set up and lab. from nornir import InitNornir File "/usr/local/lib/python3.5/dist-packages/nornir/__init__.py", line 3, in from nornir.init_nornir import InitNornir File "/usr/local/lib/python3.5/dist-packages/nornir/init_nornir.py", line 22 return f"{cls.__module__}.{cls.__name__}"
@IPvZero
@IPvZero 4 жыл бұрын
@@SoulJah876 Ah I see you've got an older version of Python3. Python3.5 does not support f strings, so it'll crash. You'll need to update to Python version 3.6.2 or above :)
@2ronaldinho21
@2ronaldinho21 2 жыл бұрын
what ia have wrong in my env ? ModuleNotFoundError: No module named 'nornir.plugins.tasks.networking'
@IPvZero
@IPvZero 2 жыл бұрын
Hey, Pavel. This is an older video which uses Nornir2. Now the current version is Nornir3. The imports are all different. I cover the changes you have to make in this video here: kzfaq.info/get/bejne/m5OpoaqW08ycoJ8.html Hope that helps :) -John
@2ronaldinho21
@2ronaldinho21 2 жыл бұрын
@@IPvZero Thank you for your message.Yes that was the problem. Now works like a charm :)
@DineshKumar-uw3yn
@DineshKumar-uw3yn 4 жыл бұрын
1.Is it possible to promote to enter username and password and enable password ? 2. As we are using same ios is it possible to call list if host name from file ? 3. As we are using list of commands is it possible to call list if commands from file ?
@IPvZero
@IPvZero 4 жыл бұрын
Hey, Dinesh! KZfaq only gave me an alert for this today. Sorry about the delay! Yeah, if you watch my video here - you can see how to push commands from a textfile: kzfaq.info/get/bejne/qKtmp5p-kpncf30.html& With regard to prompting username and password, you instruct the script to ask you for the username and store is as a variable, and then pass that variable into to nornir's inventory. For example: username = input("Please enter your username: ") nr = InitNornir() nr.inventory.defaults.username = username Alternatively you could use Sysargv to pass this value into the script. The same can be done for passwords by importing getpass. An example being: password = getpass.getpass() nr = InitNornir() nr.inventory.defaults.password = password Hope that helps! :) -John
@DineshKumar-uw3yn
@DineshKumar-uw3yn 4 жыл бұрын
@@IPvZero thanks john but let's say I want push some config or get some show output for 500 devices then I can simply the host file and it's hard to write host file right ? Is it possible to copy past 500 device to text file and call it to script if yes please give me idea how can do it and also to enter enable password ?
@IPvZero
@IPvZero 4 жыл бұрын
@@DineshKumar-uw3yn Hey, Dinesh I'm still a little unsure of what you're looking to do. Are you asking - can you, for example, use Nornir to gather the running configs for each devices and save the output to a seperate text file. And then you could call upon those textfiles as configurations in another script?
@IPvZero
@IPvZero 4 жыл бұрын
With respect to the enable password, you can specify enable password in your inventory, something like: R1: connection_options: netmiko: extras: secret: secretpassword Then when execute commands use the enable method like so: results = nr.run(task=netmiko_send_command, command_string="show run", enable=True)
@DineshKumar-uw3yn
@DineshKumar-uw3yn 4 жыл бұрын
@@IPvZero thanks for reply john ! I'm already using netmiko with multithread/multiprocess for configuration push and get some show output and Im just checking is there any best way to use nornir+netmiko but I'm feeling this method is very complicated compare to only netmiko...let's say example I want to push config for 1000 devices what I will doI create text file and past 1000 devices but in nornir I'm feeling adding 1000 devices only it will take some time ... and another thing Let's say we have different vendors. Cisco- 200 devices ,Aruba-200 devices , juniper - 100 devices ,. cisco_nxos-100 devies and I want to push different config to different vendor can we do it using with nornir+netmiko and end it should print any failed devices and pushed config should save in different files
@michaelyang8074
@michaelyang8074 3 жыл бұрын
I’m getting error with network plugin.
@IPvZero
@IPvZero 3 жыл бұрын
Hey Michael. This video was recording using Nornir2. It has since been updated. Basically the import paths and the config.yaml has changed. Check out my video on Nornir3 on how to make the changes! kzfaq.info/get/bejne/m5OpoaqW08ycoJ8.html If you have any problems after that, just lemme know :) -John
@toolate6971
@toolate6971 4 жыл бұрын
It seems like a pure asyncio ssh is faster.
@IPvZero
@IPvZero 4 жыл бұрын
Hey, Too Late! Thanks for watching! The benefit in Nornir is really that it simplifies things. It handles all the concurrent execution for you, plus there's get the benefit of in-built features like F Object for filtering, and the Ansible-like inheritance model with the inventory. That said, this is just an introduction to Nornir. Currently I'm using Nornir with a tool called Scrapli to run the concurrent connections over SSH2 and it is much faster than what I demonstrate here :) -John
@mc-wi8wp
@mc-wi8wp 4 жыл бұрын
The Font is still small. And also, just keep it calm. Talk slower and user a non CLI Text editor.
@IPvZero
@IPvZero 4 жыл бұрын
Keep calm?
@mc-wi8wp
@mc-wi8wp 4 жыл бұрын
@@IPvZero Because you talk too fast. And for people who are not native English speaker it's not fun!
@IPvZero
@IPvZero 4 жыл бұрын
@@mc-wi8wp Apologies, but that's how people from Scotland speak.
Introduction to Genie | Python Network Automation!
25:41
IPvZero
Рет қаралды 7 М.
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 545 М.
Русалка
01:00
История одного вокалиста
Рет қаралды 5 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 21 МЛН
Automate your network with Nornir - Python automation framework
48:23
Python Network Automation | Netmiko!
20:38
IPvZero
Рет қаралды 5 М.
Scrapli CFG - Network Automation
21:05
IPvZero
Рет қаралды 2,9 М.
How To Setup A Network Automation Environment!
16:35
IPvZero
Рет қаралды 6 М.
Efficient network automation with Nornir and Napalm
23:17
Parse Cisco IOS to JSON with Python and Netmiko
17:15
Data Knox
Рет қаралды 21 М.
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 545 М.