mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
added monitor -WIP
This commit is contained in:
@@ -32,6 +32,7 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
self.password = password
|
self.password = password
|
||||||
self.sta_list = station_list
|
self.sta_list = station_list
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
self.debug = _debug_on
|
||||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port, debug_=False, halt_on_error_=True)
|
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port, debug_=False, halt_on_error_=True)
|
||||||
#upload
|
#upload
|
||||||
self.cx_prof_upload = realm.L3CXProfile(self.host, self.port, self.local_realm,
|
self.cx_prof_upload = realm.L3CXProfile(self.host, self.port, self.local_realm,
|
||||||
@@ -51,6 +52,7 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
security=self.security, number_template_=self.prefix, mode=0, up=True,
|
security=self.security, number_template_=self.prefix, mode=0, up=True,
|
||||||
dhcp=True,
|
dhcp=True,
|
||||||
debug_=False)
|
debug_=False)
|
||||||
|
self.newMonitor = realm.WifiMonitor(self.lfclient_url, self.local_realm,debug_= _debug_on)
|
||||||
self.station_profile.admin_up(resource=1)
|
self.station_profile.admin_up(resource=1)
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +67,7 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
self.station_profile.set_command_flag("add_sta", "power_save_enable", 1)
|
self.station_profile.set_command_flag("add_sta", "power_save_enable", 1)
|
||||||
|
|
||||||
self.station_profile.create(resource=1, radio="wiphy0", sta_names_=self.sta_list, debug=False)
|
self.station_profile.create(resource=1, radio="wiphy0", sta_names_=self.sta_list, debug=False)
|
||||||
|
self.newMonitor.create(resource_=1, radio_= "wiphy1", name_="moni_powersave")
|
||||||
|
|
||||||
self._pass("PASS: Station builds finished")
|
self._pass("PASS: Station builds finished")
|
||||||
temp_sta_list = []
|
temp_sta_list = []
|
||||||
@@ -81,6 +84,7 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
self.cx_prof_download.create(endp_type="lf_udp", side_a=temp_sta_list, side_b="1.eth1", sleep_time=.05)
|
self.cx_prof_download.create(endp_type="lf_udp", side_a=temp_sta_list, side_b="1.eth1", sleep_time=.05)
|
||||||
|
|
||||||
def __set_all_cx_state(self, state, sleep_time=5):
|
def __set_all_cx_state(self, state, sleep_time=5):
|
||||||
|
|
||||||
print("Setting CX States to %s" % state)
|
print("Setting CX States to %s" % state)
|
||||||
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:
|
||||||
@@ -112,6 +116,8 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
#start second test, measure
|
#start second test, measure
|
||||||
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
|
||||||
|
#admin up on new monitor
|
||||||
|
self.newMonitor.admin_up()
|
||||||
self.__set_all_cx_state("RUNNING")
|
self.__set_all_cx_state("RUNNING")
|
||||||
|
|
||||||
while cur_time < end_time:
|
while cur_time < end_time:
|
||||||
@@ -123,6 +129,8 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
#switch off new monitor
|
||||||
|
self.newMonitor.admin_down()
|
||||||
self.__set_all_cx_state("STOPPED")
|
self.__set_all_cx_state("STOPPED")
|
||||||
for sta_name in self.sta_list:
|
for sta_name in self.sta_list:
|
||||||
data = LFUtils.portDownRequest(1, sta_name)
|
data = LFUtils.portDownRequest(1, sta_name)
|
||||||
@@ -131,10 +139,12 @@ class L3PowersaveTraffic(LFCliBase):
|
|||||||
|
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
self.newMonitor.cleanup()
|
||||||
self.cx_prof_download.cleanup()
|
self.cx_prof_download.cleanup()
|
||||||
self.cx_prof_upload.cleanup()
|
self.cx_prof_upload.cleanup()
|
||||||
self.station_profile.cleanup(resource=1,desired_stations=self.sta_list)
|
self.station_profile.cleanup(resource=1,desired_stations=self.sta_list)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
lfjson_host = "localhost"
|
lfjson_host = "localhost"
|
||||||
|
|||||||
Reference in New Issue
Block a user