diff --git a/src/tests/tools/mock_nbi_dependencies/Config.py b/src/tests/tools/mock_nbi_dependencies/Config.py index 516a58d15315ea0f680cc4801e46b93c6f45b2b6..621bc31872747ca09ca5814d2a40e256809aa876 100644 --- a/src/tests/tools/mock_nbi_dependencies/Config.py +++ b/src/tests/tools/mock_nbi_dependencies/Config.py @@ -12,8 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -from common.Settings import get_log_level, get_setting +import os +from common.Constants import ServiceNameEnum +from common.Settings import ( + ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, + get_env_var_name, get_log_level, get_setting +) + +LOCAL_HOST = '127.0.0.1' +MOCK_PORT = 10000 BIND_ADDRESS = str(get_setting('BIND_ADDRESS', default='0.0.0.0')) -BIND_PORT = int(get_setting('BIND_PORT', default=10000 )) +BIND_PORT = int(get_setting('BIND_PORT', default=MOCK_PORT)) LOG_LEVEL = str(get_log_level()) + +MOCKED_SERVICES = [ + ServiceNameEnum.CONTEXT, + ServiceNameEnum.DEVICE, + ServiceNameEnum.SERVICE, + ServiceNameEnum.SLICE, +] +for mocked_service in MOCKED_SERVICES: + os.environ[get_env_var_name(mocked_service, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) + os.environ[get_env_var_name(mocked_service, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(BIND_PORT )