mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 12:18:00 +00:00
Added wanlink testing and short sleep times to prevent unnecessary errors
This commit is contained in:
125
connectTest.py
125
connectTest.py
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if 'py-json' not in sys.path:
|
if 'py-json' not in sys.path:
|
||||||
sys.path.append('py-json')
|
sys.path.append('py-json')
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ from LANforge import LFUtils
|
|||||||
import create_genlink as genl
|
import create_genlink as genl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[0] != 3:
|
if sys.version_info[0] != 3:
|
||||||
print("This script requires Python 3")
|
print("This script requires Python 3")
|
||||||
exit()
|
exit()
|
||||||
@@ -63,11 +65,13 @@ def removeCX(mgrURL, cxNames):
|
|||||||
jsonReq(mgrURL,"cli-json/rm_cx", data)
|
jsonReq(mgrURL,"cli-json/rm_cx", data)
|
||||||
|
|
||||||
print("Creating endpoints and cross connects")
|
print("Creating endpoints and cross connects")
|
||||||
|
|
||||||
#create cx for tcp and udp
|
#create cx for tcp and udp
|
||||||
cmd = ("./lf_firemod.pl --action create_cx --cx_name testTCP --use_ports sta00000,eth1 --use_speeds 360000,150000 --endp_type tcp > /tmp/connectTest.log")
|
cmd = ("./lf_firemod.pl --action create_cx --cx_name testTCP --use_ports sta00000,eth1 --use_speeds 360000,150000 --endp_type tcp > /tmp/connectTest.log")
|
||||||
execWrap(cmd)
|
execWrap(cmd)
|
||||||
cmd = ("./lf_firemod.pl --action create_cx --cx_name testUDP --use_ports sta00000,eth1 --use_speeds 360000,150000 --endp_type udp >> /tmp/connectTest.log")
|
cmd = ("./lf_firemod.pl --action create_cx --cx_name testUDP --use_ports sta00000,eth1 --use_speeds 360000,150000 --endp_type udp >> /tmp/connectTest.log")
|
||||||
execWrap(cmd)
|
execWrap(cmd)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create l4 endpoint
|
#create l4 endpoint
|
||||||
url = "cli-json/add_l4_endp"
|
url = "cli-json/add_l4_endp"
|
||||||
@@ -83,6 +87,7 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonReq(mgrURL, url, data)
|
jsonReq(mgrURL, url, data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create cx for l4_endp
|
#create cx for l4_endp
|
||||||
url = "cli-json/add_cx"
|
url = "cli-json/add_cx"
|
||||||
@@ -94,6 +99,7 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonReq(mgrURL, url, data)
|
jsonReq(mgrURL, url, data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create fileio endpoint
|
#create fileio endpoint
|
||||||
url = "cli-json/add_file_endp"
|
url = "cli-json/add_file_endp"
|
||||||
@@ -107,6 +113,7 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonReq(mgrURL,url,data)
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create fileio cx
|
#create fileio cx
|
||||||
url = "cli-json/add_cx"
|
url = "cli-json/add_cx"
|
||||||
@@ -118,7 +125,7 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonReq(mgrURL,url,data)
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create generic endpoints
|
#create generic endpoints
|
||||||
genl.createGenEndp("genTest1",1,1,"sta00000","gen_generic")
|
genl.createGenEndp("genTest1",1,1,"sta00000","gen_generic")
|
||||||
@@ -127,7 +134,7 @@ genl.setFlags("genTest1","ClearPortOnStart",1)
|
|||||||
genl.setFlags("genTest2","ClearPortOnStart",1)
|
genl.setFlags("genTest2","ClearPortOnStart",1)
|
||||||
genl.setFlags("genTest2","Unmanaged",1)
|
genl.setFlags("genTest2","Unmanaged",1)
|
||||||
genl.setCmd("genTest1","lfping -i 0.1 -I sta00000 10.40.0.1")
|
genl.setCmd("genTest1","lfping -i 0.1 -I sta00000 10.40.0.1")
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
#create generic cx
|
#create generic cx
|
||||||
url = "cli-json/add_cx"
|
url = "cli-json/add_cx"
|
||||||
@@ -139,6 +146,90 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsonReq(mgrURL,url,data)
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
|
#create redirects for wanlink
|
||||||
|
url = "cli-json/add_rdd"
|
||||||
|
data = {
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd0",
|
||||||
|
"peer_ifname":"rdd1"
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
|
||||||
|
url = "cli-json/add_rdd"
|
||||||
|
data = {
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd1",
|
||||||
|
"peer_ifname":"rdd0"
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
|
#reset redirect ports
|
||||||
|
url = "cli-json/reset_port"
|
||||||
|
data = {
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd0"
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
|
||||||
|
url = "cli-json/reset_port"
|
||||||
|
data = {
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd1"
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
|
|
||||||
|
#create wanlink endpoints
|
||||||
|
url = "cli-json/add_wl_endp"
|
||||||
|
data = {
|
||||||
|
"alias":"wlTest1",
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd0",
|
||||||
|
"latency":20,
|
||||||
|
"max_rate":1544000
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
|
||||||
|
url = "cli-json/add_wl_endp"
|
||||||
|
data = {
|
||||||
|
"alias":"wlTest2",
|
||||||
|
"shelf":1,
|
||||||
|
"resource":1,
|
||||||
|
"port":"rdd1",
|
||||||
|
"latency":30,
|
||||||
|
"max_rate":1544000
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
|
#create wanlink cx
|
||||||
|
url = "cli-json/add_cx"
|
||||||
|
data = {
|
||||||
|
"alias":"CX_wlTest1",
|
||||||
|
"test_mgr":"default_tm",
|
||||||
|
"tx_endp":"wlTest1",
|
||||||
|
"rx_endp":"wlTest2"
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonReq(mgrURL,url,data)
|
||||||
|
time.sleep(.5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#get data before running traffic
|
#get data before running traffic
|
||||||
testTCPA = getJsonInfo(mgrURL, "endp/testTCP-A?fields=tx+bytes,rx+bytes", "testTCP-A")
|
testTCPA = getJsonInfo(mgrURL, "endp/testTCP-A?fields=tx+bytes,rx+bytes", "testTCP-A")
|
||||||
@@ -163,10 +254,17 @@ l4TestBR = l4Test['endpoint']['bytes-rd']
|
|||||||
genTest1 = getJsonInfo(mgrURL, "generic/genTest1?fields=last+results", "genTest1")
|
genTest1 = getJsonInfo(mgrURL, "generic/genTest1?fields=last+results", "genTest1")
|
||||||
genTest1LR = genTest1['endpoint']['last results']
|
genTest1LR = genTest1['endpoint']['last results']
|
||||||
|
|
||||||
|
wlTest1 = getJsonInfo(mgrURL,"wl_ep/wlTest1","wlTest1")
|
||||||
|
wlTest1TXB = wlTest1['endpoint']['tx bytes']
|
||||||
|
wlTest1RXP = wlTest1['endpoint']['rx pkts']
|
||||||
|
wlTest2 = getJsonInfo(mgrURL,"wl_ep/wlTest2","wlTest2")
|
||||||
|
wlTest2TXB = wlTest2['endpoint']['tx bytes']
|
||||||
|
wlTest2RXP = wlTest2['endpoint']['rx pkts']
|
||||||
|
|
||||||
|
|
||||||
#start cx traffic
|
#start cx traffic
|
||||||
print("\nStarting CX Traffic")
|
print("\nStarting CX Traffic")
|
||||||
cxNames = ["testTCP","testUDP", "CX_l4Test", "CX_fioTest", "CX_genTest1"]
|
cxNames = ["testTCP","testUDP", "CX_l4Test", "CX_fioTest", "CX_genTest1", "CX_wlTest1"]
|
||||||
for name in range(len(cxNames)):
|
for name in range(len(cxNames)):
|
||||||
cmd = (f"./lf_firemod.pl --mgr localhost --quiet yes --action do_cmd --cmd \"set_cx_state default_tm {cxNames[name]} RUNNING\" >> /tmp/connectTest.log")
|
cmd = (f"./lf_firemod.pl --mgr localhost --quiet yes --action do_cmd --cmd \"set_cx_state default_tm {cxNames[name]} RUNNING\" >> /tmp/connectTest.log")
|
||||||
execWrap(cmd)
|
execWrap(cmd)
|
||||||
@@ -174,7 +272,6 @@ for name in range(len(cxNames)):
|
|||||||
#print("Sleeping for 5 seconds")
|
#print("Sleeping for 5 seconds")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
#show tx and rx bytes for ports
|
#show tx and rx bytes for ports
|
||||||
"""
|
"""
|
||||||
print("eth1")
|
print("eth1")
|
||||||
@@ -242,6 +339,13 @@ pl4TestBR = pl4Test['endpoint']['bytes-rd']
|
|||||||
pgenTest1 = getJsonInfo(mgrURL, "generic/genTest1?fields=last+results", "genTest1")
|
pgenTest1 = getJsonInfo(mgrURL, "generic/genTest1?fields=last+results", "genTest1")
|
||||||
pgenTest1LR = pgenTest1['endpoint']['last results']
|
pgenTest1LR = pgenTest1['endpoint']['last results']
|
||||||
|
|
||||||
|
pwlTest1 = getJsonInfo(mgrURL,"wl_ep/wlTest1","wlTest1")
|
||||||
|
pwlTest1TXB = pwlTest1['endpoint']['tx bytes']
|
||||||
|
pwlTest1RXP = pwlTest1['endpoint']['rx pkts']
|
||||||
|
pwlTest2 = getJsonInfo(mgrURL,"wl_ep/wlTest2","wlTest2")
|
||||||
|
pwlTest2TXB = pwlTest2['endpoint']['tx bytes']
|
||||||
|
pwlTest2RXP = pwlTest2['endpoint']['rx pkts']
|
||||||
|
|
||||||
#print("Sleeping for 5 seconds")
|
#print("Sleeping for 5 seconds")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
@@ -272,12 +376,23 @@ compareVals("testUDP-B RX", testUDPBRX, ptestUDPBRX)
|
|||||||
compareVals("l4Test Bytes Read", l4TestBR, pl4TestBR)
|
compareVals("l4Test Bytes Read", l4TestBR, pl4TestBR)
|
||||||
|
|
||||||
compareVals("genTest1 Last Results", genTest1LR, pgenTest1LR)
|
compareVals("genTest1 Last Results", genTest1LR, pgenTest1LR)
|
||||||
|
|
||||||
|
compareVals("wlTest1 TX Bytes", wlTest1TXB, pwlTest1TXB)
|
||||||
|
compareVals("wlTest1 RX Pkts", wlTest1RXP, pwlTest1RXP)
|
||||||
|
|
||||||
|
compareVals("wlTest2 TX Bytes", wlTest2TXB, pwlTest2TXB)
|
||||||
|
compareVals("wlTest2 RX Pkts", wlTest2RXP, pwlTest2RXP)
|
||||||
|
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#remove all endpoints and cxs
|
#remove all endpoints and cxs
|
||||||
print("Cleaning up...")
|
print("Cleaning up...")
|
||||||
endpNames = ["testTCP-A", "testTCP-B", "testUDP-A", "testUDP-B", "l4Test", "fioTest", "genTest1", "genTest2"]
|
endpNames = ["testTCP-A", "testTCP-B",
|
||||||
|
"testUDP-A", "testUDP-B",
|
||||||
|
"l4Test", "fioTest",
|
||||||
|
"genTest1", "genTest2",
|
||||||
|
"wlTest1","wlTest2"]
|
||||||
removeCX(mgrURL, cxNames)
|
removeCX(mgrURL, cxNames)
|
||||||
removeEndps(mgrURL, endpNames)
|
removeEndps(mgrURL, endpNames)
|
||||||
|
|||||||
Reference in New Issue
Block a user