/PingSubnetCli

Arista Python script to ping a selected subnet and output a summary report

Primary LanguagePython

Description

Python script to add a pingsubnet command to Arista switches to send echo messages to a CIDR address and print out a report.

Requirements

EOS 4.14.5 or higher.

Output

switch#pingsubnet
Network         Subnet
0               172.16.1.4/28
1               192.168.99.2/30

Enter the network to ping (0-1): 0
-----------------------------------------
Date            2016-01-27 10:12:10
Timezone        PST
-----------------------------------------
172.16.1.1 up
172.16.1.2 up
172.16.1.3 up
172.16.1.4 up
172.16.1.5 down
172.16.1.6 down
172.16.1.7 down
172.16.1.8 down
172.16.1.9 down
172.16.1.10 up
172.16.1.11 down
172.16.1.12 down
172.16.1.13 down
172.16.1.14 down
-----------------------------------------
CIDR            172.16.1.4/28
Network ID      172.16.1.0
Broadcast       172.16.1.15
Total Hosts     14
-----------------------------------------
Hosts Online    5
Hosts Online    9

Installation

Copy the following files to /mnt/flash on the switch:

LoadPingSubnetCli.sh
PingSubnetCli.py
netaddr-0.7.18.tar.gz from https://pypi.python.org/pypi/netaddr

Add the following configuration statements:

event-handler Boot-Cli
   trigger on-boot
   action bash sudo /mnt/flash/LoadPingSubnetCli.sh
   delay 60

management api http-commands
   protocol unix-socket
   no shutdown

Caveats

If you do not want to reboot the device, perform the following steps to enable the pingsubnet command:

From /mnt/flash/netaddr-0.7.18

sudo python setup.py install
sudo killall FastClid-server