Orange-OpenSource/python-onapsdk

View on GitHub
src/onapsdk/clamp/templates/clamp_add_drools_policy.json.j2

Summary

Maintainability
Test Coverage
A
100%
[
  {
    "name": "{{ name }}",
    "jsonRepresentation": {
      "title": "onap.policies.controlloop.operational.common.Drools",
      "type": "object",
      "description": "Operational policies for Drools PDP",
      "required": [
        "abatement",
        "operations",
        "trigger",
        "timeout",
        "id"
      ],
      "properties": {
        "abatement": {
          "type": "boolean",
          "description": "Whether an abatement event message will be expected for the control loop from DCAE.",
          "default": "false"
        },
        "operations": {
          "type": "array",
          "description": "List of operations to be performed when Control Loop is triggered.",
          "items": {
            "title": "onap.datatype.controlloop.Operation",
            "type": "object",
            "description": "An operation supported by an actor",
            "required": [
              "id",
              "operation",
              "retries",
              "timeout"
            ],
            "properties": {
              "failure_retries": {
                "type": "string",
                "description": "Points to the operation to invoke when the current operation has exceeded its max retries.",
                "default": "final_failure_retries"
              },
              "id": {
                "type": "string",
                "description": "Unique identifier for the operation"
              },
              "failure_timeout": {
                "type": "string",
                "description": "Points to the operation to invoke when the time out for the operation occurs.",
                "default": "final_failure_timeout"
              },
              "failure": {
                "type": "string",
                "description": "Points to the operation to invoke on Actor operation failure.",
                "default": "final_failure"
              },
              "operation": {
                "title": "onap.datatype.controlloop.Actor",
                "type": "object",
                "description": "An actor/operation/target definition",
                "required": [
                  "target",
                  "actor",
                  "operation"
                ],
                "properties": {
                  "payload": {
                    "type": "object",
                    "description": "Name/value pairs of payload information passed by Policy to the actor",
                    "anyOf": [
                      {
                        "title": "User defined",
                        "properties": {
                          
                        }
                      }
                    ]
                  },
                  "target": {
                    "title": "onap.datatype.controlloop.Target",
                    "type": "object",
                    "description": "Definition for a entity in A&AI to perform a control loop operation on",
                    "required": [
                      "targetType"
                    ],
                    "properties": {
                      "entityIds": {
                        "type": "object",
                        "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n",
                        "anyOf": [
                          {
                            "title": "User defined",
                            "properties": {
                              
                            }
                          },
                          {
                            "title": "VNF-ubuntu18agent_VF 0",
                            "properties": {
                              "resourceID": {
                                "title": "Resource ID",
                                "type": "string",
                                "default": "6daf6e05-fc26-4aa3-9f0b-d47cf3f37ece",
                                "readOnly": "True"
                              }
                            }
                          },
                          {
                            "title": "VFMODULE-Ubuntu18agentVf..base_ubuntu18..module-0",
                            "properties": {
                              "resourceID": {
                                "title": "Resource ID",
                                "type": "string",
                                "default": "Ubuntu18agentVf..base_ubuntu18..module-0",
                                "readOnly": "True"
                              },
                              "modelInvariantId": {
                                "title": "Model Invariant Id (ModelInvariantUUID)",
                                "type": "string",
                                "default": "2556faee-75dd-448f-8d2f-d4201a957e7c",
                                "readOnly": "True"
                              },
                              "modelVersionId": {
                                "title": "Model Version Id (ModelUUID)",
                                "type": "string",
                                "default": "98df9741-530a-486c-b156-b2cb62e6fc6c",
                                "readOnly": "True"
                              },
                              "modelName": {
                                "title": "Model Name",
                                "type": "string",
                                "default": "Ubuntu18agentVf..base_ubuntu18..module-0",
                                "readOnly": "True"
                              },
                              "modelVersion": {
                                "title": "Model Version",
                                "type": "string",
                                "default": "1",
                                "readOnly": "True"
                              },
                              "modelCustomizationId": {
                                "title": "Customization ID",
                                "type": "string",
                                "default": "ba567b66-e46b-4521-8fdd-54185cb21a7f",
                                "readOnly": "True"
                              }
                            }
                          }
                        ]
                      },
                      "targetType": {
                        "type": "string",
                        "description": "Category for the target type",
                        "enum": [
                          "VNF",
                          "VM",
                          "VFMODULE",
                          "PNF"
                        ]
                      }
                    }
                  },
                  "actor": {
                    "type": "string",
                    "description": "The actor performing the operation.",
                    "enum": [
                      "SDNR",
                      "SDNC",
                      "VFC",
                      "SO",
                      "APPC",
                      "CDS"
                    ],
                    "options": {
                      "enum_titles": [
                        "SDNR",
                        "SDNC",
                        "VFC",
                        "SO",
                        "APPC"
                      ]
                    }
                  },
                  "operation": {
                    "type": "string",
                    "description": "The operation the actor is performing.",
                    "enum": [
                      "BandwidthOnDemand",
                      "VF Module Delete",
                      "Reroute",
                      "VF Module Create",
                      "ModifyConfig",
                      "Rebuild",
                      "Restart",
                      "Migrate",
                      "Health-Check"
                    ],
                    "options": {
                      "enum_titles": [
                        "BandwidthOnDemand (SDNC operation)",
                        "VF Module Delete (SO operation)",
                        "Reroute (SDNC operation)",
                        "VF Module Create (SO operation)",
                        "ModifyConfig (APPC/VFC operation)",
                        "Rebuild (APPC operation)",
                        "Restart (APPC operation)",
                        "Migrate (APPC operation)",
                        "Health-Check (APPC operation)"
                      ]
                    }
                  }
                }
              },
              "failure_guard": {
                "type": "string",
                "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.",
                "default": "final_failure_guard"
              },
              "retries": {
                "type": "integer",
                "description": "The number of retries the actor should attempt to perform the operation.",
                "default": "0"
              },
              "timeout": {
                "type": "integer",
                "description": "The amount of time for the actor to perform the operation."
              },
              "failure_exception": {
                "type": "string",
                "description": "Points to the operation to invoke when the current operation causes an exception.",
                "default": "final_failure_exception"
              },
              "description": {
                "type": "string",
                "description": "A user-friendly description of the intent for the operation"
              },
              "success": {
                "type": "string",
                "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.",
                "default": "final_success"
              }
            }
          },
          "format": "tabs-top"
        },
        "trigger": {
          "type": "string",
          "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop."
        },
        "timeout": {
          "type": "integer",
          "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n"
        },
        "id": {
          "type": "string",
          "description": "The unique control loop id."
        },
        "controllerName": {
          "type": "string",
          "description": "Drools controller properties"
        }
      }
    },
    "configurationsJson": {
      "abatement": false,
      "operations": [
        {
          "failure_retries": "final_failure_retries",
          "id": "policy-1-vfmodule-create",
          "failure_timeout": "final_failure_timeout",
          "failure": "final_failure",
          "operation": {
            "payload": {
              "requestParameters": "{\"usePreload\":false,\"userParams\":[]}",
              "configurationParameters": "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16].value\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[30].value\"}]"
            },
            "target": {
              "entityIds": {
                "resourceID": "{{ resourceID }}",
                "modelInvariantId": "{{ modelInvariantId }}",
                "modelVersionId": "{{ modelVersionId }}",
                "modelName": "{{ modelName }}",
                "modelVersion": "{{ modelVersion }}",
                "modelCustomizationId": "{{ modelCustomizationId }}"
              },
              "targetType": "VFMODULE"
            },
            "actor": "SO",
            "operation": "VF Module Create"
          },
          "failure_guard": "final_failure_guard",
          "retries": 1,
          "timeout": 300,
          "failure_exception": "final_failure_exception",
          "description": "test",
          "success": "final_success"
        }
      ],
      "trigger": "policy-1-vfmodule-create",
      "timeout": 650,
      "id": "{{ LOOP_name }}"
    },
    "policyModel": {
      "policyModelType": "onap.policies.controlloop.operational.common.Drools",
      "version": "1.0.0",
      "policyAcronym": "Drools",
      "policyPdpGroup": {
        "supportedPdpGroups": [
          {
            "defaultGroup": [
              "drools"
            ]
          }
        ]
      },
      "createdDate": "2020-07-22T01:37:38.528901Z",
      "updatedDate": "2020-07-22T01:37:51.752302Z",
      "updatedBy": "Not found",
      "createdBy": "Not found"
    },
    "createdDate": "2020-07-22T07:50:00.076714Z",
    "updatedDate": "2020-07-22T07:50:00.076714Z",
    "updatedBy": "clamp@clamp.onap.org",
    "createdBy": "clamp@clamp.onap.org",
    "pdpGroup": "defaultGroup",
    "pdpSubgroup": "drools"
  }
]