-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.eve-keng-cisco_v1.py
More file actions
60 lines (50 loc) · 1.55 KB
/
Copy pathtest.eve-keng-cisco_v1.py
File metadata and controls
60 lines (50 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /usr/bin/python3.8
### MODULES
import urllib3
import requests
import time,re
from os import system
from prettytable import PrettyTable
from eveng_utils import *
from kengTest import Test_ebgp_route_prefix
### GLOBAL VARIABLES
server = "172.16.14.2"
username = "admin"
password = "eve"
labPath = "Users/Sam/KENG_Demo.unl"
userCookie = ""
nodeList = []
### PROGRAM BODY
# Initial setup and clean
system('clear') # clear CLI screen
urllib3.disable_warnings() # stop SSL Self cert error
print("=== EVE-NG Lab Loader ===")
print(f"Accessing Lab\t \"{labPath}\"")
print(f"Accessing \t{username}@{server}")
print("")
# get authentication cookie
userCookie = login(server, username, password)
# check lab exists in appliction
if verifyLab(server,labPath,userCookie) == False:
print("Lab Not Present. Gracefully quitting app")
time.sleep(1)
quit()
### Get List of Nodes in Lab and report
time.sleep(0.5)
nodeList=getNodes(server,labPath,userCookie)
### Starting All Nodes
time.sleep(0.5)
startAllNodes(server,labPath,userCookie,nodeList)
### Get all node IPs; not working at the moment hence hardcoding IPs
#ixVMChassisIP = re.sub("//", "", nodeList[nodeList.index("IxVM")+1].split(":")[1])
#ixNWebIP = re.sub("//", "", nodeList[nodeList.index("IxWebUI")+1].split(":")[1])
kengController = "10.36.86.26"
### Run IxN test
print("Waiting 60s for all nodes to complete starting and ready to run test")
time.sleep(60)
Test_ebgp_route_prefix()
time.sleep(2)
userCookie = login(server, username, password)
stopAllNodes(server,labPath,userCookie)
print("Closing App")
quit()