Add rest api
[osm/vim-emu.git] / src / emuvim / cli / network.py
index 911c5ef..48ff33a 100755 (executable)
@@ -1,6 +1,7 @@
 """\r
 son-emu network CLI\r
 (c) 2016 by Manuel Peuster <manuel.peuster@upb.de>\r
+Steven Van Rossem <steven.vanrossem@intec.ugent.be>\r
 """\r
 \r
 import argparse\r
@@ -25,7 +26,7 @@ class ZeroRpcClient(object):
             # call the local method with the same name as the command arg\r
             getattr(self, args["command"])(args)\r
         else:\r
-            print "Command not implemented."\r
+            print("Command not implemented.")\r
 \r
     def add(self, args):\r
         vnf_src_name = self._parse_vnf_name(args.get("source"))\r
@@ -56,6 +57,7 @@ class ZeroRpcClient(object):
             vnf_dst_interface=self._parse_vnf_interface(args.get("destination")),\r
             weight=args.get("weight"),\r
             match=args.get("match"),\r
+            bidirectional=args.get("bidirectional"),\r
             cookie=args.get("cookie"))\r
 \r
         r = self.c.network_action_stop(\r
@@ -83,7 +85,8 @@ class ZeroRpcClient(object):
 parser = argparse.ArgumentParser(description='son-emu network')\r
 parser.add_argument(\r
     "command",\r
-    help="Action to be executed: add|remove")\r
+    choices=['add', 'remove'],\r
+    help="Action to be executed.")\r
 parser.add_argument(\r
     "--datacenter", "-d", dest="datacenter",\r
     help="Data center to in which the network action should be initiated")\r
@@ -102,10 +105,10 @@ parser.add_argument(
 parser.add_argument(\r
     "--bidirectional", "-b", dest="bidirectional",\r
     action='store_true',\r
-    help="add/remove the flow entries in 2 directions")\r
+    help="add/remove the flow entries from src to dst and back")\r
 parser.add_argument(\r
     "--cookie", "-c", dest="cookie",\r
-    help="cookie for this flow")\r
+    help="cookie for this flow, as easy to use identifier (eg. per tenant/service)")\r
 \r
 def main(argv):\r
     args = vars(parser.parse_args(argv))\r