The software is a java web application that supports one simple REST API for support Health Check and Statistical information. Upon invocation, the code will be able to spin up a thread that performs the work to respond to SDC Service Distribution notifications. There will be a layer of shared code between the Health Check, Statistics and the implementation of the Service Distribution in order for each to interact.
# Example Output from curl http -a '{user}:{password}' :8443/healthcheck HTTP/1.1 200 OK Content-Length: XXX Content-Type: application/json Date: Tue, 17 Apr 2018 10:51:14 GMT Server: Jetty(9.3.20.v20170531) { "code":200, "healthy":true, "message":"alive", "name":"Policy SSD", "url":"self" } |
Statistics shall be kept to keep track of Service Distribution notifications and subsequent artifact downloads that occur during a Service Distribution.
# Example Output from curl http -a '{user}:{password}' :8443/statistics HTTP/1.1 200 OK Content-Length: XXX Content-Type: application/json Date: Tue, 17 Apr 2018 10:51:14 GMT Server: Jetty(9.3.20.v20170531) { "code":200, "distributions":10, "distribution_complete_ok":8, "distribution_complete_fail":2, "downloads":15, "downloads_ok"; 10, "downloads_error": 5 } |
Starting and stopping the application should mirror the functionality similar to the Drools PDP as documented in Beijing Wiki: Policy Cookbook
According to the SDC Project's documentation: SDC Distribution client AID, the client needs to register as a SDC client, and acts as a publisher too then publish the distribution status event.
the policy platform will need to implement several classes that derive from IConfiguration, INotificationCallback, IDistributionStatusMessageBasic, IComponentDoneStatusMessage,
IDistributionStatusMessage, IResourceInstance, IVfModuleData etc.
for the IConfiguration, it configures all the necessary settings for a client to interact with SDC, below table is based on Beijing release:
function | Value Tobe set in Policy | Comment from Lando, Michael |
---|---|---|
String getAsdcAddress() | Sdcip | |
List<String> getMsgBusAddress() | DMAAP address? | Yes |
String getUser() | This needs to be defined in sdc and then used in the client to access our secure api’s please open a task for me to create one for you. | |
String getPassword() | Same as above. | |
int getPollingInterval() | 20 | |
int getPollingTimeout() | 30 | |
List<String> getRelevantArtifactTypes() | TOSCA_CSAR | yes |
String getConsumerGroup(); | policy-group | |
String getEnvironmentName(); | TEST | This is the env name you are running in used for auditing from which env the client is connecting |
String getKeyStorePath(); | Null | |
String getKeyStorePassword(); | Null | |
boolean activateServerTLSAuth() | False | |
boolean isFilterInEmptyResources() | True | |
Boolean isUseHttpsWithDmaap() | False |
The current existing Policy API as documented in the readthedocs:
http://onap.readthedocs.io/en/beijing/submodules/policy/engine.git/docs/platform/offeredapis.html
However, that interface will be pluggable in anticipation of the new Policy Lifecycle API which begins implementation in Casablanca and is targeted for Dublin release.
The diagram above shows a draft sketch of the software for the Policy SDC Service Distribution component. It should be sufficiently detailed to enable commencement of the implementation of the SDC Distribution component in the ONAP Policy Framework.
The component has three packages, the main package of the component, a Policy unmarshaling component, and a policy forwarding component.
The SDCDistributionMain package reads the parameters from the JSON parameter file provided as a command line parameter. Based on the parameters, it sets up Policy unmarshaling and policy forwarding as well as starting life cycle management.
Policy unmarshaling receives policies from SDC and unmarshals them using the policy decoder specified in the parameters. In the case of TOSCA PDP-X decoding, the PolicyDecoderToscaPdpX implementation is used to read the parameters from the TOSCA description and to create a XACML policy. In the cases where a Drools or APEX policy is packaged in the CSAR, other policy decoders are invoked to decode the policy.
Policy forwarding has two implementations, one for working towards the current PAP that is in the Engine component of the Policy Framework, and another for working towards the PAP in the evolved Policy Framework architecture.
There may, of course, be multiple subscriptions to SDC from Policy for different policies. For each subscription, a pair of PolicyUnmarshaling-PolicyForwarding linked instances are required. There are two implementation options here: