Extended network API to support multiple interfaces in a single Docker container...
[osm/vim-emu.git] / emuvim / cli / compute.py
old mode 100644 (file)
new mode 100755 (executable)
index c5f2231..70de20a
@@ -27,8 +27,17 @@ class ZeroRpcClient(object):
             print "Command not implemented."
 
     def start(self, args):
+        nw_list = list()
+        if args.get("network") is not None:
+            networks = args.get("network").split(",")
+            for nw in networks:
+                nw_list.append({"ip": nw})
         r = self.c.compute_action_start(
-            args.get("datacenter"), args.get("name"))
+            args.get("datacenter"),
+            args.get("name"),
+            args.get("image"),
+            args.get("docker_command"),
+            nw_list)
         pp.pprint(r)
 
     def stop(self, args):
@@ -72,12 +81,26 @@ class ZeroRpcClient(object):
 
 
 parser = argparse.ArgumentParser(description='son-emu compute')
-parser.add_argument("command", help="Action to be executed.")
 parser.add_argument(
-    "--datacenter", "-d", dest="datacenter", help="Data center.")
+    "command",
+    choices=['start', 'stop', 'list', 'status'],
+    help="Action to be executed.")
+parser.add_argument(
+    "--datacenter", "-d", dest="datacenter",
+    help="Data center to in which the compute instance should be executed")
+parser.add_argument(
+    "--name", "-n", dest="name",
+    help="Name of compute instance e.g. 'vnf1'")
+parser.add_argument(
+    "--image","-i", dest="image",
+    help="Name of container image to be used e.g. 'ubuntu'")
+parser.add_argument(
+    "--dcmd", "-c", dest="docker_command",
+    help="Startup command of the container e.g. './start.sh'")
 parser.add_argument(
-    "--name", "-n", dest="name", help="Compute name.")
-# TODO: IP, image, etc. pp.
+    "--net", dest="network",
+    help="Network properties of compute instance e.g. \
+          '10.0.0.123/8' or '10.0.0.123/8,11.0.0.123/24' for multiple interfaces.")
 
 
 def main(argv):