(bug 589) add proper filtering VDU by instance-id on scalling
[osm/RO.git] / osm_ro / nfvo.py
index cfd2b43..01ac017 100644 (file)
@@ -1604,7 +1604,7 @@ def get_vnf_id(mydb, tenant_id, vnf_id):
             SELECT=('vms.uuid as uuid', 'vms.osm_id as osm_id', 'vms.name as name', 'vms.description as description',
                     'boot_data'),
             WHERE={'vnfs.uuid': vnf_id} )
-    if len(content)!=0:
+    if len(content) != 0:
         #raise NfvoException("vnf '{}' not found".format(vnf_id), HTTP_Not_Found)
     # change boot_data into boot-data
         for vm in content:
@@ -1612,7 +1612,7 @@ def get_vnf_id(mydb, tenant_id, vnf_id):
                 vm["boot-data"] = yaml.safe_load(vm["boot_data"])
                 del vm["boot_data"]
 
-    data['vnf']['VNFC'] = content
+        data['vnf']['VNFC'] = content
     #TODO: GET all the information from a VNFC and include it in the output.
 
     #GET NET
@@ -4374,13 +4374,14 @@ def instance_action(mydb,nfvo_tenant,instance_id, action_dict):
                     raise NfvoException("Cannot find the vdu with id {}".format(vdu_id), HTTP_Not_Found)
             else:
                 if not osm_vdu_id and not member_vnf_index:
-                    raise NfvoException("Invalid imput vdu parameters. Must supply either 'vdu-id' of 'osm_vdu_id','member-vnf-index'")
+                    raise NfvoException("Invalid input vdu parameters. Must supply either 'vdu-id' of 'osm_vdu_id','member-vnf-index'")
                 target_vms = mydb.get_rows(
                     # SELECT=("ivms.uuid", "ivnfs.datacenter_id", "ivnfs.datacenter_tenant_id"),
                     FROM="instance_vms as ivms join instance_vnfs as ivnfs on ivms.instance_vnf_id=ivnfs.uuid"\
                          " join sce_vnfs as svnfs on ivnfs.sce_vnf_id=svnfs.uuid"\
                          " join vms on ivms.vm_id=vms.uuid",
-                    WHERE={"vms.osm_id": osm_vdu_id, "svnfs.member_vnf_index": member_vnf_index},
+                    WHERE={"vms.osm_id": osm_vdu_id, "svnfs.member_vnf_index": member_vnf_index,
+                           "ivnfs.instance_scenario_id": instance_id},
                     ORDER_BY="ivms.created_at"
                 )
                 if not target_vms: