class TestModifyConfigForNonSanity(unittest.TestCase):
    """Unittest: TestModifyConfigForNonSanity"""
    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")
class TestRestoreConfigAfterNonSanity(unittest.TestCase):
    """Unittest: TestRestoreConfigAfterNonSanity"""

    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")
Пример #3
0
class TestModifyConfigForNonSanity(unittest.TestCase):
    """Unittest: TestModifyConfigForNonSanity"""
    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()
class TestRestoreConfigAfterNonSanity(unittest.TestCase):
    """Unittest: TestRestoreConfigAfterNonSanity"""
    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()