+ @asyncio.coroutine
+ def create_vlr(self,vlr):
+ self._log.debug("Creating openmano vim network VLR name %s, VLR DC: %s",vlr.vld_msg.name,
+ vlr.om_datacenter_name)
+ net_create = {}
+ net = {}
+ net['name'] = vlr.name
+ net['shared'] = True
+ net['type'] = 'bridge'
+ self._log.debug("Received ip profile is %s",vlr._ip_profile)
+ if vlr._ip_profile and vlr._ip_profile.has_field("ip_profile_params"):
+ ip_profile_params = vlr._ip_profile.ip_profile_params
+ ip_profile = {}
+ if ip_profile_params.ip_version == "ipv6":
+ ip_profile['ip_version'] = "IPv6"
+ else:
+ ip_profile['ip_version'] = "IPv4"
+ if ip_profile_params.has_field('subnet_address'):
+ ip_profile['subnet_address'] = ip_profile_params.subnet_address
+ if ip_profile_params.has_field('gateway_address'):
+ ip_profile['gateway_address'] = ip_profile_params.gateway_address
+ if ip_profile_params.has_field('dns_server') and len(ip_profile_params.dns_server) > 0:
+ ip_profile['dns_address'] = ip_profile_params.dns_server[0].address
+ if ip_profile_params.has_field('dhcp_params'):
+ ip_profile['dhcp_enabled'] = ip_profile_params.dhcp_params.enabled
+ ip_profile['dhcp_start_address'] = ip_profile_params.dhcp_params.start_address
+ ip_profile['dhcp_count'] = ip_profile_params.dhcp_params.count
+ net['ip_profile'] = ip_profile
+ net_create["network"]= net
+
+ net_create_msg = yaml.safe_dump(net_create,default_flow_style=False)
+ fpath = dump_openmano_descriptor(
+ "{}_vim_net_create_{}".format(self._nsr_config_msg.name,vlr.name),
+ net_create_msg)
+ self._log.debug("Dumped Openmano VIM Net create to: %s", fpath)
+
+ vim_network_uuid = yield from self._loop.run_in_executor(
+ None,
+ self._cli_api.ns_vim_network_create,
+ net_create_msg,
+ vlr.om_datacenter_name)
+ self._vlrs.append(vlr)
+
+