From 2dd4e997c1ccf5dab4dfb7665ce74c0fd1f13e49 Mon Sep 17 00:00:00 2001 From: sebdet Date: Wed, 4 Mar 2020 15:47:39 -0800 Subject: Rework tosca converter New code to convert the Policy Tosca Yaml to Json Schema for the Clamp UI Issue-ID: CLAMP-647 Signed-off-by: sebdet Change-Id: Id15ddedc1910f6a40bf6e407b34e343e00135571 --- .../.file | 10 +- .../1.0.0?connectionTimeToLive=5000/.file | 40 ----- .../1.0.0?connectionTimeToLive=5000/.header | 1 - .../1.0.0?connectionTimeToLive=5000/.file | 50 ------ .../1.0.0?connectionTimeToLive=5000/.header | 1 - .../1.0.0?connectionTimeToLive=5000/.file | 44 ------ .../1.0.0?connectionTimeToLive=5000/.header | 1 - .../1.0.0?connectionTimeToLive=5000/.file | 38 +++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 47 ++++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../2.0.0?connectionTimeToLive=5000/.file | 40 +++++ .../2.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 158 +++++++++++++++++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 146 +++++++++++++++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 7 +- .../v1/pdps?connectionTimeToLive=5000/.file | 6 +- .../resources/tosca/new-converter/tca-schema.json | 175 +++++++++++++++++++++ src/test/resources/tosca/templates.properties | 7 - 21 files changed, 622 insertions(+), 154 deletions(-) delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/tosca/new-converter/tca-schema.json delete mode 100644 src/test/resources/tosca/templates.properties (limited to 'src/test/resources') diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file index 4b27438c..0cce9c3d 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file @@ -1,34 +1,34 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.operational.Drools: + - onap.policies.controlloop.operational.common.Drools: version: 1.0.0 description: Operational Policy for Control Loops using the Drools PDP derived_from: onapy.policies.controlloop.Operational properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.operational.Apex: + - onap.policies.controlloop.operational.common.Apex: version: 1.0.0 description: Operational Policy for Control Loops using the APEX PDP derived_from: onap.policies.controlloop.Operational properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.FrequencyLimiter: + - onap.policies.controlloop.guard.common.FrequencyLimiter: version: 1.0.0 description: Supports limiting the frequency of actions being taken by a Actor. derived_from: onap.policies.controlloop.Guard properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.Blacklist: + - onap.policies.controlloop.guard.common.Blacklist: version: 1.0.0 description: Supports blacklist of VNF's from performing control loop actions on. derived_from: onap.policies.controlloop.Guard properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.MinMax: + - onap.policies.controlloop.guard.common.MinMax: version: 2.0.0 description: Supports Min/Max number of VF Modules derived_from: onap.policies.controlloop.Guard diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 91a82521..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,40 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.Blacklist: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports blacklist of VNF's from performing control loop actions on. - properties: - blacklist_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.Blacklist -data_types: - onap.datatypes.guard.Blacklist: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the blacklist is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - blacklist: - type: list - description: List of VNF's - required: true \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header deleted file mode 100644 index 6a280d97..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 45e5471f..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,50 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.FrequencyLimiter: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports limiting the frequency of actions being taken by a Actor. - properties: - frequency_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.FrequencyLimiter -data_types: - onap.datatypes.guard.FrequencyLimiter: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_window: - type: scalar-unit.time - description: The time window to count the actions against. - required: true - limit: - type: integer - description: The limit - required: true - constraints: - - greater_than: 0 - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the frequency is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - target: - type: string - description: An optional specific VNF to apply this guard to. - required: false \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header deleted file mode 100644 index 6a280d97..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 54c4204e..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,44 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.MinMax: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports Min/Max number of VF Modules - properties: - minmax_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.MinMax -data_types: - onap.datatypes.guard.MinMax: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the Min/Max limit is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - min_vf_module_instances: - type: integer - required: true - description: The minimum instances of this VF-Module - max_vf_module_instances: - type: integer - required: false - description: The maximum instances of this VF-Module \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header deleted file mode 100644 index 6a280d97..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..79e79f0f --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,38 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.Blacklist: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports blacklist of entity id's from performing control loop actions on. + properties: + blacklist: + type: list + description: List of entity id's + required: true + entry_schema: + type: string \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..163027e4 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,47 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.FrequencyLimiter: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports limiting the frequency of actions being taken by a Actor. + properties: + timeWindow: + type: integer + description: The time window to count the actions against. + required: true + timeUnits: + type: string + description: The units of time the window is counting. + constraints: + - valid_values: ["second", "minute", "hour", "day", "week", "month", "year"] + limit: + type: integer + description: The limit + required: true + constraints: + - greater_than: 0 \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..78bdde74 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,40 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.MinMax: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports Min/Max number of entity for scaling operations + properties: + min: + type: integer + required: true + description: The minimum instances of this entity + max: + type: integer + required: false + description: The maximum instances of this entity \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..44f55879 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,158 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.operational.common.Apex: + derived_from: onap.policies.controlloop.operational.Common + type_version: 1.0.0 + version: 1.0.0 + description: Operational policies for Apex PDP + properties: + engineServiceParameters: + type: string + description: The engine parameters like name, instanceCount, policy implementation, parameters etc. + required: true + eventInputParameters: + type: string + description: The event input parameters. + required: true + eventOutputParameters: + type: string + description: The event output parameters. + required: true + javaProperties: + type: string + description: Name/value pairs of properties to be set for APEX if needed. + required: false + onap.policies.controlloop.operational.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant + Policy Types. This does NOT support the legacy Policy YAML policy type. + properties: + id: + type: string + description: The unique control loop id. + required: true + timeout: + type: integer + description: | + Overall timeout for executing all the operations. This timeout should equal or exceed the total + timeout for each operation listed. + required: true + abatement: + type: boolean + description: Whether an abatement event message will be expected for the control loop from DCAE. + required: true + default: false + trigger: + type: string + description: Initial operation to execute upon receiving an Onset event message for the Control Loop. + required: true + operations: + type: list + description: List of operations to be performed when Control Loop is triggered. + required: true + entry_schema: + type: onap.datatype.controlloop.Operation +data_types: + onap.datatype.controlloop.Target: + derived_from: tosca.datatypes.Root + description: Definition for a entity in A&AI to perform a control loop operation on + properties: + targetType: + type: string + description: Category for the target type + required: true + constraints: + - valid_values: [VNF, VM, VFMODULE, PNF] + entityIds: + type: map + description: | + Map of values that identify the resource. If none are provided, it is assumed that the + entity that generated the ONSET event will be the target. + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Actor: + derived_from: tosca.datatypes.Root + description: An actor/operation/target definition + properties: + actor: + type: string + description: The actor performing the operation. + required: true + operation: + type: string + description: The operation the actor is performing. + required: true + target: + type: onap.datatype.controlloop.Target + description: The resource the operation should be performed on. + required: true + metadata: + clamp_possible_values: + payload: + type: map + description: Name/value pairs of payload information passed by Policy to the actor + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Operation: + derived_from: tosca.datatypes.Root + description: An operation supported by an actor + properties: + id: + type: string + description: Unique identifier for the operation + required: true + description: + type: string + description: A user-friendly description of the intent for the operation + required: false + operation: + type: onap.datatype.controlloop.Actor + description: The definition of the operation to be performed. + required: true + metadata: + clamp_possible_values: + timeout: + type: integer + description: The amount of time for the actor to perform the operation. + required: true + retries: + type: integer + description: The number of retries the actor should attempt to perform the operation. + required: true + default: 0 + success: + type: string + description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation. + required: false + default: final_success + failure: + type: string + description: Points to the operation to invoke on Actor operation failure. + required: false + default: final_failure + failure_timeout: + type: string + description: Points to the operation to invoke when the time out for the operation occurs. + required: false + default: final_failure_timeout + failure_retries: + type: string + description: Points to the operation to invoke when the current operation has exceeded its max retries. + required: false + default: final_failure_retries + failure_exception: + type: string + description: Points to the operation to invoke when the current operation causes an exception. + required: false + default: final_failure_exception + failure_guard: + type: string + description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement. + required: false + default: final_failure_guard \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..72897be0 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,146 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.operational.common.Drools: + derived_from: onap.policies.controlloop.operational.Common + type_version: 1.0.0 + version: 1.0.0 + description: Operational policies for Drools PDP + properties: + controllerName: + type: string + description: Drools controller properties + required: false + onap.policies.controlloop.operational.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant + Policy Types. This does NOT support the legacy Policy YAML policy type. + properties: + id: + type: string + description: The unique control loop id. + required: true + timeout: + type: integer + description: | + Overall timeout for executing all the operations. This timeout should equal or exceed the total + timeout for each operation listed. + required: true + abatement: + type: boolean + description: Whether an abatement event message will be expected for the control loop from DCAE. + required: true + default: false + trigger: + type: string + description: Initial operation to execute upon receiving an Onset event message for the Control Loop. + required: true + operations: + type: list + description: List of operations to be performed when Control Loop is triggered. + required: true + entry_schema: + type: onap.datatype.controlloop.Operation +data_types: + onap.datatype.controlloop.Target: + derived_from: tosca.datatypes.Root + description: Definition for a entity in A&AI to perform a control loop operation on + properties: + targetType: + type: string + description: Category for the target type + required: true + constraints: + - valid_values: [VNF, VM, VFMODULE, PNF] + entityIds: + type: map + description: | + Map of values that identify the resource. If none are provided, it is assumed that the + entity that generated the ONSET event will be the target. + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Actor: + derived_from: tosca.datatypes.Root + description: An actor/operation/target definition + properties: + actor: + type: string + description: The actor performing the operation. + required: true + operation: + type: string + description: The operation the actor is performing. + required: true + target: + type: onap.datatype.controlloop.Target + description: The resource the operation should be performed on. + required: true + metadata: + clamp_possible_values: + payload: + type: map + description: Name/value pairs of payload information passed by Policy to the actor + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Operation: + derived_from: tosca.datatypes.Root + description: An operation supported by an actor + properties: + id: + type: string + description: Unique identifier for the operation + required: true + description: + type: string + description: A user-friendly description of the intent for the operation + required: false + operation: + type: onap.datatype.controlloop.Actor + description: The definition of the operation to be performed. + required: true + metadata: + clamp_possible_values: + timeout: + type: integer + description: The amount of time for the actor to perform the operation. + required: true + retries: + type: integer + description: The number of retries the actor should attempt to perform the operation. + required: true + default: 0 + success: + type: string + description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation. + required: false + default: final_success + failure: + type: string + description: Points to the operation to invoke on Actor operation failure. + required: false + default: final_failure + failure_timeout: + type: string + description: Points to the operation to invoke when the time out for the operation occurs. + required: false + default: final_failure_timeout + failure_retries: + type: string + description: Points to the operation to invoke when the current operation has exceeded its max retries. + required: false + default: final_failure_retries + failure_exception: + type: string + description: Points to the operation to invoke when the current operation causes an exception. + required: false + default: final_failure_exception + failure_guard: + type: string + description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement. + required: false + default: final_failure_guard \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file index 5fa4308d..3c17c900 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file @@ -1,4 +1,4 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 +tosca_definitions_version: tosca_simple_yaml_1_1_0 policy_types: onap.policies.Monitoring: derived_from: tosca.policies.Root @@ -9,10 +9,9 @@ policy_types: version: 1.0.0 properties: tca_policy: - type: map + type: onap.datatypes.monitoring.tca_policy description: TCA Policy JSON - entry_schema: - type: onap.datatypes.monitoring.tca_policy + required: true data_types: onap.datatypes.monitoring.metricsPerEventName: derived_from: tosca.datatypes.Root diff --git a/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file index 6b6b372c..f16f4e89 100644 --- a/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file @@ -27,6 +27,10 @@ "policies": [], "properties": {}, "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.operational.common.*", + "version": "1.0.0" + }, { "name": "onap.policies.controlloop.Operational", "version": "1.0.0" @@ -42,7 +46,7 @@ "properties": {}, "supportedPolicyTypes": [ { - "name": "onap.policies.controlloop.Guard", + "name": "onap.policies.controlloop.guard.common.*", "version": "1.0.0" } ] diff --git a/src/test/resources/tosca/new-converter/tca-schema.json b/src/test/resources/tosca/new-converter/tca-schema.json new file mode 100644 index 00000000..3f444aa9 --- /dev/null +++ b/src/test/resources/tosca/new-converter/tca-schema.json @@ -0,0 +1,175 @@ +{ + "title": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "type": "object", + "required": [], + "properties": { + "tca_policy": { + "title": "onap.datatypes.monitoring.tca_policy", + "type": "object", + "required": [ + "domain", + "metricsPerEventName" + ], + "properties": { + "domain": { + "type": "string", + "description": "Domain name to which TCA needs to be applied", + "default": "measurementsForVfScaling", + "const": "measurementsForVfScaling" + }, + "metricsPerEventName": { + "type": "array", + "description": "Contains eventName and threshold details that need to be applied to given eventName", + "items": { + "title": "onap.datatypes.monitoring.metricsPerEventName", + "type": "object", + "required": [ + "controlLoopSchemaType", + "eventName", + "policyName", + "policyScope", + "policyVersion", + "thresholds" + ], + "properties": { + "controlLoopSchemaType": { + "type": "string", + "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", + "enum": [ + "VM", + "VNF" + ] + }, + "eventName": { + "type": "string", + "description": "Event name to which thresholds need to be applied" + }, + "policyName": { + "type": "string", + "description": "TCA Policy Scope Name" + }, + "policyScope": { + "type": "string", + "description": "TCA Policy Scope" + }, + "policyVersion": { + "type": "string", + "description": "TCA Policy Scope Version" + }, + "thresholds": { + "type": "array", + "description": "Thresholds associated with eventName", + "items": { + "title": "onap.datatypes.monitoring.thresholds", + "type": "object", + "required": [ + "closedLoopControlName", + "closedLoopEventStatus", + "direction", + "fieldPath", + "severity", + "thresholdValue", + "version" + ], + "properties": { + "closedLoopControlName": { + "type": "string", + "description": "Closed Loop Control Name associated with the threshold" + }, + "closedLoopEventStatus": { + "type": "string", + "description": "Closed Loop Event Status of the threshold", + "enum": [ + "ONSET", + "ABATED" + ] + }, + "direction": { + "type": "string", + "description": "Direction of the threshold", + "enum": [ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL", + "EQUAL" + ] + }, + "fieldPath": { + "type": "string", + "description": "Json field Path as per CEF message which needs to be analyzed for TCA", + "enum": [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", + "$.event.measurementsForVfScalingFields.meanRequestLatency", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" + ] + }, + "severity": { + "type": "string", + "description": "Threshold Event Severity", + "enum": [ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + }, + "thresholdValue": { + "type": "integer", + "description": "Threshold value for the field Path inside CEF message" + }, + "version": { + "type": "string", + "description": "Version number associated with the threshold" + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/tosca/templates.properties b/src/test/resources/tosca/templates.properties deleted file mode 100644 index 792238bd..00000000 --- a/src/test/resources/tosca/templates.properties +++ /dev/null @@ -1,7 +0,0 @@ -Integer=type,description,required -Boolean=description,required -String=type,description,required,metadata,constraints -Number=description,required -Map=type,description,required,entry_schema -List=type,required,entry_schema -onap.datatype.controlloop.Actor=type,description,required,metadata \ No newline at end of file -- cgit 1.2.3-korg