mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2026-03-20 03:41:54 +00:00
vlan creation logic fix
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -84,6 +84,12 @@ class ChamberView:
|
||||
self.CreateChamberview.sync_cv()
|
||||
return self.CreateChamberview, self.scenario_name
|
||||
|
||||
def add_vlan(self, vlan_ids=[]):
|
||||
for vlans in vlan_ids:
|
||||
self.raw_line.append(["profile_link 1.1 " + "vlan-100 1 " + self.upstream_port
|
||||
+ " NA " + self.upstream_port.split(".")[2] + ",AUTO -1 " + str(vlans)])
|
||||
self.Chamber_View()
|
||||
|
||||
def add_stations(self, band="2G", num_stations="max", dut="NA", ssid_name=[]):
|
||||
idx = 0
|
||||
print(self.dut_idx_mapping)
|
||||
@@ -123,8 +129,6 @@ class ChamberView:
|
||||
station_data = ["profile_link 1.1 STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" +
|
||||
str(int(idx) + 1) + "'" + " NA " + radio]
|
||||
self.raw_line.append(station_data)
|
||||
|
||||
|
||||
|
||||
def Create_Dut(self):
|
||||
self.CreateDut.setup()
|
||||
@@ -202,4 +206,3 @@ class ChamberView:
|
||||
allure.attach.file(source=relevant_path + i,
|
||||
name=i,
|
||||
attachment_type="image/png", extension=None)
|
||||
|
||||
|
||||
@@ -570,6 +570,7 @@ def lf_tools(get_configuration, testbed):
|
||||
""" Create a DUT on LANforge"""
|
||||
obj = ChamberView(lanforge_data=get_configuration["traffic_generator"]["details"],
|
||||
testbed=testbed, access_point_data=get_configuration["access_point"])
|
||||
|
||||
yield obj
|
||||
|
||||
|
||||
@@ -581,55 +582,10 @@ def lf_tools(get_configuration, testbed):
|
||||
yield obj
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def create_vlan(request, testbed, get_configuration):
|
||||
"""Create a vlan on lanforge"""
|
||||
if request.param["mode"] == "VLAN":
|
||||
vlan_list = list()
|
||||
refactored_vlan_list = list()
|
||||
ssid_modes = request.param["ssid_modes"].keys()
|
||||
for mode in ssid_modes:
|
||||
for ssid in range(len(request.param["ssid_modes"][mode])):
|
||||
if "vlan" in request.param["ssid_modes"][mode][ssid]:
|
||||
vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"])
|
||||
else:
|
||||
pass
|
||||
if vlan_list:
|
||||
[refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list]
|
||||
vlan_list = refactored_vlan_list
|
||||
for i in range(len(vlan_list)):
|
||||
if vlan_list[i] > 4095 or vlan_list[i] < 1:
|
||||
vlan_list.pop(i)
|
||||
|
||||
if not vlan_list:
|
||||
vlan_list.append(100)
|
||||
|
||||
if vlan_list:
|
||||
chamberview_obj = ChamberView(lanforge_data=get_configuration["traffic_generator"]["details"],
|
||||
testbed=testbed, access_point_data=get_configuration["access_point"])
|
||||
|
||||
lanforge_data = get_configuration["traffic_generator"]["details"]
|
||||
upstream_port = lanforge_data["upstream"]
|
||||
upstream_resources = upstream_port.split(".")[0] + "." + upstream_port.split(".")[1]
|
||||
|
||||
for vlan in vlan_list:
|
||||
chamberview_obj.raw_line.append(["profile_link " + upstream_resources + " Vlan 1 NA "
|
||||
+ "NA " + upstream_port.split(".")[2] + ",AUTO -1 " + str(vlan)])
|
||||
|
||||
chamberview_obj.Chamber_View()
|
||||
port_resource = upstream_resources.split(".")
|
||||
|
||||
yield vlan_list
|
||||
else:
|
||||
yield False
|
||||
# try:
|
||||
# ip = chamberview_obj.json_get("/port/" + port_resource[0] + "/" + port_resource[1] +
|
||||
# "/" + upstream_port.split(".")[2] + "." + str(vlan))["interface"]["ip"]
|
||||
# if ip:
|
||||
# yield vlan_list, ip
|
||||
# except Exception as e:
|
||||
# print(e)
|
||||
# yield False
|
||||
# @pytest.fixture(scope="class")
|
||||
# def create_vlan(request, testbed, get_configuration, lf_tools):
|
||||
# """Create a vlan on lanforge"""
|
||||
#
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
||||
@@ -58,6 +58,22 @@ def setup_vlan():
|
||||
def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_id,
|
||||
instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
|
||||
get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info):
|
||||
if request.param["mode"] == "VLAN":
|
||||
vlan_list = list()
|
||||
refactored_vlan_list = list()
|
||||
ssid_modes = request.param["ssid_modes"].keys()
|
||||
for mode in ssid_modes:
|
||||
for ssid in range(len(request.param["ssid_modes"][mode])):
|
||||
if "vlan" in request.param["ssid_modes"][mode][ssid]:
|
||||
vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"])
|
||||
else:
|
||||
pass
|
||||
if vlan_list:
|
||||
[refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list]
|
||||
vlan_list = refactored_vlan_list
|
||||
for i in range(len(vlan_list)):
|
||||
if vlan_list[i] > 4095 or vlan_list[i] < 1:
|
||||
vlan_list.pop(i)
|
||||
if request.config.getoption("1.x"):
|
||||
instantiate_profile = instantiate_profile(sdk_client=setup_controller)
|
||||
vlan_id, mode = 0, 0
|
||||
@@ -899,7 +915,8 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
|
||||
print(ssid_data)
|
||||
lf_tools.reset_scenario()
|
||||
lf_tools.update_ssid(ssid_data=ssid_data)
|
||||
|
||||
if request.param["mode"] == "VLAN":
|
||||
lf_tools.add_vlan(vlan_ids=vlan_list)
|
||||
yield test_cases
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user