Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Latest commit

 

History

History
195 lines (142 loc) · 4.75 KB

requirements-and-installation.md

File metadata and controls

195 lines (142 loc) · 4.75 KB

Table of Contents

Requirements on your laptop

Python 3 (at least 3.3) is required:

python -V

The Python package anta and these scripts require some packages that are not part of the Python standard library:

  • They are indicated in the requirements.txt file
  • There are several ways to install them. They are described below.

Use the pip install command with the git url

Run this command to install:

  • The package anta and its dependencies
  • The packages required by these scripts
  • These scripts in /usr/local/bin/
sudo pip install git+https://github.com/ksator/network-test-automation.git

Run these commands to verify:

pip list
check-devices-reachability.py --help

To update, run this command:

sudo pip install -U git+https://github.com/ksator/network-test-automation.git

Clone the repository and use the pip install . command

Run these commands to install:

  • The package anta and its dependencies
  • The packages required by these scripts
  • These scripts in /usr/local/bin/
git clone https://github.com/ksator/network-test-automation.git
cd network-test-automation
sudo pip install .

Run these commands to verify:

pip list
check-devices-reachability.py --help

Clone the repository and use setup.py

Run these commands to clone the repository and to move to the new folder:

git clone https://github.com/ksator/network-test-automation.git
cd network-test-automation

Run this command to build the package anta:

python setup.py build

Run this command to install:

  • The package anta and its dependencies
  • The packages required by these scripts
  • These scripts in /usr/local/bin/
sudo python setup.py install

Run these commands to verify:

pip list
check-devices-reachability.py --help

Clone the repository and use the pip install -r requirements.txt command

Run these commands to install the packages indicated in the requirements.txt file.

git clone https://github.com/ksator/network-test-automation.git
cd network-test-automation
pip install -r requirements.txt

These packages are required by:

But this will not install:

Run this command to verify:

pip list

Requirements on the switches

switch1#sh run int ma1
interface Management1
   description oob_management
   vrf MGMT
   ip address 10.73.1.105/24
switch1#

Enable eAPI on the MGMT vrf:

switch1#configure
switch1(config)#management api http-commands
switch1(config-mgmt-api-http-cmds)#protocol https port 443
switch1(config-mgmt-api-http-cmds)#no shutdown
switch1(config-mgmt-api-http-cmds)#vrf MGMT
switch1(config-mgmt-api-http-cmds-vrf-MGMT)#no shutdown
switch1(config-mgmt-api-http-cmds-vrf-MGMT)#exit
switch1(config-mgmt-api-http-cmds)#exit
switch1(config)#

Now the swicth accepts on port 443 in the MGMT VRF HTTPS requests containing a list of CLI commands.

Run these EOS commands to verify:

switch1#sh management http-server
switch1#show management api http-commands

Quick checks

Execute this python script to validate:

  • You can import the jsonrpclib library
  • The device reachability using eAPI Use your device credentials and IP address.
import ssl
from jsonrpclib import Server
ssl._create_default_https_context = ssl._create_unverified_context
USERNAME = "arista"
PASSWORD = "aristatwfn"
ENABLE_PASSWORD = "aristatwfn"
IP = "192.168.0.12"
URL=f'https://{USERNAME}:{PASSWORD}@{IP}/command-api'
switch = Server(URL)
result=switch.runCmds(1,['show version'], 'json')
print(result[0]['uptime'])

Run these python commands to validate you can import and use the anta package

from anta.tests import *
dir()
help(verify_bgp_ipv4_unicast_state)
verify_bgp_ipv4_unicast_state(switch, ENABLE_PASSWORD)
exit()