mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
Fixed dut creation and update
Signed-off-by: shivam <shivam.thakur@candelatech.com>
This commit is contained in:
Binary file not shown.
@@ -137,26 +137,27 @@ class lf_libs:
|
||||
logging.basicConfig(format='%(asctime)s - %(message)s', level=log_level)
|
||||
lf_data = dict(lf_data)
|
||||
self.dut_data = dut_data
|
||||
try:
|
||||
self.lanforge_data = lf_data.get("details")
|
||||
self.testbed = lf_data.get("testbed")
|
||||
self.scenario = lf_data.get("scenario")
|
||||
self.setup_lf_data()
|
||||
# self.load_scenario()
|
||||
self.setup_metadata()
|
||||
if self.scenario == "dhcp-bridge":
|
||||
logging.info("Scenario name: " + str(self.scenario))
|
||||
# creating default raw lines for chamberview
|
||||
self.create_dhcp_bridge()
|
||||
elif self.scenario == "dhcp-external":
|
||||
logging.info("Scenario name: " + str(self.scenario))
|
||||
self.create_dhcp_external()
|
||||
self.chamber_view(raw_lines=self.default_scenario_raw_lines)
|
||||
self.setup_relevent_profiles()
|
||||
self.setup_dut()
|
||||
except Exception as e:
|
||||
logging.error("lf_data has bad values: " + str(lf_data))
|
||||
logging.error(e)
|
||||
# try:
|
||||
self.lanforge_data = lf_data.get("details")
|
||||
self.testbed = lf_data.get("testbed")
|
||||
self.scenario = lf_data.get("scenario")
|
||||
self.setup_lf_data()
|
||||
self.setup_relevent_profiles()
|
||||
# self.load_scenario()
|
||||
# self.setup_metadata()
|
||||
if self.scenario == "dhcp-bridge":
|
||||
logging.info("Scenario name: " + str(self.scenario))
|
||||
# creating default raw lines for chamberview
|
||||
self.create_dhcp_bridge()
|
||||
elif self.scenario == "dhcp-external":
|
||||
logging.info("Scenario name: " + str(self.scenario))
|
||||
self.create_dhcp_external()
|
||||
self.chamber_view(raw_lines=self.default_scenario_raw_lines)
|
||||
self.setup_dut()
|
||||
|
||||
# except Exception as e:
|
||||
# logging.error("lf_data has bad values: " + str(lf_data))
|
||||
# logging.error(e)
|
||||
|
||||
"""
|
||||
setup_lf_data : used to set object variables that are passed from lab_info.json
|
||||
@@ -197,10 +198,6 @@ class lf_libs:
|
||||
serial_num=self.dut_data[index]["identifier"])
|
||||
dut_obj.setup()
|
||||
dut_obj.add_ssids()
|
||||
dut_obj.show_text_blob(None, None, True) # Show changes on GUI
|
||||
dut_obj.sync_cv()
|
||||
time.sleep(2)
|
||||
dut_obj.sync_cv()
|
||||
print("Creating DUT")
|
||||
|
||||
def setup_metadata(self):
|
||||
@@ -345,17 +342,18 @@ class lf_libs:
|
||||
lan_port=gateway_ip)
|
||||
dut_obj.setup()
|
||||
dut_obj.add_ssids()
|
||||
dut_obj.show_text_blob(None, None, True) # Show changes on GUI
|
||||
dut_obj.sync_cv()
|
||||
time.sleep(2)
|
||||
dut_obj.sync_cv()
|
||||
# dut_obj.show_text_blob(None, None, True) # Show changes on GUI
|
||||
# dut_obj.sync_cv()
|
||||
# time.sleep(2)
|
||||
# dut_obj.sync_cv()
|
||||
self.default_scenario_raw_lines.append(["profile_link " + upstream_resources + " upstream-dhcp 1 NA NA " +
|
||||
upstream_port.split(".")[2] + ",AUTO -1 NA"])
|
||||
self.default_scenario_raw_lines.append(
|
||||
["profile_link " + uplink_resources + " uplink-nat 1 'DUT: upstream LAN "
|
||||
+ gateway_ip +
|
||||
+ gateway_ip
|
||||
+ "' NA " + uplink_port.split(".")[2] + "," + upstream_port.split(".")[2] + " -1 NA"])
|
||||
return self.default_scenario_raw_lines
|
||||
|
||||
def create_dhcp_external(self):
|
||||
self.setup_connectivity_port(data=self.wan_ports)
|
||||
self.setup_connectivity_port(data=self.lan_ports)
|
||||
@@ -365,6 +363,7 @@ class lf_libs:
|
||||
self.default_scenario_raw_lines.append(["profile_link " + upstream_resources + " upstream 1 NA NA " +
|
||||
upstream_port.split(".")[2] + ",AUTO -1 NA"])
|
||||
return self.default_scenario_raw_lines
|
||||
|
||||
def json_get(self, _req_url="/"):
|
||||
cli_base = LFCliBase(_lfjson_host=self.manager_ip, _lfjson_port=self.manager_http_port)
|
||||
json_response = cli_base.json_get(_req_url=_req_url)
|
||||
@@ -410,9 +409,14 @@ class lf_libs:
|
||||
|
||||
# Create upstream-dhcp and uplink-nat profile if they don't exists
|
||||
# Checking availability of upstream-dhcp profile
|
||||
upstream_dhcp = profile_utility_obj.check_profile(profile_name="upstream-dhcp")
|
||||
# Checking availability of uplink-nat profile
|
||||
uplink_nat = profile_utility_obj.check_profile(profile_name="uplink-nat")
|
||||
try:
|
||||
upstream_dhcp = profile_utility_obj.check_profile(profile_name="upstream-dhcp")
|
||||
# Checking availability of uplink-nat profile
|
||||
uplink_nat = profile_utility_obj.check_profile(profile_name="uplink-nat")
|
||||
except Exception as e:
|
||||
upstream_dhcp = True
|
||||
uplink_nat = True
|
||||
pass
|
||||
if upstream_dhcp:
|
||||
logging.info("upstream_dhcp profile: Available")
|
||||
profile_utility_obj.remove_profile(name="upstream-dhcp")
|
||||
@@ -423,13 +427,17 @@ class lf_libs:
|
||||
profile_flags="DHCP-SERVER")
|
||||
if uplink_nat:
|
||||
profile_utility_obj.remove_profile(name="uplink-nat")
|
||||
profile_utility_obj.add_profile(profile_name="uplink-nat", profile_type="uplink", profile_flags=None)
|
||||
profile_utility_obj.add_profile(profile_name="uplink-nat", profile_type="uplink", profile_flags="NAT")
|
||||
else:
|
||||
profile_utility_obj.add_profile(profile_name="uplink-nat", profile_type="uplink", profile_flags=None)
|
||||
profile_utility_obj.add_profile(profile_name="uplink-nat", profile_type="uplink", profile_flags="NAT")
|
||||
|
||||
# Create VLAN Based profiles
|
||||
if self.scenario == "dhcp-bridge":
|
||||
vlan_dhcp_profile = profile_utility_obj.check_profile(profile_name="vlan_dhcp_profile")
|
||||
try:
|
||||
vlan_dhcp_profile = profile_utility_obj.check_profile(profile_name="vlan_dhcp_profile")
|
||||
except Exception as e:
|
||||
vlan_dhcp_profile = True
|
||||
|
||||
if vlan_dhcp_profile:
|
||||
profile_utility_obj.remove_profile(name="vlan_dhcp_profile")
|
||||
profile_utility_obj.add_profile(profile_name="vlan_dhcp_profile", profile_type="vlan",
|
||||
@@ -439,7 +447,10 @@ class lf_libs:
|
||||
profile_flags="DHCP-SERVER")
|
||||
|
||||
elif self.scenario == "dhcp-external":
|
||||
vlan_profile = profile_utility_obj.check_profile(profile_name="vlan_profile")
|
||||
try:
|
||||
vlan_profile = profile_utility_obj.check_profile(profile_name="vlan_profile")
|
||||
except Exception as e:
|
||||
vlan_profile = True
|
||||
if vlan_profile:
|
||||
profile_utility_obj.remove_profile(name="vlan_profile")
|
||||
profile_utility_obj.add_profile(profile_name="vlan_profile", profile_type="vlan", profile_flags=None)
|
||||
@@ -531,8 +542,6 @@ class lf_libs:
|
||||
self.json_post("/cli-json/set_port", data)
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
|
||||
def chamber_view(self, delete_old_scenario=True, raw_lines=[]):
|
||||
print(self.chamberview_object)
|
||||
if delete_old_scenario:
|
||||
@@ -631,4 +640,3 @@ class SCP_File:
|
||||
|
||||
def save_current_scenario(self):
|
||||
pass
|
||||
|
||||
|
||||
4
lf_libs/scan_ssid.csv
Normal file
4
lf_libs/scan_ssid.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
,age,auth,beacon,bss,channel,entity id,frequency,info,signal,ssid
|
||||
0,4698,Open,100,00:00:c1:01:88:15,1,1.1.4,2412,2x2 MCS 0-11 AX,-17.0,Maverick-018812
|
||||
1,354731974,WPA2 WPA3,100,02:00:c1:01:88:15,1,1.1.4,2412,2x2 MCS 0-11 AX,-22.0,ssid_wpa3_p_m_2g_br
|
||||
2,354731972,WPA WPA2,100,06:00:c1:01:88:15,1,1.1.4,2412,2x2 MCS 0-11 AX,-21.0,ssid_wpa_wpa2_p_m_2g_br
|
||||
|
0
lf_libs/sh-results.csv
Normal file
0
lf_libs/sh-results.csv
Normal file
|
|
BIN
lf_libs/sniff_radio.pcap
Normal file
BIN
lf_libs/sniff_radio.pcap
Normal file
Binary file not shown.
@@ -26,6 +26,7 @@ class cv_dut(LFCliBase):
|
||||
hw_version="NA",
|
||||
serial_num="NA",
|
||||
model_num="NA",
|
||||
lan_port="BLANK",
|
||||
desired_dut_flags=None,
|
||||
desired_dut_flags_mask=None
|
||||
):
|
||||
@@ -39,7 +40,7 @@ class cv_dut(LFCliBase):
|
||||
self.serial_num = serial_num
|
||||
self.serial_port = "[BLANK]"
|
||||
self.wan_port = "[BLANK]"
|
||||
self.lan_port = "[BLANK]"
|
||||
self.lan_port = lan_port
|
||||
self.api_id = "0"
|
||||
self.flags_mask = "NA"
|
||||
if desired_dut_flags:
|
||||
|
||||
@@ -31,7 +31,7 @@ class ProfileUtility(Realm):
|
||||
"""Add profile"""
|
||||
profile_type_data = {"as_is": 0, "sta": 1, "bridged_ap": 2, "routed_ap": 3, "upstream": 4, "monitor": 5,
|
||||
"mobile_sta": 6, "rdd": 7, "client": 8, "bond": 9, "peer": 10, "uplink": 11, "vlan": 12}
|
||||
profile_flags_data = {"DHCP-SERVER": "0x1", "NAT": "0x100"}
|
||||
profile_flags_data = {"DHCP-SERVER": "0x1", "NAT": "0x100", }
|
||||
data = {
|
||||
"name": None,
|
||||
"profile_type": None,
|
||||
|
||||
@@ -103,7 +103,6 @@ class DUT(dut):
|
||||
self.dut_name = dut_name
|
||||
self.ssid = ssid
|
||||
self.lan_port = lan_port
|
||||
print("JITT")
|
||||
|
||||
def setup(self):
|
||||
self.create_dut()
|
||||
|
||||
Reference in New Issue
Block a user