mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-11-03 20:38:05 +00:00 
			
		
		
		
	Did improvements in imports and added device check in gateway
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
		@@ -13,7 +13,6 @@ import allure
 | 
				
			|||||||
import requests
 | 
					import requests
 | 
				
			||||||
from operator import itemgetter
 | 
					from operator import itemgetter
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
from configuration import open_flow
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from requests.adapters import HTTPAdapter
 | 
					from requests.adapters import HTTPAdapter
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
@@ -171,7 +170,6 @@ class Controller(ConfigureController):
 | 
				
			|||||||
    def get_device_by_serial_number(self, serial_number=None):
 | 
					    def get_device_by_serial_number(self, serial_number=None):
 | 
				
			||||||
        uri = self.build_uri("device/" + serial_number)
 | 
					        uri = self.build_uri("device/" + serial_number)
 | 
				
			||||||
        resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
 | 
					        resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
 | 
				
			||||||
        self.check_response("GET", resp, self.make_headers(), "", uri)
 | 
					 | 
				
			||||||
        device = resp.json()
 | 
					        device = resp.json()
 | 
				
			||||||
        # resp.close()()
 | 
					        # resp.close()()
 | 
				
			||||||
        return device
 | 
					        return device
 | 
				
			||||||
@@ -386,7 +384,7 @@ class UProfileUtility:
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        self.mode = None
 | 
					        self.mode = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_express_wifi(self):
 | 
					    def set_express_wifi(self, open_flow=None):
 | 
				
			||||||
        if self.mode == "NAT":
 | 
					        if self.mode == "NAT":
 | 
				
			||||||
            self.base_profile_config["interfaces"][0]["services"] = ["lldp", "ssh"]
 | 
					            self.base_profile_config["interfaces"][0]["services"] = ["lldp", "ssh"]
 | 
				
			||||||
            self.base_profile_config["interfaces"][1]["services"] = ["ssh", "lldp", "open-flow"]
 | 
					            self.base_profile_config["interfaces"][1]["services"] = ["ssh", "lldp", "open-flow"]
 | 
				
			||||||
@@ -583,10 +581,10 @@ if __name__ == '__main__':
 | 
				
			|||||||
    controller = {
 | 
					    controller = {
 | 
				
			||||||
        'url': 'https://sec-qa01.cicd.lab.wlan.tip.build:16001',  # API base url for the controller
 | 
					        'url': 'https://sec-qa01.cicd.lab.wlan.tip.build:16001',  # API base url for the controller
 | 
				
			||||||
        'username': "tip@ucentral.com",
 | 
					        'username': "tip@ucentral.com",
 | 
				
			||||||
        'password': 'openwifi',
 | 
					        'password': 'OpenWifi%123',
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    obj = Controller(controller_data=controller)
 | 
					    obj = Controller(controller_data=controller)
 | 
				
			||||||
    print(obj.get_system_fms())
 | 
					    print(obj.get_device_by_serial_number(serial_number="903cb36ae224"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # fms = FMSUtils(sdk_client=obj)
 | 
					    # fms = FMSUtils(sdk_client=obj)
 | 
				
			||||||
    # new = fms.get_firmwares(model='ecw5410')
 | 
					    # new = fms.get_firmwares(model='ecw5410')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,6 +47,7 @@ import pytest
 | 
				
			|||||||
from lanforge.lf_tests import RunTest
 | 
					from lanforge.lf_tests import RunTest
 | 
				
			||||||
from cv_test_manager import cv_test
 | 
					from cv_test_manager import cv_test
 | 
				
			||||||
from configuration import CONFIGURATION
 | 
					from configuration import CONFIGURATION
 | 
				
			||||||
 | 
					from configuration import open_flow
 | 
				
			||||||
from configuration import RADIUS_SERVER_DATA
 | 
					from configuration import RADIUS_SERVER_DATA
 | 
				
			||||||
from configuration import RADIUS_ACCOUNTING_DATA
 | 
					from configuration import RADIUS_ACCOUNTING_DATA
 | 
				
			||||||
from lanforge.scp_util import SCP_File
 | 
					from lanforge.scp_util import SCP_File
 | 
				
			||||||
@@ -274,6 +275,10 @@ def get_uci_show(fixtures_ver, get_apnos, get_configuration):
 | 
				
			|||||||
def skip_lf(request):
 | 
					def skip_lf(request):
 | 
				
			||||||
    yield request.config.getoption("--skip-lanforge")
 | 
					    yield request.config.getoption("--skip-lanforge")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@pytest.fixture(scope="session")
 | 
				
			||||||
 | 
					def get_openflow():
 | 
				
			||||||
 | 
					    yield open_flow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Controller Fixture
 | 
					# Controller Fixture
 | 
				
			||||||
@pytest.fixture(scope="session")
 | 
					@pytest.fixture(scope="session")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -196,7 +196,7 @@ def setup_vlan():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture(scope="class")
 | 
					@pytest.fixture(scope="class")
 | 
				
			||||||
def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, skip_lf,
 | 
					def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, skip_lf, get_openflow,
 | 
				
			||||||
                   instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
					                   instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
				
			||||||
                   get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info):
 | 
					                   get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -229,7 +229,7 @@ def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtur
 | 
				
			|||||||
                                             instantiate_profile,
 | 
					                                             instantiate_profile,
 | 
				
			||||||
                                             get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
					                                             get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
				
			||||||
                                             get_security_flags, get_configuration, radius_info, get_apnos,
 | 
					                                             get_security_flags, get_configuration, radius_info, get_apnos,
 | 
				
			||||||
                                             radius_accounting_info, skip_lf=skip_lf)
 | 
					                                             radius_accounting_info, skip_lf=skip_lf, open_flow=get_openflow)
 | 
				
			||||||
    yield return_var
 | 
					    yield return_var
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -358,7 +358,7 @@ class Fixtures_2x:
 | 
				
			|||||||
    def setup_profiles(self, request, param, setup_controller, testbed, get_equipment_ref,
 | 
					    def setup_profiles(self, request, param, setup_controller, testbed, get_equipment_ref,
 | 
				
			||||||
                       instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
					                       instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
 | 
				
			||||||
                       get_security_flags, get_configuration, radius_info, get_apnos,
 | 
					                       get_security_flags, get_configuration, radius_info, get_apnos,
 | 
				
			||||||
                       radius_accounting_info, skip_lf=False):
 | 
					                       radius_accounting_info, skip_lf=False, open_flow=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        instantiate_profile_obj = instantiate_profile(sdk_client=setup_controller)
 | 
					        instantiate_profile_obj = instantiate_profile(sdk_client=setup_controller)
 | 
				
			||||||
        print(1, instantiate_profile_obj.sdk_client)
 | 
					        print(1, instantiate_profile_obj.sdk_client)
 | 
				
			||||||
@@ -544,8 +544,8 @@ class Fixtures_2x:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            if parameter['express-wifi']:
 | 
					            if parameter['express-wifi']:
 | 
				
			||||||
                instantiate_profile_obj.set_express_wifi()
 | 
					                instantiate_profile_obj.set_express_wifi(open_flow=open_flow)
 | 
				
			||||||
        except:
 | 
					        except Exception as e:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="2.x")
 | 
					        ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="2.x")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,12 +142,22 @@ class TestResources(object):
 | 
				
			|||||||
        allure.attach(name="Exoected SDK: ", body=str(expected_sdk))
 | 
					        allure.attach(name="Exoected SDK: ", body=str(expected_sdk))
 | 
				
			||||||
        print("SDK On AP: ", str(get_uci_show.split("=")[1]))
 | 
					        print("SDK On AP: ", str(get_uci_show.split("=")[1]))
 | 
				
			||||||
        allure.attach(name="SDK Pointed by AP: ", body=str(get_uci_show.split("=")[1]))
 | 
					        allure.attach(name="SDK Pointed by AP: ", body=str(get_uci_show.split("=")[1]))
 | 
				
			||||||
 | 
					        for ap in get_configuration["access_point"]:
 | 
				
			||||||
 | 
					            out = setup_controller.get_device_by_serial_number(serial_number=ap["serial"])
 | 
				
			||||||
 | 
					            if "ErrorCode" in out.keys():
 | 
				
			||||||
 | 
					                print(out)
 | 
				
			||||||
 | 
					                allure.attach(name="Error Device not found in Gateway: ", body=str(out))
 | 
				
			||||||
 | 
					                pytest.exit("Error Device not found in Gateway:")
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                print(out)
 | 
				
			||||||
 | 
					                allure.attach(name="Device is available in Gateway: ", body=str(out))
 | 
				
			||||||
        if expected_sdk not in get_uci_show:
 | 
					        if expected_sdk not in get_uci_show:
 | 
				
			||||||
            pytest.exit("AP has invalid Redirector")
 | 
					            pytest.exit("AP has invalid Redirector")
 | 
				
			||||||
        if test_ap_connection_status[0] == 0:
 | 
					        if test_ap_connection_status[0] == 0:
 | 
				
			||||||
            pytest.exit("AP in Disconnected State")
 | 
					            pytest.exit("AP in Disconnected State")
 | 
				
			||||||
        assert False not in data
 | 
					        assert False not in data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @pytest.mark.traffic_generator_connectivity
 | 
					    @pytest.mark.traffic_generator_connectivity
 | 
				
			||||||
    @allure.testcase(name="test_traffic_generator_connectivity", url="")
 | 
					    @allure.testcase(name="test_traffic_generator_connectivity", url="")
 | 
				
			||||||
    def test_traffic_generator_connectivity(self, traffic_generator_connectivity):
 | 
					    def test_traffic_generator_connectivity(self, traffic_generator_connectivity):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user