...
- Periodically check policy (e.g. every 20 minutes) to see if there have been any changes that were not received over the dmaap
- If either a matching dmaap notification arrives or the periodic check reveals updates, it will pull the latest policies from the PDP using the rest api and dump them to a file for consumption by the microservice.
Drawio | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Configuration
configuration is done via environment variables to support varied environments easily.
ENV_VARIABLE | flag | Description | Example |
---|---|---|---|
POLICY_SYNC_PDP_URL | --pdp | PDP URL to query | https://policy-conexus-ist-02.ecomp.cci.att.com:30281 |
POLICY_SYNC_FILTER | --filter | A regular expression or full policy name that the puller should track and query the PDP | DCAE.Config_MS_AGING_UVERSE_.* |
POLICY_SYNC_ID | --id | This just brings back a specific policy name for those who don't need or want a regular expression. | XYZ |
POLICY_SYNC_OUTFILE | --outfile | The output file to write the policy inventory to | /opt/etc/policies.json |
POLICY_SYNC_CHECKINTERVAL | --checkinterval | How often to check the PDP periodically for resiliency purposes | 20m |
POLICY_SYNC_USER | --user | Optional Username to use as part of basic auth for the PDP | userxyz |
POLICY_SYNC_PASS | --password | Optional Password to use as part of basic auth for the PDP | password123 |
Interface with Policy
Sidecar to use ONAP's policy API to interface and retrieve policies as described: Policy Life Cycle API — onap master documentation.
GET /policy/api/v1/policies (For Policy Filter based queries).
Note: Current policy API does not offer regex based querying...so the only way to implement this is to pull all policies and filter accordingly on client side.
Retrieve all versions of available policies
- Description: Returns all version of available policies
- Consumes: [‘application/json’, ‘application/yaml’]
- Produces: [‘application/json’, ‘application/yaml’]
Parameters
Name | Position | Description | Type |
---|---|---|---|
X-ONAP-RequestID | header | RequestID for http transaction | string |
mode | query | Fetch mode for policies, BARE for bare policies (default), REFERENCED for fully referenced policies | string |
Responses
200 - successful operation
401 - Authentication Error
403 - Authorization Error
404 - Resource Not Found
500 - Internal Server Error
GET /policy/api/v1/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/latest (For policy id based queries).
Retrieve the latest version of a particular policy
- Description: Returns the latest version of specified policy
- Produces: [‘application/json’, ‘application/yaml’]
Parameters
Name | Position | Description | Type |
---|---|---|---|
policyTypeId | path | ID of policy type | string |
policyTypeVersion | path | Version of policy type | string |
policyId | path | ID of policy | string |
X-ONAP-RequestID | header | RequestID for http transaction | string |
Responses
200 - successful operation; Latest version of specified policy matching specified policy type will be returned.
401 - Authentication Error
403 - Authorization Error
404 - Resource Not Found
500 - Internal Server Error
DMaaP Notifications
Utilize the PAP's DMaaP Notification URL to identify changes to policy and act accordingly: https://docs.onap.org/projects/onap-policy-parent/en/latest/pap/pap.html#dmaap-api
...