From: peusterm Date: Wed, 12 Jun 2019 08:25:38 +0000 (+0200) Subject: Fix: Use "emu0" as shrot name for the default X-Git-Tag: v6.0.0^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F7648%2F1;p=osm%2Fvim-emu.git Fix: Use "emu0" as shrot name for the default network interface of a container if no network is specified manually. Change-Id: I8f206c8def1cd19084860e7d8a3fa4b0b37c2a5d Signed-off-by: peusterm --- diff --git a/src/emuvim/dcemulator/node.py b/src/emuvim/dcemulator/node.py index bf4417b..2a211d7 100755 --- a/src/emuvim/dcemulator/node.py +++ b/src/emuvim/dcemulator/node.py @@ -231,6 +231,7 @@ class Datacenter(object): :return: """ assert name is not None + default_net = {"id": "emu0"} # no duplications if name in [c.name for c in self.net.getAllContainers()]: raise Exception("Container with name %s already exists." % name) @@ -238,13 +239,17 @@ class Datacenter(object): if image is None: image = "ubuntu:trusty" if network is None: - network = {} # {"ip": "10.0.0.254/8"} + network = {} if isinstance(network, dict): + if len(network) < 1: + # create at least one default interface + network = default_net # if we have only one network, put it in a list network = [network] if isinstance(network, list): if len(network) < 1: - network.append({}) + # create at least one default interface + network.append(default_net) # apply hard-set resource limits=0 cpu_percentage = params.get('cpu_percent')