Add new method to retrieve vnf-id
[policy/models.git] / models-interactions / model-impl / aai / src / main / java / org / onap / policy / aai / AaiCqResponse.java
index 1b18e43..2648959 100644 (file)
@@ -382,6 +382,24 @@ public class AaiCqResponse implements Serializable {
         return null;
     }
 
+    /**
+     * Returns the VNF given the vnf-id.
+     *
+     * @param vnfId The vnf-id
+     * @return generic Vnf
+     */
+    public GenericVnf getGenericVnfByVnfId(String vnfId) {
+        List<GenericVnf> genericVnfList = this.getGenericVnfs();
+
+        for (GenericVnf genVnf : genericVnfList) {
+            if (vnfId.equals(genVnf.getVnfId())) {
+                return genVnf;
+            }
+        }
+
+        return null;
+    }
+
     /**
      * Get the generic vnf associated with the vserver in the custom query.
      *