X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=openmano;h=11cc726fb3804accd6b918ee0dd6d56d5ad7368b;hb=refs%2Fchanges%2F27%2F927%2F1;hp=7c3c5ac489ec9d72cbc5b595f883042d946d78f5;hpb=a4e1a6ed87de04788ec6855fc8a5e722914e4f03;p=osm%2FRO.git diff --git a/openmano b/openmano index 7c3c5ac4..11cc726f 100755 --- 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.8-r512" +version_date="Oct 2016" from argcomplete.completers import FilesCompleter import os @@ -251,7 +251,7 @@ def vnf_create(args): tenant = _get_tenant() myvnf = _load_file_or_yaml(args.file) - if args.name or args.description or args.image_path: + if args.name or args.description or args.image_path or args.image_name or args.image_checksum: #print args.name try: if args.name: @@ -264,6 +264,16 @@ def vnf_create(args): #print "image-path", image_path_ myvnf['vnf']['VNFC'][index]['VNFC image']=image_path_ index=index+1 + if args.image_name: + index=0 + for image_name_ in args.image_name.split(","): + myvnf['vnf']['VNFC'][index]['image name']=image_name_ + index=index+1 + if args.image_checksum: + index=0 + for image_checksum_ in args.image_checksum.split(","): + myvnf['vnf']['VNFC'][index]['image checksum']=image_checksum_ + index=index+1 except (KeyError, TypeError), e: if str(e)=='vnf': error_pos= "missing field 'vnf'" elif str(e)=='name': error_pos= "missing field 'vnf':'name'" @@ -271,6 +281,8 @@ def vnf_create(args): elif str(e)=='VNFC': error_pos= "missing field 'vnf':'VNFC'" elif str(e)==str(index): error_pos= "field 'vnf':'VNFC' must be an array" elif str(e)=='VNFC image': error_pos= "missing field 'vnf':'VNFC'['VNFC image']" + elif str(e)=='image name': error_pos= "missing field 'vnf':'VNFC'['image name']" + elif str(e)=='image checksum': error_pos= "missing field 'vnf':'VNFC'['image checksum']" else: error_pos="wrong format" print "Wrong VNF descriptor: " + error_pos return -1 @@ -480,6 +492,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 +608,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 +629,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 +754,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 +901,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 @@ -1199,6 +1219,8 @@ if __name__=="__main__": vnf_create_parser.add_argument("--name", action="store", help="name of the VNF (if it exists in the VNF descriptor, it is overwritten)") vnf_create_parser.add_argument("--description", action="store", help="description of the VNF (if it exists in the VNF descriptor, it is overwritten)") vnf_create_parser.add_argument("--image-path", action="store", help="change image path locations (overwritten)") + vnf_create_parser.add_argument("--image-name", action="store", help="change image name (overwritten)") + vnf_create_parser.add_argument("--image-checksum", action="store", help="change image checksum (overwritten)") vnf_create_parser.set_defaults(func=vnf_create) vnf_list_parser = subparsers.add_parser('vnf-list', parents=[parent_parser], help="lists information about a vnf") @@ -1329,6 +1351,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")