installation script enhancement. Allow test/basictest install openvim in test mode
[osm/RO.git] / openmano
index 7c3c5ac..6c546c1 100755 (executable)
--- a/openmano
+++ b/openmano
@@ -28,8 +28,8 @@ openmano client used to interact with openmano-server (openmanod)
 '''
 __author__="Alfonso Tierno, Gerardo Garcia"
 __date__ ="$09-oct-2014 09:09:48$"
-__version__="0.4.5-r489"
-version_date="Aug 2016"
+__version__="0.4.7-r511"
+version_date="Oct 2016"
 
 from argcomplete.completers import FilesCompleter
 import os
@@ -480,6 +480,8 @@ def scenario_deploy(args):
     args.file = None
     args.netmap_use = None
     args.netmap_create = None
+    args.keypair = None
+    args.keypair_auto = None
     return instance_create(args)
 
 #     #print "scenario-deploy",args
@@ -594,7 +596,9 @@ def instance_create(args):
                 net_datacenter = net_tuple[1].strip()
                 if net_scenario not in myInstance["instance"]["networks"]:
                     myInstance["instance"]["networks"][net_scenario] = {} 
-                myInstance["instance"]["networks"][net_scenario]["netmap-use"] = net_datacenter
+                if "sites" not in myInstance["instance"]["networks"][net_scenario]:
+                    myInstance["instance"]["networks"][net_scenario]["sites"] = [ {} ]
+                myInstance["instance"]["networks"][net_scenario]["sites"][0]["netmap-use"] = net_datacenter
     if args.netmap_create:
         if "networks" not in myInstance["instance"]:
             myInstance["instance"]["networks"] = {}
@@ -613,7 +617,9 @@ def instance_create(args):
                     return
                 if net_scenario not in myInstance["instance"]["networks"]:
                     myInstance["instance"]["networks"][net_scenario] = {} 
-                myInstance["instance"]["networks"][net_scenario]["netmap-create"] = net_datacenter
+                if "sites" not in myInstance["instance"]["networks"][net_scenario]:
+                    myInstance["instance"]["networks"][net_scenario]["sites"] = [ {} ]
+                myInstance["instance"]["networks"][net_scenario]["sites"][0]["netmap-create"] = net_datacenter
     if args.keypair:
         if "cloud-config" not in myInstance["instance"]:
             myInstance["instance"]["cloud-config"] = {}
@@ -736,12 +742,12 @@ def instance_scenario_list(args):
                 print "---------------------------------------"
                 print "Internal nets:"
                 for net in instance['nets']:
-                    if not net['external']:
+                    if net['created']:
                         print "    %s %s VIM ID: %s" %(net['uuid'].ljust(38), net['status'].ljust(12), net['vim_net_id'])
                 print "---------------------------------------"
                 print "External nets:"
                 for net in instance['nets']:
-                    if net['external']:
+                    if not net['created']:
                         print "    %s %s VIM ID: %s" %(net['uuid'].ljust(38), net['status'].ljust(12), net['vim_net_id'])
             print "---------------------------------------"
             print "VM instances:"
@@ -883,6 +889,8 @@ def datacenter_attach(args):
         datacenter_dict['vim_username'] = args.user
     if args.password != None:
         datacenter_dict['vim_password'] = args.password
+    if args.config!=None:
+        datacenter_dict["config"] = _load_file_or_yaml(args.config)
     payload_req = json.dumps( {"datacenter": datacenter_dict })
     
     #print payload_req
@@ -1329,6 +1337,7 @@ if __name__=="__main__":
     datacenter_attach_parser.add_argument('--vim-tenant-name', action='store', help="specify a datacenter tenant name.")
     datacenter_attach_parser.add_argument("--user", action="store", help="user credentials for the datacenter")
     datacenter_attach_parser.add_argument("--password", action="store", help="password credentials for the datacenter")
+    datacenter_attach_parser.add_argument("--config", action="store", help="aditional configuration in json/yaml format")
     datacenter_attach_parser.set_defaults(func=datacenter_attach)
 
     datacenter_detach_parser = subparsers.add_parser('datacenter-detach', parents=[parent_parser], help="removes the association between a datacenter and the operating tenant")