add skewness monitor control
[osm/vim-emu.git] / src / emuvim / api / rest / monitor.py
index 8de0379..490f5cc 100755 (executable)
@@ -113,7 +113,10 @@ class MonitorFlowAction(Resource):
 
 class MonitorLinkAction(Resource):
     """
-    Add or remove chains between VNFs. These chain links are implemented as flow entries in the networks' SDN switches.
+    Add or remove flow monitoring on chains between VNFs.
+    These chain links are implemented as flow entries in the networks' SDN switches.
+    The monitoring is an extra flow entry on top of the existing chain, with a specific match. (preserving the chaining)
+    The counters of this new monitoring flow are exported
     :param vnf_src_name: VNF name of the source of the link
     :param vnf_dst_name: VNF name of the destination of the link
     :param vnf_src_interface: VNF interface name of the source of the link
@@ -199,7 +202,11 @@ class MonitorLinkAction(Resource):
                 vnf_name = vnf_src_name
                 vnf_interface = vnf_src_interface
 
-            c2 = net.monitor_agent.setup_flow(vnf_name, vnf_interface, metric, cookie)
+            c2 = 'command unknown'
+            if command == 'add-flow':
+                c2 = net.monitor_agent.setup_flow(vnf_name, vnf_interface, metric, cookie)
+            elif command == 'del-flows':
+                c2 = net.monitor_agent.stop_flow(vnf_name, vnf_interface, metric, cookie)
 
             # return setChain response
             return (str(c1) + " " + str(c2)), 200