From: tierno Date: Wed, 18 Jan 2017 16:44:32 +0000 (+0100) Subject: allow new vim-image-list/delete commands X-Git-Tag: v1.1.0~21 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F987%2F3;p=osm%2FRO.git allow new vim-image-list/delete commands Change-Id: Id53af6bac339bd71557b9762b3f57e53680971e1 Signed-off-by: tierno --- diff --git a/nfvo.py b/nfvo.py index 7537c756..21e57195 100644 --- a/nfvo.py +++ b/nfvo.py @@ -2759,6 +2759,8 @@ def vim_action_get(mydb, tenant_id, datacenter, item, name): content = myvim.get_network_list(filter_dict=filter_dict) elif item=="tenants": content = myvim.get_tenant_list(filter_dict=filter_dict) + elif item == "images": + content = myvim.get_image_list(filter_dict=filter_dict) else: raise NfvoException(item + "?", HTTP_Method_Not_Allowed) logger.debug("vim_action response %s", content) #update nets Change from VIM format to NFVO format @@ -2796,6 +2798,8 @@ def vim_action_delete(mydb, tenant_id, datacenter, item, name): content = myvim.delete_network(item_id) elif item=="tenants": content = myvim.delete_tenant(item_id) + elif item == "images": + content = myvim.delete_image(item_id) else: raise NfvoException(item + "?", HTTP_Method_Not_Allowed) except vimconn.vimconnException as e: diff --git a/openmano b/openmano index ab492f6d..66c12610 100755 --- a/openmano +++ b/openmano @@ -28,7 +28,7 @@ openmano client used to interact with openmano-server (openmanod) ''' __author__="Alfonso Tierno, Gerardo Garcia" __date__ ="$09-oct-2014 09:09:48$" -__version__="0.4.9-r515" +__version__="0.4.10-r516" version_date="Jan 2017" from argcomplete.completers import FilesCompleter @@ -1415,7 +1415,7 @@ if __name__=="__main__": datacenter_action_parser.add_argument("-f","--force", action="store_true", help="do not prompt for confirmation") datacenter_action_parser.set_defaults(func=datacenter_netmap_action, action=item) - for item in ("network", "tenant"): + for item in ("network", "tenant", "image"): if item=="network": commnad_name = 'vim-net' else: @@ -1430,17 +1430,18 @@ if __name__=="__main__": vim_item_del_parser.add_argument("--datacenter", action="store", help="specifies the datacenter") vim_item_del_parser.set_defaults(func=vim_action, item=item, action="delete") - vim_item_create_parser = subparsers.add_parser(commnad_name + '-create', parents=[parent_parser], help="create a "+item+" at vim") - vim_item_create_parser.add_argument("file", nargs='?', help="descriptor of the %s. Must be a file or yaml/json text" % item).completer = FilesCompleter - vim_item_create_parser.add_argument("--name", action="store", help="name of the %s" % item ) - vim_item_create_parser.add_argument("--datacenter", action="store", help="specifies the datacenter") - if item=="network": - vim_item_create_parser.add_argument("--type", action="store", help="type of network, data, ptp, bridge") - vim_item_create_parser.add_argument("--shared", action="store_true", help="Private or shared") - vim_item_create_parser.add_argument("--bind-net", action="store", help="For openvim datacenter type, net to be bind to, for vlan type, use sufix ':'") - else: - vim_item_create_parser.add_argument("--description", action="store", help="description of the %s" % item) - vim_item_create_parser.set_defaults(func=vim_action, item=item, action="create") + if item == "network" or item == "tenant": + vim_item_create_parser = subparsers.add_parser(commnad_name + '-create', parents=[parent_parser], help="create a "+item+" at vim") + vim_item_create_parser.add_argument("file", nargs='?', help="descriptor of the %s. Must be a file or yaml/json text" % item).completer = FilesCompleter + vim_item_create_parser.add_argument("--name", action="store", help="name of the %s" % item ) + vim_item_create_parser.add_argument("--datacenter", action="store", help="specifies the datacenter") + if item=="network": + vim_item_create_parser.add_argument("--type", action="store", help="type of network, data, ptp, bridge") + vim_item_create_parser.add_argument("--shared", action="store_true", help="Private or shared") + vim_item_create_parser.add_argument("--bind-net", action="store", help="For openvim datacenter type, net to be bind to, for vlan type, use sufix ':'") + else: + vim_item_create_parser.add_argument("--description", action="store", help="description of the %s" % item) + vim_item_create_parser.set_defaults(func=vim_action, item=item, action="create") argcomplete.autocomplete(main_parser) diff --git a/openmanod.py b/openmanod.py index 761e9123..a5f0be0d 100755 --- a/openmanod.py +++ b/openmanod.py @@ -33,7 +33,7 @@ It loads the configuration file and launches the http_server thread that will li ''' __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ ="$26-aug-2014 11:09:29$" -__version__="0.5.5-r514" +__version__="0.5.6-r516" version_date="Jan 2017" database_version="0.19" #expected database schema version diff --git a/vimconn_openstack.py b/vimconn_openstack.py index fc3254bf..eaeae92f 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -659,9 +659,9 @@ class vimconnector(vimconn.vimconnector): #Then we filter by the rest of filter fields: checksum filtered_list = [] for image in image_list: - image_dict=self.glance.images.get(image.id) - if 'checksum' not in filter_dict or image_dict['checksum']==filter_dict.get('checksum'): - filtered_list.append(image_dict) + image_class=self.glance.images.get(image.id) + if 'checksum' not in filter_dict or image_class['checksum']==filter_dict.get('checksum'): + filtered_list.append(image_class.copy()) return filtered_list except (ksExceptions.ClientException, nvExceptions.ClientException, gl1Exceptions.CommunicationError, ConnectionError) as e: self._format_exception(e)