mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
Added init parameters for min/max rates, added check for cx_list not equal to None
This commit is contained in:
@@ -18,7 +18,8 @@ import datetime
|
|||||||
|
|
||||||
|
|
||||||
class IPV4VariableTime(LFCliBase):
|
class IPV4VariableTime(LFCliBase):
|
||||||
def __init__(self, host, port, ssid, security, password, num_stations, prefix="00000", test_duration="5m",
|
def __init__(self, host, port, ssid, security, password, num_stations, side_a_min_rate=56, side_b_min_rate=56, side_a_max_rate=0,
|
||||||
|
side_b_max_rate=0, prefix="00000", test_duration="5m",
|
||||||
_debug_on=False,
|
_debug_on=False,
|
||||||
_exit_on_error=False,
|
_exit_on_error=False,
|
||||||
_exit_on_fail=False):
|
_exit_on_fail=False):
|
||||||
@@ -35,7 +36,9 @@ class IPV4VariableTime(LFCliBase):
|
|||||||
security=self.security, prefix=self.prefix, mode=0, up=True,
|
security=self.security, prefix=self.prefix, mode=0, up=True,
|
||||||
dhcp=True,
|
dhcp=True,
|
||||||
debug_=False)
|
debug_=False)
|
||||||
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
self.cx_profile = realm.L3CXProfile(self.host, self.port, self.local_realm, side_a_min_rate=side_a_min_rate,
|
||||||
|
side_b_min_rate=side_b_min_rate, side_a_max_rate=side_a_max_rate,
|
||||||
|
side_b_max_rate=side_b_max_rate, debug_=False)
|
||||||
self.test_duration = test_duration
|
self.test_duration = test_duration
|
||||||
|
|
||||||
def __set_all_cx_state(self, state, sleep_time=5):
|
def __set_all_cx_state(self, state, sleep_time=5):
|
||||||
@@ -43,16 +46,16 @@ class IPV4VariableTime(LFCliBase):
|
|||||||
cx_list = list(self.local_realm.cx_list())
|
cx_list = list(self.local_realm.cx_list())
|
||||||
for cx_name in cx_list:
|
for cx_name in cx_list:
|
||||||
if cx_name != 'handler' or cx_name != 'uri':
|
if cx_name != 'handler' or cx_name != 'uri':
|
||||||
req_url = "cli-json/set_cx_state"
|
req_url = "cli-json/set_cx_state"
|
||||||
data = {
|
data = {
|
||||||
"test_mgr": "default_tm",
|
"test_mgr": "default_tm",
|
||||||
"cx_name": cx_name,
|
"cx_name": cx_name,
|
||||||
"cx_state": state
|
"cx_state": state
|
||||||
}
|
}
|
||||||
|
|
||||||
super().json_post(req_url, data)
|
super().json_post(req_url, data)
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
cur_time = datetime.datetime.now()
|
cur_time = datetime.datetime.now()
|
||||||
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
||||||
@@ -84,15 +87,16 @@ class IPV4VariableTime(LFCliBase):
|
|||||||
super().json_post(req_url, data)
|
super().json_post(req_url, data)
|
||||||
|
|
||||||
cx_list = list(self.local_realm.cx_list())
|
cx_list = list(self.local_realm.cx_list())
|
||||||
print("Cleaning up cxs")
|
if cx_list is not None:
|
||||||
for cx_name in cx_list:
|
print("Cleaning up cxs")
|
||||||
if cx_name != 'handler' or cx_name != 'uri':
|
for cx_name in cx_list:
|
||||||
req_url = "cli-json/rm_cx"
|
if cx_name != 'handler' or cx_name != 'uri':
|
||||||
data = {
|
req_url = "cli-json/rm_cx"
|
||||||
"test_mgr": "default_tm",
|
data = {
|
||||||
"cx_name": cx_name
|
"test_mgr": "default_tm",
|
||||||
}
|
"cx_name": cx_name
|
||||||
super().json_post(req_url, data)
|
}
|
||||||
|
super().json_post(req_url, data)
|
||||||
|
|
||||||
print("Cleaning up endps")
|
print("Cleaning up endps")
|
||||||
endp_list = super().json_get("/endp")
|
endp_list = super().json_get("/endp")
|
||||||
@@ -107,9 +111,6 @@ class IPV4VariableTime(LFCliBase):
|
|||||||
super().json_post(req_url, data)
|
super().json_post(req_url, data)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
super().clear_test_results()
|
|
||||||
print("Cleaning up old stations")
|
|
||||||
self.cleanup()
|
|
||||||
sta_list = []
|
sta_list = []
|
||||||
|
|
||||||
self.station_profile.use_wpa2(True, self.ssid, self.password)
|
self.station_profile.use_wpa2(True, self.ssid, self.password)
|
||||||
@@ -130,10 +131,14 @@ def main():
|
|||||||
lfjson_port = 8080
|
lfjson_port = 8080
|
||||||
ip_var_test = IPV4VariableTime(lfjson_host, lfjson_port, prefix="00", ssid="jedway-wpa2-x2048-4-4",
|
ip_var_test = IPV4VariableTime(lfjson_host, lfjson_port, prefix="00", ssid="jedway-wpa2-x2048-4-4",
|
||||||
password="jedway-wpa2-x2048-4-4",
|
password="jedway-wpa2-x2048-4-4",
|
||||||
security="open", num_stations=10, test_duration="1m")
|
security="open", num_stations=10, test_duration="4m",
|
||||||
ip_var_test.run()
|
side_a_min_rate=256, side_b_min_rate=256)
|
||||||
ip_var_test.run_test()
|
|
||||||
ip_var_test.cleanup()
|
ip_var_test.cleanup()
|
||||||
|
ip_var_test.run()
|
||||||
|
print(ip_var_test.cx_profile.created_cx)
|
||||||
|
time.sleep(5)
|
||||||
|
ip_var_test.run_test()
|
||||||
|
#ip_var_test.cleanup()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user