mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
Updated to use new methods in realm
This commit is contained in:
@@ -17,7 +17,7 @@ import pprint
|
||||
|
||||
|
||||
class IPv4Test(LFCliBase):
|
||||
def __init__(self, host, port, ssid, security, password, sta_list=None, num_stations=0, prefix="00000", _debug_on=False,
|
||||
def __init__(self, host, port, ssid, security, password, resource=1, sta_list=None, num_stations=0, prefix="00000", _debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||
@@ -28,13 +28,14 @@ class IPv4Test(LFCliBase):
|
||||
self.password = password
|
||||
self.num_stations = num_stations
|
||||
self.sta_list = sta_list
|
||||
self.resource = resource
|
||||
self.timeout = 120
|
||||
self.prefix = prefix
|
||||
self.debug = _debug_on
|
||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
||||
self.profile = realm.StationProfile(self.lfclient_url, ssid=self.ssid, ssid_pass=self.password,
|
||||
security=self.security, number_template_=self.prefix, mode=0, up=False, dhcp=True,
|
||||
debug_=False)
|
||||
debug_=False, local_realm=self.local_realm)
|
||||
|
||||
def build(self):
|
||||
# Build stations
|
||||
@@ -48,7 +49,6 @@ class IPv4Test(LFCliBase):
|
||||
self._pass("PASS: Station build finished")
|
||||
|
||||
def start(self, sta_list, print_pass, print_fail):
|
||||
# Bring stations up
|
||||
self.profile.admin_up(1)
|
||||
associated_map = {}
|
||||
ip_map = {}
|
||||
@@ -92,33 +92,18 @@ class IPv4Test(LFCliBase):
|
||||
# print(sta_name)
|
||||
self.json_post(url, data)
|
||||
|
||||
def cleanup(self, resource):
|
||||
port_list = self.local_realm.station_list()
|
||||
sta_list = []
|
||||
for item in list(port_list):
|
||||
# print(list(item))
|
||||
if "sta" in list(item)[0]:
|
||||
sta_list.append(self.local_realm.name_to_eid(list(item)[0])[2])
|
||||
|
||||
for sta_name in sta_list:
|
||||
req_url = "cli-json/rm_vlan"
|
||||
data = {
|
||||
"shelf": 1,
|
||||
"resource": 1,
|
||||
"port": sta_name
|
||||
}
|
||||
self.json_post(req_url, data, self.debug)
|
||||
time.sleep(.05)
|
||||
LFUtils.wait_until_ports_disappear(resource_id=resource, base_url=self.lfclient_url, port_list=sta_list, debug=self.debug)
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.profile.cleanup(self.resource, sta_list)
|
||||
LFUtils.wait_until_ports_disappear(resource_id=self.resource, base_url=self.lfclient_url, port_list=sta_list,
|
||||
debug=self.debug)
|
||||
|
||||
def main():
|
||||
lfjson_host = "localhost"
|
||||
lfjson_port = 8080
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=29, padding_number_=10000)
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=1, padding_number_=10000)
|
||||
ip_test = IPv4Test(lfjson_host, lfjson_port, ssid="jedway-wpa2-x2048-4-4", password="jedway-wpa2-x2048-4-4",
|
||||
security="open", sta_list=station_list)
|
||||
ip_test.cleanup(1)
|
||||
ip_test.cleanup(station_list)
|
||||
ip_test.timeout = 60
|
||||
ip_test.build()
|
||||
if not ip_test.passes():
|
||||
@@ -130,7 +115,7 @@ def main():
|
||||
print(ip_test.get_fail_message())
|
||||
exit(1)
|
||||
time.sleep(30)
|
||||
ip_test.cleanup(1)
|
||||
ip_test.cleanup(station_list)
|
||||
if ip_test.passes():
|
||||
print("Full test passed, all stations associated and got IP")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user