Merge branch 'master' of github.com:greearb/lanforge-scripts

This commit is contained in:
Ben Greear
2020-08-05 16:22:10 -07:00
2 changed files with 32 additions and 9 deletions

View File

@@ -1652,6 +1652,29 @@ class VAPProfile(LFCliBase):
data["port"] = current_stations["interface"]["alias"] data["port"] = current_stations["interface"]["alias"]
self.local_realm.json_post(req_url, data, debug_=self.debug) self.local_realm.json_post(req_url, data, debug_=self.debug)
class PortUtils(LFCliBase):
def __init__(self, local_realm):
self.local_realm = local_realm
def set_ftp(self, port_name="", resource=1, on=False):
if port_name != "":
data = {
"shelf": 1,
"resource": resource,
"port": port_name,
"current_flags": 0,
"interest": 0
}
if on:
data["current_flags"] = 0x400000000000
data["interest"] = 0x10000000
else:
data["interest"] = 0x10000000
self.local_realm.json_post("cli-json/set_port", data)
else:
raise ValueError("Port name required")
# use the station profile to set the combination of features you want on your stations # use the station profile to set the combination of features you want on your stations
# once this combination is configured, build the stations with the build(resource, radio, number) call # once this combination is configured, build the stations with the build(resource, radio, number) call
@@ -1867,7 +1890,7 @@ class StationProfile:
time.sleep(delay) time.sleep(delay)
# And now see if they are gone # And now see if they are gone
count = 0; count = 0
while count < (del_count + 10): while count < (del_count + 10):
found_one = False found_one = False
for port_eid in desired_stations: for port_eid in desired_stations:
@@ -1928,7 +1951,7 @@ class StationProfile:
add_sta_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/add_sta") add_sta_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/add_sta")
set_port_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_port") set_port_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_port")
my_sta_names = []; my_sta_names = []
if num_stations > 0: if num_stations > 0:
my_sta_names = LFUtils.portNameSeries("sta", 0, num_stations - 1, int("1" + self.number_template)) my_sta_names = LFUtils.portNameSeries("sta", 0, num_stations - 1, int("1" + self.number_template))
else: else:

View File

@@ -45,10 +45,10 @@ class IPV4VariableTime(LFCliBase):
self.station_profile.lfclient_url = self.lfclient_url self.station_profile.lfclient_url = self.lfclient_url
self.station_profile.ssid = self.ssid self.station_profile.ssid = self.ssid
self.station_profile.ssid_pass = self.password, self.station_profile.ssid_pass = self.password
self.station_profile.security = self.security self.station_profile.security = self.security
self.station_profile.number_template_ = self.number_template self.station_profile.number_template_ = self.number_template
self.station_profile.mode = 0 self.station_profile.debug = self.debug
self.station_profile.use_ht160 = use_ht160 self.station_profile.use_ht160 = use_ht160
if self.station_profile.use_ht160: if self.station_profile.use_ht160:
self.station_profile.mode = 9 self.station_profile.mode = 9
@@ -96,7 +96,7 @@ class IPV4VariableTime(LFCliBase):
self.station_profile.admin_up(self.resource) self.station_profile.admin_up(self.resource)
temp_stas = self.sta_list.copy() temp_stas = self.sta_list.copy()
temp_stas.append("eth1") temp_stas.append("eth1")
if self.local_realm.wait_for_ip(self.resource, temp_stas): if self.local_realm.wait_for_ip(temp_stas):
self._pass("All stations got IPs", print_pass) self._pass("All stations got IPs", print_pass)
else: else:
self._fail("Stations failed to get IPs", print_fail) self._fail("Stations failed to get IPs", print_fail)
@@ -139,7 +139,7 @@ class IPV4VariableTime(LFCliBase):
def cleanup(self, sta_list): def cleanup(self, sta_list):
self.cx_profile.cleanup() self.cx_profile.cleanup()
self.station_profile.cleanup(self.resource, sta_list) self.station_profile.cleanup(sta_list)
LFUtils.wait_until_ports_disappear(resource_id=self.resource, base_url=self.lfclient_url, port_list=sta_list, LFUtils.wait_until_ports_disappear(resource_id=self.resource, base_url=self.lfclient_url, port_list=sta_list,
debug=self.debug) debug=self.debug)
@@ -153,7 +153,7 @@ class IPV4VariableTime(LFCliBase):
temp_sta_list = [] temp_sta_list = []
for station in range(len(self.sta_list)): for station in range(len(self.sta_list)):
temp_sta_list.append(str(self.resource) + "." + self.sta_list[station]) temp_sta_list.append(str(self.resource) + "." + self.sta_list[station])
self.station_profile.create(resource=1, radio=self.radio, sta_names_=self.sta_list, debug=self.debug) self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
self.cx_profile.create(endp_type="lf_udp", side_a=temp_sta_list, side_b="1.eth1", sleep_time=.5) self.cx_profile.create(endp_type="lf_udp", side_a=temp_sta_list, side_b="1.eth1", sleep_time=.5)
self._pass("PASS: Station build finished") self._pass("PASS: Station build finished")
@@ -169,7 +169,7 @@ def main():
resource=1, resource=1,
radio="wiphy2", radio="wiphy2",
security="wpa2", test_duration="5m", use_ht160=False, security="wpa2", test_duration="5m", use_ht160=False,
side_a_min_rate=256000, side_b_min_rate=256000, _debug_on=False) side_a_min_rate=256000, side_b_min_rate=256000, _debug_on=True)
ip_var_test.cleanup(station_list) ip_var_test.cleanup(station_list)
ip_var_test.build() ip_var_test.build()