working now

This commit is contained in:
Dipti Dhond
2020-08-06 15:13:17 -07:00
parent 346919156b
commit b19e55fe3a

View File

@@ -22,6 +22,7 @@ from LANforge.lfcli_base import LFCliBase
from LANforge.LFUtils import * from LANforge.LFUtils import *
import realm import realm
from realm import Realm from realm import Realm
import pprint
OPEN="open" OPEN="open"
WEP="wep" WEP="wep"
@@ -141,7 +142,7 @@ class StaConnect2(LFCliBase):
if (response is not None) and (response["interface"] is not None): if (response is not None) and (response["interface"] is not None):
for sta_name in self.station_names: for sta_name in self.station_names:
LFUtils.removePort(self.resource, sta_name, self.lfclient_url) LFUtils.removePort(self.resource, sta_name, self.lfclient_url)
LFUtils.wait_until_ports_disappear(self.resource, self.lfclient_url, self.station_names) LFUtils.wait_until_ports_disappear(self.lfclient_url, self.station_names)
# Create stations and turn dhcp on # Create stations and turn dhcp on
self.station_profile = self.localrealm.new_station_profile() self.station_profile = self.localrealm.new_station_profile()
@@ -153,8 +154,8 @@ class StaConnect2(LFCliBase):
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1) self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
print("Adding new stations ", end="") print("Adding new stations ", end="")
self.station_profile.create(resource=self.resource, radio=self.radio, sta_names_=self.station_names, up_=False, debug=self.debug, suppress_related_commands_=True) self.station_profile.create(radio=self.radio, sta_names_=self.station_names, up_=False, debug=self.debug, suppress_related_commands_=True)
LFUtils.wait_until_ports_appear(self.resource, self.lfclient_url, self.station_names, debug=self.debug) LFUtils.wait_until_ports_appear(self.lfclient_url, self.station_names, debug=self.debug)
# Create UDP endpoints # Create UDP endpoints
self.l3_udp_profile = self.localrealm.new_l3_cx_profile() self.l3_udp_profile = self.localrealm.new_l3_cx_profile()
@@ -193,7 +194,7 @@ class StaConnect2(LFCliBase):
"port": "ALL", "port": "ALL",
"probe_flags": 1} "probe_flags": 1}
self.json_post("/cli-json/nc_show_ports", data) self.json_post("/cli-json/nc_show_ports", data)
self.station_profile.admin_up(self.resource) self.station_profile.admin_up()
LFUtils.waitUntilPortsAdminUp(self.resource, self.lfclient_url, self.station_names) LFUtils.waitUntilPortsAdminUp(self.resource, self.lfclient_url, self.station_names)
# station_info = self.jsonGet(self.mgr_url, "%s?fields=port,ip,ap" % (self.getStaUrl())) # station_info = self.jsonGet(self.mgr_url, "%s?fields=port,ip,ap" % (self.getStaUrl()))
@@ -329,14 +330,16 @@ class StaConnect2(LFCliBase):
if self.cleanup_on_exit: if self.cleanup_on_exit:
for sta_name in self.station_names: for sta_name in self.station_names:
LFUtils.removePort(self.resource, sta_name, self.lfclient_url) LFUtils.removePort(self.resource, sta_name, self.lfclient_url)
endp_names = [] curr_endp_names = []
removeCX(self.lfclient_url, self.l3_udp_profile.get_cx_names()) removeCX(self.lfclient_url, self.l3_udp_profile.get_cx_names())
removeCX(self.lfclient_url, self.l3_tcp_profile.get_cx_names()) removeCX(self.lfclient_url, self.l3_tcp_profile.get_cx_names())
for (cx_name, endp_names) in self.l3_udp_profile.created_cx.items(): for (cx_name, endp_names) in self.l3_udp_profile.created_cx.items():
endp_names.append(endp_names[0]) curr_endp_names.append(endp_names[0])
endp_names.append(endp_names[1]) curr_endp_names.append(endp_names[1])
removeEndps(self.lfclient_url, endp_names) for (cx_name, endp_names) in self.l3_tcp_profile.created_cx.items():
curr_endp_names.append(endp_names[0])
curr_endp_names.append(endp_names[1])
removeEndps(self.lfclient_url, curr_endp_names, debug= self.debug)
# ~class # ~class
@@ -408,6 +411,7 @@ Example:
if args.dut_security is not None: if args.dut_security is not None:
staConnect.dut_security = args.dut_security staConnect.dut_security = args.dut_security
# staConnect.cleanup()
staConnect.setup() staConnect.setup()
staConnect.start() staConnect.start()
print("napping %f sec" % staConnect.runtime_secs) print("napping %f sec" % staConnect.runtime_secs)