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
4a9471f8
Commit
4a9471f8
authored
1 year ago
by
JORGE SASIAIN
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-244: make netbox operations a single workflow step
parent
6278d4ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!94
Feature/Netbox integration terminate ip trunk
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/iptrunk/terminate_iptrunk.py
+10
-35
10 additions, 35 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
with
10 additions
and
35 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
+
10
−
35
View file @
4a9471f8
...
...
@@ -59,53 +59,27 @@ def deprovision_ip_trunk_real(subscription: Iptrunk, process_id: UUIDstr, tt_num
}
@step
(
"
Unreserve involved physical interfaces
"
)
def
unreserve_physical_interfaces
(
subscription
:
Iptrunk
)
->
State
:
router_sideA
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
)
router_sideB
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_node
)
sideA_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_ae_members
sideB_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_ae_members
for
sideA_member
in
sideA_members
:
NetBoxClient
().
unreserve_interface
(
router_sideA
,
sideA_member
)
for
sideB_member
in
sideB_members
:
NetBoxClient
().
unreserve_interface
(
router_sideB
,
sideB_member
)
return
{
"
subscription
"
:
subscription
}
@step
(
"
Deallocate involved physical interfaces
"
)
def
deallocate_physical_interfaces
(
subscription
:
Iptrunk
)
->
State
:
router_sideA
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
)
router_sideB
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_node
)
sideA_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_ae_members
sideB_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_ae_members
for
sideA_member
in
sideA_members
:
NetBoxClient
().
deallocate_interface
(
router_sideA
,
sideA_member
)
for
sideB_member
in
sideB_members
:
NetBoxClient
().
deallocate_interface
(
router_sideB
,
sideB_member
)
return
{
"
subscription
"
:
subscription
}
@step
(
"
Remove IP Trunk from NetBox
"
)
def
remove_iptrunk_from_netbox
(
subscription
:
Iptrunk
)
->
State
:
@step
(
"
Unattach physical interfaces from respective LAG
"
)
def
unattach_physical_interfaces
(
subscription
:
Iptrunk
)
->
State
:
router_sideA
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
)
router_sideB
=
NetBoxClient
().
get_device_by_name
(
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_node
)
sideA_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_ae_members
sideB_members
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_ae_members
sideA_ae_iface
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_ae_iface
sideB_ae_iface
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_ae_iface
for
sideA_member
in
sideA_members
:
NetBoxClient
().
unattach_interface_from_lag
(
router_sideA
,
sideA_ae_iface
,
sideA_member
)
for
sideB_member
in
sideB_members
:
NetBoxClient
().
unattach_interface_from_lag
(
router_sideB
,
sideB_ae_iface
,
sideB_member
)
return
{
"
subscription
"
:
subscription
}
NetBoxClient
().
unreserve_interface
(
router_sideA
,
sideA_member
)
NetBoxClient
().
deallocate_interface
(
router_sideA
,
sideA_member
)
for
sideB_member
in
sideB_members
:
NetBoxClient
().
unreserve_interface
(
router_sideB
,
sideB_member
)
NetBoxClient
().
deallocate_interface
(
router_sideB
,
sideB_member
)
@step
(
"
Delete involved LAGs
"
)
def
delete_lags
(
subscription
:
Iptrunk
)
->
State
:
sideA_ae_iface
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_ae_iface
sideB_ae_iface
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_ae_iface
NetBoxClient
().
delete_device
(
sideA_ae_iface
)
NetBoxClient
().
delete_device
(
sideB_ae_iface
)
return
{
"
subscription
"
:
subscription
}
...
...
@@ -145,6 +119,7 @@ def terminate_iptrunk() -> StepList:
>>
store_process_subscription
(
Target
.
TERMINATE
)
>>
unsync
>>
run_config_steps
(
config_steps
)
>>
remove_iptrunk_from_netbox
>>
run_ipam_steps
(
ipam_steps
)
>>
set_status
(
SubscriptionLifecycle
.
TERMINATED
)
>>
resync
...
...
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