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
b9cbf3fc
Commit
b9cbf3fc
authored
1 year ago
by
JORGE SASIAIN
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-244: optimize netbox queries in iptrunk termination
parent
05208f37
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
+8
-11
8 additions, 11 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
with
8 additions
and
11 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
+
8
−
11
View file @
b9cbf3fc
...
...
@@ -62,25 +62,22 @@ def deprovision_ip_trunk_real(subscription: Iptrunk, process_id: UUIDstr, tt_num
@step
(
"
Remove IP Trunk from NetBox
"
)
def
remove_iptrunk_from_netbox
(
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
)
router_sideA
=
subscription
.
iptrunk
.
iptrunk_sides
[
0
].
iptrunk_side_node
.
router_fqdn
router_sideB
=
subscription
.
iptrunk
.
iptrunk_sides
[
1
].
iptrunk_side_node
.
router_fqdn
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
# Remove physical interfaces from LAGs
for
sideA_member
in
sideA_members
:
NetBoxClient
().
unreserve_interface
(
router_sideA
,
sideA_member
)
NetBoxClient
().
deallocate_interface
(
router_sideA
,
sideA_member
)
NetBoxClient
().
update_interface_description
(
router_sideA
,
sideA_member
,
""
)
NetBoxClient
().
clear_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
)
NetBoxClient
().
update_interface_description
(
router_sideB
,
sideB_member
,
""
)
NetBoxClient
().
clear_interface
(
router_sideB
,
sideB_member
)
NetBoxClient
().
delete_device
(
sideA_ae_iface
)
NetBoxClient
().
delete_device
(
sideB_ae_iface
)
# Delete LAGs
NetBoxClient
().
delete_interface
(
router_sideA
,
sideA_ae_iface
)
NetBoxClient
().
delete_interface
(
router_sideB
,
sideB_ae_iface
)
return
{
"
subscription
"
:
subscription
}
...
...
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