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
6278d4ee
Commit
6278d4ee
authored
1 year ago
by
JORGE SASIAIN
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-244
: Add preliminary steps in terminate iptrunk workflow for NetBox
parent
ecb845b3
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!94
Feature/Netbox integration terminate ip trunk
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/iptrunk/terminate_iptrunk.py
+51
-0
51 additions, 0 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
utils/netboxcli.py
+0
-1
0 additions, 1 deletion
utils/netboxcli.py
with
51 additions
and
1 deletion
gso/workflows/iptrunk/terminate_iptrunk.py
+
51
−
0
View file @
6278d4ee
...
...
@@ -10,6 +10,7 @@ from orchestrator.workflows.utils import wrap_modify_initial_input_form
from
gso.products.product_types.iptrunk
import
Iptrunk
from
gso.services
import
infoblox
,
provisioning_proxy
from
gso.services.netbox_client
import
NetBoxClient
from
gso.services.provisioning_proxy
import
pp_interaction
from
gso.utils.helpers
import
set_isis_to_90000
...
...
@@ -58,6 +59,56 @@ 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
(
"
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
}
@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
}
@step
(
"
Deprovision IPv4 networks
"
)
def
deprovision_ip_trunk_ipv4
(
subscription
:
Iptrunk
)
->
dict
:
infoblox
.
delete_network
(
ipaddress
.
IPv4Network
(
subscription
.
iptrunk
.
iptrunk_ipv4_network
))
...
...
This diff is collapsed.
Click to expand it.
utils/netboxcli.py
+
0
−
1
View file @
6278d4ee
...
...
@@ -179,7 +179,6 @@ def free_interface(fqdn: str, iface: str) -> None:
freed_iface
=
NetboxClient
().
free_interface
(
fqdn
,
iface
)
click
.
echo
(
freed_iface
)
@action.command
()
@click.option
(
"
--fqdn
"
,
help
=
"
Device name from where to get interface to edit
"
)
@click.option
(
"
--iface
"
,
help
=
"
Interface name to edit
"
)
...
...
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