Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
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
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
4ef56d26
Commit
4ef56d26
authored
1 year ago
by
Karel van Klink
Committed by
Aleksandr Kurbatov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Update IPtrunk migration IPAM step behaviour
parent
aaed503e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!173
Update IPtrunk migration IPAM step behaviour
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/iptrunk/migrate_iptrunk.py
+6
-7
6 additions, 7 deletions
gso/workflows/iptrunk/migrate_iptrunk.py
test/workflows/iptrunk/test_migrate_iptrunk.py
+3
-9
3 additions, 9 deletions
test/workflows/iptrunk/test_migrate_iptrunk.py
with
9 additions
and
16 deletions
gso/workflows/iptrunk/migrate_iptrunk.py
+
6
−
7
View file @
4ef56d26
...
...
@@ -542,26 +542,25 @@ def delete_old_config_real(
@step
(
"
Update IP records in IPAM
"
)
def
update_ipam
(
subscription
:
Iptrunk
,
old_side_data
:
dic
t
,
new_node
:
Router
,
new_lag_interface
:
str
)
->
State
:
def
update_ipam
(
subscription
:
Iptrunk
,
replace_index
:
in
t
,
new_node
:
Router
,
new_lag_interface
:
str
)
->
State
:
"""
Update :term:`IPAM` resources.
Move the DNS record pointing to the old side of the trunk, to the new side.
"""
old_fqdn
=
f
"
{
old_side_data
[
'
iptrunk_side_ae_iface
'
]
}
.
{
old_side_data
[
'
iptrunk_side_node
'
][
'
router_fqdn
'
]
}
"
trunk_v4
=
infoblox
.
find_host_by_fqdn
(
old_fqdn
)
trunk_v6
=
infoblox
.
find_v6_host_by_fqdn
(
old_fqdn
)
v4_addr
=
subscription
.
iptrunk
.
iptrunk_ipv4_network
[
replace_index
]
v6_addr
=
subscription
.
iptrunk
.
iptrunk_ipv6_network
[
replace_index
]
# Out with the old
try
:
infoblox
.
delete_host_by_
fqdn
(
old_fqdn
)
infoblox
.
delete_host_by_
ip
(
subscription
.
iptrunk
.
iptrunk_ipv4_network
[
replace_index
]
)
except
DeletionError
as
e
:
msg
=
"
Failed to delete record from Infoblox.
"
raise
ProcessFailureError
(
msg
)
from
e
# And in with the new
new_fqdn
=
f
"
{
new_lag_interface
}
.
{
new_node
.
router
.
router_fqdn
}
"
new_fqdn
=
f
"
{
new_lag_interface
}
-0
.
{
new_node
.
router
.
router_fqdn
}
"
comment
=
str
(
subscription
.
subscription_id
)
infoblox
.
create_host_by_ip
(
new_fqdn
,
trunk_v4
.
ipv4addr
,
trunk_v6
.
ipv6addr
,
service_type
=
"
TRUNK
"
,
comment
=
comment
)
infoblox
.
create_host_by_ip
(
new_fqdn
,
v4_addr
,
v6_addr
,
"
TRUNK
"
,
comment
)
return
{
"
subscription
"
:
subscription
}
...
...
This diff is collapsed.
Click to expand it.
test/workflows/iptrunk/test_migrate_iptrunk.py
+
3
−
9
View file @
4ef56d26
...
...
@@ -109,9 +109,7 @@ def interface_lists_are_equal(list1, list2):
)
@pytest.mark.workflow
()
@patch
(
"
gso.services.infoblox.create_host_by_ip
"
)
@patch
(
"
gso.services.infoblox.find_v6_host_by_fqdn
"
)
@patch
(
"
gso.services.infoblox.find_host_by_fqdn
"
)
@patch
(
"
gso.services.infoblox.delete_host_by_fqdn
"
)
@patch
(
"
gso.services.infoblox.delete_host_by_ip
"
)
@patch
(
"
gso.services.provisioning_proxy._send_request
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_interfaces
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_lags
"
)
...
...
@@ -131,9 +129,7 @@ def test_migrate_iptrunk_success(
mocked_get_available_lags
,
mocked_get_available_interfaces
,
mock_execute_playbook
,
mock_delete_host_by_fqdn
,
mock_find_host_by_fqdn
,
mock_find_v6_host_by_fqdn
,
mock_delete_host_by_ip
,
mock_create_host_by_ip
,
migrate_form_input
,
data_config_filename
:
PathLike
,
...
...
@@ -173,10 +169,8 @@ def test_migrate_iptrunk_success(
assert
subscription
.
status
==
"
active
"
assert
mock_execute_playbook
.
call_count
==
9
assert
mock_find_host_by_fqdn
.
call_count
==
1
assert
mock_find_v6_host_by_fqdn
.
call_count
==
1
assert
mock_create_host_by_ip
.
call_count
==
1
assert
mock_delete_host_by_
fqdn
.
call_count
==
1
assert
mock_delete_host_by_
ip
.
call_count
==
1
# get some values from form
new_router
=
migrate_form_input
[
2
][
"
new_node
"
]
...
...
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