From ba84f56edf7a7050dceacfbc10b7759dd92f4005 Mon Sep 17 00:00:00 2001 From: peusterm Date: Mon, 7 Mar 2016 21:15:35 +0100 Subject: [PATCH] moved example topology to examples folder. added a simple topology used for the year 1 demo storyboard --- README.md | 3 +- .../simple_topology.py} | 4 +- .../examples/sonata_y1_demo_topology_1.py | 46 +++++++++++++++++++ start_dcnetwork | 3 +- 4 files changed, 52 insertions(+), 4 deletions(-) rename src/emuvim/{example_topology.py => examples/simple_topology.py} (97%) create mode 100644 src/emuvim/examples/sonata_y1_demo_topology_1.py diff --git a/README.md b/README.md index fa45bbf..eefb97c 100755 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ In the `~/son-emu` directory: * Otherwise, for a classic installation: * `python setup.py install` * First terminal: - * `sudo python src/emuvim/example_topology.py` + * `sudo python src/emuvim/examples/simple_topology.py +` * Second terminal: * `son-emu-cli compute start -d datacenter1 -n vnf1` * `son-emu-cli compute start -d datacenter1 -n vnf2` diff --git a/src/emuvim/example_topology.py b/src/emuvim/examples/simple_topology.py similarity index 97% rename from src/emuvim/example_topology.py rename to src/emuvim/examples/simple_topology.py index a63bd7f..8f14b69 100755 --- a/src/emuvim/example_topology.py +++ b/src/emuvim/examples/simple_topology.py @@ -19,8 +19,8 @@ script. import logging from mininet.log import setLogLevel from emuvim.dcemulator.net import DCNetwork -from api.zerorpcapi import ZeroRpcApiEndpoint -from api.zerorpcapi_DCNetwork import ZeroRpcApiEndpointDCNetwork +from emuvim.api.zerorpcapi import ZeroRpcApiEndpoint +from emuvim.api.zerorpcapi_DCNetwork import ZeroRpcApiEndpointDCNetwork logging.basicConfig(level=logging.INFO) diff --git a/src/emuvim/examples/sonata_y1_demo_topology_1.py b/src/emuvim/examples/sonata_y1_demo_topology_1.py new file mode 100644 index 0000000..1588190 --- /dev/null +++ b/src/emuvim/examples/sonata_y1_demo_topology_1.py @@ -0,0 +1,46 @@ +""" +A simple topology with two PoPs for the y1 demo story board. + + (dc1) <<-->> s1 <<-->> (dc2) +""" + +import logging +from mininet.log import setLogLevel +from emuvim.dcemulator.net import DCNetwork +from emuvim.api.zerorpcapi import ZeroRpcApiEndpoint + +logging.basicConfig(level=logging.INFO) + + +def create_topology1(): + # create topology + net = DCNetwork() + dc1 = net.addDatacenter("dc1") + dc2 = net.addDatacenter("dc2") + s1 = net.addSwitch("s1") + net.addLink(dc1, s1) + net.addLink(dc2, s1) + + # create a new instance of a endpoint implementation + zapi1 = ZeroRpcApiEndpoint("0.0.0.0", 4242) + # connect data centers to this endpoint + zapi1.connectDatacenter(dc1) + zapi1.connectDatacenter(dc2) + # run API endpoint server (in another thread, don't block) + zapi1.start() + + # TODO add "fake gatekeeper" api endpoint and connect it to both dcs + + # start the emulation platform + net.start() + net.CLI() + net.stop() + + +def main(): + setLogLevel('info') # set Mininet loglevel + create_topology1() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/start_dcnetwork b/start_dcnetwork index 6deb2c9..7280054 100755 --- a/start_dcnetwork +++ b/start_dcnetwork @@ -1,6 +1,7 @@ #!/bin/bash # start DC Network -python src/emuvim/example_topology.py +python src/emuvim/examples/simple_topology.py + -- 2.25.1