Merge branch 'master' into master
diff --git a/src/emuvim/api/rest/compute.py b/src/emuvim/api/rest/compute.py
index f0c8954..dc2b611 100755
--- a/src/emuvim/api/rest/compute.py
+++ b/src/emuvim/api/rest/compute.py
@@ -32,6 +32,8 @@
 
 logging.basicConfig(level=logging.INFO)
 
+CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
+
 dcs = {}
 
 
@@ -72,10 +74,10 @@
             c = dcs.get(dc_label).startCompute(
                 compute_name, image=image, command=command, network=nw_list)
             # return docker inspect dict
-            return c.getStatus(), 200
+            return c.getStatus(), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def _update_resource(self, dc_label, compute_name, resource, value):
         #check if container exists
@@ -96,18 +98,18 @@
         logging.debug("API CALL: compute status")
 
         try:
-            return dcs.get(dc_label).containers.get(compute_name).getStatus(), 200
+            return dcs.get(dc_label).containers.get(compute_name).getStatus(), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def delete(self, dc_label, compute_name):
         logging.debug("API CALL: compute stop")
         try:
-            return dcs.get(dc_label).stopCompute(compute_name), 200
+            return dcs.get(dc_label).stopCompute(compute_name), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def _parse_network(self, network_str):
         '''
@@ -140,14 +142,14 @@
                 all_containers = []
                 for dc in dcs.itervalues():
                     all_containers += dc.listCompute()
-                return [(c.name, c.getStatus()) for c in all_containers], 200
+                return [(c.name, c.getStatus()) for c in all_containers], 200, CORS_HEADER
             else:
                 # return list of compute nodes for specified DC
                 return [(c.name, c.getStatus())
-                        for c in dcs.get(dc_label).listCompute()], 200
+                        for c in dcs.get(dc_label).listCompute()], 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
 
 class DatacenterList(Resource):
@@ -156,10 +158,10 @@
     def get(self):
         logging.debug("API CALL: datacenter list")
         try:
-            return [d.getStatus() for d in dcs.itervalues()], 200
+            return [d.getStatus() for d in dcs.itervalues()], 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
 
 class DatacenterStatus(Resource):
@@ -168,7 +170,7 @@
     def get(self, dc_label):
         logging.debug("API CALL: datacenter status")
         try:
-            return dcs.get(dc_label).getStatus(), 200
+            return dcs.get(dc_label).getStatus(), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
diff --git a/src/emuvim/api/rest/monitor.py b/src/emuvim/api/rest/monitor.py
index c1c7831..6f99bdf 100755
--- a/src/emuvim/api/rest/monitor.py
+++ b/src/emuvim/api/rest/monitor.py
@@ -39,6 +39,8 @@
 
 logging.basicConfig(level=logging.INFO)
 
+CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
+
 net = None
 
 
@@ -61,10 +63,10 @@
             else:
                 c = net.monitor_agent.setup_metric(vnf_name, vnf_interface, metric)
             # return monitor message response
-            return  str(c), 200
+            return  str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def delete(self, vnf_name, vnf_interface=None, metric='tx_packets', cookie=None):
         logging.debug("REST CALL: stop monitor VNF interface")
@@ -74,10 +76,10 @@
             else:
                 c = net.monitor_agent.stop_metric(vnf_name, vnf_interface, metric)
             # return monitor message response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
 
 class MonitorFlowAction(Resource):
@@ -96,20 +98,20 @@
         try:
             c = net.monitor_agent.setup_flow(vnf_name, vnf_interface, metric, cookie)
             # return monitor message response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def delete(self, vnf_name, vnf_interface=None, metric='tx_packets', cookie=0):
         logging.debug("REST CALL: stop monitor VNF interface")
         try:
             c = net.monitor_agent.stop_flow(vnf_name, vnf_interface, metric, cookie)
             # return monitor message response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
 class MonitorLinkAction(Resource):
     """
@@ -144,7 +146,7 @@
             return self._MonitorLinkAction(vnf_src_name, vnf_dst_name, command=command)
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def delete(self, vnf_src_name, vnf_dst_name):
         logging.debug("REST CALL: monitor link flow remove")
@@ -154,7 +156,7 @@
             return self._MonitorLinkAction(vnf_src_name, vnf_dst_name, command=command)
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
+            return ex.message, 500, CORS_HEADER
 
     def _MonitorLinkAction(self, vnf_src_name, vnf_dst_name, command=None):
         # call DCNetwork method, not really datacenter specific API for now...
@@ -209,7 +211,7 @@
                 c2 = net.monitor_agent.stop_flow(vnf_name, vnf_interface, metric, cookie)
 
             # return setChain response
-            return (str(c1) + " " + str(c2)), 200
+            return (str(c1) + " " + str(c2)), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
             return ex.message, 500
@@ -242,7 +244,8 @@
             c = net.monitor_agent.update_skewmon(vnf_name, resource_name, action='stop')
 
             # return monitor message response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
\ No newline at end of file
+            return ex.message, 500, CORS_HEADER
+
diff --git a/src/emuvim/api/rest/network.py b/src/emuvim/api/rest/network.py
index 88ea470..c4ab23f 100755
--- a/src/emuvim/api/rest/network.py
+++ b/src/emuvim/api/rest/network.py
@@ -38,6 +38,7 @@
 import json
 
 logging.basicConfig(level=logging.INFO)
+CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
 
 # the global net is set from the topology file, and connected via connectDCNetwork function in rest_api_endpoint.py
 net = None
@@ -109,7 +110,7 @@
                 monitor=monitor,
                 monitor_placement=monitor_placement)
             # return setChain response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
\ No newline at end of file
+            return ex.message, 500, CORS_HEADER
diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py
index b0838e0..1a8d938 100755
--- a/src/emuvim/dcemulator/net.py
+++ b/src/emuvim/dcemulator/net.py
@@ -202,7 +202,7 @@
         edge_attributes = [p for p in params if p in weight_metrics]
         for attr in edge_attributes:
             # if delay: strip ms (need number as weight in graph)
-            match = re.search('([0-9]*\.?[0-9]+)', params[attr])
+            match = re.search('([0-9]*\.?[0-9]+)', str(params[attr]))
             if match:
                 attr_number = match.group(1)
             else: