sub_composite_profile_name2="test_composite_profile2"
 composite_profile_description="test_composite_profile_description"
 
-genericPlacementIntentName1="test_gen_placement_intent1"
-genericPlacementIntentName2="test_gen_placement_intent2"
+genericPlacementIntentName="test_gen_placement_intent1"
 genericPlacementIntentDesc="test_gen_placement_intent_desc"
 logicalCloud="logical_cloud_name"
+
+appIntentNameForApp1="appIntentForApp1"
+appIntentForApp1Desc="AppIntentForApp1Desc"
+appIntentNameForApp2="appIntentForApp2"
+appIntentForApp2Desc="AppIntentForApp2Desc"
+providerName1="aws"
+providerName2="azure"
 clusterName1="edge1"
 clusterName2="edge2"
 clusterLabelName1="east-us1"
 payload="$(cat <<EOF
 {
    "metadata":{
-      "name":"${genericPlacementIntentName1}",
-      "description":"${genericPlacementIntentDesc}",
-      "userData1":"${userData1}",
-      "userData2":"${userData2}"
-   },
-   "spec":{
-      "logical-cloud":"${logicalCloud}"
-   }
-}
-EOF
-)"
-call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/generic-placement-intents"
-
-
-print_msg "Registering GenericPlacementIntent for app2"
-payload="$(cat <<EOF
-{
-   "metadata":{
-      "name":"${genericPlacementIntentName2}",
+      "name":"${genericPlacementIntentName}",
       "description":"${genericPlacementIntentDesc}",
       "userData1":"${userData1}",
       "userData2":"${userData2}"
 payload="$(cat <<EOF
 {
    "metadata":{
-      "name":"${genericPlacementIntentName1}",
-      "description":"${genericPlacementIntentDesc}",
+      "name":"${appIntentNameForApp1}",
+      "description":"${appIntentForApp1Desc}",
       "userData1":"${userData1}",
       "userData2":"${userData2}"
    },
       "app-name":"${app1_name}",
       "intent":{
          "allOf":[
-            {
+            {  "provider-name":"${providerName1}",
                "cluster-name":"${clusterName1}"
             },
             {
+               "provider-name":"${providerName2}",
                "cluster-name":"${clusterName2}"
             },
             {
                "anyOf":[
                   {
+                     "provider-name":"${providerName1}",
                      "cluster-label-name":"${clusterLabelName1}"
                   },
                   {
+                     "provider-name":"${providerName2}",
                      "cluster-label-name":"${clusterLabelName2}"
                   }
                ]
 }
 EOF
 )"
-call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/generic-placement-intents/${genericPlacementIntentName1}/app-intents"
+call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/generic-placement-intents/${genericPlacementIntentName}/app-intents"
 
 print_msg "Adding placement intent for app2(prometheus)"
 payload="$(cat <<EOF
 {
    "metadata":{
-      "name":"${genericPlacementIntentName2}",
-      "description":"${genericPlacementIntentDesc}",
+      "name":"${appIntentNameForApp2}",
+      "description":"${appIntentForApp2Desc}",
       "userData1":"${userData1}",
       "userData2":"${userData2}"
    },
       "intent":{
          "allOf":[
             {
+               "provider-name":"${providerName1}",
                "cluster-name":"${clusterName1}"
             },
             {
+               "provider-name":"${providerName2}",
                "cluster-name":"${clusterName2}"
             },
             {
                "anyOf":[
                   {
+                     "provider-name":"${providerName1}",
                      "cluster-label-name":"${clusterLabelName1}"
                   },
                   {
+                     "provider-name":"${providerName2}",
                      "cluster-label-name":"${clusterLabelName2}"
                   }
                ]
 }
 EOF
 )"
-call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/generic-placement-intents/${genericPlacementIntentName2}/app-intents"
+call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/generic-placement-intents/${genericPlacementIntentName}/app-intents"
 # END: Adding placement intent for each app in the composite app.
 
 # BEGIN: Registering DeploymentIntentGroup in the database
 # END: Registering DeploymentIntentGroup in the database
 
 # BEGIN: Adding intents to an intent group
-print_msg "Adding two intents to the intent group"
+print_msg "Adding the genericPlacement intent to the deploymentIntent group"
 payload="$(cat <<EOF
 {
    "metadata":{
    },
    "spec":{
       "intent":{
-         "generic-placement-intent":"${genericPlacementIntentName1}",
-         "generic-placement-intent":"${genericPlacementIntentName2}"
+         "generic-placement-intent":"${genericPlacementIntentName}"
       }
    }
 }
 
 
        router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.createAppIntentHandler).Methods("POST")
        router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.getAppIntentHandler).Methods("GET")
+       router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.getAllAppIntentsHandler).Methods("GET")
+       router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/", appIntentHandler.getAllIntentsByAppHandler).Queries("app-name", "{app-name}")
        router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.deleteAppIntentHandler).Methods("DELETE")
-
        //setting routes for deploymentIntentGroup
        if deploymentIntentGrpClient == nil {
                deploymentIntentGrpClient = moduleClient.DeploymentIntentGroup
 
 
 import (
        "encoding/json"
-       "github.com/gorilla/mux"
-       moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module"
        "io"
        "net/http"
+
+       "github.com/gorilla/mux"
+       "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation"
+       moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module"
 )
 
 /* Used to store backend implementation objects
 
 }
 
+/*
+getAllIntentsByAppHandler handles the URL:
+/v2/project/{project-name}/composite-apps/{composite-app-name}/{version}/generic-placement-intent/{intent-name}/app-intents?app-name=<app-name>
+*/
+func (h appIntentHandler) getAllIntentsByAppHandler(w http.ResponseWriter, r *http.Request) {
+
+       vars := mux.Vars(r)
+       pList := []string{"project-name", "composite-app-name", "composite-app-version", "intent-name"}
+       err := validation.IsValidParameterPresent(vars, pList)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusBadRequest)
+       }
+       p := vars["project-name"]
+       ca := vars["composite-app-name"]
+       v := vars["composite-app-version"]
+       i := vars["intent-name"]
+       aN := r.URL.Query().Get("app-name")
+       if aN == "" {
+               http.Error(w, "Missing appName in GET request", http.StatusBadRequest)
+               return
+       }
+
+       specData, err := h.client.GetAllIntentsByApp(aN, p, ca, v, i)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusInternalServerError)
+               return
+       }
+       w.Header().Set("Content-Type", "application/json")
+       w.WriteHeader(http.StatusOK)
+       err = json.NewEncoder(w).Encode(specData)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusInternalServerError)
+               return
+       }
+       return
+
+}
+
+/* getAllAppIntentsHandler handles the URL:
+/v2/project/{project-name}/composite-apps/{composite-app-name}/{version}/generic-placement-intent/{intent-name}/app-intents
+*/
+func (h appIntentHandler) getAllAppIntentsHandler(w http.ResponseWriter, r *http.Request) {
+       vars := mux.Vars(r)
+       pList := []string{"project-name", "composite-app-name", "composite-app-version", "intent-name"}
+       err := validation.IsValidParameterPresent(vars, pList)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusBadRequest)
+       }
+       p := vars["project-name"]
+       ca := vars["composite-app-name"]
+       v := vars["composite-app-version"]
+       i := vars["intent-name"]
+
+       applicationsAndClusterInfo, err := h.client.GetAllAppIntents(p, ca, v, i)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusInternalServerError)
+               return
+       }
+
+       w.Header().Set("Content-Type", "application/json")
+       w.WriteHeader(http.StatusOK)
+       err = json.NewEncoder(w).Encode(applicationsAndClusterInfo)
+       if err != nil {
+               http.Error(w, err.Error(), http.StatusInternalServerError)
+               return
+       }
+       return
+
+}
+
 func (h appIntentHandler) deleteAppIntentHandler(w http.ResponseWriter, r *http.Request) {
        vars := mux.Vars(r)
 
 
                        http.Error(w, err.Error(), http.StatusInternalServerError)
                        return
                }
-               kc_bytes, err := base64.StdEncoding.DecodeString(retAppProfileContent.Profile)
+               kcBytes, err := base64.StdEncoding.DecodeString(retAppProfileContent.Profile)
                if err != nil {
                        http.Error(w, err.Error(), http.StatusInternalServerError)
                        return
                }
-               _, err = pw.Write(kc_bytes)
+               _, err = pw.Write(kcBytes)
                if err != nil {
                        http.Error(w, err.Error(), http.StatusInternalServerError)
                        return
        case "application/octet-stream":
                w.Header().Set("Content-Type", "application/octet-stream")
                w.WriteHeader(http.StatusOK)
-               kc_bytes, err := base64.StdEncoding.DecodeString(retAppProfileContent.Profile)
+               kcBytes, err := base64.StdEncoding.DecodeString(retAppProfileContent.Profile)
                if err != nil {
                        http.Error(w, err.Error(), http.StatusInternalServerError)
                        return
                }
-               _, err = w.Write(kc_bytes)
+               _, err = w.Write(kcBytes)
                if err != nil {
                        http.Error(w, err.Error(), http.StatusInternalServerError)
                        return
 
 }
 
 func (c *MockRunTimeContext) RtcDeletePrefix(handle interface{}) error {
-       for k, _ := range c.Items {
+       for k := range c.Items {
                delete(c.Items, k)
        }
        return c.Err
 func (c *MockRunTimeContext) RtcGetHandles(handle interface{}) ([]interface{}, error) {
        var keys []interface{}
 
-       for k, _ := range c.Items {
+       for k := range c.Items {
                keys = append(keys, string(k))
        }
        return keys, c.Err
                        key:           "/context/9345674458787728/",
                },
                {
-                       label:         "Delete returns error case",
+                       label:         "Error case for adding app",
                        mockRtcontext: &MockRunTimeContext{Err: pkgerrors.Errorf("Error adding app to run time context:")},
                        key:           "/context/9345674458787728/",
                        expectedError: "Error adding app to run time context:",
 
                opts ...*options.FindOptions) (*mongo.Cursor, error)
        UpdateOne(ctx context.Context, filter interface{}, update interface{},
                opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
-        CountDocuments(ctx context.Context, filter interface{},
+       CountDocuments(ctx context.Context, filter interface{},
                opts ...*options.CountOptions) (int64, error)
 }
 
        }
        return nil
 }
-
 
        // Find the document(s) with key and get the tag values from the document(s)
        Find(coll string, key Key, tag string) ([][]byte, error)
 
-        // Removes the document(s) matching the key if no child reference in collection
+       // Removes the document(s) matching the key if no child reference in collection
        Remove(coll string, key Key) error
 
        // Remove all the document(s) matching the key
 
 import (
        "archive/tar"
        "compress/gzip"
+       "fmt"
        "io"
        "net"
        "regexp"
        }
        return errs
 }
+
+/*
+IsValidParameterPresent method takes in a vars map and a array of string parameters
+that you expect to be present in the GET request.
+Returns Nil if all the parameters are present or else shall return error message.
+*/
+func IsValidParameterPresent(vars map[string]string, sp []string) error {
+
+       for i := range sp {
+               v := vars[sp[i]]
+               if v == "" {
+                       errMessage := fmt.Sprintf("Missing %v in GET request", sp[i])
+                       return fmt.Errorf(errMessage)
+               }
+
+       }
+       return nil
+
+}
 
 
 package module
 
+/*
+This files deals with the backend implementation of adding
+genericPlacementIntents to deployementIntentGroup
+*/
+
 import (
        "encoding/json"
        "reflect"
 
 
 package module
 
+/*
+This file deals with the backend implementation of
+Adding/Querying AppIntents for each application in the composite-app
+*/
+
 import (
        "encoding/json"
        "reflect"
 
 // AllOf consists of AnyOfArray and ClusterNames array
 type AllOf struct {
+       ProviderName     string  `json:"provider-name,omitempty"`
        ClusterName      string  `json:"cluster-name,omitempty"`
        ClusterLabelName string  `json:"cluster-label-name,omitempty"`
        AnyOfArray       []AnyOf `json:"anyOf,omitempty"`
 }
 
-// AnyOf consists of Array of ClusterLabelNames
+// AnyOf consists of Array of ProviderName & ClusterLabelNames
 type AnyOf struct {
+       ProviderName     string `json:"provider-name,omitempty"`
        ClusterName      string `json:"cluster-name,omitempty"`
        ClusterLabelName string `json:"cluster-label-name,omitempty"`
 }
 type AppIntentManager interface {
        CreateAppIntent(a AppIntent, p string, ca string, v string, i string) (AppIntent, error)
        GetAppIntent(ai string, p string, ca string, v string, i string) (AppIntent, error)
+       GetAllIntentsByApp(aN, p, ca, v, i string) (SpecData, error)
+       GetAllAppIntents(p, ca, v, i string) (ApplicationsAndClusterInfo, error)
        DeleteAppIntent(ai string, p string, ca string, v string, i string) error
 }
 
+//AppIntentQueryKey required for query
+type AppIntentQueryKey struct {
+       AppName string `json:"app-name"`
+}
+
 // AppIntentKey is used as primary key
 type AppIntentKey struct {
        Name         string `json:"appintent"`
        Intent       string `json:"genericplacement"`
 }
 
+// AppIntentFindByAppKey required for query
+type AppIntentFindByAppKey struct {
+       Project             string `json:"project"`
+       CompositeApp        string `json:"compositeapp"`
+       CompositeAppVersion string `json:"compositeappversion"`
+       Intent              string `json:"genericplacement"`
+       AppName             string `json:"app-name"`
+}
+
+// ApplicationsAndClusterInfo type represents the list of
+type ApplicationsAndClusterInfo struct {
+       ArrayOfAppClusterInfo []AppClusterInfo `json:"applications"`
+}
+
+// AppClusterInfo is a type linking the app and the clusters
+// on which they need to be installed.
+type AppClusterInfo struct {
+       Name       string  `json:"name"`
+       AllOfArray []AllOf `json:"allOf,omitempty"`
+       AnyOfArray []AnyOf `json:"anyOf,omitempty"`
+}
+
 // We will use json marshalling to convert to string to
 // preserve the underlying structure.
 func (ak AppIntentKey) String() string {
        }
 }
 
-// CreateAppIntent creates an entry for AppIntent in the db. Other input parameters for it - projectName, compositeAppName, version, intentName.
+// CreateAppIntent creates an entry for AppIntent in the db.
+// Other input parameters for it - projectName, compositeAppName, version, intentName.
 func (c *AppIntentClient) CreateAppIntent(a AppIntent, p string, ca string, v string, i string) (AppIntent, error) {
 
        //Check for the AppIntent already exists here.
                Intent:       i,
        }
 
-       err = db.DBconn.Insert(c.storeName, akey, nil, c.tagMetaData, a)
+       qkey := AppIntentQueryKey{
+               AppName: a.Spec.AppName,
+       }
+
+       err = db.DBconn.Insert(c.storeName, akey, qkey, c.tagMetaData, a)
        if err != nil {
                return AppIntent{}, pkgerrors.Wrap(err, "Create DB entry error")
        }
        return AppIntent{}, pkgerrors.New("Error getting AppIntent")
 }
 
+/*
+GetAllIntentsByApp takes in parameters AppName, CompositeAppName, CompositeNameVersion
+and GenericPlacementIntentName. Returns SpecData which contains
+all the intents for the app.
+*/
+func (c *AppIntentClient) GetAllIntentsByApp(aN, p, ca, v, i string) (SpecData, error) {
+       k := AppIntentFindByAppKey{
+               Project:             p,
+               CompositeApp:        ca,
+               CompositeAppVersion: v,
+               Intent:              i,
+               AppName:             aN,
+       }
+       result, err := db.DBconn.Find(c.storeName, k, c.tagMetaData)
+       if err != nil {
+               return SpecData{}, pkgerrors.Wrap(err, "Get SpecData error")
+       }
+       var a AppIntent
+       err = db.DBconn.Unmarshal(result[0], &a)
+       if err != nil {
+               return SpecData{}, pkgerrors.Wrap(err, "Unmarshalling  SpecData")
+       }
+       return a.Spec, nil
+
+}
+
+/*
+GetAllAppIntents takes in paramaters ProjectName, CompositeAppName, CompositeNameVersion
+and GenericPlacementIntentName. Returns the ApplicationsAndClusterInfo Object - an array of AppClusterInfo
+*/
+func (c *AppIntentClient) GetAllAppIntents(p, ca, v, i string) (ApplicationsAndClusterInfo, error) {
+       k := AppIntentKey{
+               Name:         "",
+               Project:      p,
+               CompositeApp: ca,
+               Version:      v,
+               Intent:       i,
+       }
+       result, err := db.DBconn.Find(c.storeName, k, c.tagMetaData)
+       if err != nil {
+               return ApplicationsAndClusterInfo{}, pkgerrors.Wrap(err, "Get AppClusterInfo error")
+       }
+
+       var a AppIntent
+       var appClusterInfoArray []AppClusterInfo
+
+       if len(result) != 0 {
+               for i := range result {
+                       a = AppIntent{}
+                       err = db.DBconn.Unmarshal(result[i], &a)
+                       if err != nil {
+                               return ApplicationsAndClusterInfo{}, pkgerrors.Wrap(err, "Unmarshalling  AppIntent")
+                       }
+                       appName := a.Spec.AppName
+                       allOfArray := a.Spec.Intent.AllOfArray
+                       anyOfArray := a.Spec.Intent.AnyOfArray
+                       appClusterInfo := AppClusterInfo{appName, allOfArray,
+                               anyOfArray}
+                       appClusterInfoArray = append(appClusterInfoArray, appClusterInfo)
+               }
+       }
+       applicationsAndClusterInfo := ApplicationsAndClusterInfo{appClusterInfoArray}
+       return applicationsAndClusterInfo, err
+}
+
 // DeleteAppIntent delete an AppIntent
 func (c *AppIntentClient) DeleteAppIntent(ai string, p string, ca string, v string, i string) error {
        k := AppIntentKey{
 
                                        Intent: IntentStruc{
                                                AllOfArray: []AllOf{
                                                        {
-                                                               ClusterName: "edge1",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge1",
                                                                //ClusterLabelName: "edge1",
                                                        },
                                                        {
-                                                               ClusterName: "edge2",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge2",
                                                                //ClusterLabelName: "edge2",
                                                        },
                                                        {
                                                                AnyOfArray: []AnyOf{
-                                                                       {ClusterLabelName: "east-us1"},
-                                                                       {ClusterLabelName: "east-us2"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us1"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us2"},
                                                                        //{ClusterName: "east-us1"},
                                                                        //{ClusterName: "east-us2"},
                                                                },
                                        Intent: IntentStruc{
                                                AllOfArray: []AllOf{
                                                        {
-                                                               ClusterName: "edge1",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge1",
                                                                //ClusterLabelName: "edge1",
                                                        },
                                                        {
-                                                               ClusterName: "edge2",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge2",
                                                                //ClusterLabelName: "edge2",
                                                        },
                                                        {
                                                                AnyOfArray: []AnyOf{
-                                                                       {ClusterLabelName: "east-us1"},
-                                                                       {ClusterLabelName: "east-us2"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us1"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us2"},
                                                                        //{ClusterName: "east-us1"},
                                                                        //{ClusterName: "east-us2"},
                                                                },
                                        Intent: IntentStruc{
                                                AllOfArray: []AllOf{
                                                        {
-                                                               ClusterName: "edge1",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge1",
                                                        },
                                                        {
-                                                               ClusterName: "edge2",
+                                                               ProviderName: "aws",
+                                                               ClusterName:  "edge2",
                                                        },
                                                        {
                                                                AnyOfArray: []AnyOf{
-                                                                       {ClusterLabelName: "east-us1"},
-                                                                       {ClusterLabelName: "east-us2"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us1"},
+                                                                       {ProviderName: "aws",
+                                                                               ClusterLabelName: "east-us2"},
                                                                },
                                                        },
                                                },
                                                                "\"spec\":{\"app-name\": \"SampleApp\"," +
                                                                "\"intent\": {" +
                                                                "\"allOf\":[" +
-                                                               "{\"cluster-name\":\"edge1\"}," +
-                                                               "{\"cluster-name\":\"edge2\"}," +
+                                                               "{" +
+                                                               "\"provider-name\":\"aws\"," +
+                                                               "\"cluster-name\":\"edge1\"}," +
+                                                               "{" +
+                                                               "\"provider-name\":\"aws\"," +
+                                                               "\"cluster-name\":\"edge2\"}," +
                                                                "{" +
                                                                "\"anyOf\":[" +
                                                                "{" +
+                                                               "\"provider-name\":\"aws\"," +
                                                                "\"cluster-label-name\":\"east-us1\"}," +
                                                                "{" +
+                                                               "\"provider-name\":\"aws\"," +
                                                                "\"cluster-label-name\":\"east-us2\"}" +
                                                                "]}]" +
                                                                "}}}"),
 
        //Check if composite profile exists (success assumes existance of all higher level 'parent' objects)
        _, err = NewCompositeProfileClient().GetCompositeProfile(compositeProfile, project, compositeApp, compositeAppVersion)
        if err != nil {
-               return AppProfile{}, pkgerrors.New("Unable to find the project")
+               return AppProfile{}, pkgerrors.New("Unable to find the compositeProfile")
        }
 
        // TODO: (after app api is ready) check that the app Spec.AppName exists as part of the composite app