コード例 #1
0
    def test_modify_config_for_non_sanity(self):
        """Modify configurations for Non-Sanity Test Cases

        Some non-sanity test cases need changes in default configuration. This
        test script modifies the  configuration files with required values so
        that all the test cases of non-sanity test suite can be verified
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)
        ret_codes = []

        print("Modifying configuration for all non-sanity test cases to pass")

        print("Enabling Ha service")
        ret_codes.append(
            self._magmad_util.config_ha_service(
                MagmadUtil.ha_service_cmds.ENABLE, ), )

        # It is assumed that oai-gtp_4.9-9_amd64.deb pkg is already installed
        print("Enabling IPv6 solicitation service")
        ret_codes.append(
            self._magmad_util.config_ipv6_solicitation(
                MagmadUtil.ipv6_config_cmds.ENABLE, ), )

        if 1 in ret_codes:
            print("Restarting services to apply configuration change")
            self._magmad_util.restart_all_services()
        else:
            print("No need to restart the services")
コード例 #2
0
    def test_modify_config_for_non_sanity(self):
        """Modify configurations for Non-Sanity Test Cases

        Some non-sanity test cases need changes in default configuration. This
        test script modifies the  configuration files with required values so
        that all the test cases of non-sanity test suite can be verified
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)
        ret_codes = []

        print("Modifying configuration for all non-sanity test cases to pass")

        print("Enabling Ha service")
        ret_codes.append(
            self._magmad_util.config_ha_service(
                MagmadUtil.ha_service_cmds.ENABLE, ), )

        print(
            "Modifying MME configuration for non-sanity test cases to pass", )
        self._magmad_util.update_mme_config_for_non_sanity(
            MagmadUtil.config_update_cmds.MODIFY, )

        print("Restarting services to apply configuration change")
        self._magmad_util.restart_all_services()
コード例 #3
0
ファイル: s1ap_wrapper.py プロジェクト: stjordanis/magma-1
    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()
コード例 #4
0
    def test_restore_config_after_non_sanity(self):
        """Restore configurations after Non-Sanity Test Cases Execution

        This test script restores the configuration to default values after
        non-sanity test case execution, if the config files have been modified
        using the test script s1aptests/test_modify_config_for_non_sanity.py
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)
        ret_codes = []

        print("Restoring configuration to default values")

        print("Disabling Ha service")
        ret_codes.append(
            self._magmad_util.config_ha_service(
                MagmadUtil.ha_service_cmds.DISABLE,
            ),
        )

        print("Disabling IPv6 solicitation service")
        ret_codes.append(
            self._magmad_util.config_ipv6_solicitation(
                MagmadUtil.ipv6_config_cmds.DISABLE,
            ),
        )

        if 1 in ret_codes:
            print("Restarting services to apply configuration change")
            self._magmad_util.restart_all_services()
        else:
            print("No need to restart the services")
コード例 #5
0
    def test_restore_config_after_non_sanity(self):
        """Restore configurations after Non-Sanity Test Cases Execution

        This test script restores the configuration to default values after
        non-sanity test case execution, if the config files have been modified
        using the test script s1aptests/test_modify_config_for_non_sanity.py
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)
        ret_codes = []

        print("Restoring configuration to default values")

        print("Disabling Ha service")
        ret_codes.append(
            self._magmad_util.config_ha_service(
                MagmadUtil.ha_service_cmds.DISABLE, ), )

        print(
            "Restoring MME configuration to default values using backup "
            "configuration file", )
        self._magmad_util.update_mme_config_for_non_sanity(
            MagmadUtil.config_update_cmds.RESTORE, )

        print("Restarting services to apply configuration change")
        self._magmad_util.restart_all_services()
コード例 #6
0
ファイル: s1ap_wrapper.py プロジェクト: rsarwad/magma
    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()
コード例 #7
0
    def test_modify_mme_config_for_sanity(self):
        """
        Some test cases need changes in default mme configuration. This test
        script modifies MME configuration with generic values so that all the
        test cases of sanity suite can be verified
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)

        print("Modifying MME configuration for all sanity test cases to pass")
        self._magmad_util.update_mme_config_for_sanity(
            MagmadUtil.config_update_cmds.MODIFY)

        print("Restarting services to apply configuration change")
        self._magmad_util.restart_all_services()
コード例 #8
0
    def test_restore_mme_config_after_sanity(self):
        """
        This test script restores the MME configuration to default values, if
        the config file mme.conf.template has been modified using the test
        script s1aptests/test_modify_mme_config_for_sanity.py
        """
        magmad_client = MagmadServiceGrpc()
        self._magmad_util = MagmadUtil(magmad_client)

        # Replace mme.conf.template with backup of this config file. Backup of
        # this config file with default values is created when running the
        # test script s1aptests/test_modify_mme_config_for_sanity.py
        print("Restoring MME configuration to default values using backup "
              "configuration file")
        self._magmad_util.update_mme_config_for_sanity(
            MagmadUtil.config_update_cmds.RESTORE)
コード例 #9
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()
コード例 #10
0
    def tearDown(self):
        """Cleanup after test case execution"""
        is_test_successful = s1ap_wrapper.TestWrapper.is_test_successful(self)
        print("************************* Sending SCTP SHUTDOWN")
        self._s1_util.issue_cmd(s1ap_types.tfwCmd.SCTP_SHUTDOWN_REQ, None)

        if not is_test_successful:
            print("************************* Cleaning up TFW")
            self._s1_util.issue_cmd(s1ap_types.tfwCmd.TFW_CLEANUP, None)
            self._s1_util.delete_ovs_flow_rules()

        self._s1_util.cleanup()
        if not is_test_successful:
            print("The test has failed. Restarting Sctpd for cleanup")
            magmad_client = MagmadServiceGrpc()
            magmad_util = MagmadUtil(magmad_client)
            magmad_util.restart_sctpd()
            magmad_util.print_redis_state()
コード例 #11
0
ファイル: s1ap_wrapper.py プロジェクト: tyree-z/magma
    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()