Merge pull request #221 from mpeuster/master
authorpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 19 May 2017 10:03:17 +0000 (12:03 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 19 May 2017 10:03:17 +0000 (12:03 +0200)
Cleanups and fixes for upcoming v2.1

README.md
src/emuvim/api/rest/rest_api_endpoint.py
src/emuvim/dashboard/index_upb.html
src/emuvim/dashboard/js/main_upb.js

index f144818..3877e87 100755 (executable)
--- a/README.md
+++ b/README.md
@@ -3,14 +3,16 @@
 # son-emu
 This is the repository of [SONATA's](http://sonata-nfv.eu) emulation platform.
 
-This emulation platform was created to support network  service developers to locally prototype and test complete network service chains in realistic end-to-end multi-PoP scenarios. It allows the direct execution of real network functions, packaged as Docker containers, in emulated network topologies running locally on the network service developer's machine.
+This emulation platform was created to support network  service developers to locally prototype and test complete network service chains in realistic end-to-end multi-PoP scenarios. It allows the execution of real network functions, packaged as Docker containers, in emulated network topologies running locally on the network service developer's machine.
 
 ### Cite this work
 
 If you use son-emu for your research and/or other publications, please cite the following paper to reference our work:
 
-* Manuel Peuster, Holger Karl, and Steven van Rossem. "**MeDICINE: Rapid Prototyping of Production-Ready Network Services in Multi-PoP Environments.**" to appear in IEEE Conference on Network Function Virtualization and Software Defined Network (NFV-SDN), 2016.
-  * Pre-print online: http://arxiv.org/abs/1606.05995
+* M. Peuster, H. Karl and S. van Rossem, **"MeDICINE: Rapid prototyping of production-ready network services in multi-PoP environments,"** 2016 IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Palo Alto, CA, USA, 2016, pp. 148-153.
+doi: 10.1109/NFV-SDN.2016.7919490
+  * Link: http://ieeexplore.ieee.org/document/7919490/
+  * Pre-print: http://arxiv.org/abs/1606.05995
 
 A short demo that showcases son-emu together with its dummy gatekeeper is available [here](https://www.youtube.com/watch?v=ZANz97pV9ao).
 
@@ -25,15 +27,17 @@ To install the emulator package in development mode, do:
 * `ansible` Install scripts
 * `misc` Example packages and VNFs
 * `src` 
-       * `emuvim` Emulator components
-               * `api` API endpoint implementations
-                       * `rest` REST API for son-emu-cli
-               * `sonata` Dummy gatekeeper API
-               * `cli` Command line client to control the emulator
-               * `dcemulator` Emulator core
-                       * `resourcemodel` Resource limitation models
-       * `examples` Example topology scripts
-       * `test` Test scripts
+    * `emuvim` Emulator components
+        * `api` API endpoint implementations
+            * `rest` REST API for son-emu-cli
+            * `sonata` Dummy gatekeeper API
+            * `openstack` OpenStack-like APIs for MANO integration
+        * `cli` Command line client to control the emulator
+        * `dashboard` A web-based dashboard to display the emulator's state
+        * `dcemulator` Emulator core
+            * `resourcemodel` Resource limitation models
+        * `examples` Example topology scripts
+        * `test` Test scripts
 * `utils` Helper scripts for SONATA's CI/CD setup
 
 
@@ -78,7 +82,7 @@ Contributing to the son-emu is really easy. You must:
 4. Follow/answer related [issues](https://github.com/sonata-nfv/son-emu/issues) (see Feedback-Chanel, below).
 
 ## Installation
-There are two ways to install and use son-emu. The simple one is to use Vagrant to create a VirtualBox-based VM on you machine that contains the pre-installed and configured emulator. The more complicated installation requires a freshly installed Ubuntu 14.04 LTS and is done by a ansible playbook.
+There are two ways to install and use son-emu. The simple one is to use Vagrant to create a VirtualBox-based VM on your machine that contains the pre-installed and configured emulator. The more complicated installation requires a freshly installed Ubuntu 16.04 LTS and is done by a ansible playbook.
 
 ### Vagrant Installation
 
@@ -92,7 +96,7 @@ Follow the MOTD in the VM to run the example topology and the dummy-gatekeeper.
 
 ### Ansible Installation
 
-* Requires: Ubuntu 14.04 LTS
+* Requires: Ubuntu 16.04 LTS
 * `sudo apt-get install ansible git aptitude`
 * `sudo vim /etc/ansible/hosts`
 * Add: `localhost ansible_connection=local`
@@ -115,7 +119,6 @@ Follow the MOTD in the VM to run the example topology and the dummy-gatekeeper.
 ## Usage
 
 ### Examples
-#### Manual Usage Example:
 
 This simple example shows how to start the emulator with a simple topology (terminal 1) and how to start (terminal 2) some empty VNF containers in the emulated datacenters (PoPs) by using the son-emu-cli.
 
@@ -129,23 +132,11 @@ This simple example shows how to start the emulator with a simple topology (term
  * `containernet> vnf1 ifconfig`
  * `containernet> vnf1 ping -c 2 vnf2`
 
-#### Dummy Gatekeeper Example:
-
-This example shows how to deploy a SONATA example package in the emulator using the dummy gatekeeper.
-
-* First terminal (start the emulation platform):
- * `sudo python src/emuvim/examples/sonata_y1_demo_topology_1.py`
-* Second terminal (deploy the example package):
- * Upload: `curl -i -X POST -F package=@sonata-demo-docker.son http://127.0.0.1:5000/packages`
- * Instantiate: `curl -X POST http://127.0.0.1:5000/instantiations -d "{}"`
- * Verify that service runs: `son-emu-cli compute list`
-
-Note: The [son-push](https://github.com/mpeuster/son-cli) tool can be used instead of CURL.
-
 
 ### Further Documentation
 * [Full CLI command documentation](https://github.com/sonata-nfv/son-emu/wiki/CLI-Command-Overview)
 * [Requirements for Docker containers executed by the emulator](https://github.com/sonata-nfv/son-emu/wiki/Container-Requirements)
+* [REST API](https://github.com/sonata-nfv/son-emu/wiki/REST-API-command-overview)
 
 ## License
 
@@ -168,6 +159,7 @@ The following lead developers are responsible for this repository and have admin
 * Hadi Razzaghi Kouchaksaraei (https://github.com/hadik3r)
 * Wouter Tavernier (https://github.com/wtaverni)
 * Geoffroy Chollon (https://github.com/cgeoffroy)
+* Eduard Maas (https://github.com/edmaas)
 
 #### Feedback-Chanel
 
index 891f95d..10b6c26 100755 (executable)
@@ -130,7 +130,11 @@ class RestApiEndpoint(object):
         logging.info("Started API endpoint @ http://%s:%d" % (self.ip, self.port))
 
     def _start_flask(self):
-        #self.app.run(self.ip, self.port, debug=True, use_reloader=False)
+        #self.app.run(self.ip, self.port, debug=False, use_reloader=False)
         #this should be a more production-fit http-server
-        http_server = WSGIServer((self.ip, self.port), self.app)
+        #self.app.logger.setLevel(logging.ERROR)
+        http_server = WSGIServer((self.ip, self.port),
+                                 self.app,
+                                 log=open("/dev/null", "w")  # This disables HTTP request logs to not mess up the CLI when e.g. the auto-updated dashboard is used
+        )
         http_server.serve_forever()
index 485a6b1..cbff5e0 100755 (executable)
@@ -25,7 +25,7 @@
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
     <![endif]-->
 
-    <script src="js/main.js" type="text/javascript"></script>
+    <script src="js/main_upb.js" type="text/javascript"></script>
 
 
 </head>
       <div class="col-sm-4" id="logo"><a href="http://sonata-nfv.eu" target="_blank"><img src="img/SONATA_new.png" alt="SONATA Logo" width="252" height="70"></a></div>
     </div>
 
-<nav class="navbar navbar-default">
-  <div class="container-fluid">
-    <!-- Brand and toggle get grouped for better mobile display -->
-    <div class="navbar-header">
-      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
-        <span class="sr-only">Toggle navigation</span>
-        <span class="icon-bar"></span>
-        <span class="icon-bar"></span>
-        <span class="icon-bar"></span>
-      </button>
-    </div>
-
-    <!-- Collect the nav links, forms, and other content for toggling -->
-    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-      <div class="navbar-form navbar- navbar-btn btn-group" role="group" aria-label="category">
-          <!--<button type="button" class="btn btn-default active" id="btn_tab_pop">Datacenter List</button>-->
-          <!--<button type="button" class="btn btn-default" id="btn_tab_container">Container List</button>-->
-          <!--<button type="button" class="btn btn-default" id="btn_tab_other">Other</button> -->
-      </div>
-      <form class="navbar-form navbar-right">
-       <div class="input-group">
-          <span class="input-group-addon">http://</span>
-         <input type="text" class="form-control" placeholder="api-url.or.ip" value="localhost:5001" id="text_api_host" data-provide="typeahead" size="30">
-       </div>
-       <button type="button" class="btn btn-success" id="btn_connect">Connect &nbsp;<span class="glyphicon glyphicon-play-circle"></span></button>
-       <button type="button" class="btn btn-danger disabled" id="btn_disconnect">Disconnect &nbsp;<span class="glyphicon glyphicon-off"></span></button>
-               </form> 
-    </div><!-- /.navbar-collapse -->
-  </div><!-- /.container-fluid -->
-</nav>
 </div>
   <div id="content">
 
 
 </div>
 
-<footer class="footer text-center small">(c) 2017 by SONATA Consortium and Paderborn University and IMEC</footer>
+<footer class="footer text-center small">(c) 2017 by SONATA Consortium, Paderborn University and IMEC</footer>
 
 
 </body>
index 0fb707d..619702f 100755 (executable)
@@ -1,18 +1,18 @@
-var API_HOST = "http://127.0.0.1:5001";
+var API_HOST = "";  // set to a remote url if dashboard is not served by REST API server
 var ERROR_ALERT = false;
 var TIMESTAMP = 0;
 var CONNECTED = false;
 var LATENESS_UPDATE_INTERVAL = 50;
-var DATA_UPDATE_INTERVAL = 1000 * 10;
+var DATA_UPDATE_INTERVAL = 1000 * 2;
 var LAST_UPDATE_TIMESTAMP_CONTAINER = 0;
 var LAST_UPDATE_TIMESTAMP_DATACENTER = 0;
 
 
 function update_lateness_loop() {
     lateness_datacenter= (Date.now() - LAST_UPDATE_TIMESTAMP_DATACENTER) / 1000;
-    $("#lbl_lateness_datacenter").text("Lateness: " + Number(lateness_datacenter).toPrecision(3) + "s");
+    $("#lbl_lateness_datacenter").text("Lateness: " + Number(lateness_datacenter).toPrecision(2) + "s");
     lateness_container= (Date.now() - LAST_UPDATE_TIMESTAMP_CONTAINER) / 1000;
-    $("#lbl_lateness_container").text("Lateness: " + Number(lateness_container).toPrecision(3) + "s");
+    $("#lbl_lateness_container").text("Lateness: " + Number(lateness_container).toPrecision(2) + "s");
     // loop while connected
     if(CONNECTED)
         setTimeout(update_lateness_loop, LATENESS_UPDATE_INTERVAL)
@@ -26,11 +26,12 @@ function errorAjaxConnection()
     {
         ERROR_ALERT = true;
         // show message
-        alert("ERROR!\nAPI request failed.\n\n Please check the backend connection.", function() {
+        alert("API request failed. Is the emulator running?", function() {
             // callback
             ERROR_ALERT = false;
         });
     }
+    CONNECTED = false;
 }
 
 
@@ -106,14 +107,6 @@ function fetch_container()
 }
 
 
-function fetch_d3graph()
-{
-    // do HTTP request and trigger gui update on success
-    var request_url = API_HOST + "/restapi/network/d3jsgraph";
-    console.debug("fetching from: " + request_url);
-    //$.getJSON(request_url,  update_graph);
-}
-
 function fetch_loop()
 {
     // only fetch if we are connected
@@ -134,7 +127,7 @@ function connect()
 {
     console.info("connect()");
     // get host address
-    API_HOST = "http://" + $("#text_api_host").val();
+    //API_HOST = "http://" + $("#text_api_host").val();
     console.debug("API address: " + API_HOST);
     // reset data
     LAST_UPDATE_TIMESTAMP_DATACENTER = Date.now();
@@ -144,36 +137,19 @@ function connect()
     update_lateness_loop();
     // restart data fetch loop
     fetch_loop();
-    // gui updates
-    $("#btn_disconnect").removeClass("disabled");
-    $("#btn_connect").addClass("disabled");
-}
-
-function disconnect()
-{
-    console.info("disconnect()");
-    CONNECTED = false;
-     // gui updates
-    $("#btn_connect").removeClass("disabled");
-    $("#btn_disconnect").addClass("disabled");
 }
 
 
 $(document).ready(function(){
     console.info("document ready");
     // setup global connection error handling
-    /*
+    
     $.ajaxSetup({
         "error": errorAjaxConnection
     });
 
-    // add listeners
-    $("#btn_connect").click(connect);
-    $("#btn_disconnect").click(disconnect);
-    */
-    setTimeout(fetch_datacenter, 1000);//fetch_datacenter();
-    setTimeout(fetch_container, 2000);//fetch_container();
-
+    // connect
+    connect();
 
     // additional refresh on window focus
     $(window).focus(function () {