diff --git a/gso/workflows/device/create_device.py b/gso/workflows/device/create_device.py index 1bf01d749d75cc20f9459ba73fdf3fd5029d39b5..0368a473a214c3373ad44cabd4265ca317574280 100644 --- a/gso/workflows/device/create_device.py +++ b/gso/workflows/device/create_device.py @@ -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