Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LSO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
LSO
Commits
d1310d2e
Commit
d1310d2e
authored
1 year ago
by
Simone Spinelli
Committed by
Karel van Klink
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Adjusting tests to the latest modeling
parent
13f8f94e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!45
Migrate iptrunks ansible integration
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lso/routes/ip_trunk.py
+13
-4
13 additions, 4 deletions
lso/routes/ip_trunk.py
test/routes/test_ip_trunk.py
+43
-32
43 additions, 32 deletions
test/routes/test_ip_trunk.py
test/routes/test_router.py
+2
-0
2 additions, 0 deletions
test/routes/test_router.py
with
58 additions
and
36 deletions
lso/routes/ip_trunk.py
+
13
−
4
View file @
d1310d2e
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
test/routes/test_ip_trunk.py
+
43
−
32
View file @
d1310d2e
...
@@ -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
,
}
}
...
...
This diff is collapsed.
Click to expand it.
test/routes/test_router.py
+
2
−
0
View file @
d1310d2e
...
@@ -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
"
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment