Skip to content
Snippets Groups Projects
Commit d1310d2e authored by Simone Spinelli's avatar Simone Spinelli Committed by Karel van Klink
Browse files

Adjusting tests to the latest modeling

parent 13f8f94e
Branches
Tags
1 merge request!45Migrate iptrunks ansible integration
...@@ -56,6 +56,7 @@ class IPTrunkMigrationParams(IPTrunkParams): ...@@ -56,6 +56,7 @@ class IPTrunkMigrationParams(IPTrunkParams):
verb: str verb: str
config_object: str config_object: str
class IPTrunkCheckParams(IPTrunkParams): class IPTrunkCheckParams(IPTrunkParams):
"""Additional parameters for checking an IPtrunk.""" """Additional parameters for checking an IPtrunk."""
...@@ -88,7 +89,9 @@ def provision_ip_trunk(params: IPTrunkProvisioningParams) -> PlaybookLaunchRespo ...@@ -88,7 +89,9 @@ def provision_ip_trunk(params: IPTrunkProvisioningParams) -> PlaybookLaunchRespo
"dry_run": str(params.dry_run), "dry_run": str(params.dry_run),
"verb": "deploy", "verb": "deploy",
"config_object": params.object, "config_object": params.object,
"commit_comment": f"GSO_PROCESS_ID: {params.process_id} - TT_NUMBER: {params.tt_number} - Deploy config for {params.subscription['iptrunk']['geant_s_sid']} ", "commit_comment": f"GSO_PROCESS_ID: {params.process_id} "
f"- TT_NUMBER: {params.tt_number}"
f"- Deploy config for {params.subscription['iptrunk']['geant_s_sid']} ",
} }
return run_playbook( return run_playbook(
...@@ -118,7 +121,9 @@ def modify_ip_trunk(params: IPTrunkModifyParams) -> PlaybookLaunchResponse: ...@@ -118,7 +121,9 @@ def modify_ip_trunk(params: IPTrunkModifyParams) -> PlaybookLaunchResponse:
"old_wfo_trunk_json": params.old_subscription, "old_wfo_trunk_json": params.old_subscription,
"dry_run": str(params.dry_run), "dry_run": str(params.dry_run),
"verb": "modify", "verb": "modify",
"commit_comment": f"GSO_PROCESS_ID: {params.process_id} - TT_NUMBER: {params.tt_number} - Modify config for {params.subscription['iptrunk']['geant_s_sid']} ", "commit_comment": f"GSO_PROCESS_ID: {params.process_id} "
f"- TT_NUMBER: {params.tt_number}"
f"- Modify config for {params.subscription['iptrunk']['geant_s_sid']} ",
} }
return run_playbook( return run_playbook(
...@@ -149,7 +154,9 @@ def delete_ip_trunk(params: IPTrunkDeleteParams) -> PlaybookLaunchResponse: ...@@ -149,7 +154,9 @@ def delete_ip_trunk(params: IPTrunkDeleteParams) -> PlaybookLaunchResponse:
"dry_run": str(params.dry_run), "dry_run": str(params.dry_run),
"verb": "terminate", "verb": "terminate",
"config_object": "trunk_deprovision", "config_object": "trunk_deprovision",
"commit_comment": f"GSO_PROCESS_ID: {params.process_id} - TT_NUMBER: {params.tt_number} - Remove config for {params.subscription['iptrunk']['geant_s_sid']} ", "commit_comment": f"GSO_PROCESS_ID: {params.process_id} "
f"- TT_NUMBER: {params.tt_number}"
f"- Remove config for {params.subscription['iptrunk']['geant_s_sid']} ",
} }
return run_playbook( return run_playbook(
...@@ -207,7 +214,9 @@ def migrate_ip_trunk(params: IPTrunkMigrationParams) -> PlaybookLaunchResponse: ...@@ -207,7 +214,9 @@ def migrate_ip_trunk(params: IPTrunkMigrationParams) -> PlaybookLaunchResponse:
"verb": params.verb, "verb": params.verb,
"config_object": params.config_object, "config_object": params.config_object,
"dry_run": str(params.dry_run), "dry_run": str(params.dry_run),
"commit_comment": f"GSO_PROCESS_ID: {params.process_id} - TT_NUMBER: {params.tt_number} - Migrating - {params.verb} - {params.subscription['iptrunk']['geant_s_sid']} ", "commit_comment": f"GSO_PROCESS_ID: {params.process_id} "
f"- TT_NUMBER: {params.tt_number}"
f"- Deploy config for {params.subscription['iptrunk']['geant_s_sid']} ",
} }
return run_playbook( return run_playbook(
......
...@@ -109,38 +109,35 @@ _SUBSCRIPTION_OBJECT = { ...@@ -109,38 +109,35 @@ _SUBSCRIPTION_OBJECT = {
_MIGRATION_OBJECT = { _MIGRATION_OBJECT = {
"new_node": { "new_node": {
"name": "RouterBlock", "description": "Router rt1.luc.it.geant.net",
"label": None, "router": {
"router_fqdn": "rt2.city.country.geant.net", "router_access_via_ts": "true",
"router_role": "p", "router_fqdn": "rt1.luc.it.geant.net",
"router_site": { "router_role": "pe",
"name": "SiteBlock", "router_is_ias_connected": "false",
"label": None, "router_lo_ipv4_address": "62.40.96.7",
"site_city": "City", "router_lo_ipv6_address": "2001:798:aa:1::49",
"site_name": "city", "router_lo_iso_address": "49.51e5.0001.0620.4009.6007.00",
"site_tier": "1", "router_site": {
"site_country": "Country", "name": "SiteBlock",
"site_latitude": 1, "label": "null",
"site_longitude": 1, "site_city": "Lucca",
"site_ts_address": "0.0.0.0", "site_name": "luc",
"site_internal_id": 2, "site_tier": "1",
"site_country_code": "country", "site_country": "Italy",
"owner_subscription_id": "93cba8dc-7424-44c0-8872-13159df93042", "site_latitude": "10.0",
"site_bgp_community_id": 2, "site_longitude": "43.0",
"subscription_instance_id": "6bf4f274-6496-438d-9dba-9c3984d0ec07", "site_ts_address": "172.16.100.151",
"site_internal_id": 133,
"site_country_code": "IT",
"owner_subscription_id": "f4bacf38-39bb-4553-8e74-190699bd9b4e",
"site_bgp_community_id": 33,
"subscription_instance_id": "2cf443a2-4039-4402-ab75-73ff1a1096f5",
},
"router_ts_port": 22111,
"router_vendor": "juniper",
}, },
"router_vendor": "juniper", "status": "provisioning",
"router_ts_port": 11111,
"router_access_via_ts": True,
"owner_subscription_id": "9cb1fc7d-9608-42ce-aacc-2a97f9620a91",
"router_lo_iso_address": "49.51e5.0001.0620.4009.6066.00",
"router_lo_ipv4_address": "0.0.0.0",
"router_lo_ipv6_address": "::",
"router_si_ipv4_network": "0.0.0.0/31",
"router_is_ias_connected": True,
"subscription_instance_id": "6d09394e-658b-4e55-8b1f-8b812d59f5a1",
"router_ias_lt_ipv4_network": "0.0.0.0/31",
"router_ias_lt_ipv6_network": "::/126",
}, },
"new_lag_interface": "ae1", "new_lag_interface": "ae1",
"new_lag_member_interfaces": ["ge-0/0/0", "ge-0/0/1"], "new_lag_member_interfaces": ["ge-0/0/0", "ge-0/0/1"],
...@@ -154,6 +151,8 @@ def test_ip_trunk_provisioning(client: TestClient) -> None: ...@@ -154,6 +151,8 @@ def test_ip_trunk_provisioning(client: TestClient) -> None:
params = { params = {
"callback": TEST_CALLBACK_URL, "callback": TEST_CALLBACK_URL,
"process_id": "cb5f6c71-63d7-4857-9124-4fc6e7ef3f41",
"tt_number": "TT123456789",
"dry_run": True, "dry_run": True,
"object": "trunk_interface", "object": "trunk_interface",
"verb": "deploy", "verb": "deploy",
...@@ -179,6 +178,8 @@ def test_ip_trunk_modification(client: TestClient) -> None: ...@@ -179,6 +178,8 @@ def test_ip_trunk_modification(client: TestClient) -> None:
params = { params = {
"callback": TEST_CALLBACK_URL, "callback": TEST_CALLBACK_URL,
"process_id": "cb5f6c71-63d7-4857-9124-4fc6e7ef3f41",
"tt_number": "TT123456789",
"dry_run": True, "dry_run": True,
"verb": "modify", "verb": "modify",
"subscription": _SUBSCRIPTION_OBJECT, "subscription": _SUBSCRIPTION_OBJECT,
...@@ -202,7 +203,14 @@ def test_ip_trunk_modification(client: TestClient) -> None: ...@@ -202,7 +203,14 @@ def test_ip_trunk_modification(client: TestClient) -> None:
def test_ip_trunk_deletion(client: TestClient) -> None: def test_ip_trunk_deletion(client: TestClient) -> None:
responses.put(url=TEST_CALLBACK_URL, status=204) responses.put(url=TEST_CALLBACK_URL, status=204)
params = {"callback": TEST_CALLBACK_URL, "dry_run": True, "verb": "terminate", "subscription": _SUBSCRIPTION_OBJECT} params = {
"callback": TEST_CALLBACK_URL,
"process_id": "cb5f6c71-63d7-4857-9124-4fc6e7ef3f41",
"tt_number": "TT123456789",
"dry_run": True,
"verb": "terminate",
"subscription": _SUBSCRIPTION_OBJECT,
}
with patch("lso.playbook.ansible_runner.run", new=test_ansible_runner_run) as _: with patch("lso.playbook.ansible_runner.run", new=test_ansible_runner_run) as _:
rv = client.request(url="/api/ip_trunk/", method=responses.DELETE, json=params) rv = client.request(url="/api/ip_trunk/", method=responses.DELETE, json=params)
...@@ -224,7 +232,10 @@ def test_ip_trunk_migration(client: TestClient) -> None: ...@@ -224,7 +232,10 @@ def test_ip_trunk_migration(client: TestClient) -> None:
params = { params = {
"callback": TEST_CALLBACK_URL, "callback": TEST_CALLBACK_URL,
"dry_run": True, "dry_run": True,
"process_id": "cb5f6c71-63d7-4857-9124-4fc6e7ef3f41",
"tt_number": "TT123456789",
"verb": "migrate", "verb": "migrate",
"config_object": "trunk_interface",
"subscription": _SUBSCRIPTION_OBJECT, "subscription": _SUBSCRIPTION_OBJECT,
"new_side": _MIGRATION_OBJECT, "new_side": _MIGRATION_OBJECT,
} }
......
...@@ -16,6 +16,8 @@ def test_router_provisioning(client: TestClient) -> None: ...@@ -16,6 +16,8 @@ def test_router_provisioning(client: TestClient) -> None:
params = { params = {
"callback": TEST_CALLBACK_URL, "callback": TEST_CALLBACK_URL,
"dry_run": True, "dry_run": True,
"process_id": "cb5f6c71-63d7-4857-9124-4fc6e7ef3f41",
"tt_number": "TT123456789",
"verb": "deploy", "verb": "deploy",
"subscription": { "subscription": {
"router": { "router": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment