Hello
PyATS, Genie, and unicon implement robot framework to create easy verifications for your network. Today i’ve created this simple robot testset that goes through a number of tests.
*** Settings ***
Library ats.robot.pyATSRobot
Library genie.libs.robot.GenieRobot
Library pyats.aetest.container.TestContainer
Library genie.libs.robot.GenieRobotApis
Library unicon.robot.UniconRobot
*** Test Cases ***
Connect to HUB1 device
use genie testbed "testbed_session2_slide25.yaml"
connect to device "HUB1"
Verify that number of bgp routes on HUB1 device is 0
verify count "0" "bgp routes" on device "HUB1"
Verify that Tunnels are UP on HUB1
verify interface config no shutdown device=HUB1 interface=tunnel1251
Disconnect from HUB1 device
disconnect from device "HUB1"
Connect to ISP device
use genie testbed "testbed_session2_slide25.yaml"
connect to device "ISP1"
Verify number of BGP nei
verify count "1" "bgp neighbors" on device "ISP1"
Disconnect from ISP device
disconnect from device "ISP1"
The syntax for verifications can be checked at https://pubhub.devnetcloud.com/media/genie-feature-browser/docs/#/apis
One important gotcha is that there need to be two spaces between the name of the verification (for which you just remove the _ character for the name taken from the api website) and the args. Otherwise robot doesn’t know where the name ends and where args start.
I’ll be writing more about this but it’s clear this is an absolutely awesome tool.
tode@ubuntu:~/perfectscripts/generator/Session2$ robot second.robot Second [ WARN ] Could not load the Datafile correctly Connect to HUB1 device | PASS | Verify that number of bgp routes on HUB1 device is 0 | PASS | Verify that Tunnels are UP on HUB1 | PASS | Disconnect from HUB1 device | PASS | [ WARN ] Could not load the Datafile correctly Connect to ISP device | PASS | Verify number of BGP nei | FAIL | Expected '1', but found '0' Disconnect from ISP device | PASS | Second | FAIL | 7 critical tests, 6 passed, 1 failed 7 tests total, 6 passed, 1 failed Output: /home/tode/perfectscripts/generator/Session2/output.xml Log: /home/tode/perfectscripts/generator/Session2/log.html Report: /home/tode/perfectscripts/generator/Session2/report.html