Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Here's a pointer to the demo that Pam gave on this topic: 

zoom_0.mp4


Since there're big changes in the config that we send to Policy framework for policy retrieval, we need to modify our code accordingly to match that logic.

...

AR: Confirm if retrieving by name is still needed – Avteet Chayal


Examples of policy retrieval

Code Block
Occasion one: Normal way
#Available policies inside the policy db
- 
        OSDF_CASABLANCA.Affinity_Default_vCPE_US_0:
            type: onap.policies.optimization.AffinityPolicy
            version: 1.0.0
            type_version: 1.0.0
            metadata:
                policy-id: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0
                policy-version: 1
            properties:
                scope: [OSDF_FRANKFURT]
                services: [vCPE]
                resources: [vG]
                geography: [US]
                identity: affinity_vCPE
                applicableResources: any
                affinityProperties:
                    qualifier: different
                    category: complex

- 
        OSDF_CASABLANCA.Affinity_Default_vCPE_US_1:
            type: onap.policies.optimization.AffinityPolicy
            version: 1.0.0
            type_version: 1.0.0
            metadata:
                policy-id: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0
                policy-version: 1
            properties:
                scope: [OSDF_FRANKFURT]
                services: [vCPE]
                resources: [vGMux]
                geography: [US]
                identity: affinity_vCPE
                applicableResources: any
                affinityProperties:
                    qualifier: different
                    category: complex


# VFC Request
{  
    "requestInfo":{  
        "transactionId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "requestId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "callbackUrl":"http://10.42.57.133:8403/api/nslcm/v1/ns/placevnf",
        "sourceId":"vfc",
        "requestType":"create",
        "numSolutions":1,
        "optimizers":[  
            "placement"
        ],
        "timeout":600
    },
    "placementInfo":{  
        "requestParameters":{  
            "customerLatitude":"32.897480",
            "customerLongitude":"97.040443",
            "customerName":"some_company"
        },
        "subscriberInfo":{  
            "globalSubscriberId":"",
            "subscriberName":"",
            "subscriberCommonSiteId":""
        },
        "placementDemands":[  
            {  
                "resourceModuleName":"vG",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2d",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f175",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fba",
                    "modelName":"7400fd06-c75f-4a44-a68f",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            },
            {  
                "resourceModuleName":"vGMux",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2e",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f176",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fbb",
                    "modelName":"7400fd06-c75f-4a44-a68g",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            }
        ]
    },
    "serviceInfo":{  
        "serviceInstanceId":"83a23b7a-e68e-4496-a3b2-3bfd822ed63b",
        "serviceName":"vcpe",
        "modelInfo":{  
            "modelType":"",
            "modelInvariantId":"0d9312af-96fa-425c-b732-01eeca3c3490",
            "modelVersionId":"65f761a4-45db-4cde-8d7c-ef9512585098",
            "modelName":"vCPE 2018-10-31 19:17:04",
            "modelVersion":"1.0",
            "modelCustomizationName":""
        }
    }
}

#Retrieval plans
Plan A: If we are going to send only one policy request per VFC request to get all policies, the config need to have two resources both appeared in the 'resources' filter which shall look like this:
        Config:     {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vG", "vGMux"],
                        "scope": ["OSDF_FRANKFURT"] }"
        However, if we send out a request like this, neither of the policies should be fetched.

NOTE: 12/3 per PLD - you will actually get BOTH policies from this. The items within each LHS are treated as OR, whereas each line is treated is an AND.

vcpe AND US AND (vg OR vGMux) AND OSDF_FRANKFURT


Plan B: If we are going to send multiple policy requests(one request per vnf), there would be two separate configs with different values inside the key 'resources':
        Config A:   {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vG"],
                        "scope": ["OSDF_FRANKFURT"] }"
       Config B:    {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vGMux],
                        "scope": ["OSDF_FRANKFURT"] }"
      In this way, each policy will be respond to OSDF for certain request.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Occasion 2: Only one default policy available in policy db
#Available policies inside the policy db
-
        OSDF_CASABLANCA.Affinity_Default_US:
            type: onap.policies.optimization.AffinityPolicy
            version: 1.0.0
            type_version: 1.0.0
            metadata:
                policy-id: OSDF_CASABLANCA.Affinity_Default_US
                policy-version: 1
            properties:
                scope: [OSDF_FRANKFURT]
                services: [vCPE]
                resources: []
                geography: [US]
                identity: affinity_vCPE
                applicableResources: any
                affinityProperties:
                    qualifier: same
                    category: complex

# A same homing request is then made to OOF
{  
    "requestInfo":{  
        "transactionId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "requestId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "callbackUrl":"http://10.42.57.133:8403/api/nslcm/v1/ns/placevnf",
        "sourceId":"vfc",
        "requestType":"create",
        "numSolutions":1,
        "optimizers":[  
            "placement"
        ],
        "timeout":600
    },
    "placementInfo":{  
        "requestParameters":{  
            "customerLatitude":"32.897480",
            "customerLongitude":"97.040443",
            "customerName":"some_company"
        },
        "subscriberInfo":{  
            "globalSubscriberId":"",
            "subscriberName":"",
            "subscriberCommonSiteId":""
        },
        "placementDemands":[  
            {  
                "resourceModuleName":"vG",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2d",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f175",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fba",
                    "modelName":"7400fd06-c75f-4a44-a68f",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            },
            {  
                "resourceModuleName":"vGMux",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2e",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f176",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fbb",
                    "modelName":"7400fd06-c75f-4a44-a68g",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            }
        ]
    },
    "serviceInfo":{  
        "serviceInstanceId":"83a23b7a-e68e-4496-a3b2-3bfd822ed63b",
        "serviceName":"vcpe",
        "modelInfo":{  
            "modelType":"",
            "modelInvariantId":"0d9312af-96fa-425c-b732-01eeca3c3490",
            "modelVersionId":"65f761a4-45db-4cde-8d7c-ef9512585098",
            "modelName":"vCPE 2018-10-31 19:17:04",
            "modelVersion":"1.0",
            "modelCustomizationName":""
        }
    }
}

#Retrieval plans
Plan A: If we are going to send only one policy request per VFC request to get all policies, the config should contain both resources in the 'resources' filter which shall look like this:
        Config:     {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vCPE"],
                        "geography": ["US"],
                        "resources": ["vG, vGMux"],
                        "scope": ["OSDF_FRANKFURT"] }"
        Both of the policies will be fetched.

Plan B: If we are going to send multiple policy requests(one request per vnf), there would be two separate configs with different values inside the key 'resources':
        Config A:   {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vG"],
                        "scope": ["OSDF_FRANKFURT"] }"
       Config B:    {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vGMux],
                        "scope": ["OSDF_FRANKFURT"] }"
      In this way, the default policy will be respond to OSDF for certain request.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Occasion 3: One default policy and one specific policy available in policy db
#Available policies inside the policy db
-
        OSDF_CASABLANCA.Affinity_Default_US:
            type: onap.policies.optimization.AffinityPolicy
            version: 1.0.0
            type_version: 1.0.0
            metadata:
                policy-id: OSDF_CASABLANCA.Affinity_Default_US
                policy-version: 1
            properties:
                scope: [OSDF_FRANKFURT]
                services: [vCPE]
                resources: []
                geography: [US]
                identity: affinity_vCPE
                applicableResources: any
                affinityProperties:
                    qualifier: same
                    category: complex

-      OSDF_CASABLANCA.Affinity_US_vG:
            type: onap.policies.optimization.AffinityPolicy
            version: 1.0.0
            type_version: 1.0.0
            metadata:
                policy-id: OSDF_CASABLANCA.Affinity_Default_US
                policy-version: 1
            properties:
                scope: [OSDF_FRANKFURT]
                services: [vCPE]
                resources: [vG]
                geography: [US]
                identity: affinity_vCPE
                applicableResources: any
                affinityProperties:
                    qualifier: same
                    category: complex

# A same homing request is then made to OOF
{  
    "requestInfo":{  
        "transactionId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "requestId":"12348659-a547-4b81-954e-a244fc5f0f9e",
        "callbackUrl":"http://10.42.57.133:8403/api/nslcm/v1/ns/placevnf",
        "sourceId":"vfc",
        "requestType":"create",
        "numSolutions":1,
        "optimizers":[  
            "placement"
        ],
        "timeout":600
    },
    "placementInfo":{  
        "requestParameters":{  
            "customerLatitude":"32.897480",
            "customerLongitude":"97.040443",
            "customerName":"some_company"
        },
        "subscriberInfo":{  
            "globalSubscriberId":"",
            "subscriberName":"",
            "subscriberCommonSiteId":""
        },
        "placementDemands":[  
            {  
                "resourceModuleName":"vG",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2d",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f175",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fba",
                    "modelName":"7400fd06-c75f-4a44-a68f",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            },
            {  
                "resourceModuleName":"vGMux",
                "serviceResourceId":"f0a16496-2e0a-480b-8486-04ef762d1d2e",
                "tenantId":"null",
                "resourceModelInfo":{  
                    "modelInvariantId":"c01e991e-b687-4875-8d75-d6888637f176",
                    "modelVersionId":"c00456ac-c9b5-4f72-87ae-3a4a0eec6fbb",
                    "modelName":"7400fd06-c75f-4a44-a68g",
                    "modelType":"",
                    "modelVersion":"1.0",
                    "modelCustomizationName":""
                }
            }
        ]
    },
    "serviceInfo":{  
        "serviceInstanceId":"83a23b7a-e68e-4496-a3b2-3bfd822ed63b",
        "serviceName":"vcpe",
        "modelInfo":{  
            "modelType":"",
            "modelInvariantId":"0d9312af-96fa-425c-b732-01eeca3c3490",
            "modelVersionId":"65f761a4-45db-4cde-8d7c-ef9512585098",
            "modelName":"vCPE 2018-10-31 19:17:04",
            "modelVersion":"1.0",
            "modelCustomizationName":""
        }
    }
}

#Retrieval plans
Plan A: If we are going to send only one policy request per VFC request to get all policies, the config should contain both resources in the 'resources' filter which shall look like this:
        Config:     {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vCPE"],
                        "geography": ["US"],
                        "resources": ["vG, vGMux"],
                        "scope": ["OSDF_FRANKFURT"] }"
        Will both of the policies being fetched? Since the second policy instance is more fine-grained.

Plan B: If we are going to send multiple policy requests(one request per vnf), there would be two separate configs with different values inside the key 'resources':
        Config A:   {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vG"],
                        "scope": ["OSDF_FRANKFURT"] }"
       Config B:    {"ONAPName": "OOF",
                     "ONAPComponent": "OOF_Component",
                     "ONAPInstance": "OOF_Component_Instance",
                     "action": "optimize",
                     "resources": "{
                        "services": ["vcpe"],
                        "geography": ["US"],
                        "resources": ["vGMux],
                        "scope": ["OSDF_FRANKFURT"] }"
      In this way, the default policy will be respond to OSDF for vGMux and the specific policy will be respond to vG.

Question:

A. Would there be chances that certain policy is intended to be working for a certain service but rather than a vnf.

Currently, Subscriber policy and Query policy are verified that they are used per service level.

Keys needed are 'services'. 'scope' and 'geography'.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Other policies including Vnf policy, Distance policy, Affinity policy, HPA policy, Optimization policy and Capacity(Vim-fit) policy are used per VNF level

Keys needed are 'services', 'scope', 'geography' and 'resources' which fits our current implementation.


Extra thing: Shankaranarayanan Puzhavakath Narayanan Lukasz Rajewski I got a question on the TD Query policies. I just checked the sample TD query policies inside the repo and find that the 'resources' field is also added. Any reason the request parameters are applied for certain vnf?


B. TD policies slightly different to other optimization policies, which they are most likely related with TD functionality rather than with concrete service or VNF.

So we planned to change overall policy type to 'demand' to cover TD and other normal policies for certain VNF, and have a separate policy type to cover other policies which are used per service level.