self.pushgateway = 'localhost:9091'\r
# when sdk is started with docker-compose, we could use\r
# self.pushgateway = 'pushgateway:9091'\r
- # Start up the server to expose the metrics to Prometheus\r
- #start_http_server(8000)\r
\r
# supported Prometheus metrics\r
self.registry = CollectorRegistry()\r
self.monitor_flow_thread.start()\r
\r
# helper tools\r
- # Prometheus pushgateway and DB are started as external contianer, outside of son-emu\r
- #self.pushgateway_process = self.start_PushGateway()\r
- #self.prometheus_process = self.start_Prometheus()\r
- #self.cadvisor_process = self.start_cadvisor()\r
+ # cAdvisor, Prometheus pushgateway and DB are started as external container, outside of son-emu\r
+\r
\r
# first set some parameters, before measurement can start\r
def setup_flow(self, vnf_name, vnf_interface=None, metric='tx_packets', cookie=0):\r
"""
self.dcs = {}
+ # make sure any remaining Ryu processes are killed
+ self.killRyu()
+ # make sure no containers are left over from a previous emulator run.
+ self.removeLeftoverContainers()
+
# call original Docker.__init__ and setup default controller
Containernet.__init__(
self, switch=OVSKernelSwitch, controller=controller, **kwargs)
if self.ryu_process is not None:
self.ryu_process.terminate()
self.ryu_process.kill()
+ self.killRyu()
+
+ @staticmethod
+ def removeLeftoverContainers():
+ # TODO can be more python-based using eg. docker-py?
+ Popen('docker ps -a -q --filter="name=mn.*" | xargs -r docker rm -f', shell=True)
+
+ @staticmethod
+ def killRyu():
+ Popen(['pkill', '-f', 'ryu-manager'])
def ryu_REST(self, prefix, dpid=None, data=None):
try:
self.assertTrue(s2["network"][0]['intf_name'] == 'intf2')
self.assertTrue(s2["network"][0]['ip'] == '10.0.10.2')
+ # should be not not yet connected
+ self.assertTrue(self.net.ping([vnf1, vnf2]) > 0.0)
# setup links
self.net.setChain('vnf1', 'vnf2', 'intf1', 'intf2', bidirectional=True, cmd='add-flow')
# check connectivity by using ping
#!/bin/bash
+set -e
+set -x
+
# test if a vnf can be deployed and monitored
#start test emulator topology