Skip to content
Snippets Groups Projects
Commit 99ed5627 authored by Simone Spinelli's avatar Simone Spinelli
Browse files

IPAM module integration: done for the Loopback

parent e3fab4ac
No related branches found
No related tags found
1 merge request!16Feature/ipam integration
......@@ -84,14 +84,14 @@ def iso_from_ipv4(ipv4_address):
@step('Get information from IPAM')
def get_info_from_ipam(subscription: DeviceInactive) -> State:
def get_info_from_ipam(subscription: DeviceProvisioning) -> State:
# lo = ipam.new_device_lo_address()
# subscription.device.lo_ipv4_address = lo.v4
# subscription.device.lo_ipv6_address = lo.v6
# TODO: get info about how these should be generated
lo0_alias = f"{hostname}.{subscription.device.device_site.site_name.lower()}.\
{subscription.device_type.site_country_code.lower()}"
lo0_alias = re.sub(".geant.net", "", subscription.device.device_fqdn)
lo0_name = f"lo0.{lo0_alias}"
#print(lo0_alias)
lo0_addr = _ipam.allocate_service_host(hostname=lo0_name, service_type='LO', cname_aliases=[lo0_alias])
subscription.device.device_lo_ipv4_address = lo0_addr.v4
subscription.device.device_lo_ipv6_address = lo0_addr.v6
......@@ -123,10 +123,11 @@ def initialize_subscription(
subscription.device.device_vendor = device_vendor
subscription.device.device_site \
= Site.from_subscription(device_site[0]).site
fqdn = str(hostname + '.' +
subscription.device.device_site.site_name.lower() + '.' +
subscription.device.device_site.site_country_code.lower() +
'.geant.net')
fqdn = f"{hostname}.{subscription.device.device_site.site_name.lower()}.{subscription.device.device_site.site_country_code.lower()}.geant.net"
#fqdn = str(hostname + '.' +
# subscription.device.device_site.site_name.lower() + '.' +
# subscription.device.device_site.site_country_code.lower() +
# '.geant.net')
subscription.device.device_fqdn = fqdn
subscription.device.device_role = device_role
subscription.description = f'Device {fqdn} ' \
......@@ -165,8 +166,8 @@ def create_device():
init
>> create_subscription
>> store_process_subscription(Target.CREATE)
>> get_info_from_ipam
>> initialize_subscription
>> get_info_from_ipam
>> provision_device_dry
>> await_pp_results
>> confirm_pp_results
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment