X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Fapi%2Fsonata%2Fdummygatekeeper.py;h=bea0a010be8696fb70549e1d7332f86f9d6413c9;hb=ca88566fc038a5a59c8ca3d3af82aab8db7d253a;hp=432c134a4577bbe77094d67593ba8ac423bf9423;hpb=075b46a5e2770ad880ad0dd69434a964eb3056fa;p=osm%2Fvim-emu.git diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 432c134..bea0a01 100755 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -225,7 +225,18 @@ class Service(object): # 3. do the dc.startCompute(name="foobar") call to run the container # TODO consider flavors, and other annotations intfs = vnfd.get("connection_points") - self.vnf_name2docker_name[vnf_name] = GK.get_next_vnf_name() + # mgmt connection points can be skipped, this is considered to be the connection the default docker0 bridge + intfs = [intf for intf in intfs if 'mgmt' not in intf['id']] + + # use the vnf_id in the nsd as docker name + # so deployed containers can be easily mapped back to the nsd + vnf_name2id = defaultdict(lambda: "NotExistingNode", + reduce(lambda x, y: dict(x, **y), + map(lambda d: {d["vnf_name"]: d["vnf_id"]}, + self.nsd["network_functions"]))) + self.vnf_name2docker_name[vnf_name] = vnf_name2id[vnf_name] + # self.vnf_name2docker_name[vnf_name] = GK.get_next_vnf_name() + LOG.info("Starting %r as %r in DC %r" % (vnf_name, self.vnf_name2docker_name[vnf_name], vnfd.get("dc"))) LOG.debug("Interfaces for %r: %r" % (vnf_name, intfs)) vnfi = target_dc.startCompute(self.vnf_name2docker_name[vnf_name], network=intfs, image=docker_name, flavor_name="small")