added REST API endpoint to OpenStack example to have son-emu-cli working
authorpeusterm <manuel.peuster@uni-paderborn.de>
Tue, 29 Aug 2017 17:41:13 +0000 (19:41 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Tue, 29 Aug 2017 17:41:13 +0000 (19:41 +0200)
src/emuvim/examples/openstack_single_dc.py

index b12079d..25ef3e3 100644 (file)
@@ -28,7 +28,7 @@ partner consortium (www.sonata-nfv.eu).
 import logging
 from mininet.log import setLogLevel
 from emuvim.dcemulator.net import DCNetwork
-
+from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint
 from emuvim.api.openstack.openstack_api_endpoint import OpenstackApiEndpoint
 
 logging.basicConfig(level=logging.INFO)
@@ -38,11 +38,16 @@ def create_topology():
     net = DCNetwork(monitor=False, enable_learning=False)
 
     dc1 = net.addDatacenter("dc1")
-
+    # add OpenStack-like APIs to the emulated DC
     api1 = OpenstackApiEndpoint("0.0.0.0", 6001)
     api1.connect_datacenter(dc1)
     api1.start()
     api1.connect_dc_network(net)
+    # add the command line interface endpoint to the emulated DC (REST API)
+    rapi1 = RestApiEndpoint("0.0.0.0", 5001)
+    rapi1.connectDCNetwork(net)
+    rapi1.connectDatacenter(dc1)
+    rapi1.start()
 
     net.start()
     net.CLI()