summaryrefslogtreecommitdiffstats
path: root/src/test/resources/http-cache
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-08 09:33:13 -0800
committerJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-08 09:33:25 -0800
commitbfc36d8cb714661eb00ba805d7858872cbce5308 (patch)
tree99052cc69000d791187d45381b4253353c77bef1 /src/test/resources/http-cache
parentdcd4bab11134095747a90d05f97a578b7d909520 (diff)
parent1083012bb7376c63d26b7caf9e6251d736342e30 (diff)
Merge branch 'master' of /home/jwagantall/linuxfoundation/onap/IT-21108/clamp
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'src/test/resources/http-cache')
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.file96
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header1
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.file12
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/.file46
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.file38
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.file47
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.file80
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.file40
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.file360
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.file150
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file158
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/pap/v1/pdps/.file80
-rw-r--r--src/test/resources/http-cache/example/policy/pap/v1/pdps/.header1
-rwxr-xr-xsrc/test/resources/http-cache/start_http_cache.sh52
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py497
24 files changed, 1667 insertions, 0 deletions
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.file b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.file
new file mode 100644
index 000000000..9e616dfea
--- /dev/null
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.file
@@ -0,0 +1,96 @@
+{
+ "blueprintName": "baseconfiguration",
+ "version": "1.0.0",
+ "workFlowData": {
+ "workFlowName": "resource-assignment",
+ "inputs": {
+ "resource-assignment-properties": {
+ "required": true,
+ "type": "dt-resource-assignment-properties"
+ }
+ },
+ "outputs": {
+ "response-property": {
+ "type": "string",
+ "value": "executed"
+ },
+ "template-properties": {
+ "type": "json",
+ "value": {
+ "get_attribute": [
+ "resource-assignment",
+ "assignment-params"
+ ]
+ }
+ }
+ }
+ },
+ "dataTypes": {
+ "dt-resource-assignment-properties": {
+ "description": "This is Dynamically generated data type for workflow activate",
+ "version": "1.0.0",
+ "metadata": null,
+ "attributes": null,
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "vnf-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "request-info": {
+ "required": true,
+ "type": "dt-request-info-properties",
+ "input-param": true
+ },
+ "vnf_name": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "constraints": null,
+ "derived_from": "tosca.datatypes.Dynamic"
+ },
+ "dt-request-info-properties": {
+ "description": "This is Dynamically generated data type for workflow activate",
+ "version": "1.0.0",
+ "metadata": null,
+ "attributes": null,
+ "properties": {
+ "prop1": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ },
+ "prop2": {
+ "required": true,
+ "type": "string",
+ "input-param": true
+ }
+ },
+ "constraints": null,
+ "derived_from": "tosca.datatypes.Dynamic"
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.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/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.file b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.file
new file mode 100644
index 000000000..58975d86a
--- /dev/null
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.file
@@ -0,0 +1,12 @@
+{
+ "blueprintName": "baseconfiguration",
+ "version": "1.0.0",
+ "workflows": [
+ "resource-assignment",
+ "activate",
+ "activate-restconf",
+ "activate-cli",
+ "assign-activate",
+ "imperative-test-wf"
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
new file mode 100644
index 000000000..7f5b897bf
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
@@ -0,0 +1,46 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+policy_types:
+ 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.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.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.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.common.MinMax:
+ version: 1.0.0
+ description: Supports Min/Max number of VF Modules
+ derived_from: onap.policies.controlloop.Guard
+ properties:
+ # Omitted for brevity, see Section 1
+
+ onap.policies.controlloop.guard.common.MinMax:
+ version: 2.0.0
+ description: Supports Min/Max number of VF Modules
+ derived_from: onap.policies.controlloop.Guard
+ properties:
+ # Omitted for brevity, see Section 1
+
+data_types:
+ # Any bespoke data types referenced by policy type definitions[]
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.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.Blacklist/versions/1.0.0/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.file
new file mode 100644
index 000000000..79e79f0fe
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.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/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.file
new file mode 100644
index 000000000..163027e46
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.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/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.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/1.0.0/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.file
new file mode 100644
index 000000000..778efae9e
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.file
@@ -0,0 +1,80 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "policy_types": {
+ "onap.policies.controlloop.guard.Common": {
+ "properties": {
+ "id": {
+ "name": "id",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "The Control Loop id this applies to.",
+ "required": false,
+ "constraints": [],
+ "metadata": {}
+ },
+ "actor": {
+ "name": "actor",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the Actor the guard applies to.",
+ "required": true,
+ "constraints": [],
+ "metadata": {}
+ },
+ "operation": {
+ "name": "operation",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specified the operation that the actor is performing the guard applies to.",
+ "required": true,
+ "constraints": [],
+ "metadata": {}
+ },
+ "timeRange": {
+ "name": "timeRange",
+ "type": "tosca.datatypes.TimeInterval",
+ "typeVersion": "0.0.0",
+ "description": "An optional range of time during the day the guard policy is valid for.\n",
+ "required": false,
+ "constraints": [],
+ "metadata": {}
+ }
+ },
+ "name": "onap.policies.controlloop.guard.Common",
+ "version": "1.0.0",
+ "derived_from": "tosca.policies.Root",
+ "metadata": {},
+ "description": "This is the base Policy Type for Guard policies that guard the execution of Operational\nPolicies.\n"
+ },
+ "onap.policies.controlloop.guard.common.MinMax": {
+ "properties": {
+ "min": {
+ "name": "min",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The minimum instances of this entity",
+ "required": true,
+ "constraints": [],
+ "metadata": {}
+ },
+ "max": {
+ "name": "max",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum instances of this entity",
+ "required": false,
+ "constraints": [],
+ "metadata": {}
+ }
+ },
+ "name": "onap.policies.controlloop.guard.common.MinMax",
+ "version": "1.0.0",
+ "derived_from": "onap.policies.controlloop.guard.Common",
+ "metadata": {},
+ "description": "Supports Min/Max number of entity for scaling operations"
+ }
+ },
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {}
+} \ 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/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.file
new file mode 100644
index 000000000..78bdde746
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.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/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.file
new file mode 100644
index 000000000..14ae7acd8
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.file
@@ -0,0 +1,360 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+policy_types:
+ onap.policies.controlloop.operational.Common:
+ properties:
+ abatement:
+ name: abatement
+ type: boolean
+ typeVersion: 0.0.0
+ description: Whether an abatement event message will be expected for
+ the control loop from DCAE.
+ default: 'false'
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ operations:
+ name: operations
+ type: list
+ typeVersion: 0.0.0
+ description: List of operations to be performed when Control Loop
+ is triggered.
+ required: true
+ constraints: [
+ ]
+ entry_schema:
+ type: onap.datatype.controlloop.Operation
+ typeVersion: 0.0.0
+ constraints: [
+ ]
+ metadata: {
+ }
+ trigger:
+ name: trigger
+ type: string
+ typeVersion: 0.0.0
+ description: Initial operation to execute upon receiving an Onset
+ event message for the Control Loop.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ timeout:
+ name: timeout
+ type: integer
+ typeVersion: 0.0.0
+ description: |
+ Overall timeout for executing all the operations. This timeout should equal or exceed the total
+ timeout for each operation listed.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ id:
+ name: id
+ type: string
+ typeVersion: 0.0.0
+ description: The unique control loop id.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ name: onap.policies.controlloop.operational.Common
+ version: 1.0.0
+ derived_from: tosca.policies.Root
+ metadata: {
+ }
+ 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.
+ onap.policies.controlloop.operational.common.Apex:
+ properties:
+ engineServiceParameters:
+ name: engineServiceParameters
+ type: string
+ typeVersion: 0.0.0
+ description: The engine parameters like name, instanceCount, policy
+ implementation, parameters etc.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ eventOutputParameters:
+ name: eventOutputParameters
+ type: string
+ typeVersion: 0.0.0
+ description: The event output parameters.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ javaProperties:
+ name: javaProperties
+ type: string
+ typeVersion: 0.0.0
+ description: Name/value pairs of properties to be set for APEX if
+ needed.
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ eventInputParameters:
+ name: eventInputParameters
+ type: string
+ typeVersion: 0.0.0
+ description: The event input parameters.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ name: onap.policies.controlloop.operational.common.Apex
+ version: 1.0.0
+ derived_from: onap.policies.controlloop.operational.Common
+ metadata: {
+ }
+ description: Operational policies for Apex PDP
+data_types:
+ onap.datatype.controlloop.Actor:
+ constraints: [
+ ]
+ properties:
+ payload:
+ name: payload
+ type: map
+ typeVersion: 0.0.0
+ description: Name/value pairs of payload information passed by Policy
+ to the actor
+ required: false
+ constraints: [
+ ]
+ entry_schema:
+ type: string
+ typeVersion: 0.0.0
+ constraints: [
+ ]
+ metadata:
+ clamp_possible_values: ClampExecution:CDS/payload
+ target:
+ name: target
+ type: onap.datatype.controlloop.Target
+ typeVersion: 0.0.0
+ description: The resource the operation should be performed on.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ actor:
+ name: actor
+ type: string
+ typeVersion: 0.0.0
+ description: The actor performing the operation.
+ required: true
+ constraints: [
+ ]
+ metadata:
+ clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor
+ operation:
+ name: operation
+ type: string
+ typeVersion: 0.0.0
+ description: The operation the actor is performing.
+ required: true
+ constraints: [
+ ]
+ metadata:
+ clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation
+ name: onap.datatype.controlloop.Actor
+ version: 0.0.0
+ derived_from: tosca.datatypes.Root
+ metadata: {
+ }
+ description: An actor/operation/target definition
+ onap.datatype.controlloop.Operation:
+ constraints: [
+ ]
+ properties:
+ failure_retries:
+ name: failure_retries
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke when the current operation
+ has exceeded its max retries.
+ default: final_failure_retries
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ id:
+ name: id
+ type: string
+ typeVersion: 0.0.0
+ description: Unique identifier for the operation
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ failure_timeout:
+ name: failure_timeout
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke when the time out for
+ the operation occurs.
+ default: final_failure_timeout
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ failure:
+ name: failure
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke on Actor operation
+ failure.
+ default: final_failure
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ operation:
+ name: operation
+ type: onap.datatype.controlloop.Actor
+ typeVersion: 0.0.0
+ description: The definition of the operation to be performed.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ failure_guard:
+ name: failure_guard
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke when the current operation
+ is blocked due to guard policy enforcement.
+ default: final_failure_guard
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ retries:
+ name: retries
+ type: integer
+ typeVersion: 0.0.0
+ description: The number of retries the actor should attempt to perform
+ the operation.
+ default: '0'
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ timeout:
+ name: timeout
+ type: integer
+ typeVersion: 0.0.0
+ description: The amount of time for the actor to perform the operation.
+ required: true
+ constraints: [
+ ]
+ metadata: {
+ }
+ failure_exception:
+ name: failure_exception
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke when the current operation
+ causes an exception.
+ default: final_failure_exception
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ description:
+ name: description
+ type: string
+ typeVersion: 0.0.0
+ description: A user-friendly description of the intent for the operation
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ success:
+ name: success
+ type: string
+ typeVersion: 0.0.0
+ description: Points to the operation to invoke on success. A value
+ of "final_success" indicates and end to the operation.
+ default: final_success
+ required: false
+ constraints: [
+ ]
+ metadata: {
+ }
+ name: onap.datatype.controlloop.Operation
+ version: 0.0.0
+ derived_from: tosca.datatypes.Root
+ metadata: {
+ }
+ description: An operation supported by an actor
+ onap.datatype.controlloop.Target:
+ constraints: [
+ ]
+ properties:
+ entityIds:
+ name: entityIds
+ type: map
+ typeVersion: 0.0.0
+ 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
+ constraints: [
+ ]
+ entry_schema:
+ type: string
+ typeVersion: 0.0.0
+ constraints: [
+ ]
+ metadata:
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
+ targetType:
+ name: targetType
+ type: string
+ typeVersion: 0.0.0
+ description: Category for the target type
+ required: true
+ constraints:
+ - valid_values:
+ - VNF
+ - VM
+ - VFMODULE
+ - PNF
+ metadata: {
+ }
+ name: onap.datatype.controlloop.Target
+ version: 0.0.0
+ derived_from: tosca.datatypes.Root
+ metadata: {
+ }
+ description: Definition for a entity in A&AI to perform a control loop operation
+ on
+name: ToscaServiceTemplateSimple
+version: 1.0.0
+metadata: {
+ }
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.file
new file mode 100644
index 000000000..af7a61ef7
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.file
@@ -0,0 +1,150 @@
+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
+ metadata:
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
+ 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
+ metadata:
+ clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor
+ operation:
+ type: string
+ description: The operation the actor is performing.
+ required: true
+ metadata:
+ clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations
+ target:
+ type: onap.datatype.controlloop.Target
+ description: The resource the operation should be performed on.
+ required: true
+ payload:
+ type: map
+ description: Name/value pairs of payload information passed by Policy to the actor
+ required: false
+ metadata:
+ clamp_possible_values: ClampExecution:CDS/payload
+ 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
+ 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/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.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/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file
new file mode 100644
index 000000000..3c17c9004
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file
@@ -0,0 +1,158 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+policy_types:
+ onap.policies.Monitoring:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern monitoring provisioning
+ onap.policies.monitoring.cdap.tca.hi.lo.app:
+ derived_from: onap.policies.Monitoring
+ version: 1.0.0
+ properties:
+ tca_policy:
+ type: onap.datatypes.monitoring.tca_policy
+ description: TCA Policy JSON
+ required: true
+data_types:
+ onap.datatypes.monitoring.metricsPerEventName:
+ derived_from: tosca.datatypes.Root
+ properties:
+ controlLoopSchemaType:
+ type: string
+ required: true
+ description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
+ constraints:
+ - valid_values:
+ - VM
+ - VNF
+ eventName:
+ type: string
+ required: true
+ description: Event name to which thresholds need to be applied
+ policyName:
+ type: string
+ required: true
+ description: TCA Policy Scope Name
+ policyScope:
+ type: string
+ required: true
+ description: TCA Policy Scope
+ policyVersion:
+ type: string
+ required: true
+ description: TCA Policy Scope Version
+ thresholds:
+ type: list
+ required: true
+ description: Thresholds associated with eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.thresholds
+ onap.datatypes.monitoring.tca_policy:
+ derived_from: tosca.datatypes.Root
+ properties:
+ domain:
+ type: string
+ required: true
+ description: Domain name to which TCA needs to be applied
+ default: measurementsForVfScaling
+ constraints:
+ - equal: measurementsForVfScaling
+ metricsPerEventName:
+ type: list
+ required: true
+ description: Contains eventName and threshold details that need to be applied to given eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.metricsPerEventName
+ onap.datatypes.monitoring.thresholds:
+ derived_from: tosca.datatypes.Root
+ properties:
+ closedLoopControlName:
+ type: string
+ required: true
+ description: Closed Loop Control Name associated with the threshold
+ closedLoopEventStatus:
+ type: string
+ required: true
+ description: Closed Loop Event Status of the threshold
+ constraints:
+ - valid_values:
+ - ONSET
+ - ABATED
+ direction:
+ type: string
+ required: true
+ description: Direction of the threshold
+ constraints:
+ - valid_values:
+ - LESS
+ - LESS_OR_EQUAL
+ - GREATER
+ - GREATER_OR_EQUAL
+ - EQUAL
+ fieldPath:
+ type: string
+ required: true
+ description: Json field Path as per CEF message which needs to be analyzed for TCA
+ constraints:
+ - valid_values:
+ - $.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
+ required: true
+ description: Threshold Event Severity
+ constraints:
+ - valid_values:
+ - CRITICAL
+ - MAJOR
+ - MINOR
+ - WARNING
+ - NORMAL
+ thresholdValue:
+ type: integer
+ required: true
+ description: Threshold value for the field Path inside CEF message
+ version:
+ type: string
+ required: true
+ description: Version number associated with the threshold \ 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/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.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/pap/v1/pdps/.file b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file
new file mode 100644
index 000000000..f16f4e899
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file
@@ -0,0 +1,80 @@
+{
+ "groups": [
+ {
+ "description": "This group should be used for managing all control loop related policies and pdps",
+ "name": "controlloop",
+ "pdpGroupState": "ACTIVE",
+ "pdpSubgroups": [
+ {
+ "currentInstanceCount": 0,
+ "desiredInstanceCount": 1,
+ "pdpInstances": [],
+ "pdpType": "apex",
+ "policies": [],
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.Operational",
+ "version": "1.0.0"
+ }
+ ]
+ },
+ {
+ "currentInstanceCount": 0,
+ "desiredInstanceCount": 1,
+ "pdpInstances": [],
+ "pdpType": "drools",
+ "policies": [],
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.operational.common.*",
+ "version": "1.0.0"
+ },
+ {
+ "name": "onap.policies.controlloop.Operational",
+ "version": "1.0.0"
+ }
+ ]
+ },
+ {
+ "currentInstanceCount": 0,
+ "desiredInstanceCount": 1,
+ "pdpInstances": [],
+ "pdpType": "xacml",
+ "policies": [],
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.guard.common.*",
+ "version": "1.0.0"
+ }
+ ]
+ }
+ ],
+ "properties": {}
+ },
+ {
+ "description": "This group should be used for managing all monitoring related policies and pdps",
+ "name": "monitoring",
+ "pdpGroupState": "ACTIVE",
+ "pdpSubgroups": [
+ {
+ "currentInstanceCount": 0,
+ "desiredInstanceCount": 1,
+ "pdpInstances": [],
+ "pdpType": "xacml",
+ "policies": [],
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.monitoring.*",
+ "version": "1.0.0"
+ }
+ ]
+ }
+ ],
+ "properties": {}
+ }
+ ]
+}
diff --git a/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.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/start_http_cache.sh b/src/test/resources/http-cache/start_http_cache.sh
new file mode 100755
index 000000000..1f84b56f5
--- /dev/null
+++ b/src/test/resources/http-cache/start_http_cache.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+echo "Starting HTTP CACHE python script"
+for i in "$@"
+do
+case $i in
+ --python_proxyaddress=*)
+ python_proxyaddress="--proxyaddress ${i#*=}"
+ echo "- Using python_proxyaddress and set it to: $python_proxyaddress"
+ shift # past argument=value
+ ;;
+ --http_proxyaddress=*)
+ export http_proxy="${i#*=}"
+ export https_proxy="${i#*=}"
+ echo "- Defining http_proxy/https_proxy env variables to: $http_proxy"
+ shift # past argument=value
+ ;;
+ -?|--help|-help)
+ echo "Usage: $(basename $0) [--http_proxyaddress=<http://proxy_address:port>] [--python_proxyaddress=<python_simulator_address:port>]"
+ echo "--http_proxyaddress Set the http_proxy/https_proxy in the script before running python"
+ echo "--python_proxyaddress <python_simulator_address:port>, like localhost:8080 and will be set as --proxyaddress, this is the adress returned by DCAE simulator response"
+ exit 2
+ ;;
+esac
+done
+
+echo 'Installing requests packages for Python'
+pip install --no-cache-dir requests
+echo 'Executing the Http proxy in Cache mode only'
+python -u third_party_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache $python_proxyaddress
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
new file mode 100755
index 000000000..7fe316852
--- /dev/null
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -0,0 +1,497 @@
+#!/usr/bin/env python2
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+import json
+import requests
+import os
+import errno
+import sys
+import SimpleHTTPServer
+import SocketServer
+import argparse
+import tempfile
+import signal
+import uuid
+import shutil
+
+parser = argparse.ArgumentParser(description="3rd party Cache & Replay")
+parser.add_argument("--username", "-u", type=str, help="Set the username for contacting 3rd party - only used for GET")
+parser.add_argument("--password", "-p", type=str, help="Set the password for contacting 3rd party - only used for GET")
+parser.add_argument("--root", "-r", default=tempfile.mkdtemp(), type=str, help="Root folder for the proxy cache")
+parser.add_argument("--temp", "-t", default=tempfile.mkdtemp(), type=str, help="Temp folder for the generated content")
+parser.add_argument("--proxy" , type=str, help="Url of the Act as a proxy. If not set, this script only uses the cache and will return a 404 if files aren't found")
+parser.add_argument("--port", "-P", type=int, default="8081", help="Port on which the proxy should listen to")
+parser.add_argument("--verbose", "-v", type=bool, help="Print more information in case of error")
+parser.add_argument("--proxyaddress","-a", type=str, help="Address of this proxy, generally either third-party-proxy:8085 or localhost:8085 depending if started with docker-compose or not")
+options = parser.parse_args()
+
+
+PORT = options.port
+HOST = options.proxy
+AUTH = (options.username, options.password)
+HEADERS = {'X-ECOMP-InstanceID':'CLAMP'}
+CACHE_ROOT = str(options.root)
+TMP_ROOT = str(options.temp)
+PROXY_ADDRESS=str(options.proxyaddress)
+
+def signal_handler(signal_sent, frame):
+ global httpd
+ if signal_sent == signal.SIGINT:
+ print('Got Ctrl-C (SIGINT)')
+ httpd.socket.close()
+ httpd.shutdown()
+ httpd.server_close()
+
+class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
+ def print_headers(self):
+ for header,value in self.headers.items():
+ print("header: %s : %s" % (header, value))
+
+ def check_credentials(self):
+ pass
+
+ def _send_content(self, header_file, content_file):
+ self.send_response(200)
+ with open(header_file, 'rb') as f:
+ headers = json.load(f)
+ for key,value in headers.items():
+ if key in ('Transfer-Encoding',):
+ continue
+ self.send_header(key, value)
+ self.end_headers()
+ with open(content_file,'rb') as f:
+ fc = f.read()
+ self.wfile.write(fc)
+
+ def _write_cache(self,cached_file_folder, header_file, content_file, response):
+ os.makedirs(cached_file_folder, 0777)
+ with open(content_file, 'w') as f:
+ f.write(response.raw.read())
+ with open(header_file, 'w') as f:
+ json.dump(dict(response.raw.headers), f)
+ # Entry point of the code
+ def _get_cached_file_folder_name(self,folder):
+ cached_file_folder = '%s/%s' % (folder, self.path,)
+ print("Cached file name before escaping : %s" % cached_file_folder)
+ cached_file_folder = cached_file_folder.replace('<','&#60;').replace('>','&#62;').replace('?','&#63;').replace('*','&#42;').replace('\\','&#42;').replace(':','&#58;').replace('|','&#124;')
+ print("Cached file name after escaping (used for cache storage) : %s" % cached_file_folder)
+ return cached_file_folder
+
+ def _get_cached_content_file_name(self,cached_file_folder):
+ return "%s/.file" % (cached_file_folder,)
+
+ def _get_cached_header_file_name(self,cached_file_folder):
+ return "%s/.header" % (cached_file_folder,)
+
+ def _execute_content_generated_cases(self,http_type):
+ print("Testing special cases, cache files will be sent to :" +TMP_ROOT)
+ cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ _file_available = os.path.exists(cached_file_content)
+
+ if self.path.startswith("/dcae-service-types?asdcResourceId=") and http_type == "GET":
+ if not _file_available:
+ print "self.path start with /dcae-service-types?asdcResourceId=, generating response json..."
+ uuidGenerated = str(uuid.uuid4())
+ typeId = "typeId-" + uuidGenerated
+ typeName = "typeName-" + uuidGenerated
+ print "typeId generated: " + typeName + " and typeName: "+ typeId
+ jsonGenerated = "{\"totalCount\":1, \"items\":[{\"typeId\":\"" + typeId + "\", \"typeName\":\"" + typeName +"\"}]}"
+ print "jsonGenerated: " + jsonGenerated
+
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-operationstatus/install") and http_type == "GET":
+ if not _file_available:
+ print "self.path start with /dcae-operationstatus/install, generating response json..."
+ jsonGenerated = "{\"operationType\": \"install\", \"status\": \"succeeded\"}"
+ print "jsonGenerated: " + jsonGenerated
+
+ try:
+ os.makedirs(cached_file_folder, 0777)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ print(cached_file_folder+" already exists")
+
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-operationstatus/uninstall") and http_type == "GET":
+ if not _file_available:
+ print "self.path start with /dcae-operationstatus/uninstall, generating response json..."
+ jsonGenerated = "{\"operationType\": \"uninstall\", \"status\": \"succeeded\"}"
+ print "jsonGenerated: " + jsonGenerated
+
+ try:
+ os.makedirs(cached_file_folder, 0777)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ print(cached_file_folder+" already exists")
+
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/sdc/v1/catalog/services/") and http_type == "POST":
+ if not _file_available:
+ print "self.path start with /sdc/v1/catalog/services/, generating response json..."
+ jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"artifactName\":\"" + jsondata['artifactName'] + "\",\"artifactType\":\"" + jsondata['artifactType'] + "\",\"artifactURL\":\"" + self.path + "\",\"artifactDescription\":\"" + jsondata['description'] + "\",\"artifactChecksum\":\"ZjJlMjVmMWE2M2M1OTM2MDZlODlmNTVmZmYzNjViYzM=\",\"artifactUUID\":\"" + str(uuid.uuid4()) + "\",\"artifactVersion\":\"1\"}"
+ print "jsonGenerated: " + jsonGenerated
+
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-deployments/") and http_type == "PUT":
+ print "self.path start with /dcae-deployments/ DEPLOY, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"operationType\":\"install\",\"status\":\"processing\",\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus/install?test=test\"}}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-deployments/") and http_type == "DELETE":
+ print "self.path start with /dcae-deployments/ UNDEPLOY, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"operationType\":\"uninstall\",\"status\":\"processing\",\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus/uninstall?test=test\"}}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(jsonGenerated)
+ return True
+ elif (self.path.startswith("/pdp/api/") and (http_type == "PUT" or http_type == "DELETE")) or (self.path.startswith("/pdp/api/policyEngineImport") and http_type == "POST"):
+ print "self.path start with /pdp/api/, copying body to response ..."
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "POST":
+ print "self.path start with POST new policy API /pdp/api/, copying body to response ..."
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "DELETE":
+ print "self.path start with DELETE new policy API /policy/api/v1/policytypes/ ..."
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len("")) + "\", \"Content-Type\": \""+str("")+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
+ elif self.path.startswith("/policy/pap/v1/pdps/policies") and http_type == "POST":
+ print "self.path start with POST new policy API /policy/pap/v1/pdps/ ..."
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len("")) + "\", \"Content-Type\": \""+str("")+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
+ elif (self.path.startswith("/policy/pap/v1/policies/deployed/")) and http_type == "GET":
+ print "self.path start with /policy/api/v1/policytypes/, generating response json..."
+ jsonGenerated = "{\"policyTypeId\": \"onap.policies.controlloop.operational\",\"policyTypeVersion\": \"1.0.0\",\"policyId\": \"OPERATIONAL_z711F_v1_0_ResourceInstanceName1_tca\"}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-service-types") and http_type == "GET":
+ if not _file_available:
+ self.path = "/dcae-service-types"
+ cached_file_folder = '%s/%s' % (TMP_ROOT, self.path)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ print "self.path start with /dcae-service-types, generating response json..."
+ response = "{\"links\": {\"previousLink\": {\"title\": \"string\",\"rel\": \"string\",\"uri\": \"string\",\"uriBuilder\": {},\"rels\": [\"string\"],\"params\": {\"additionalProp1\": \"string\",\"additionalProp2\": \"string\",\"additionalProp3\": \"string\"},\"type\": \"string\"},\"nextLink\": {\"title\": \"string\",\"rel\": \"string\",\"uri\": \"string\",\"uriBuilder\": {},\"rels\": [\"string\"],\"params\": {\"additionalProp1\": \"string\",\"additionalProp2\": \"string\",\"additionalProp3\": \"string\"},\"type\": \"string\"}},\"totalCount\": 1,\"items\": [{\"owner\": \"testOwner\",\"application\": \"testApplication\",\"component\": \"testComponent\",\"typeName\": \"testTypeName\",\"typeVersion\": 0,\"blueprintTemplate\": \"testBlueprintTemplate\",\"serviceIds\": [\"serviceId1\", \"serviceId2\"],\"vnfTypes\": [\"vnfType1\", \"vnfType2\"],\"serviceLocations\": [\"serviceLocation1\", \"serviceLocation2\"],\"asdcServiceId\": \"testAsdcServiceId\",\"asdcResourceId\": \"0\",\"asdcServiceURL\": \"testAsdcServiceURL\",\"typeId\": \"testtypeId\",\"selfLink\": {\"title\": \"selfLinkTitle\",\"rel\": \"selfLinkRel\",\"uri\": \"selfLinkUri\",\"uriBuilder\": {},\"rels\": [\"string\"],\"params\": {\"additionalProp1\": \"string\",\"additionalProp2\": \"string\",\"additionalProp3\": \"string\"},\"type\": \"string\"},\"created\": \"2020-01-22T09:38:15.436Z\",\"deactivated\": \"2020-01-22T09:38:15.437Z\"},{\"owner\": \"testOwner2\",\"application\": \"testApplication1\",\"component\": \"testComponent2\",\"typeName\": \"testTypeName2\",\"typeVersion\": 0,\"blueprintTemplate\": \"testBlueprintTemplate2\",\"serviceIds\": [\"serviceId3\", \"serviceId4\"],\"vnfTypes\": [\"vnfType13\", \"vnfType4\"],\"serviceLocations\": [\"serviceLocation3\", \"serviceLocation4\"],\"asdcServiceId\": \"testAsdcServiceId\",\"asdcResourceId\": \"1\",\"asdcServiceURL\": \"testAsdcServiceURL2\",\"typeId\": \"testtypeId2\",\"selfLink\": {\"title\": \"selfLinkTitle\",\"rel\": \"selfLinkRel\",\"uri\": \"selfLinkUri\",\"uriBuilder\": {},\"rels\": [\"string\"],\"params\": {\"additionalProp1\": \"string\",\"additionalProp2\": \"string\",\"additionalProp3\": \"string\"},\"type\": \"string\"},\"created\": \"2020-01-22T09:38:15.436Z\",\"deactivated\": \"2020-01-22T09:38:15.437Z\"}]}"
+ print "jsonGenerated: " + response
+
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(response)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(response)
+ return True
+ else:
+ return False
+
+
+ def do_GET(self):
+ cached_file_folder = ""
+ cached_file_content =""
+ cached_file_header=""
+ print("\n\n\nGot a GET request for %s " % self.path)
+
+ self.print_headers()
+ self.check_credentials()
+ # Verify if it's a special case
+ is_special = self._execute_content_generated_cases("GET")
+ if is_special:
+ cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ else:
+ cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+
+ _file_available = os.path.exists(cached_file_content)
+
+ if not _file_available:
+ print("Request for data currently not present in cache: %s" % (cached_file_folder,))
+
+ if not HOST:
+ self.send_response(404)
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ print("HOST value is: %s " % (options.proxy))
+ return "404 Not found, no remote HOST specified on the emulator !!!"
+
+ url = '%s%s' % (HOST, self.path)
+ response = requests.get(url, auth=AUTH, headers=HEADERS, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
+ return response.content
+ else:
+ print("Request for data currently present in cache: %s" % (cached_file_folder,))
+ print("HOST value is: %s " % (HOST))
+
+ self._send_content(cached_file_header, cached_file_content)
+
+ if self.path.startswith("/dcae-service-types?asdcResourceId="):
+ print "DCAE case deleting folder created " + cached_file_folder
+ shutil.rmtree(cached_file_folder, ignore_errors=False, onerror=None)
+ elif self.path.startswith("/dcae-service-types"):
+ print "DCAE case deleting folder created " + cached_file_folder
+ shutil.rmtree(cached_file_folder, ignore_errors=False, onerror=None)
+ else:
+ print "NOT in DCAE case deleting folder created " + cached_file_folder
+
+ def do_POST(self):
+ cached_file_folder = ""
+ cached_file_content =""
+ cached_file_header=""
+ print("\n\n\nGot a POST for %s" % self.path)
+ self.check_credentials()
+ self.data_string = self.rfile.read(int(self.headers['Content-Length']))
+ print("data-string:\n %s" % self.data_string)
+ print("self.headers:\n %s" % self.headers)
+
+ is_special = self._execute_content_generated_cases("POST")
+ if is_special:
+ cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ else:
+ cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+
+ _file_available = os.path.exists(cached_file_content)
+
+ if not _file_available:
+
+ if not HOST:
+ self.send_response(404)
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
+
+ print("Request for data currently not present in cache: %s" % (cached_file_folder,))
+
+ url = '%s%s' % (HOST, self.path)
+ print("url: %s" % (url,))
+ response = requests.post(url, data=self.data_string, headers=self.headers, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
+ return response.content
+ else:
+ print("Request for data present in cache: %s" % (cached_file_folder,))
+
+ self._send_content(cached_file_header, cached_file_content)
+
+ def do_PUT(self):
+ cached_file_folder = ""
+ cached_file_content =""
+ cached_file_header=""
+ print("\n\n\nGot a PUT for %s " % self.path)
+ self.check_credentials()
+ self.data_string = self.rfile.read(int(self.headers['Content-Length']))
+ print("data-string:\n %s" % self.data_string)
+ print("self.headers:\n %s" % self.headers)
+
+ is_special = self._execute_content_generated_cases("PUT")
+ if is_special:
+ cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ else:
+ cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+
+ _file_available = os.path.exists(cached_file_content)
+
+ if not _file_available:
+ if not HOST:
+ self.send_response(404)
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
+
+ print("Request for data currently not present in cache: %s" % (cached_file_folder,))
+
+ url = '%s%s' % (HOST, self.path)
+ print("url: %s" % (url,))
+ response = requests.put(url, data=self.data_string, headers=self.headers, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
+ return response.content
+ else:
+ print("Request for data present in cache: %s" % (cached_file_folder,))
+
+ self._send_content(cached_file_header, cached_file_content)
+
+
+ def do_DELETE(self):
+ cached_file_folder = ""
+ cached_file_content =""
+ cached_file_header=""
+ print("\n\n\nGot a DELETE for %s " % self.path)
+ self.check_credentials()
+ if self.headers.get('Content-Length') is not None:
+ self.data_string = self.rfile.read(int(self.headers['Content-Length']))
+ else:
+ self.data_string = "empty generated"
+ print("self.headers:\n %s" % self.headers)
+
+ is_special = self._execute_content_generated_cases("DELETE")
+ if is_special:
+ cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+ else:
+ cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT)
+ cached_file_content = self._get_cached_content_file_name(cached_file_folder)
+ cached_file_header = self._get_cached_header_file_name(cached_file_folder)
+
+ _file_available = os.path.exists(cached_file_content)
+
+ if not _file_available:
+ if not HOST:
+ self.send_response(404)
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
+
+ print("Request for data currently not present in cache: %s" % (cached_file_folder,))
+
+ url = '%s%s' % (HOST, self.path)
+ print("url: %s" % (url,))
+ response = requests.put(url, data=self.data_string, headers=self.headers, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
+ return response.content
+ else:
+ print("Request for data present in cache: %s" % (cached_file_folder,))
+
+ self._send_content(cached_file_header, cached_file_content)
+
+
+
+# Main code that start the HTTP server
+httpd = SocketServer.ForkingTCPServer(('', PORT), Proxy)
+httpd.allow_reuse_address = True
+print "Listening on port "+ str(PORT) + "(Press Ctrl+C/Ctrl+Z to stop HTTPD Caching script)"
+print "Caching folder " + CACHE_ROOT + ", Tmp folder for generated files " + TMP_ROOT
+signal.signal(signal.SIGINT, signal_handler)
+httpd.serve_forever() \ No newline at end of file