diff --git a/gso/oss-params-example.json b/gso/oss-params-example.json index 74d81cc9ddf2276ada1968af0f6146627fb5084d..51702b5963ec89b763a87022ea9a8d3aeb6f4a93 100644 --- a/gso/oss-params-example.json +++ b/gso/oss-params-example.json @@ -16,37 +16,37 @@ "password": "robot-user-password" }, "LO": { - "V4": {"containers": [], "networks": ["1.1.0.0/24"], "mask": 0}, - "V6": {"containers": [], "networks": ["dead:beef::/64"], "mask": 0}, - "domain_name": ".lo", + "V4": {"containers": [], "networks": ["10.255.255.0/26"], "mask": 32}, + "V6": {"containers": [], "networks": ["dead:beef::/80"], "mask": 128}, + "domain_name": ".geant.net", "dns_view": "default", "network_view": "default" }, "TRUNK": { - "V4": {"containers": ["1.1.1.0/24"], "networks": [], "mask": 31}, - "V6": {"containers": ["dead:beef::/64"], "networks": [], "mask": 126}, + "V4": {"containers": ["10.255.255.0/24", "10.255.254.0/24"], "networks": [], "mask": 31}, + "V6": {"containers": ["dead:beef::/64", "dead:beee::/64"], "networks": [], "mask": 126}, "domain_name": ".trunk", "dns_view": "default", "network_view": "default" }, "GEANT_IP": { - "V4": {"containers": ["1.1.2.0/24"], "networks": [], "mask": 31}, - "V6": {"containers": ["dead:beef::/64"], "networks": [], "mask": 126}, + "V4": {"containers": ["10.255.255.0/24", "10.255.254.0/24"], "networks": [], "mask": 31}, + "V6": {"containers": ["dead:beef::/64", "dead:beee::/64"], "networks": [], "mask": 126}, "domain_name": ".geantip", "dns_view": "default", "network_view": "default" }, "SI": { - "V4": {"containers": ["1.1.3.0/24"], "networks": [], "mask": 31}, - "V6": {"containers": ["dead:beef::/64"], "networks": [], "mask": 126}, - "domain_name": ".si", + "V4": {"containers": ["10.255.253.128/25"], "networks": [], "mask": 31}, + "V6": {"containers": [], "networks": [], "mask": 126}, + "domain_name": ".geantip", "dns_view": "default", "network_view": "default" }, "LT_IAS": { - "V4": {"containers": ["1.1.4.0/24"], "networks": [], "mask": 31}, - "V6": {"containers": ["dead:beef::/64"], "networks": [], "mask": 126}, - "domain_name": ".ltias", + "V4": {"containers": ["10.255.255.0/24"], "networks": [], "mask": 31}, + "V6": {"containers": ["dead:beef:cc::/48"], "networks": [], "mask": 126}, + "domain_name": ".geantip", "dns_view": "default", "network_view": "default" } diff --git a/test/api/test_subscriptions.py b/test/api/test_subscriptions.py index b4bad4e091301ccd644a417f9cf7391779d1d32a..37c74cd83bb24dfa32f338235983fb77ee7feee7 100644 --- a/test/api/test_subscriptions.py +++ b/test/api/test_subscriptions.py @@ -11,7 +11,7 @@ def test_router_subscriptions_endpoint_with_valid_api_key(test_client, nokia_rou nokia_router_subscription_factory(status=SubscriptionLifecycle.INITIAL) response = test_client.get( - ROUTER_SUBSCRIPTION_ENDPOINT, headers={"Authorization": "Bearer REALY_random_AND_3cure_T0keN"} + ROUTER_SUBSCRIPTION_ENDPOINT, headers={"Authorization": "Bearer another_REALY_random_AND_3cure_T0keN"} ) assert response.status_code == 200 diff --git a/test/conftest.py b/test/conftest.py index bc5dd61b0cddbf4c9652d1d6f41fdab34801a1ed..ed7459f9f4ec2386f75f85631837b085fdf0f537 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,9 +1,6 @@ import contextlib -import json import logging import os -import socket -import tempfile from pathlib import Path import orchestrator @@ -91,149 +88,14 @@ def faker() -> Faker: return fake -@pytest.fixture(scope="session") -def configuration_data() -> dict: - with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: - s.bind(("", 0)) - s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - yield { - "GENERAL": {"public_hostname": "https://orchestrator.dev.gap.geant.org", "isis_high_metric": 999999}, - "NETBOX": {"api": "https://127.0.0.1:8000", "token": "TOKEN"}, - "IPAM": { - "INFOBLOX": { - "scheme": "https", - "wapi_version": "2.12", - "host": "10.0.0.1", - "username": "robot-user", - "password": "robot-user-password", - }, - "LO": { - "V4": { - "containers": [], - "networks": ["10.255.255.0/26"], - "mask": 32, - }, - "V6": { - "containers": [], - "networks": ["dead:beef::/80"], - "mask": 128, - }, - "domain_name": ".geant.net", - "dns_view": "default", - "network_view": "default", - }, - "TRUNK": { - "V4": { - "containers": ["10.255.255.0/24", "10.255.254.0/24"], - "networks": [], - "mask": 31, - }, - "V6": { - "containers": ["dead:beef::/64", "dead:beee::/64"], - "networks": [], - "mask": 126, - }, - "domain_name": ".trunk", - "dns_view": "default", - "network_view": "default", - }, - "GEANT_IP": { - "V4": { - "containers": ["10.255.255.0/24", "10.255.254.0/24"], - "networks": [], - "mask": 31, - }, - "V6": { - "containers": ["dead:beef::/64", "dead:beee::/64"], - "networks": [], - "mask": 126, - }, - "domain_name": ".geantip", - "dns_view": "default", - "network_view": "default", - }, - "SI": { - "V4": { - "containers": ["10.255.253.128/25"], - "networks": [], - "mask": 31, - }, - "V6": {"containers": [], "networks": [], "mask": 126}, - "domain_name": ".geantip", - "dns_view": "default", - "network_view": "default", - }, - "LT_IAS": { - "V4": { - "containers": ["10.255.255.0/24"], - "networks": [], - "mask": 31, - }, - "V6": { - "containers": ["dead:beef:cc::/48"], - "networks": [], - "mask": 126, - }, - "domain_name": ".geantip", - "dns_view": "default", - "network_view": "default", - }, - }, - "MONITORING": { - "LIBRENMS": { - "base_url": "http://librenms", - "token": "secret-token", - }, - "SNMP": { - "v2c": { - "community": "fake-community", - }, - "v3": { - "authlevel": "AuthPriv", - "authname": "librenms", - "authpass": "<password1>", - "authalgo": "sha", - "cryptopass": "<password2>", - "cryptoalgo": "aes", - }, - }, - }, - "PROVISIONING_PROXY": { - "scheme": "https", - "api_base": "localhost:44444", - "auth": "Bearer <token>", - "api_version": 1123, - }, - "CELERY": { - "broker_url": "redis://localhost:6379", - "result_backend": "rpc://localhost:6379/0", - "result_expires": 3600, - }, - "THIRD_PARTY_API_KEYS": { - "AnsibleDynamicInventoryGenerator": "REALY_random_AND_3cure_T0keN", - "Application_2": "another_REALY_random_AND_3cure_T0keN", - }, - "EMAIL": { - "from_address": "noreply@nren.local", - "smtp_host": "smtp.nren.local", - "smtp_port": 487, - "starttls_enabled": True, - "smtp_username": "username", - "smtp_password": "password", - }, - } - - @pytest.fixture(scope="session", autouse=True) -def data_config_filename(configuration_data) -> str: - """Create a temporary file with configuration data and set an environment variable to its path.""" - with tempfile.NamedTemporaryFile(mode="w+", delete=False) as f: - json.dump(configuration_data, f, ensure_ascii=False) - os.environ["OSS_PARAMS_FILENAME"] = f.name +def data_config_filename() -> str: + """Set an environment variable to the path of the example OSS parameters file.""" + config_filename = "gso/oss-params-example.json" - yield f.name + os.environ["OSS_PARAMS_FILENAME"] = config_filename + yield config_filename del os.environ["OSS_PARAMS_FILENAME"] - Path(f.name).unlink() @pytest.fixture(scope="session")