Merge remote-tracking branch 'upstream/master'
diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py
index 939070c..2aa712e 100755
--- a/src/emuvim/api/sonata/dummygatekeeper.py
+++ b/src/emuvim/api/sonata/dummygatekeeper.py
@@ -157,7 +157,7 @@
vnfi = self._start_vnfd(vnfd)
self.instances[instance_uuid]["vnf_instances"].append(vnfi)
- # 3. Configure the chaining of the network functions (currently only E-Line links supported)
+ # 3. Configure the chaining of the network functions (currently only E-Line and E-LAN links supported)
vnf_id2vnf_name = defaultdict(lambda: "NotExistingNode",
reduce(lambda x, y: dict(x, **y),
map(lambda d: {d["vnf_id"]: d["vnf_name"]},
diff --git a/src/emuvim/dcemulator/monitoring.py b/src/emuvim/dcemulator/monitoring.py
index ba04771..2e1e041 100755
--- a/src/emuvim/dcemulator/monitoring.py
+++ b/src/emuvim/dcemulator/monitoring.py
@@ -44,23 +44,15 @@
class to read openflow stats from the Ryu controller of the DCNetwork
"""
+PUSHGATEWAY_PORT = 9091
+CADVISOR_PORT = 8080
+
class DCNetworkMonitor():
def __init__(self, net):
self.net = net
- # TODO: these global variables should be part of a config file?
- '''
- # prometheus is started outside of son-emu
- prometheus_ip = '127.0.0.1'
- prometheus_port = '9090'
- self.prometheus_REST_api = 'http://{0}:{1}'.format(prometheus_ip, prometheus_port)
- '''
- # helper variables to calculate the metrics
- # pushgateway is started outside of son-emu and son-emu is started with net=host
- # so localhost:9091 works
- self.pushgateway = 'localhost:9091'
- # when sdk is started with docker-compose, we could use
- # self.pushgateway = 'pushgateway:9091'
+ # pushgateway address
+ self.pushgateway = 'localhost:{0}'.format(PUSHGATEWAY_PORT)
# supported Prometheus metrics
self.registry = CollectorRegistry()
@@ -103,7 +95,9 @@
self.monitor_flow_thread.start()
# helper tools
- # cAdvisor, Prometheus pushgateway and DB are started as external container, outside of son-emu
+ # cAdvisor, Prometheus pushgateway are started as external container, to gather monitoring metric in son-emu
+ self.start_PushGateway()
+ self.start_cAdvisor()
# first set some parameters, before measurement can start
@@ -473,7 +467,7 @@
logging.warning("Pushgateway not reachable: {0} {1}".format(Exception, e))
- def start_Prometheus(self, port=9090):
+ def start_Prometheus(self, port=CADVISOR_PORT):
# prometheus.yml configuration file is located in the same directory as this file
cmd = ["docker",
"run",
@@ -487,7 +481,7 @@
logging.info('Start Prometheus container {0}'.format(cmd))
return Popen(cmd)
- def start_PushGateway(self, port=9091):
+ def start_PushGateway(self, port=PUSHGATEWAY_PORT):
cmd = ["docker",
"run",
"-d",
@@ -499,7 +493,7 @@
logging.info('Start Prometheus Push Gateway container {0}'.format(cmd))
return Popen(cmd)
- def start_cadvisor(self, port=8090):
+ def start_cAdvisor(self, port=8080):
cmd = ["docker",
"run",
"--rm",