From: peusterm Date: Wed, 25 Sep 2019 17:31:55 +0000 (+0200) Subject: 5GTANGO LLCM: Allow to publish multiple ports and UDP ports. X-Git-Tag: v7.0.0rc1~18 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=cc77502a9c6ff5f4e3676bb543861ada03bdeb8e;p=osm%2Fvim-emu.git 5GTANGO LLCM: Allow to publish multiple ports and UDP ports. Change-Id: I97ce2afd01f373e0fb4b155d588317bba84975f0 Signed-off-by: peusterm --- diff --git a/src/emuvim/api/tango/llcm.py b/src/emuvim/api/tango/llcm.py index 75c71bf..9ddc772 100755 --- a/src/emuvim/api/tango/llcm.py +++ b/src/emuvim/api/tango/llcm.py @@ -364,11 +364,30 @@ class Service(object): ports = list() # Containernet naming port_bindings = dict() for i in intfs: - if i.get("port"): + if i.get("port"): # field with a single port if not isinstance(i.get("port"), int): LOG.info("Field 'port' is no int CP: {}".format(i)) else: - ports.append(i.get("port")) + ports.append(i.get("port")) # collect all ports + if i.get("ports"): # list with multiple ports + if not isinstance(i.get("ports"), list): + LOG.info("Field 'port' is no list CP: {}".format(i)) + else: + for p in i.get("ports"): + if not isinstance(p, int): + # do some parsing + try: + if "/udp" in p: + p = tuple(p.split("/")) + else: + p = int(p) + ports.append(p) # collect all ports + except BaseException as ex: + LOG.error( + "Could not parse ports list: {}".format(p)) + LOG.error(ex) + else: + ports.append(p) # collect all ports if i.get("publish"): if not isinstance(i.get("publish"), dict): LOG.info("Field 'publish' is no dict CP: {}".format(i))