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
bfa951b0
Commit
bfa951b0
authored
1 year ago
by
Simone Spinelli
Browse files
Options
Downloads
Patches
Plain Diff
Add IPAM/DNS management in terminate_device workflow
parent
c7f482aa
No related branches found
No related tags found
1 merge request
!28
Feature/nat178 trunks isis metric modify
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/device/terminate_device.py
+40
-5
40 additions, 5 deletions
gso/workflows/device/terminate_device.py
with
40 additions
and
5 deletions
gso/workflows/device/terminate_device.py
+
40
−
5
View file @
bfa951b0
import
ipaddress
from
orchestrator.forms
import
FormPage
from
orchestrator.forms
import
FormPage
from
orchestrator.forms.validators
import
Label
from
orchestrator.forms.validators
import
Label
from
orchestrator.targets
import
Target
from
orchestrator.targets
import
Target
from
orchestrator.types
import
InputForm
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.types
import
InputForm
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.workflow
import
done
,
init
,
step
,
workflow
from
orchestrator.workflow
import
done
,
init
,
step
,
workflow
from
gso.services
import
ipam
from
orchestrator.workflows.steps
import
(
from
orchestrator.workflows.steps
import
(
resync
,
resync
,
set_status
,
set_status
,
...
@@ -29,11 +31,42 @@ def _deprovision_in_user_management_system(fqdn: str) -> str:
...
@@ -29,11 +31,42 @@ def _deprovision_in_user_management_system(fqdn: str) -> str:
pass
pass
@step
(
"
Deprovision device
"
)
@step
(
"
Deprovision loopback IPs from IPAM/DNS
"
)
def
deprovision_user
(
subscription
:
Device
)
->
None
:
def
deprovision_loopback_ips
(
subscription
:
Device
)
->
None
:
# _deprovision_in_user_management_system(subscription.user.user_id)
input_host_addresses
=
ipam
.
HostAddresses
(
pass
v4
=
ipaddress
.
ip_address
(
subscription
.
device
.
device_lo_ipv4_address
),
v6
=
ipaddress
.
ip_address
(
subscription
.
device
.
device_lo_ipv6_address
)
)
fqdn_as_list
=
subscription
.
device
.
device_fqdn
.
split
(
"
.
"
)
hostname
=
str
(
fqdn_as_list
[
0
])
+
"
.
"
+
str
(
fqdn_as_list
[
1
])
+
"
.
"
+
str
(
fqdn_as_list
[
2
])
lo0_name
=
"
lo0.
"
+
hostname
host_addresses
=
ipam
.
delete_service_host
(
hostname
=
lo0_name
,
host_addresses
=
input_host_addresses
,
cname_aliases
=
[
hostname
],
service_type
=
'
LO
'
)
return
{
'
cleanup_for
'
:
hostname
}
@step
(
"
Deprovision SI- interface IPs from IPAM/DNS
"
)
def
deprovision_si_ips
(
subscription
:
Device
)
->
None
:
service_network
=
ipam
.
delete_service_network
(
network
=
ipaddress
.
ip_network
(
subscription
.
device
.
device_si_ipv4_network
)
,
service_type
=
'
SI
'
)
return
{
'
service_network
'
:
service_network
}
@step
(
"
Deprovision LT- (IAS) interface IPs from IPAM/DNS
"
)
def
deprovision_lt_ips
(
subscription
:
Device
)
->
None
:
service_network_v4
=
ipam
.
delete_service_network
(
network
=
ipaddress
.
ip_network
(
subscription
.
device
.
device_ias_lt_ipv4_network
),
service_type
=
'
LT_IAS
'
)
service_network_v6
=
ipam
.
delete_service_network
(
network
=
ipaddress
.
ip_network
(
subscription
.
device
.
device_ias_lt_ipv6_network
),
service_type
=
'
LT_IAS
'
)
return
{
'
service_network_v4
'
:
service_network_v4
,
'
service_network_v6
'
:
service_network_v6
}
@workflow
(
@workflow
(
"
Terminate device
"
,
"
Terminate device
"
,
...
@@ -46,7 +79,9 @@ def terminate_device():
...
@@ -46,7 +79,9 @@ def terminate_device():
init
init
>>
store_process_subscription
(
Target
.
TERMINATE
)
>>
store_process_subscription
(
Target
.
TERMINATE
)
>>
unsync
>>
unsync
>>
deprovision_user
>>
deprovision_loopback_ips
>>
deprovision_si_ips
>>
deprovision_lt_ips
>>
set_status
(
SubscriptionLifecycle
.
TERMINATED
)
>>
set_status
(
SubscriptionLifecycle
.
TERMINATED
)
>>
resync
>>
resync
>>
done
>>
done
...
...
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