- for vnf_id in self.vnf_id2vnf_name:
- vnf_name = self.vnf_id2vnf_name[vnf_id]
- self.vnfds[vnf_id] = vnfd_set[vnf_name]
- LOG.debug("Loaded VNFD: {0} id: {1}".format(vnf_name, vnf_id))
-
- def _load_saps(self):
- # create list of all SAPs
- # check if we need to deploy management ports
- if USE_DOCKER_MGMT:
- SAPs = [p for p in self.nsd["connection_points"]
- if 'management' not in p.get('type')]
- else:
- SAPs = [p for p in self.nsd["connection_points"]]
-
- for sap in SAPs:
- # endpoint needed in this service
- sap_id, sap_interface, sap_docker_name = parse_interface(sap['id'])
- # make sure SAP has type set (default internal)
- sap["type"] = sap.get("type", 'internal')
-
- # Each Service Access Point (connection_point) in the nsd is an IP
- # address on the host
- if sap["type"] == "external":
- # add to vnfds to calculate placement later on
- sap_net = SAP_SUBNETS.pop(0)
- self.saps[sap_docker_name] = {
- "name": sap_docker_name, "type": "external", "net": sap_net}
- # add SAP vnf to list in the NSD so it is deployed later on
- # each SAP gets a unique VNFD and vnf_id in the NSD and custom
- # type (only defined in the dummygatekeeper)
- self.nsd["network_functions"].append(
- {"vnf_id": sap_docker_name, "vnf_name": sap_docker_name, "vnf_type": "sap_ext"})
-
- # Each Service Access Point (connection_point) in the nsd is
- # getting its own container (default)
- elif sap["type"] == "internal" or sap["type"] == "management":
- # add SAP to self.vnfds
- if SAP_VNFD is None:
- sapfile = pkg_resources.resource_filename(
- __name__, "sap_vnfd.yml")
- else:
- sapfile = SAP_VNFD
- sap_vnfd = load_yaml(sapfile)
- sap_vnfd["connection_points"][0]["id"] = sap_interface
- sap_vnfd["name"] = sap_docker_name
- sap_vnfd["type"] = "internal"
- # add to vnfds to calculate placement later on and deploy
- self.saps[sap_docker_name] = sap_vnfd
- # add SAP vnf to list in the NSD so it is deployed later on
- # each SAP get a unique VNFD and vnf_id in the NSD
- self.nsd["network_functions"].append(
- {"vnf_id": sap_docker_name, "vnf_name": sap_docker_name, "vnf_type": "sap_int"})
-
- LOG.debug("Loaded SAP: name: {0}, type: {1}".format(
- sap_docker_name, sap['type']))
-
- # create sap lists
- self.saps_ext = [self.saps[sap]['name']
- for sap in self.saps if self.saps[sap]["type"] == "external"]
- self.saps_int = [self.saps[sap]['name']
- for sap in self.saps if self.saps[sap]["type"] == "internal"]
-
- def _start_sap(self, sap, instance_uuid):
- if not DEPLOY_SAP:
- return
-
- LOG.info('start SAP: {0} ,type: {1}'.format(sap['name'], sap['type']))
- if sap["type"] == "internal":
- vnfi = None
- if not GK_STANDALONE_MODE:
- vnfi = self._start_vnfd(sap, sap['name'], type='sap_int')
- self.instances[instance_uuid]["vnf_instances"].append(vnfi)
-
- elif sap["type"] == "external":
- target_dc = sap.get("dc")
- # add interface to dc switch
- target_dc.attachExternalSAP(sap['name'], sap['net'])
-
- def _connect_elines(self, eline_fwd_links, instance_uuid):