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
Jira
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
4f208be6
Commit
4f208be6
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
update unit test for migrate IP trunk
parent
49143987
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!135
Feature/trunk migration ipam
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/workflows/iptrunk/migrate_iptrunk.py
+1
-1
1 addition, 1 deletion
gso/workflows/iptrunk/migrate_iptrunk.py
test/conftest.py
+0
-1
0 additions, 1 deletion
test/conftest.py
test/workflows/iptrunk/test_migrate_iptrunk.py
+16
-4
16 additions, 4 deletions
test/workflows/iptrunk/test_migrate_iptrunk.py
with
17 additions
and
6 deletions
gso/workflows/iptrunk/migrate_iptrunk.py
+
1
−
1
View file @
4f208be6
...
@@ -24,13 +24,13 @@ from orchestrator.workflows.utils import wrap_modify_initial_input_form
...
@@ -24,13 +24,13 @@ from orchestrator.workflows.utils import wrap_modify_initial_input_form
from
pydantic
import
validator
from
pydantic
import
validator
from
pydantic_forms.core
import
ReadOnlyField
from
pydantic_forms.core
import
ReadOnlyField
from
pynetbox.models.dcim
import
Interfaces
from
pynetbox.models.dcim
import
Interfaces
from
services.infoblox
import
DeletionError
from
gso.products.product_blocks.iptrunk
import
IptrunkInterfaceBlock
from
gso.products.product_blocks.iptrunk
import
IptrunkInterfaceBlock
from
gso.products.product_blocks.router
import
RouterVendor
from
gso.products.product_blocks.router
import
RouterVendor
from
gso.products.product_types.iptrunk
import
Iptrunk
from
gso.products.product_types.iptrunk
import
Iptrunk
from
gso.products.product_types.router
import
Router
from
gso.products.product_types.router
import
Router
from
gso.services
import
infoblox
from
gso.services
import
infoblox
from
gso.services.infoblox
import
DeletionError
from
gso.services.netbox_client
import
NetboxClient
from
gso.services.netbox_client
import
NetboxClient
from
gso.services.provisioning_proxy
import
execute_playbook
,
pp_interaction
from
gso.services.provisioning_proxy
import
execute_playbook
,
pp_interaction
from
gso.services.subscriptions
import
get_active_router_subscriptions
from
gso.services.subscriptions
import
get_active_router_subscriptions
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
0
−
1
View file @
4f208be6
import
contextlib
import
contextlib
import
ipaddress
import
json
import
json
import
logging
import
logging
import
os
import
os
...
...
This diff is collapsed.
Click to expand it.
test/workflows/iptrunk/test_migrate_iptrunk.py
+
16
−
4
View file @
4f208be6
...
@@ -36,7 +36,7 @@ def migrate_form_input(
...
@@ -36,7 +36,7 @@ def migrate_form_input(
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
new_router
=
juniper_router_subscription_factory
()
new_router
=
juniper_router_subscription_factory
()
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
new_side_ae_members
=
faker
.
generate_juniper_members_list
()[
0
:
2
]
new_side_ae_members
=
faker
.
link_members_juniper
()[
0
:
2
]
lag_name
=
"
ae1
"
lag_name
=
"
ae1
"
elif
use_juniper
==
UseJuniperSide
.
SIDE_B
:
elif
use_juniper
==
UseJuniperSide
.
SIDE_B
:
# Juniper -> Nokia
# Juniper -> Nokia
...
@@ -48,7 +48,7 @@ def migrate_form_input(
...
@@ -48,7 +48,7 @@ def migrate_form_input(
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
new_router
=
nokia_router_subscription_factory
()
new_router
=
nokia_router_subscription_factory
()
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
new_side_ae_members
=
faker
.
generate_nokia
_members_
list
()[
0
:
2
]
new_side_ae_members
=
faker
.
link
_members_
nokia
()[
0
:
2
]
lag_name
=
"
LAG1
"
lag_name
=
"
LAG1
"
elif
use_juniper
==
UseJuniperSide
.
SIDE_BOTH
:
elif
use_juniper
==
UseJuniperSide
.
SIDE_BOTH
:
# Juniper -> Juniper
# Juniper -> Juniper
...
@@ -60,7 +60,7 @@ def migrate_form_input(
...
@@ -60,7 +60,7 @@ def migrate_form_input(
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
new_router
=
juniper_router_subscription_factory
()
new_router
=
juniper_router_subscription_factory
()
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
new_side_ae_members
=
faker
.
generate_juniper_members_list
()[
0
:
2
]
new_side_ae_members
=
faker
.
link_members_juniper
()[
0
:
2
]
lag_name
=
"
ae1
"
lag_name
=
"
ae1
"
else
:
else
:
# Nokia -> Nokia
# Nokia -> Nokia
...
@@ -68,7 +68,7 @@ def migrate_form_input(
...
@@ -68,7 +68,7 @@ def migrate_form_input(
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
old_subscription
=
Iptrunk
.
from_subscription
(
product_id
)
new_router
=
nokia_router_subscription_factory
()
new_router
=
nokia_router_subscription_factory
()
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
replace_side
=
str
(
old_subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
subscription
.
subscription_id
)
new_side_ae_members
=
faker
.
generate_nokia
_members_
list
()[
0
:
2
]
new_side_ae_members
=
faker
.
link
_members_
nokia
()[
0
:
2
]
lag_name
=
"
LAG1
"
lag_name
=
"
LAG1
"
return
[
return
[
...
@@ -107,6 +107,10 @@ def interface_lists_are_equal(list1, list2):
...
@@ -107,6 +107,10 @@ def interface_lists_are_equal(list1, list2):
indirect
=
True
,
indirect
=
True
,
)
)
@pytest.mark.workflow
()
@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.provisioning_proxy._send_request
"
)
@patch
(
"
gso.services.provisioning_proxy._send_request
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_interfaces
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_interfaces
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_lags
"
)
@patch
(
"
gso.services.netbox_client.NetboxClient.get_available_lags
"
)
...
@@ -126,6 +130,10 @@ def test_migrate_iptrunk_success(
...
@@ -126,6 +130,10 @@ def test_migrate_iptrunk_success(
mocked_get_available_lags
,
mocked_get_available_lags
,
mocked_get_available_interfaces
,
mocked_get_available_interfaces
,
mock_execute_playbook
,
mock_execute_playbook
,
mock_delete_host_by_fqdn
,
mock_find_host_by_fqdn
,
mock_find_v6_host_by_fqdn
,
mock_create_host_by_ip
,
migrate_form_input
,
migrate_form_input
,
data_config_filename
:
PathLike
,
data_config_filename
:
PathLike
,
):
):
...
@@ -164,6 +172,10 @@ def test_migrate_iptrunk_success(
...
@@ -164,6 +172,10 @@ def test_migrate_iptrunk_success(
assert
subscription
.
status
==
"
active
"
assert
subscription
.
status
==
"
active
"
assert
mock_execute_playbook
.
call_count
==
9
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
# get some values from form
# get some values from form
new_router
=
migrate_form_input
[
2
][
"
new_node
"
]
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