X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Fdcemulator%2Fnode.py;h=8612096585ec61193890c9ae66c77785110d5fbc;hb=7b38ee1ed94ec3e9124e8e5b9c21cf224d39edc3;hp=18febb43e6dc9eb6428a962b782f1ef5f77341ea;hpb=4e37abbc1a06ffa40ed11c7c6a16c1fe95403161;p=osm%2Fvim-emu.git diff --git a/src/emuvim/dcemulator/node.py b/src/emuvim/dcemulator/node.py index 18febb4..8612096 100755 --- a/src/emuvim/dcemulator/node.py +++ b/src/emuvim/dcemulator/node.py @@ -208,7 +208,7 @@ class Datacenter(object): def start(self): pass - def startCompute(self, name, image=None, command=None, network=None, flavor_name="tiny", **params): + def startCompute(self, name, image=None, command=None, network=None, flavor_name="tiny", properties=dict(), **params): """ Create a new container as compute resource and connect it to this data center. @@ -217,6 +217,7 @@ class Datacenter(object): :param command: command (string) :param network: networks list({"ip": "10.0.0.254/8"}, {"ip": "11.0.0.254/24"}) :param flavor_name: name of the flavor for this compute container + :param properties: dictionary of properties (key-value) that will be passed as environment variables :return: """ assert name is not None @@ -240,6 +241,8 @@ class Datacenter(object): params['cpu_period'] = self.net.cpu_period params['cpu_quota'] = self.net.cpu_period * float(cpu_percentage) + env = properties + properties['VNF_NAME'] = name # create the container d = self.net.addDocker( "%s" % (name), @@ -247,7 +250,7 @@ class Datacenter(object): dcmd=command, datacenter=self, flavor_name=flavor_name, - environment = {'VNF_NAME':name}, + environment = env, **params )