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
c9cc1ee9
Verified
Commit
c9cc1ee9
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
update for loop in create_iptrunk workflow
parent
c784fd8f
No related branches found
No related tags found
1 merge request
!96
Make use of new callback step for external provisioning
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/iptrunk/create_iptrunk.py
+11
-13
11 additions, 13 deletions
gso/workflows/iptrunk/create_iptrunk.py
with
11 additions
and
13 deletions
gso/workflows/iptrunk/create_iptrunk.py
+
11
−
13
View file @
c9cc1ee9
...
...
@@ -285,49 +285,47 @@ def reserve_interfaces_in_netbox(subscription: IptrunkProvisioning) -> State:
"""
Create the LAG interfaces in NetBox and attach the lag interfaces to the physical interfaces.
"""
nbclient
=
NetboxClient
()
for
side
in
range
(
0
,
2
)
:
if
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_vendor
==
RouterVendor
.
NOKIA
:
for
trunk_
side
in
subscription
.
iptrunk
.
iptrunk_sides
:
if
trunk_side
.
iptrunk_side_node
.
router_vendor
==
RouterVendor
.
NOKIA
:
# Create LAG interfaces
lag_interface
:
Interfaces
=
nbclient
.
create_interface
(
iface_name
=
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_ae_iface
,
iface_name
=
trunk_side
.
iptrunk_side_ae_iface
,
type
=
"
lag
"
,
device_name
=
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_fqdn
,
device_name
=
trunk_side
.
iptrunk_side_node
.
router_fqdn
,
description
=
str
(
subscription
.
subscription_id
),
enabled
=
True
,
)
# Attach physical interfaces to LAG
# Update interface description to subscription ID
# Reserve interfaces
for
interface
in
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_ae_members
:
for
interface
in
trunk_side
.
iptrunk_side_ae_members
:
nbclient
.
attach_interface_to_lag
(
device_name
=
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_fqdn
,
device_name
=
trunk_side
.
iptrunk_side_node
.
router_fqdn
,
lag_name
=
lag_interface
.
name
,
iface_name
=
interface
.
interface_name
,
description
=
str
(
subscription
.
subscription_id
),
)
nbclient
.
reserve_interface
(
device_name
=
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_fqdn
,
device_name
=
trunk_side
.
iptrunk_side_node
.
router_fqdn
,
iface_name
=
interface
.
interface_name
,
)
return
{
"
subscription
"
:
subscription
,
"
label_text
"
:
"
NextBox integration: Reserved interfaces.
"
,
}
@step
(
"
Allocate interfaces in Netbox
"
)
def
allocate_interfaces_in_netbox
(
subscription
:
IptrunkProvisioning
)
->
State
:
"""
Allocate the LAG interfaces in NetBox and attach the lag interfaces to the physical interfaces.
"""
for
side
in
range
(
0
,
2
)
:
if
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_vendor
==
RouterVendor
.
NOKIA
:
for
interface
in
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_ae_members
:
for
trunk_
side
in
subscription
.
iptrunk
.
iptrunk_sides
:
if
trunk_side
.
iptrunk_side_node
.
router_vendor
==
RouterVendor
.
NOKIA
:
for
interface
in
trunk_side
.
iptrunk_side_ae_members
:
NetboxClient
().
allocate_interface
(
device_name
=
subscription
.
iptrunk
.
ip
trunk_side
s
[
side
]
.
iptrunk_side_node
.
router_fqdn
,
device_name
=
trunk_side
.
iptrunk_side_node
.
router_fqdn
,
iface_name
=
interface
.
interface_name
,
)
return
{
"
subscription
"
:
subscription
,
"
label_text
"
:
"
NextBox integration: Allocated interfaces.
"
,
}
...
...
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