diff options
Diffstat (limited to 'src/test/resources/http-cache')
30 files changed, 0 insertions, 2154 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 deleted file mode 100644 index 9e616dfea..000000000 --- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.file +++ /dev/null @@ -1,96 +0,0 @@ -{ - "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 deleted file mode 100644 index 5464a754d..000000000 --- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 58975d86a..000000000 --- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.file +++ /dev/null @@ -1,12 +0,0 @@ -{ - "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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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/policies/.file b/src/test/resources/http-cache/example/policy/api/v1/policies/.file deleted file mode 100644 index 91c3c87de..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policies/.file +++ /dev/null @@ -1,197 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_1_0", - "topology_template": { - "policies": [ - { - "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0": { - "type": "onap.policies.monitoring.tcagen2", - "type_version": "1.0.0", - "properties": { - "tca.policy": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "policyScope": "DCAE", - "thresholds": [ - { - "version": "1.0.2", - "severity": "MAJOR", - "thresholdValue": 200, - "closedLoopEventStatus": "ONSET", - "closedLoopControlName": "LOOP_test", - "direction": "LESS_OR_EQUAL", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta" - } - ], - "eventName": "vLoadBalancer", - "policyVersion": "v0.0.1", - "controlLoopSchemaType": "VM", - "policyName": "DCAE.Config_tca-hi-lo" - } - ] - } - }, - "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0", - "version": "1.0.0", - "metadata": { - "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0", - "policy-version": "1.0.0" - } - } - }, - { - "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd": { - "type": "onap.policies.controlloop.operational.common.Drools", - "type_version": "1.0.0", - "properties": { - "abatement": false, - "operations": [ - { - "failure_retries": "final_failure_retries", - "id": "test1", - "failure_timeout": "final_failure_timeout", - "failure": "final_failure", - "operation": { - "payload": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": "{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"hostname\":\"\",\"request-info\":{\"prop1\":\"\",\"prop2\":\"\"}}}" - }, - "target": { - "entityIds": { - "resourceID": "Vloadbalancerms..vdns..module-3", - "modelInvariantId": "4c10ba9b-f88f-415e-9de3-5d33336047fa", - "modelVersionId": "4fa73b49-8a6c-493e-816b-eb401567b720", - "modelName": "Vloadbalancerms..vdns..module-3", - "modelVersion": "1", - "modelCustomizationId": "bafcdab0-801d-4d81-9ead-f464640a38b1" - }, - "targetType": "VNF" - }, - "actor": "SDNR", - "operation": "BandwidthOnDemand" - }, - "failure_guard": "final_failure_guard", - "retries": 0, - "timeout": 0, - "failure_exception": "final_failure_exception", - "description": "test", - "success": "final_success" - } - ], - "trigger": "test1", - "timeout": 0, - "id": "LOOP_test" - }, - "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", - "version": "1.0.0", - "metadata": { - "policy-id": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", - "policy-version": "1.0.0" - } - } - }, - { - "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP": { - "type": "onap.policies.Naming", - "type_version": "1.0.0", - "properties": { - "naming-models": [ - { - "naming-type": "VNF", - "naming-recipe": "AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP", - "name-operation": "to_lower_case()", - "naming-properties": [ - { - "property-name": "AIC_CLOUD_REGION" - }, - { - "property-name": "CONSTANT", - "property-value": "onap-nf" - }, - { - "property-name": "TIMESTAMP" - }, - { - "property-value": "-", - "property-name": "DELIMITER" - } - ] - }, - { - "naming-type": "VNFC", - "naming-recipe": "VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE", - "name-operation": "to_lower_case()", - "naming-properties": [ - { - "property-name": "VNF_NAME" - }, - { - "property-name": "SEQUENCE", - "increment-sequence": { - "max": "zzz", - "scope": "ENTIRETY", - "start-value": "1", - "length": "3", - "increment": "1", - "sequence-type": "alpha-numeric" - } - }, - { - "property-name": "NFC_NAMING_CODE" - }, - { - "property-value": "-", - "property-name": "DELIMITER" - } - ] - }, - { - "naming-type": "VF-MODULE", - "naming-recipe": "VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE", - "name-operation": "to_lower_case()", - "naming-properties": [ - { - "property-name": "VNF_NAME" - }, - { - "property-value": "-", - "property-name": "DELIMITER" - }, - { - "property-name": "VF_MODULE_LABEL" - }, - { - "property-name": "VF_MODULE_TYPE" - }, - { - "property-name": "SEQUENCE", - "increment-sequence": { - "max": "zzz", - "scope": "PRECEEDING", - "start-value": "1", - "length": "3", - "increment": "1", - "sequence-type": "alpha-numeric" - } - } - ] - } - ], - "policy-instance-name": "ONAP_NF_NAMING_TIMESTAMP" - }, - "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", - "version": "1.0.0", - "metadata": { - "policy-id": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", - "policy-version": "1.0.0" - } - } - } - ] - }, - "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/policies/.header b/src/test/resources/http-cache/example/policy/api/v1/policies/.header deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policies/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 50fcf9135..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file +++ /dev/null @@ -1,53 +0,0 @@ -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.Naming: - version: 1.0.0 - description: Supports blacklist of VNF's from performing control loop actions on. - derived_from: tosca.policies.Root - 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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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.Naming/versions/1.0.0/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file deleted file mode 100644 index a00692971..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file +++ /dev/null @@ -1,101 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Naming: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Naming - description: Virtual policy node for naming - properties: - policy-instance-name: - type: string - naming-models: - type: list - entry_schema: - type: policy.data.naming-model-entity -data_types: - policy.data.naming-model-entity: - derived_from: tosca.datatypes.Root - properties: - nfRole: - type: string - required: false - metadata: - matchable: true - naming-type: - type: string - required: true - metadata: - matchable: true - naming-recipe: - type: string - required: true - name-operation: - type: string - required: false - naming-properties: - type: list - required: true - entry_schema: - type: policy.data.naming-property - policy.data.naming-property: - derived_from: tosca.datatypes.Root - properties: - property-name: - type: string - required: true - metadata: - matchable: true - property-value: - type: string - required: false - property-operation: - type: string - required: false - source-system: - type: string - required: false - source-endpoint: - type: string - required: false - increment-sequence: - type: policy.data.increment-sequence - required: false - policy.data.increment-sequence: - derived_from: tosca.datatypes.Root - properties: - scope: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - CLOUD_REGION_ID - - LOCATION_CLLI - - VNF - - VM - - VFMODULE - - PRECEEDING - - TRAILING - - ENTIRETY - sequence-type: - type: string - require: true - entry_schema: - type: string - constraints: - - valid_values: - - numeric - - alpha-numeric - start-value: - type: string - required: true - max: - type: string - required: false - increment: - type: string - required: true - length: - type: string - required: true
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 79e79f0fe..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.file +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 163027e46..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.file +++ /dev/null @@ -1,47 +0,0 @@ -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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 778efae9e..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.file +++ /dev/null @@ -1,80 +0,0 @@ -{ - "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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 78bdde746..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.file +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index 5464a754d..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 14ae7acd8..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.file +++ /dev/null @@ -1,360 +0,0 @@ -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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index af7a61ef7..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.file +++ /dev/null @@ -1,150 +0,0 @@ -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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index 3c17c9004..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file +++ /dev/null @@ -1,158 +0,0 @@ -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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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.tcagen2/versions/1.0.0/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.file deleted file mode 100644 index 367d2b5a4..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.file +++ /dev/null @@ -1,160 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Monitoring - description: a base policy type for all policies that govern monitoring provisioning - onap.policies.monitoring.tcagen2: - derived_from: onap.policies.Monitoring - version: 1.0.0 - name: onap.policies.monitoring.tcagen2 - 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.tcagen2/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100644 index b0d6819af..000000000 --- a/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file +++ /dev/null @@ -1,99 +0,0 @@ -{ - "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" - }, - { - "name": "onap.policies.controlloop.operational.common.*", - "version": "1.0.0" - } - ] - }, - { - "currentInstanceCount": 0, - "desiredInstanceCount": 1, - "pdpInstances": [], - "pdpType": "drools", - "policies": [ - { - "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", - "version": "1.0.0" - } - ], - "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": [ - { - "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0", - "version": "1.0.0" - } - ], - "properties": {}, - "supportedPolicyTypes": [ - { - "name": "onap.policies.monitoring.*", - "version": "1.0.0" - }, - { - "name": "onap.policies.Naming", - "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 deleted file mode 100644 index b11784a21..000000000 --- a/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header +++ /dev/null @@ -1 +0,0 @@ -{"Transfer-Encoding": "chunked", "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 deleted file mode 100755 index 1f84b56f5..000000000 --- a/src/test/resources/http-cache/start_http_cache.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 deleted file mode 100755 index 7fe316852..000000000 --- a/src/test/resources/http-cache/third_party_proxy.py +++ /dev/null @@ -1,497 +0,0 @@ -#!/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('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') - 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 |