Merge remote-tracking branch 'origin/master'

This commit is contained in:
Logan Lipke
2020-07-14 17:49:19 -07:00
3 changed files with 21 additions and 15 deletions

View File

@@ -159,7 +159,7 @@ def portDownRequest(resource_id, port_name, debug_on=False):
:param port_name: :param port_name:
:return: :return:
""" """
print("portDownRequest")
data = { data = {
"shelf": 1, "shelf": 1,
"resource": resource_id, "resource": resource_id,
@@ -169,6 +169,7 @@ def portDownRequest(resource_id, port_name, debug_on=False):
"report_timer": REPORT_TIMER_MS_FAST, "report_timer": REPORT_TIMER_MS_FAST,
} }
if (debug_on): if (debug_on):
print("Port down request")
debug_printer.pprint(data) debug_printer.pprint(data)
return data return data

View File

@@ -595,7 +595,7 @@ class L3CXProfile(LFCliBase):
else: else:
raise ValueError("side_a or side_b must be of type list but not both: side_a is type %s side_b is type %s" % (type(side_a), type(side_b))) raise ValueError("side_a or side_b must be of type list but not both: side_a is type %s side_b is type %s" % (type(side_a), type(side_b)))
print("post_data", cx_post_data) #print("post_data", cx_post_data)
for data in cx_post_data: for data in cx_post_data:
url = "/cli-json/add_cx" url = "/cli-json/add_cx"
self.local_realm.json_post(url, data, debug_=debug_, suppress_related_commands_=suppress_related_commands) self.local_realm.json_post(url, data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
@@ -770,7 +770,7 @@ class WifiMonitor:
self.monitor_name = None self.monitor_name = None
self.resource = resource_ self.resource = resource_
self.flag_names = [] self.flag_names = []
self.flag_mask_names = [] self.flag_masgitk_names = []
self.flags_mask = add_monitor.default_flags_mask self.flags_mask = add_monitor.default_flags_mask
self.aid = "NA" # used when sniffing /ax radios self.aid = "NA" # used when sniffing /ax radios
self.bsssid = "00:00:00:00:00:00" # used when sniffing on /ax radios self.bsssid = "00:00:00:00:00:00" # used when sniffing on /ax radios
@@ -951,8 +951,10 @@ class StationProfile:
return return
if (value == 1) and (param_name not in self.desired_add_sta_flags): if (value == 1) and (param_name not in self.desired_add_sta_flags):
self.desired_add_sta_flags.append(param_name) self.desired_add_sta_flags.append(param_name)
self.desired_add_sta_flags_mask.append(param_name)
elif value == 0: elif value == 0:
self.desired_add_sta_flags.remove(param_name) self.desired_add_sta_flags.remove(param_name)
self.desired_add_sta_flags_mask.append(param_name)
elif command_name == "set_port": elif command_name == "set_port":
if (param_name not in set_port.set_port_current_flags) and (param_name not in set_port.set_port_cmd_flags) and (param_name not in set_port.set_port_interest_flags): if (param_name not in set_port.set_port_current_flags) and (param_name not in set_port.set_port_cmd_flags) and (param_name not in set_port.set_port_interest_flags):

View File

@@ -52,13 +52,13 @@ 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.new_monitor = realm.WifiMonitor(self.lfclient_url, self.local_realm,debug_= _debug_on)
def build(self): def build(self):
self.station_profile.use_security("open", self.ssid, passwd=None) self.station_profile.use_security("open", ssid=self.ssid, passwd=self.password)
self.station_profile.set_number_template(self.prefix) self.station_profile.set_number_template(self.prefix)
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1) self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
self.station_profile.set_command_param("set_port", "report_timer", 1500) self.station_profile.set_command_param("set_port", "report_timer", 1500)
@@ -67,10 +67,8 @@ class L3PowersaveTraffic(LFCliBase):
#channel = self.json_get("/port/1/%s/%s/"%(1,"wiphy0")) #channel = self.json_get("/port/1/%s/%s/"%(1,"wiphy0"))
#rint("The channel name is...") #rint("The channel name is...")
#pprint.pprint(channel) self.new_monitor.create(resource_=1, channel=157, radio_= "wiphy1", name_="moni0")
self.newMonitor.create(resource_=1, channel=157, radio_= "wiphy1", name_="moni0") 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=True)
exit(1)
# station_channel = self.json_get("/port/1/%s/%s") # station_channel = self.json_get("/port/1/%s/%s")
# pprint.pprint(station_channel) # pprint.pprint(station_channel)
@@ -123,11 +121,16 @@ class L3PowersaveTraffic(LFCliBase):
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 #admin up on new monitor
self.newMonitor.admin_up() self.new_monitor.admin_up()
self.newMonitor.start_sniff("/home/lanforge/Documents/out2.cap") now = datetime.datetime.now()
date_time = now.strftime("%Y-%m-%d-%H%M%S")
curr_mon_name = self.new_monitor.monitor_name
#("date and time: ",date_time)
self.new_monitor.start_sniff("/home/lanforge/Documents/"+curr_mon_name+"-"+date_time+".cap")
#admin up on station #admin up on station
self.station_profile.admin_up(resource=1) self.station_profile.admin_up(resource=1)
#self.newMonitor.set_flag() #self.new_monitor.set_flag()
self.__set_all_cx_state("RUNNING") self.__set_all_cx_state("RUNNING")
while cur_time < end_time: while cur_time < end_time:
@@ -140,7 +143,7 @@ class L3PowersaveTraffic(LFCliBase):
def stop(self): def stop(self):
#switch off new monitor #switch off new monitor
self.newMonitor.admin_down() self.new_monitor.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)
@@ -149,7 +152,7 @@ class L3PowersaveTraffic(LFCliBase):
def cleanup(self): def cleanup(self):
self.newMonitor.cleanup() self.new_monitor.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)
@@ -172,6 +175,6 @@ def main():
ip_powersave_test.cleanup() ip_powersave_test.cleanup()
if __name__ == "__main__": if __name__ == "__main__":
#main(sys.argv[1:])
main() main()