test case fixes vlan mode and added more to allure reporting

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-06-19 00:31:58 +05:30
parent add764dd9e
commit dc7a6735b2
9 changed files with 283 additions and 228 deletions

View File

@@ -5,6 +5,8 @@
import sys
import os
import allure
sys.path.append(
os.path.dirname(
os.path.realpath(__file__)
@@ -59,6 +61,7 @@ class RunTest:
self.local_report_path = local_report_path
if not os.path.exists(self.local_report_path):
os.mkdir(self.local_report_path)
# self.staConnect = StaConnect2(self.lanforge_ip, self.lanforge_port, debug_=self.debug)
def Client_Connectivity(self, ssid="[BLANK]", passkey="[BLANK]", security="open", extra_securities=[],
station_name=[], mode="BRIDGE", vlan_id=1, band="twog"):
@@ -91,6 +94,19 @@ class RunTest:
self.staConnect.start()
print("napping %f sec" % self.staConnect.runtime_secs)
time.sleep(self.staConnect.runtime_secs)
for sta_name in self.staConnect.station_names:
try:
station_data_str = ""
sta_url = self.staConnect.get_station_url(sta_name)
station_info = self.staConnect.json_get(sta_url)
for i in station_info["interface"]:
try:
station_data_str = station_data_str + i + " : " + str(station_info["interface"][i]) + "\n"
except Exception as e:
print(e)
allure.attach(name=str(sta_name), body=str(station_data_str))
except Exception as e:
print(e)
self.staConnect.stop()
self.staConnect.cleanup()
run_results = self.staConnect.get_result_list()
@@ -155,7 +171,31 @@ class RunTest:
self.eap_connect.sta_list = station_name
self.eap_connect.build(extra_securities=extra_securities)
self.eap_connect.start(station_name, True, True)
for sta_name in station_name:
# try:
station_data_str = ""
# sta_url = self.eap_connect.get_station_url(sta_name)
# station_info = self.eap_connect.json_get(sta_url)
station_info = self.eap_connect.json_get("port/1/1/" + sta_name)
for i in station_info["interface"]:
try:
station_data_str = station_data_str + i + " : " + str(station_info["interface"][i]) + "\n"
except Exception as e:
print(e)
allure.attach(name=str(sta_name), body=str(station_data_str))
# except Exception as e:
# print(e)
self.eap_connect.stop()
endp_data = []
for i in self.eap_connect.resulting_endpoints:
endp_data.append(self.eap_connect.resulting_endpoints[i]["endpoint"])
cx_data = ""
for i in endp_data:
for j in i:
cx_data = cx_data + str(j) + " : " + str(i[j]) + "\n"
cx_data = cx_data + "\n"
allure.attach(name="cx_data", body=str(cx_data))
self.eap_connect.cleanup(station_name)
return self.eap_connect.passes()
@@ -259,8 +299,9 @@ class RunTest:
if __name__ == '__main__':
lanforge_data = {
"ip": "192.168.200.81",
"port": 8080,
"ip": "localhost",
"port": 8801,
"ssh_port": 22,
"2.4G-Radio": ["wiphy0"],
"5G-Radio": ["wiphy1"],
"AX-Radio": ["wiphy2"],
@@ -270,5 +311,7 @@ if __name__ == '__main__':
"AX-Station-Name": "ax",
}
obj = RunTest(lanforge_data=lanforge_data, debug=False)
# a = obj.staConnect.json_get("/events/since/")
# print(a)
# print(obj.eap_connect.json_get("port/1/1/sta0000?fields=ap,ip"))
# obj.EAP_Connect(station_name=["sta0000", "sta0001"], eap="TTLS", ssid="testing_radius")