Example #1
0
    def __init__(self):
        """
        Initialize the various classes required by the tests and setup.
        """
        self._s1_util = S1ApUtil()
        self._enBConfig()

        subscriber_client = SubscriberDbGrpc()
        mobility_client = MobilityServiceGrpc()
        magmad_client = MagmadServiceGrpc()
        self._sub_util = SubscriberUtil(subscriber_client)
        # Remove existing subscribers to start
        self._sub_util.cleanup()
        self._mobility_util = MobilityUtil(mobility_client)
        self._mobility_util.cleanup()
        self._magmad_util = MagmadUtil(magmad_client)
        # gateway tests don't require restart, just wait for healthy now
        self._gateway_services = GatewayServicesUtil()
        self.wait_gateway_healthy = True
        if not self.wait_gateway_healthy:
            self.init_s1ap_tester()

        self._configuredUes = []
        self._ue_idx = 0  # Index of UEs already used in test
        self._trf_util = TrafficUtil()
Example #2
0
class TestS1SetupFailureIncorrectPlmn(unittest.TestCase):
    """ S1 Setup with incorrect plmn ID """
    s1ap_utils._s1_util = S1ApUtil()
    print("************************* Enb tester config")
    req = s1ap_types.FwNbConfigReq_t()
    req.cellId_pr.pres = True
    req.cellId_pr.cell_id = 10
    req.plmnId_pr.pres = True
    req.plmnId_pr.plmn_id[0] = 3
    req.plmnId_pr.plmn_id[1] = 3
    req.plmnId_pr.plmn_id[2] = 3
    req.plmnId_pr.plmn_id[3] = 3
    req.plmnId_pr.plmn_id[4] = 3
    req.plmnId_pr.plmn_id[5] = 3
    assert (s1ap_utils._s1_util.issue_cmd(s1ap_types.tfwCmd.ENB_CONFIG,
                                          req) == 0)
    response = s1ap_utils._s1_util.get_response()
    assert (response.msg_type == s1ap_types.tfwCmd.ENB_CONFIG_CONFIRM.value)
    res = response.cast(s1ap_types.FwNbConfigCfm_t)
    assert (res.status == s1ap_types.CfgStatus.CFG_DONE.value)

    assert (s1ap_utils._s1_util.issue_cmd(s1ap_types.tfwCmd.ENB_S1_SETUP_REQ,
                                          req) == 0)
    response = s1ap_utils._s1_util.get_response()
    assert (response.msg_type == s1ap_types.tfwCmd.ENB_S1_SETUP_RESP.value)
Example #3
0
    def __init__(
        self,
        stateless_mode=MagmadUtil.stateless_cmds.ENABLE,
        apn_correction=MagmadUtil.apn_correction_cmds.DISABLE,
        health_service=MagmadUtil.health_service_cmds.DISABLE,
        federated_mode=False,
        ip_version=4,
    ):
        """
        Initialize the various classes required by the tests and setup.
        """
        t = time.localtime()
        current_time = time.strftime("%H:%M:%S", t)
        if TestWrapper.TEST_CASE_EXECUTION_COUNT != 0:
            print("\n**Running the test case again to identify flaky behavior")
        TestWrapper.TEST_CASE_EXECUTION_COUNT += 1
        print(
            "\nTest Case Execution Count:",
            TestWrapper.TEST_CASE_EXECUTION_COUNT,
            "[Start time: " + str(current_time) + "]",
        )

        self._s1_util = S1ApUtil()
        self._enBConfig(ip_version)

        federated_mode = (os.environ.get("FEDERATED_MODE") == "True")
        print(
            f"\n *** Running the test in {'Non-' if not federated_mode else ''}"
            "Federated Mode\n", )

        if self._test_oai_upstream:
            subscriber_client = SubscriberDbCassandra()
            self.wait_gateway_healthy = False
        elif federated_mode:
            subscriber_client = HSSGrpc()
            self.wait_gateway_healthy = True
        else:
            subscriber_client = SubscriberDbGrpc()
            self.wait_gateway_healthy = True

        mobility_client = MobilityServiceGrpc()
        magmad_client = MagmadServiceGrpc()
        self._sub_util = SubscriberUtil(subscriber_client)
        # Remove existing subscribers to start
        self._sub_util.cleanup()
        self._mobility_util = MobilityUtil(mobility_client)
        self._mobility_util.cleanup()
        self._magmad_util = MagmadUtil(magmad_client)
        self._magmad_util.config_stateless(stateless_mode)
        self._magmad_util.config_apn_correction(apn_correction)
        self._magmad_util.config_health_service(health_service)
        # gateway tests don't require restart, just wait for healthy now
        self._gateway_services = GatewayServicesUtil()
        if not self.wait_gateway_healthy:
            self.init_s1ap_tester()

        self._configuredUes = []
        self._ue_idx = 0  # Index of UEs already used in test
        self._trf_util = TrafficUtil()
Example #4
0
 def setUp(self):
     """Initialize before test case execution"""
     if s1ap_wrapper.TestWrapper.TEST_CASE_EXECUTION_COUNT != 0:
         print("\n**Running the test case again to identify flaky behavior")
     s1ap_wrapper.TestWrapper.TEST_CASE_EXECUTION_COUNT += 1
     print(
         "Test Case Execution Count:",
         s1ap_wrapper.TestWrapper.TEST_CASE_EXECUTION_COUNT,
     )
     self._s1_util = S1ApUtil()
Example #5
0
    def __init__(
        self,
        stateless_mode=MagmadUtil.stateless_cmds.ENABLE,
        apn_correction=MagmadUtil.apn_correction_cmds.DISABLE,
        health_service=MagmadUtil.health_service_cmds.DISABLE,
    ):
        """
        Initialize the various classes required by the tests and setup.
        """
        if not TestWrapper.IS_TEST_RUNNING_FIRST_TIME:
            print("\n**Running the test case again to identify flaky behavior")

        TestWrapper.IS_TEST_RUNNING_FIRST_TIME = False
        t = time.localtime()
        current_time = time.strftime("%H:%M:%S", t)
        print("Start time", current_time)
        self._s1_util = S1ApUtil()
        self._enBConfig()

        if self._test_oai_upstream:
            subscriber_client = SubscriberDbCassandra()
            self.wait_gateway_healthy = False
        else:
            subscriber_client = SubscriberDbGrpc()
            self.wait_gateway_healthy = True

        mobility_client = MobilityServiceGrpc()
        magmad_client = MagmadServiceGrpc()
        self._sub_util = SubscriberUtil(subscriber_client)
        # Remove existing subscribers to start
        self._sub_util.cleanup()
        self._mobility_util = MobilityUtil(mobility_client)
        self._mobility_util.cleanup()
        self._magmad_util = MagmadUtil(magmad_client)
        self._magmad_util.config_stateless(stateless_mode)
        self._magmad_util.config_apn_correction(apn_correction)
        self._magmad_util.config_health_service(health_service)
        # gateway tests don't require restart, just wait for healthy now
        self._gateway_services = GatewayServicesUtil()
        if not self.wait_gateway_healthy:
            self.init_s1ap_tester()

        self._configuredUes = []
        self._ue_idx = 0  # Index of UEs already used in test
        self._trf_util = TrafficUtil()
Example #6
0
    def __init__(self):
        """
        Initialize the various classes required by the tests and setup.
        """
        self._s1_util = S1ApUtil()
        self._enBConfig()

        # if self._test_cloud:
        #    self._cloud_manager = CloudManager()
        #    self._cloud_manager.clean_up()
        #    subscriber_client = SubscriberDbRest(self._cloud_manager)
        #    mobility_client = MobilityServiceRest(self._cloud_manager,
        #                                          self._gateway_services)
        #    self._sub_util = SubscriberUtil(subscriber_client)
        #    self._mobility_util = MobilityUtil(mobility_client)
        #    self._gateway_services = GatewayServicesUtil()
        #    self.wait_gateway_healthy = False
        if self._test_oai_upstream:
            subscriber_client = SubscriberDbMySQL()
            mobility_client = MobilityServiceOAI()
            self._sub_util = SubscriberUtil(subscriber_client)
            self._mobility_util = MobilityUtil(mobility_client)
            self.wait_gateway_healthy = False
        else:
            subscriber_client = SubscriberDbGrpc()
            mobility_client = MobilityServiceGrpc()
            self._sub_util = SubscriberUtil(subscriber_client)
            # Remove existing subscribers to start
            self._sub_util.clean_up()
            self._mobility_util = MobilityUtil(mobility_client)
            # gateway tests don't require restart, just wait for healthy now
            self._gateway_services = GatewayServicesUtil()
            self.wait_gateway_healthy = True
        if not self.wait_gateway_healthy:
            self.init_s1ap_tester()

        self._configuredUes = []
        self._ue_idx = 0  # Index of UEs already used in test
        self._trf_util = TrafficUtil()
Example #7
0
class TestS1SetupFailureIncorrectTac(unittest.TestCase):
    """S1 Setup Request with incorrect TAC value """
    s1ap_utils._s1_util = S1ApUtil()
    print("************************* Enb tester config")
    req = s1ap_types.FwNbConfigReq_t()
    req.cellId_pr.pres = True
    req.cellId_pr.cell_id = 10
    req.tac_pr.pres = True
    req.tac_pr.tac = 0

    assert (s1ap_utils._s1_util.issue_cmd(s1ap_types.tfwCmd.ENB_CONFIG,
                                          req) == 0)
    response = s1ap_utils._s1_util.get_response()
    assert (response.msg_type == s1ap_types.tfwCmd.ENB_CONFIG_CONFIRM.value)
    res = response.cast(s1ap_types.FwNbConfigCfm_t)
    assert (res.status == s1ap_types.CfgStatus.CFG_DONE.value)

    req = None
    assert (s1ap_utils._s1_util.issue_cmd(s1ap_types.tfwCmd.ENB_S1_SETUP_REQ,
                                          req) == 0)
    response = s1ap_utils._s1_util.get_response()
    assert (response.msg_type == s1ap_types.tfwCmd.ENB_S1_SETUP_RESP.value)
Example #8
0
    def __init__(
        self,
        stateless_mode=MagmadUtil.stateless_cmds.DISABLE,
        apn_correction=MagmadUtil.apn_correction_cmds.DISABLE,
    ):
        """
        Initialize the various classes required by the tests and setup.
        """
        self._s1_util = S1ApUtil()
        self._enBConfig()

        if self._test_oai_upstream:
            subscriber_client = SubscriberDbCassandra()
            self.wait_gateway_healthy = False
        else:
            subscriber_client = SubscriberDbGrpc()
            self.wait_gateway_healthy = True

        mobility_client = MobilityServiceGrpc()
        magmad_client = MagmadServiceGrpc()
        self._sub_util = SubscriberUtil(subscriber_client)
        # Remove existing subscribers to start
        self._sub_util.cleanup()
        self._mobility_util = MobilityUtil(mobility_client)
        self._mobility_util.cleanup()
        self._magmad_util = MagmadUtil(magmad_client)
        self._magmad_util.config_stateless(stateless_mode)
        self._magmad_util.config_apn_correction(apn_correction)
        # gateway tests don't require restart, just wait for healthy now
        self._gateway_services = GatewayServicesUtil()
        if not self.wait_gateway_healthy:
            self.init_s1ap_tester()

        self._configuredUes = []
        self._ue_idx = 0  # Index of UEs already used in test
        self._trf_util = TrafficUtil()
Example #9
0
 def setUp(self):
     self._s1_util = S1ApUtil()
Example #10
0
 def setUp(self):
     """Initialize before test case execution"""
     if not s1ap_wrapper.TestWrapper.IS_TEST_RUNNING_FIRST_TIME:
         print("\n**Running the test case again to identify flaky behavior")
     s1ap_wrapper.TestWrapper.IS_TEST_RUNNING_FIRST_TIME = False
     self._s1_util = S1ApUtil()