mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
Changed station_profile to work with changes in realm, refactored cleanup methods
This commit is contained in:
@@ -42,7 +42,7 @@ class IPV4L4(LFCliBase):
|
||||
self.profile = realm.StationProfile(self.lfclient_url, ssid=self.ssid, ssid_pass=self.password,
|
||||
security=self.security, number_template_=self.prefix, mode=0, up=False,
|
||||
dhcp=True,
|
||||
debug_=False)
|
||||
debug_=False, local_realm=self.local_realm)
|
||||
self.cx_profile = realm.L4CXProfile(lfclient_host=self.host, lfclient_port=self.port,
|
||||
local_realm=self.local_realm, debug_=False)
|
||||
self.cx_profile.url = self.url
|
||||
@@ -68,7 +68,7 @@ class IPV4L4(LFCliBase):
|
||||
expected_passes += 1
|
||||
if new_list[item] > old_list[item]:
|
||||
passes += 1
|
||||
# print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||
#print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||
|
||||
if passes == expected_passes:
|
||||
return True
|
||||
@@ -111,7 +111,7 @@ class IPV4L4(LFCliBase):
|
||||
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
||||
self.profile.admin_up(1)
|
||||
self.local_realm.wait_for_ip()
|
||||
self.__set_all_cx_state("RUNNING")
|
||||
self.cx_profile.start_cx()
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
while cur_time < end_time:
|
||||
@@ -144,48 +144,9 @@ class IPV4L4(LFCliBase):
|
||||
url = "json-cli/set_port"
|
||||
self.json_post(url, data)
|
||||
|
||||
def cleanup(self):
|
||||
layer4_list = self.json_get("layer4/list?fields=name")
|
||||
print(layer4_list)
|
||||
|
||||
if layer4_list is not None and 'endpoint' in layer4_list:
|
||||
if layer4_list['endpoint'] is not None:
|
||||
|
||||
for name in self.sta_list:
|
||||
req_url = "cli-json/rm_cx"
|
||||
data = {
|
||||
"test_mgr": "default_tm",
|
||||
"cx_name": "CX_" + name + "_l4"
|
||||
}
|
||||
self.json_post(req_url, data, True)
|
||||
|
||||
time.sleep(5)
|
||||
for endps in list(layer4_list['endpoint']):
|
||||
for name, info in endps.items():
|
||||
print(name)
|
||||
|
||||
req_url = "cli-json/rm_endp"
|
||||
data = {
|
||||
"endp_name": name
|
||||
}
|
||||
self.json_post(req_url, data, True)
|
||||
|
||||
port_list = self.local_realm.station_list()
|
||||
sta_list = []
|
||||
for item in list(port_list):
|
||||
# print(list(item))
|
||||
if "sta" in list(item)[0]:
|
||||
sta_list.append(self.local_realm.name_to_eid(list(item)[0])[2])
|
||||
|
||||
for sta_name in sta_list:
|
||||
req_url = "cli-json/rm_vlan"
|
||||
data = {
|
||||
"shelf": 1,
|
||||
"resource": self.resource,
|
||||
"port": sta_name
|
||||
}
|
||||
self.json_post(req_url, data, self.debug)
|
||||
time.sleep(.05)
|
||||
def cleanup(self, sta_list):
|
||||
self.profile.cleanup(self.resource, sta_list)
|
||||
self.cx_profile.cleanup()
|
||||
LFUtils.wait_until_ports_disappear(resource_id=self.resource, base_url=self.lfclient_url, port_list=sta_list,
|
||||
debug=self.debug)
|
||||
|
||||
@@ -193,11 +154,11 @@ class IPV4L4(LFCliBase):
|
||||
def main():
|
||||
lfjson_host = "localhost"
|
||||
lfjson_port = 8080
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=9, padding_number_=10000)
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=1, padding_number_=10000)
|
||||
ip_test = IPV4L4(lfjson_host, lfjson_port, ssid="jedway-wpa2-x2048-4-4", password="jedway-wpa2-x2048-4-4",
|
||||
security="open", station_list=station_list, url="dl http://10.40.0.1 /dev/null", test_duration="5m",
|
||||
requests_per_ten=600)
|
||||
ip_test.cleanup()
|
||||
ip_test.cleanup(station_list)
|
||||
ip_test.build()
|
||||
if not ip_test.passes():
|
||||
print(ip_test.get_fail_message())
|
||||
@@ -208,7 +169,7 @@ def main():
|
||||
print(ip_test.get_fail_message())
|
||||
exit(1)
|
||||
time.sleep(30)
|
||||
ip_test.cleanup()
|
||||
ip_test.cleanup(station_list)
|
||||
if ip_test.passes():
|
||||
print("Full test passed, all endpoints had increased bytes-rd throughout test duration")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user