Estimated changes in policy retrieving
Here's a pointer to the demo that Pam gave on this topic:
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.
Config changes in policy retrieval
Legacy Config Example
The legacy config we sent for policy retrieval contains the prefix for each release, the geography info as well as the service information.
#Scope with geography
{ "policyName": "OSDF_DUBLIN.*",
"configAttributes": {"policyScope": "us"}
#Scope with service name
{ "policyName": "OSDF_DUBLIN.*",
"configAttributes": {"policyScope": "vfw"}
New Config Example
In the new config we sent for policy retrieval, the prefix is no longer needed. And for the geography and service name, the values need to be put under certain keys.
{"ONAPName": "OOF",
"ONAPComponent": "OSDF",
"ONAPInstance": "",
"action": "optimize",
"resource": {
"geography": "us",
"services": "vfw"
"scope": "xxx" //Optional
}}
Change in OSDF common config
Legacy configuration in common.config and also a draft config according to the new payload.
...
policy_info:
prioritization_attributes:
policy_type:
- content.policyType
resources:
- content.resources
- content.objectiveParameter.parameterAttributes.resources
service_name:
- content.serviceName
placement:
policy_fetch: by_scope
policy_scope:
default_scope: OSDF_DUBLIN //This part could be removed
vcpe_scope: OSDF_DUBLIN
vfw_scope: OSDF_DUBLIN
td_scope: OSDF_DUBLIN
secondary_scopes:
-
- get_param: service_name //Better to be changed as KV pair
- US
# -
# - get_param: service_name
# - get_param: subscriber_role
default: # if no explicit service related information is needed
policy_fetch: by_name
policy_scope: none
Draft common config for OSDF
Change in code
Change in the rest call to policy framework
Since we totally change the uri to call with, there're quite many changes in the rest call.
A. The header 'ClientAuth' and 'Environment' are no longer needed.
B. The uri, username and password should be changed accordingly.
Changes: https://git.onap.org/optf/osdf/tree/osdf/adapters/policy/interface.py
Change in retrieval method
Do we still need that get_by_name method in OSDF?
Changes: https://git.onap.org/optf/osdf/tree/osdf/adapters/policy/interface.py
Meeting minutes - 2019/10/23
Changes for OSDF retrieving code:
A. Url, authentication(user and pass), extra headers
B. payload send for retrieval.
Using the new filters(geography, service, resource, scope, name?)
AR: Ask Pam about the implementation of scope(assign with multiple values?) – @ruoyu.ying
Check if the policy name filter still exists in the current implementation – @ruoyu.ying
C. Config for OSDF
Put the new filters inside the config
Add two new question from @ruoyu.ying :
Where does the input for geography and scope come from? Does user need to modify the config file each time they want to change?
2. Will the object 'scope' be added as a mandatory value in our payload to Policy framework?
@Avteet Chayal @Shankaranarayanan Puzhavakath Narayanan
D. Clean up the source code where does the filtering job ourselves by resource name
E. Clean up the source code where provides choice for retrieving(by scope or by name)
AR: Confirm if retrieving by name is still needed – @Avteet Chayal
Examples of policy retrieval
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.