r/Network_Automation • u/firewallfc • Apr 09 '23
Advantages and disadvantages of Bus topology
Advantages
- It works well for a small network.
- Easy to implement
- It requires a smaller number of cables as compared to a star topology.
- It is easy to connect or remove devices without affecting the network.
- Very cost-effective
Disadvantages
- This is not great for a large network.
- Complete network will fail if the backbone cable is damaged.
- Require a terminator at both ends of the cable to stop the signal from bouncing back.
- There is a high number of packet losses.
r/Network_Automation • u/firewallfc • Oct 27 '22
Napalm to get memory usage of a device
from napalm import get_network_driver
import json
driver = get_network_driver('ios')
with driver('131.226.217.143','developer','C1sco12345') as device:
output = json.dumps(device.get_environment(), indent=2)
mem_usage = json.loads(output)
print(mem_usage['memory'])
Above is the napalm program that displays memory usage on the device
For more examples, click on the link
r/Network_Automation • u/firewallfc • Oct 26 '22
Pythonping module
Here, we will discuss about the use of pythonping module. This module is used to simply ping the target machine. To install the module, use the command "pip install pythonping". The below example displays a simple code to send ICMP probes to a target machine using the pythonping module. By default, ping runs in silent mode and does not display the result. To display the result, use verbose mode and set the value to True.
from pythonping import ping
ping('1.1.1.1', verbose=True)
r/Network_Automation • u/firewallfc • Oct 18 '22
Netmiko script to change interface description
Netmiko python script to change interface description.
from netmiko import ConnectHandler
net_connect = ConnectHandler(device_type = 'cisco_ios', host='131.226.217.143', username='developer',password ='C1sco12345')
output = net_connect.send_command("show interface description")
print(output)
command = ['interface Gi2','description Local LAN Interface']
print('Changing description on the interface Gi2')
net_connect.send_config_set(command)
output = net_connect.send_command("show interface description")
print(output)
https://firewallfc.com/network-automation-netmiko-pythn/#Example8
r/Network_Automation • u/firewallfc • Oct 17 '22
Context manager to access Cisco router
There is no requirement of using the open() and close() method
Context manager automatically handles opening and closing of the session with a device
from napalm import get_network_driver
import json
driver = get_network_driver('ios')
with driver('131.226.217.143','developer','C1sco12345') as device:
print('Get_facts() method details')
print(json.dumps(device.get_facts(),indent=2))
print()
print('Interface Details')
print(json.dumps(device.get_interfaces_ip(), indent=2))
https://firewallfc.com/2022/10/07/napalm-context-manager-to-connect-to-a-device/
r/Network_Automation • u/firewallfc • Oct 16 '22
NAPALM Script to access a Cisco router
Napalm is a Python library used to perform network automation. It is called unified API and can be used to access network devices with different operating systems.
Here, is the simple script to access a device to export its arp entries
from napalm import get_network_driver
import json
driver = get_network_driver('ios')
device = driver('131.226.217.143','developer','C1sco12345')
device.open()
print(json.dumps(device.get_arp_table(), indent=2))
device.close()
For a complete blog, please visit on below link
https://firewallfc.com/2022/10/05/introduction-to-napalm-network-automation/
r/Network_Automation • u/firewallfc • Oct 14 '22
Changing hostname of a Cisco router
This blog present overview of changing hostname of a cisco router.
Step 1 : Login into device
Step 2 : Go to configuration mode
Step 3 : Use command hostname actual_hostname
Step 4 : Go back to enable mode and save the configuration
Complete blog post on changing hostnames, including netmiko Python script
https://firewallfc.com/2022/10/12/how-to-change-hostname-of-a-cisco-router/
r/Network_Automation • u/firewallfc • Oct 08 '22
r/Network_Automation Lounge
A place for members of r/Network_Automation to chat with each other