From a809906dbc09698fc0e09f6387b9332251aa6aab Mon Sep 17 00:00:00 2001 From: peusterm Date: Thu, 7 Jan 2016 16:48:00 +0100 Subject: [PATCH] removed old testcode --- dockernetrpc/__init__.py | 0 dockernetrpc/__main__.py | 12 ------- dockernetrpc/example_client.py | 41 ------------------------ dockernetrpc/rpc.py | 58 ---------------------------------- 4 files changed, 111 deletions(-) delete mode 100644 dockernetrpc/__init__.py delete mode 100644 dockernetrpc/__main__.py delete mode 100644 dockernetrpc/example_client.py delete mode 100644 dockernetrpc/rpc.py diff --git a/dockernetrpc/__init__.py b/dockernetrpc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dockernetrpc/__main__.py b/dockernetrpc/__main__.py deleted file mode 100644 index 56d0fea..0000000 --- a/dockernetrpc/__main__.py +++ /dev/null @@ -1,12 +0,0 @@ -import time -import logging -import rpc - -logging.basicConfig(level=logging.DEBUG) - - -def main(): - rpc.start_server() - -if __name__ == '__main__': - main() diff --git a/dockernetrpc/example_client.py b/dockernetrpc/example_client.py deleted file mode 100644 index 5a5379a..0000000 --- a/dockernetrpc/example_client.py +++ /dev/null @@ -1,41 +0,0 @@ -import time -import zerorpc - - -def main(): - # create connection to remote Mininet instance - c = zerorpc.Client() - c.connect("tcp://127.0.0.1:4242") - - # do some API tests - h1 = c.addHost('h1') - h2 = c.addHost('h2') - d1 = c.addDocker('d1', "ubuntu", "10.0.0.253") - - s1 = c.addSwitch("s1") - - c.addLink(h1, s1) - c.addLink(h2, s1) - c.addLink(d1, s1) - - c.start_net() - c.CLI() - - # check functionality at runtime - """ - d2 = c.addDocker('d2', dimage="ubuntu") - h3 = c.addHost('h3', ip='10.0.0.200') - c.addLink(d2, s1, params1={"ip": "10.0.0.251/8"}) - - time.sleep(2) - c.removeLink(node1="h1", node2="s1") - c.removeHost('h1') - #c.removeHost('d1') - """ - - time.sleep(2) - c.stop_net() - - -if __name__ == '__main__': - main() diff --git a/dockernetrpc/rpc.py b/dockernetrpc/rpc.py deleted file mode 100644 index f145b53..0000000 --- a/dockernetrpc/rpc.py +++ /dev/null @@ -1,58 +0,0 @@ -# We need a properly installed Dockernet -from mininet.net import Mininet -from mininet.node import Controller, Docker, OVSSwitch -from mininet.link import * -from mininet.cli import CLI -import mininet.log -import logging -import os -import zerorpc - - -class RemoteMininetNetwork(object): - - def __init__(self): - # set mininet loglevel - mininet.log.setLogLevel( 'info' ) - self.net = Mininet( controller=Controller ) - self.net.addController( 'c0' ) - - def start_net(self): - self.net.start() - - def CLI(self): - CLI(self.net) - - def stop_net(self): - try: - self.net.stop() - except Exception as e: - print e - - def addHost(self, name, ip=None): - return str(self.net.addHost(name, ip=ip)) - - def addDocker(self, name, dimage, ip): - return str(self.net.addDocker(name, dimage=dimage, ip=ip)) - - def addSwitch(self, name): - # we have to use OVSSwitch to be able to do link attachments - # at runtime (switch.attach) method - return str(self.net.addSwitch(name, cls=OVSSwitch)) - - def addLink(self, node1, node2, port1=None, port2=None): - return str(self.net.addLink(node1, node2, - port1, port2)) - - def removeHost(self, name): - return self.net.removeHost(name) - - def removeLink(self, link=None, node1=None, node2=None): - n1, n2 = self.net.get(node1), self.net.get(node2) - return self.net.removeLink(node1=n1, node2=n2) - - -def start_server(): - s = zerorpc.Server(RemoteMininetNetwork()) - s.bind("tcp://0.0.0.0:4242") - s.run() -- 2.25.1