From cc77502a9c6ff5f4e3676bb543861ada03bdeb8e Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 25 Sep 2019 19:31:55 +0200 Subject: [PATCH] 5GTANGO LLCM: Allow to publish multiple ports and UDP ports. Change-Id: I97ce2afd01f373e0fb4b155d588317bba84975f0 Signed-off-by: peusterm --- src/emuvim/api/tango/llcm.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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)) -- 2.25.1