mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-02 03:48:09 +00:00
uci vlan fixes
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -189,6 +189,8 @@ class UProfileUtility:
|
||||
"channel-width": 80,
|
||||
# "channel": 36
|
||||
})
|
||||
|
||||
self.vlan_section["ssids"] = []
|
||||
self.vlan_ids = []
|
||||
|
||||
def set_mode(self, mode):
|
||||
@@ -207,7 +209,7 @@ class UProfileUtility:
|
||||
return 0
|
||||
|
||||
def add_ssid(self, ssid_data):
|
||||
print("ssid data : ", ssid_data)
|
||||
# print("ssid data : ", ssid_data)
|
||||
ssid_info = {'name': ssid_data["ssid_name"], "bss-mode": "ap", "wifi-bands": []}
|
||||
for i in ssid_data["appliedRadios"]:
|
||||
ssid_info["wifi-bands"].append(i)
|
||||
@@ -220,17 +222,43 @@ class UProfileUtility:
|
||||
elif self.mode == "BRIDGE":
|
||||
self.base_profile_config['interfaces'][0]['ssids'].append(ssid_info)
|
||||
elif self.mode == "VLAN":
|
||||
self.base_profile_config['interfaces'] = []
|
||||
vid = ssid_data["vlan"]
|
||||
self.vlan_ids.append(vid)
|
||||
self.vlan_section = {
|
||||
"name": "WAN100",
|
||||
"role": "upstream",
|
||||
"vlan": {
|
||||
"id": 100
|
||||
},
|
||||
"ethernet": [
|
||||
{
|
||||
"select-ports": [
|
||||
"WAN*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ipv4": {
|
||||
"addressing": "dynamic"
|
||||
}
|
||||
}
|
||||
vlan_section = self.vlan_section
|
||||
vlan_section['name'] = "WANv%s" % (vid)
|
||||
vlan_section['vlan']['id'] = int(vid)
|
||||
self.base_profile_config['interfaces'].append(vlan_section)
|
||||
vsection = 0
|
||||
if vid in self.vlan_ids:
|
||||
for i in self.base_profile_config['interfaces']:
|
||||
if i["name"] == "WANv%s" % (vid):
|
||||
i["ssids"].append(ssid_info)
|
||||
else:
|
||||
self.vlan_ids.append(vid)
|
||||
vlan_section['name'] = "WANv%s" % (vid)
|
||||
vlan_section['vlan']['id'] = int(vid)
|
||||
vlan_section["ssids"] = []
|
||||
self.base_profile_config['interfaces'].append(vlan_section)
|
||||
vlan_section["ssids"].append(ssid_info)
|
||||
# print(vlan_section)
|
||||
vsection = 0
|
||||
# Add to the ssid section
|
||||
print(self.base_profile_config)
|
||||
self.base_profile_config['interfaces'][vsection]['vlan'] = {'id': int(vid)}
|
||||
self.base_profile_config['interfaces'][0]['ssids'].append(ssid_info)
|
||||
# print(self.base_profile_config)
|
||||
self.base_profile_config['interfaces'][vsection]['vlan'] = {'id': int(vid)}
|
||||
# self.base_profile_config['interfaces'][vsection]['ssids'].append(ssid_info)
|
||||
else:
|
||||
print("invalid mode")
|
||||
pytest.exit("invalid Operating Mode")
|
||||
@@ -241,11 +269,11 @@ class UProfileUtility:
|
||||
payload['serialNumber'] = serial_number
|
||||
payload['UUID'] = 0
|
||||
print(payload)
|
||||
uri = self.sdk_client.build_uri("device/" + serial_number + "/configure")
|
||||
basic_cfg_str = json.dumps(payload)
|
||||
resp = requests.post(uri, data=basic_cfg_str, headers=self.sdk_client.make_headers(), verify=False)
|
||||
self.sdk_client.check_response("POST", resp, self.sdk_client.make_headers(), basic_cfg_str, uri)
|
||||
print(resp)
|
||||
# uri = self.sdk_client.build_uri("device/" + serial_number + "/configure")
|
||||
# basic_cfg_str = json.dumps(payload)
|
||||
# resp = requests.post(uri, data=basic_cfg_str, headers=self.sdk_client.make_headers(), verify=False)
|
||||
# self.sdk_client.check_response("POST", resp, self.sdk_client.make_headers(), basic_cfg_str, uri)
|
||||
# print(resp)
|
||||
|
||||
|
||||
# UCENTRAL_BASE_CFG = {
|
||||
@@ -396,19 +424,19 @@ controller = {
|
||||
# "rf": {},
|
||||
# "radius": False
|
||||
# }
|
||||
# obj = UController(controller_data=controller)
|
||||
obj = UController(controller_data=controller)
|
||||
# # # print(obj.get_devices())
|
||||
# # # print(obj.get_device_uuid(serial_number="903cb3944873"))
|
||||
# # # obj.get_device_uuid(serial_number="c4411ef53f23")
|
||||
# profile_client = UProfileUtility(sdk_client=obj)
|
||||
# profile_client.set_radio_config()
|
||||
# profile_client.set_mode(mode="VLAN")
|
||||
# ssid_data = {"ssid_name": "ssid_wpa_test_3_vlan", "vlan": 100, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
# profile_client.add_ssid(ssid_data=ssid_data)
|
||||
# ssid_data = {"ssid_name": "ssid_wpa_test_4_vlan", "vlan": 100, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
# profile_client.add_ssid(ssid_data=ssid_data)
|
||||
profile_client = UProfileUtility(sdk_client=obj)
|
||||
profile_client.set_radio_config()
|
||||
profile_client.set_mode(mode="VLAN")
|
||||
ssid_data = {"ssid_name": "ssid_wpa_test_3_vlan", "vlan": 100, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
profile_client.add_ssid(ssid_data=ssid_data)
|
||||
ssid_data = {"ssid_name": "ssid_wpa_test_4_vlan", "vlan": 200, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
profile_client.add_ssid(ssid_data=ssid_data)
|
||||
# print(profile_client.base_profile_config)
|
||||
# profile_client.push_config(serial_number="903cb39d6918")
|
||||
profile_client.push_config(serial_number="903cb39d6918")
|
||||
# print(profile_client.base_profile_config)
|
||||
# equipments = obj.get_devices()
|
||||
# print(equipments)
|
||||
|
||||
Reference in New Issue
Block a user