mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
test_l3_longevity.py - adding multi cast
This commit is contained in:
225
py-json/realm.py
225
py-json/realm.py
@@ -448,6 +448,11 @@ class Realm(LFCliBase):
|
|||||||
def new_station_profile(self):
|
def new_station_profile(self):
|
||||||
station_prof = StationProfile(self.lfclient_url, local_realm=self, debug_=self.debug, up=False)
|
station_prof = StationProfile(self.lfclient_url, local_realm=self, debug_=self.debug, up=False)
|
||||||
return station_prof
|
return station_prof
|
||||||
|
# just here for now for initial coding, move later to correct spot
|
||||||
|
def new_multicast_profile(self):
|
||||||
|
multi_prof = MULTICASTProfile(self.lfclient_host, self.lfclient_port, \
|
||||||
|
local_realm=self, debug_=self.debug, report_timer_=3000)
|
||||||
|
return multi_prof
|
||||||
|
|
||||||
def new_wifi_monitor_profile(self, resource_=1, debug_=False, up_=False):
|
def new_wifi_monitor_profile(self, resource_=1, debug_=False, up_=False):
|
||||||
wifi_mon_prof = WifiMonitor(self.lfclient_url,
|
wifi_mon_prof = WifiMonitor(self.lfclient_url,
|
||||||
@@ -473,7 +478,225 @@ class Realm(LFCliBase):
|
|||||||
cx_prof = GenCXProfile(self.lfclient_host, self.lfclient_port,local_realm=self, debug_=self.debug)
|
cx_prof = GenCXProfile(self.lfclient_host, self.lfclient_port,local_realm=self, debug_=self.debug)
|
||||||
return cx_prof
|
return cx_prof
|
||||||
|
|
||||||
|
class MULTICASTProfile(LFCliBase):
|
||||||
|
def __init__(self, lfclient_host, lfclient_port, local_realm,
|
||||||
|
side_a_min_bps=None, side_b_min_bps=None,
|
||||||
|
side_a_max_bps=0, side_b_max_bps=0,
|
||||||
|
side_a_min_pdu=-1, side_b_min_pdu=-1,
|
||||||
|
side_a_max_pdu=0, side_b_max_pdu=0,
|
||||||
|
report_timer_=3000, name_prefix_="Unset", number_template_="00000", debug_=False):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param lfclient_host:
|
||||||
|
:param lfclient_port:
|
||||||
|
:param local_realm:
|
||||||
|
:param side_a_min_bps:
|
||||||
|
:param side_b_min_bps:
|
||||||
|
:param side_a_max_bps:
|
||||||
|
:param side_b_max_bps:
|
||||||
|
:param side_a_min_pdu:
|
||||||
|
:param side_b_min_pdu:
|
||||||
|
:param side_a_max_pdu:
|
||||||
|
:param side_b_max_pdu:
|
||||||
|
:param name_prefix: prefix string for connection
|
||||||
|
:param number_template_: how many zeros wide we padd, possibly a starting integer with left padding
|
||||||
|
:param debug_:
|
||||||
|
"""
|
||||||
|
super().__init__(lfclient_host, lfclient_port, debug_, _halt_on_error=True)
|
||||||
|
self.lfclient_url = "http://%s:%s" % (lfclient_host, lfclient_port)
|
||||||
|
self.debug = debug_
|
||||||
|
self.local_realm = local_realm
|
||||||
|
self.side_a_min_pdu = side_a_min_pdu
|
||||||
|
self.side_b_min_pdu = side_b_min_pdu
|
||||||
|
self.side_a_max_pdu = side_a_max_pdu
|
||||||
|
self.side_b_max_pdu = side_b_max_pdu
|
||||||
|
self.side_a_min_bps = side_a_min_bps
|
||||||
|
self.side_b_min_bps = side_b_min_bps
|
||||||
|
self.side_a_max_bps = side_a_max_bps
|
||||||
|
self.side_b_max_bps = side_b_max_bps
|
||||||
|
self.report_timer = report_timer_
|
||||||
|
self.created_mc = {}
|
||||||
|
self.name_prefix = name_prefix_
|
||||||
|
self.number_template = number_template_
|
||||||
|
|
||||||
|
def get_mc_names(self):
|
||||||
|
return self.created_mc.keys()
|
||||||
|
|
||||||
|
def refresh_mc(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def start_mc_tx(self, side_b, suppress_related_commands=None, debug_ = False ):
|
||||||
|
if self.debug:
|
||||||
|
debut_=True
|
||||||
|
|
||||||
|
print("starting mc_tx")
|
||||||
|
# hard code for now
|
||||||
|
endp_name = 'mcast-xmit-sta'
|
||||||
|
|
||||||
|
#start the trasmitter probably should be in start
|
||||||
|
json_data = {
|
||||||
|
"endp_name":endp_name,
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "cli-json/start_endp"
|
||||||
|
self.local_realm.json_post(url, json_data)
|
||||||
|
|
||||||
|
|
||||||
|
def start_mc_rx(self,side_a, suppress_related_commands=None, debug_ = False):
|
||||||
|
if self.debug:
|
||||||
|
debug_=True
|
||||||
|
|
||||||
|
for port_name in side_a:
|
||||||
|
side_a_info = self.local_realm.name_to_eid(port_name)
|
||||||
|
side_a_resource = side_a_info[2]
|
||||||
|
side_a_name = "%s%s"%(self.name_prefix, side_a_info[2])
|
||||||
|
|
||||||
|
json_data = {
|
||||||
|
"endp_name":side_a_resource
|
||||||
|
}
|
||||||
|
url = "cli-json/start_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stop_mc(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def create_mc_tx(self, side_b, suppress_related_commands=None, debug_ = False ):
|
||||||
|
if self.debug:
|
||||||
|
debug_=True
|
||||||
|
|
||||||
|
json_data = []
|
||||||
|
|
||||||
|
# need to eventually us this
|
||||||
|
#mc_tx_name = "%s%s" % (self.name_prefix, side_b)
|
||||||
|
|
||||||
|
# hard code for now
|
||||||
|
endp_name = 'mcast-xmit-sta'
|
||||||
|
# add end point
|
||||||
|
#add_endp mcast-xmit-sta 1 1 eth1 mc_udp -1 NO 4000000 0 NO 1472 0 INCREASING NO 32 0 0
|
||||||
|
json_data = {
|
||||||
|
'alias':endp_name,
|
||||||
|
'shelf':1,
|
||||||
|
'resource':1,
|
||||||
|
'port':side_b,
|
||||||
|
'type':'mc_udp',
|
||||||
|
'ip_port':-1,
|
||||||
|
'is_rate_bursty':
|
||||||
|
'NO','min_rate':4000000,
|
||||||
|
'max_rate':0,
|
||||||
|
'is_pkt_sz_random':'NO',
|
||||||
|
'min_pkt':1472,
|
||||||
|
'max_pkt':0,
|
||||||
|
'payload_pattern':'INCREASING',
|
||||||
|
'use_checksum':'NO',
|
||||||
|
'ttl':32,
|
||||||
|
'send_bad_crc_per_million':0,
|
||||||
|
'multi_conn':0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
url = "/cli-json/add_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
|
||||||
|
#set_endp_addr mcast-xmit-sta '0c c4 7a e1 ff b1 ' AUTO 0 0
|
||||||
|
json_data = {
|
||||||
|
'name':endp_name,
|
||||||
|
"mac":"xx:xx:xx:xx:*:xx", #'mac':'0c:c4:7a:e1:ff:b1'
|
||||||
|
'ip':'AUTO',
|
||||||
|
'min_port':0,
|
||||||
|
'max_port':0
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "cli-json/set_endp_addr"
|
||||||
|
#self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
#set_mc_endp mcast-xmit-sta 32 224.9.9.9 9999 No # critical
|
||||||
|
json_data = {
|
||||||
|
'name':endp_name,
|
||||||
|
'ttl':32,'mcast_group':'224.9.9.9',
|
||||||
|
'mcast_dest_port':9999,
|
||||||
|
'rcv_mcast':'No'
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "cli-json/set_mc_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def create_mc_rx(self,side_a, suppress_related_commands=None, debug_ = False):
|
||||||
|
if self.debug:
|
||||||
|
debug_=True
|
||||||
|
|
||||||
|
for port_name in side_a:
|
||||||
|
side_a_info = self.local_realm.name_to_eid(port_name)
|
||||||
|
side_a_shelf = side_a_info[1]
|
||||||
|
side_a_resource = side_a_info[2]
|
||||||
|
side_a_name = "%s%s"%(self.name_prefix, side_a_info[2])
|
||||||
|
# add_endp mcast-rcv-sta-001 1 1 sta0002 mc_udp 9999 NO 0 0 NO 1472 0 INCREASING NO 32 0 0
|
||||||
|
json_data = {
|
||||||
|
'alias':side_a_resource,
|
||||||
|
'shelf':side_a_shelf,
|
||||||
|
'resource':1,
|
||||||
|
'port':side_a_resource,
|
||||||
|
'type':'mc_udp',
|
||||||
|
'ip_port':9999,
|
||||||
|
'is_rate_bursty':
|
||||||
|
'NO','min_rate':0,
|
||||||
|
'max_rate':0,
|
||||||
|
'is_pkt_sz_random':'NO',
|
||||||
|
'min_pkt':1472,
|
||||||
|
'max_pkt':0,
|
||||||
|
'payload_pattern':'INCREASING',
|
||||||
|
'use_checksum':'NO',
|
||||||
|
'ttl':32,
|
||||||
|
'send_bad_crc_per_million':0,
|
||||||
|
'multi_conn':0
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "cli-json/add_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
#set_endp_addr mcast-rcv-sta-001 '00 0e 8e 5b 9d 44 ' AUTO 9999 0
|
||||||
|
#json_data = {
|
||||||
|
# 'name':side_a_resource,
|
||||||
|
# 'mac':'xx:xx:xx:xx:*:xx',
|
||||||
|
# 'ip':'AUTO',
|
||||||
|
# 'min_port':9999,
|
||||||
|
# 'max_port':0
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
#url = "cli-json/set_endp_addr"
|
||||||
|
#self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
# set_mc_endp mcast-rcv-sta-001 32 224.9.9.9 9999 Yes
|
||||||
|
json_data = {
|
||||||
|
'name':side_a_resource,
|
||||||
|
'ttl':32,
|
||||||
|
'mcast_group':'224.9.9.9',
|
||||||
|
'mcast_dest_port':9999,
|
||||||
|
'rcv_mcast':'Yes'
|
||||||
|
}
|
||||||
|
url = "cli-json/set_mc_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
|
||||||
|
'''json_data = {
|
||||||
|
"endp_name":side_a_resource
|
||||||
|
}
|
||||||
|
url = "cli-json/start_endp"
|
||||||
|
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||||
|
'''
|
||||||
|
|
||||||
|
def to_string(self):
|
||||||
|
pprint.pprint(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class L3CXProfile(LFCliBase):
|
class L3CXProfile(LFCliBase):
|
||||||
def __init__(self, lfclient_host, lfclient_port, local_realm,
|
def __init__(self, lfclient_host, lfclient_port, local_realm,
|
||||||
side_a_min_bps=None, side_b_min_bps=None,
|
side_a_min_bps=None, side_b_min_bps=None,
|
||||||
@@ -1397,7 +1620,7 @@ class StationProfile:
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
set_port_r.addPostData(self.set_port_data)
|
set_port_r.addPostData(self.set_port_data)
|
||||||
json_response = set_port_r.jsonPost(debug)
|
json_response = set_port_r.jsonPost(debug)
|
||||||
time.sleep(.03)
|
time.sleep(0.03)
|
||||||
|
|
||||||
LFUtils.waitUntilPortsAppear(resource, self.lfclient_url, self.station_names)
|
LFUtils.waitUntilPortsAppear(resource, self.lfclient_url, self.station_names)
|
||||||
|
|
||||||
|
|||||||
@@ -17,19 +17,38 @@ import realm
|
|||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
#The valid ways to have multiple TX would be if they were on different ports.
|
||||||
|
# I don't think that we need to add that complexity for now.
|
||||||
|
|
||||||
|
#In fact, it occurs to me that a multicast TX profile might actually already
|
||||||
|
# know the right amount of information from which to generate it's RX endpoints
|
||||||
|
|
||||||
|
#So if we create a TX endpoint, it has a multicast ip and port.
|
||||||
|
# Those two pieces of information are also useful for creating RXes.
|
||||||
|
# I suggest one profile class.
|
||||||
|
|
||||||
|
|
||||||
|
#multicast_profile.createTx(port) and multicast_profile.createRX(port_list)
|
||||||
|
|
||||||
|
#the ports have no knowledge of the protocols they will interact with,
|
||||||
|
#the ports are layer-1 devices with some layer2 and layer3 features (mac addresses, IP addresses)
|
||||||
|
#so anything you can legally assign an IP to can take a Layer3 connection or better
|
||||||
|
|
||||||
|
|
||||||
class L3VariableTimeLongevity(LFCliBase):
|
class L3VariableTimeLongevity(LFCliBase):
|
||||||
def __init__(self, host, port, endp_type, side_b, radios, radio_name_list, number_of_stations_per_radio_list,
|
def __init__(self, host, port, endp_type, is_multicast, side_b, radios, radio_name_list, number_of_stations_per_radio_list,
|
||||||
ssid_list, ssid_password_list, security, station_lists, name_prefix, resource=1,
|
ssid_list, ssid_password_list, security, station_lists, name_prefix, resource=1,
|
||||||
side_a_min_rate=56, side_a_max_rate=0,
|
side_a_min_rate=56000, side_a_max_rate=0,
|
||||||
side_b_min_rate=56, side_b_max_rate=0,
|
side_b_min_rate=56000, side_b_max_rate=0,
|
||||||
number_template="00", test_duration="256s",
|
number_template="00", test_duration="256s",
|
||||||
_debug_on=False,
|
_debug_on=True,
|
||||||
_exit_on_error=False,
|
_exit_on_error=False,
|
||||||
_exit_on_fail=False):
|
_exit_on_fail=False):
|
||||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.endp_type = endp_type
|
self.endp_type = endp_type
|
||||||
|
self.is_multicast = is_multicast
|
||||||
self.side_b = side_b
|
self.side_b = side_b
|
||||||
self.ssid_list = ssid_list
|
self.ssid_list = ssid_list
|
||||||
self.ssid_password_list = ssid_password_list
|
self.ssid_password_list = ssid_password_list
|
||||||
@@ -45,8 +64,9 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
self.number_of_stations_per_radio_list = number_of_stations_per_radio_list
|
self.number_of_stations_per_radio_list = number_of_stations_per_radio_list
|
||||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
||||||
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
||||||
|
self.multicast_profile = self.local_realm.new_multicast_profile()
|
||||||
self.station_profiles = []
|
self.station_profiles = []
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for radio in radios:
|
for radio in radios:
|
||||||
self.station_profile = self.local_realm.new_station_profile()
|
self.station_profile = self.local_realm.new_station_profile()
|
||||||
@@ -59,13 +79,25 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
self.station_profiles.append(self.station_profile)
|
self.station_profiles.append(self.station_profile)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
self.cx_profile.host = self.host
|
if is_multicast:
|
||||||
self.cx_profile.port = self.port
|
self.multicast_profile.host = self.host
|
||||||
self.cx_profile.name_prefix = self.name_prefix
|
self.cx_profile.host = self.host
|
||||||
self.cx_profile.side_a_min_bps = side_a_min_rate
|
self.cx_profile.port = self.port
|
||||||
self.cx_profile.side_a_max_bps = side_a_max_rate
|
self.cx_profile.name_prefix = self.name_prefix
|
||||||
self.cx_profile.side_b_min_bps = side_b_min_rate
|
self.cx_profile.side_a_min_bps = 0
|
||||||
self.cx_profile.side_b_max_bps = side_b_max_rate
|
self.cx_profile.side_a_max_bps = 0
|
||||||
|
self.cx_profile.side_b_min_bps = side_b_min_rate
|
||||||
|
self.cx_profile.side_b_max_bps = side_b_max_rate
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.cx_profile.host = self.host
|
||||||
|
self.cx_profile.port = self.port
|
||||||
|
self.cx_profile.name_prefix = self.name_prefix
|
||||||
|
self.cx_profile.side_a_min_bps = side_a_min_rate
|
||||||
|
self.cx_profile.side_a_max_bps = side_a_max_rate
|
||||||
|
self.cx_profile.side_b_min_bps = side_b_min_rate
|
||||||
|
self.cx_profile.side_b_max_bps = side_b_max_rate
|
||||||
|
|
||||||
def __get_rx_values(self):
|
def __get_rx_values(self):
|
||||||
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=True)
|
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=True)
|
||||||
@@ -86,6 +118,8 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
expected_passes += 1
|
expected_passes += 1
|
||||||
if new_list[item] > old_list[item]:
|
if new_list[item] > old_list[item]:
|
||||||
passes += 1
|
passes += 1
|
||||||
|
print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||||
|
|
||||||
if passes == expected_passes:
|
if passes == expected_passes:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@@ -106,10 +140,36 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
temp_stations_list.append(self.side_b)
|
temp_stations_list.append(self.side_b)
|
||||||
self.local_realm.wait_for_ip(self.resource, temp_station_list)
|
self.local_realm.wait_for_ip(self.resource, temp_station_list)
|
||||||
|
|
||||||
|
|
||||||
|
temp_station_list = []
|
||||||
|
if self.is_multicast:
|
||||||
|
for station_list in self.station_lists:
|
||||||
|
for station in range(len(station_list)):
|
||||||
|
temp_station_list.append(str(self.resource) + "." + station_list[station])
|
||||||
|
|
||||||
|
# start recievers
|
||||||
|
self.multicast_profile.start_mc_rx(side_a=temp_station_list)
|
||||||
|
|
||||||
|
# right now the multicast is hard coded, need to pass in station
|
||||||
|
self.multicast_profile.start_mc_tx(side_b=self.side_b)
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.cx_profile.start_cx()
|
||||||
|
|
||||||
cur_time = datetime.datetime.now()
|
cur_time = datetime.datetime.now()
|
||||||
old_cx_rx_values = self.__get_rx_values()
|
old_rx_values = self.__get_rx_values()
|
||||||
|
filtered_old_rx_values = []
|
||||||
|
if self.is_multicast:
|
||||||
|
for rx_value in old_rx_values:
|
||||||
|
for station in self.station_lists:
|
||||||
|
if rx_value in station:
|
||||||
|
filtered_old_rx_values += rx_value
|
||||||
|
else:
|
||||||
|
filtered_old_rx_values = old_rx_values
|
||||||
|
|
||||||
|
|
||||||
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
||||||
self.cx_profile.start_cx()
|
|
||||||
passes = 0
|
passes = 0
|
||||||
expected_passes = 0
|
expected_passes = 0
|
||||||
while cur_time < end_time:
|
while cur_time < end_time:
|
||||||
@@ -117,15 +177,24 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
while cur_time < interval_time:
|
while cur_time < interval_time:
|
||||||
cur_time = datetime.datetime.now()
|
cur_time = datetime.datetime.now()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
new_rx_values = self.__get_rx_values()
|
||||||
|
filtered_new_rx_values = []
|
||||||
|
if self.is_multicast:
|
||||||
|
for rx_value in new_rx_values:
|
||||||
|
for station in self.station_lists:
|
||||||
|
if rx_value in station:
|
||||||
|
filtered_new_rx_values += rx_value
|
||||||
|
else:
|
||||||
|
filtered_new_rx_values = new_rx_values
|
||||||
|
|
||||||
new_cx_rx_values = self.__get_rx_values()
|
|
||||||
expected_passes += 1
|
expected_passes += 1
|
||||||
if self.__compare_vals(old_cx_rx_values, new_cx_rx_values):
|
if self.__compare_vals(filtered_old_rx_values, filtered_new_rx_values):
|
||||||
passes += 1
|
passes += 1
|
||||||
else:
|
else:
|
||||||
self._fail("FAIL: Not all stations increased traffic", print_fail)
|
self._fail("FAIL: Not all stations increased traffic", print_fail)
|
||||||
break
|
break
|
||||||
old_cx_rx_values = new_cx_rx_values
|
old_rx_values = new_rx_values
|
||||||
cur_time = datetime.datetime.now()
|
cur_time = datetime.datetime.now()
|
||||||
|
|
||||||
if passes == expected_passes:
|
if passes == expected_passes:
|
||||||
@@ -136,17 +205,52 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
for station_list in self.station_lists:
|
for station_list in self.station_lists:
|
||||||
for station_name in station_list:
|
for station_name in station_list:
|
||||||
data = LFUtils.portDownRequest(1, station_name)
|
data = LFUtils.portDownRequest(1, station_name)
|
||||||
url = "json-cli/set_port"
|
url = "cli-json/set_port"
|
||||||
self.json_post(url, data)
|
self.json_post(url, data)
|
||||||
|
|
||||||
def cleanup(self, resource):
|
def cleanup(self, resource):
|
||||||
resource = 1
|
resource = 1
|
||||||
remove_all_endpoints = True
|
data = {
|
||||||
self.local_realm.remove_all_cxs(remove_all_endpoints)
|
"name":"BLANK",
|
||||||
self.local_realm.remove_all_stations(resource)
|
"action":"overwrite"
|
||||||
|
}
|
||||||
|
url = "cli-json/load"
|
||||||
|
self.json_post(url, data)
|
||||||
|
#remove_all_endpoints = True
|
||||||
|
#self.local_realm.remove_all_cxs(remove_all_endpoints)
|
||||||
|
#self.local_realm.remove_all_stations(resource)
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
# refactor in LFUtils.port_zero_request()
|
||||||
resource = 1
|
resource = 1
|
||||||
|
data ={
|
||||||
|
'shelf':1,
|
||||||
|
'resource':1,
|
||||||
|
'port':'eth1',
|
||||||
|
'ip_addr':'0.0.0.0',
|
||||||
|
'netmask':'0.0.0.0',
|
||||||
|
'gateway':'0.0.0.0',
|
||||||
|
'current_flags':0,
|
||||||
|
'interest':402653212
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "cli-json/set_port"
|
||||||
|
self.json_post(url, data)
|
||||||
|
|
||||||
|
# refactor into LFUtils
|
||||||
|
data ={
|
||||||
|
"shelf":1,
|
||||||
|
"resource": resource,
|
||||||
|
"port":"br0",
|
||||||
|
"network_devs":"eth1",
|
||||||
|
"br_flags":1
|
||||||
|
}
|
||||||
|
url = "cli-json/add_br"
|
||||||
|
self.json_post(url, data)
|
||||||
|
|
||||||
|
#refactor later
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = LFUtils.port_dhcp_up_request(resource, self.side_b)
|
data = LFUtils.port_dhcp_up_request(resource, self.side_b)
|
||||||
self.json_post("/cli-json/set_port", data)
|
self.json_post("/cli-json/set_port", data)
|
||||||
@@ -154,32 +258,38 @@ class L3VariableTimeLongevity(LFCliBase):
|
|||||||
print("LFUtils.port_dhcp_up_request didn't complete ")
|
print("LFUtils.port_dhcp_up_request didn't complete ")
|
||||||
print("or the json_post failed either way {} did not set up dhcp so test may no pass ".format(self.side_b))
|
print("or the json_post failed either way {} did not set up dhcp so test may no pass ".format(self.side_b))
|
||||||
|
|
||||||
|
#exit(1)
|
||||||
|
|
||||||
resource = 1
|
resource = 1
|
||||||
index = 0
|
index = 0
|
||||||
for station_profile in self.station_profiles:
|
for station_profile in self.station_profiles:
|
||||||
station_profile.use_security(station_profile.security, station_profile.ssid, station_profile.ssid_pass)
|
station_profile.use_security(station_profile.security, station_profile.ssid, station_profile.ssid_pass)
|
||||||
station_profile.set_number_template(station_profile.number_template)
|
station_profile.set_number_template(station_profile.number_template)
|
||||||
print("Creating stations")
|
print("Creating stations")
|
||||||
station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
#station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||||
station_profile.set_command_param("set_port", "report_timer", 1500)
|
#station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||||
station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
#station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||||
temp_station_list = []
|
temp_station_list = []
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for station_list in self.station_lists:
|
for station_list in self.station_lists:
|
||||||
for station in range(len(station_list)):
|
for station in range(len(station_list)):
|
||||||
temp_station_list.append(str(self.resource) + "." + station_list[station])
|
temp_station_list.append(str(self.resource) + "." + station_list[station])
|
||||||
station_profile.create(resource=1, radio=self.radio_list[index], sta_names_=station_list, debug=False )
|
station_profile.create(resource=1, radio=self.radio_list[index], sta_names_=station_list, debug=True )
|
||||||
index += 1
|
index += 1
|
||||||
self.cx_profile.create(endp_type=self.endp_type, side_a=temp_station_list, side_b='1.'+self.side_b, sleep_time=.5)
|
if self.is_multicast:
|
||||||
|
self.multicast_profile.create_mc_tx(self.side_b)
|
||||||
|
self.multicast_profile.create_mc_rx(side_a=temp_station_list)
|
||||||
|
else:
|
||||||
|
self.cx_profile.create(endp_type=self.endp_type, side_a=temp_station_list, side_b='1.'+self.side_b, sleep_time=.5)
|
||||||
self._pass("PASS: Stations build finished")
|
self._pass("PASS: Stations build finished")
|
||||||
|
|
||||||
def valid_endp_type(endp_type):
|
def valid_endp_type(endp_type):
|
||||||
valid_endp_type=['lf_udp','lf_udp6','lf_tcp','lf_tcp6']
|
valid_endp_type=['lf_udp','lf_udp6','lf_tcp','lf_tcp6','mc_udp','mc_udp6']
|
||||||
if str(endp_type) in valid_endp_type:
|
if str(endp_type) in valid_endp_type:
|
||||||
return endp_type
|
return endp_type
|
||||||
else:
|
else:
|
||||||
print('invalid endp_type. Valid types lf_udp, lf_udp6, lf_tcp, lf_tcp6')
|
print('invalid endp_type. Valid types lf_udp, lf_udp6, lf_tcp, lf_tcp6, mc_udp, mc_udp6')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -200,33 +310,38 @@ def main():
|
|||||||
''',
|
''',
|
||||||
|
|
||||||
description='''\
|
description='''\
|
||||||
test_l3_longevity.py:
|
test_l3_longevity.py:
|
||||||
--------------------
|
--------------------
|
||||||
Basic Idea: create stations, create traffic between upstream port and stations, run traffic.
|
Basic Idea: create stations, create traffic between upstream port and stations, run traffic.
|
||||||
The traffic on the stations will be checked once per minute to verify that traffic is transmitted
|
The traffic on the stations will be checked once per minute to verify that traffic is transmitted
|
||||||
and recieved.
|
and recieved.
|
||||||
|
|
||||||
Test will exit on failure of not recieving traffice for one minute on any station.
|
Test will exit on failure of not recieving traffice for one minute on any station.
|
||||||
|
|
||||||
Scripts are executed from: ./lanforge/py-scripts
|
Scripts are executed from: ./lanforge/py-scripts
|
||||||
|
|
||||||
Generic command layout:
|
Stations start counting form zero, thus stations count from zero - number of las
|
||||||
python .\\test_l3_longevity.py --test_duration <duration> --endp_type <traffic type> --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password>
|
|
||||||
|
|
||||||
Note: multiple --radio switches may be entered up to the number of radios available:
|
Generic command layout:
|
||||||
--radio <radio 0> <stations> <ssid> <ssid password> --radio <radio 01> <stations> <ssid> <ssid password>
|
python .\\test_l3_longevity.py --test_duration <duration> --endp_type <traffic type> --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password>
|
||||||
|
|
||||||
<duration>: number followed by one of the following
|
Note: multiple --radio switches may be entered up to the number of radios available:
|
||||||
d - days
|
--radio <radio 0> <stations> <ssid> <ssid password> --radio <radio 01> <number of last station> <ssid> <ssid password>
|
||||||
h - hours
|
|
||||||
m - minutes
|
|
||||||
s - seconds
|
|
||||||
|
|
||||||
<traffic type>:
|
<duration>: number followed by one of the following
|
||||||
lf_udp : IPv4 UDP traffic
|
d - days
|
||||||
lf_tcp : IPv4 TCP traffic
|
h - hours
|
||||||
lf_udp6 : IPv6 UDP traffic
|
m - minutes
|
||||||
lf_tcp6 : IPv6 TCP traffic
|
s - seconds
|
||||||
|
|
||||||
|
<traffic type>:
|
||||||
|
lf_udp : IPv4 UDP traffic
|
||||||
|
lf_tcp : IPv4 TCP traffic
|
||||||
|
lf_udp6 : IPv6 UDP traffic
|
||||||
|
lf_tcp6 : IPv6 TCP traffic
|
||||||
|
|
||||||
|
mc_udp : IPv4 multi cast UDP traffic
|
||||||
|
mc_udp6 : IPv6 multi cast UDP traffic
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
1. Test duration 4 minutes
|
1. Test duration 4 minutes
|
||||||
@@ -247,8 +362,8 @@ def main():
|
|||||||
parser.add_argument('-u', '--upstream_port', help='--upstream_port <cross connect upstream_port> example: --upstream_port eth1',default='eth1')
|
parser.add_argument('-u', '--upstream_port', help='--upstream_port <cross connect upstream_port> example: --upstream_port eth1',default='eth1')
|
||||||
|
|
||||||
requiredNamed = parser.add_argument_group('required arguments')
|
requiredNamed = parser.add_argument_group('required arguments')
|
||||||
requiredNamed.add_argument('-r','--radio', action='append', nargs=4, metavar=('<wiphyX>', '<number of stations>','<ssid>','<ssid password>'),
|
requiredNamed.add_argument('-r','--radio', action='append', nargs=4, metavar=('<wiphyX>', '<number last station>','<ssid>','<ssid password>'),
|
||||||
help ='--radio <number_of_wiphy> <number_of_stations> <ssid> <ssid password> ',required=True)
|
help ='--radio <number_of_wiphy> <number of last station> <ssid> <ssid password> ',required=True)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.test_duration:
|
if args.test_duration:
|
||||||
@@ -263,6 +378,8 @@ def main():
|
|||||||
if args.radio:
|
if args.radio:
|
||||||
radios = args.radio
|
radios = args.radio
|
||||||
|
|
||||||
|
is_multicast = False
|
||||||
|
|
||||||
radio_offset = 0
|
radio_offset = 0
|
||||||
number_of_stations_offset = 1
|
number_of_stations_offset = 1
|
||||||
ssid_offset = 2
|
ssid_offset = 2
|
||||||
@@ -275,6 +392,9 @@ def main():
|
|||||||
ssid_list = []
|
ssid_list = []
|
||||||
ssid_password_list = []
|
ssid_password_list = []
|
||||||
|
|
||||||
|
if endp_type in ['mc_udp','mc_udp6']:
|
||||||
|
is_multicast = True
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for radio in radios:
|
for radio in radios:
|
||||||
radio_name = radio[radio_offset]
|
radio_name = radio[radio_offset]
|
||||||
@@ -303,6 +423,7 @@ def main():
|
|||||||
station_lists= station_lists,
|
station_lists= station_lists,
|
||||||
name_prefix="var_time",
|
name_prefix="var_time",
|
||||||
endp_type=endp_type,
|
endp_type=endp_type,
|
||||||
|
is_multicast=is_multicast,
|
||||||
side_b=side_b,
|
side_b=side_b,
|
||||||
radios=radios,
|
radios=radios,
|
||||||
radio_name_list=radio_name_list,
|
radio_name_list=radio_name_list,
|
||||||
|
|||||||
Reference in New Issue
Block a user