aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-08-03 14:39:33 -0400
committerAlex Shatov <alexs@att.com>2018-08-03 14:39:33 -0400
commita5739ab3e9f7f97652e6814233abeee51f28db5e (patch)
tree71004a89bed1bbf7e247a12e66efcfe1438c206b /tests
parentd8a51f22ef4723240d18a03708275689f822b42f (diff)
3.0.0 new dataflow on policy-update and catchup
- external version 3.0.0 - internal version 5.0.0 for API and code - changed API and functionality - new dataflow - new dataflow between policy-handler and deployment-handler on policy-update and catchup = GET /policy - returns the deployed policy_ids+versions and policy-filters = PUT /policy updates policies on deployed components = new message format for policy-update and catchup = matching by policy_id+version and policy_filter_id only - removed POST to /policy - the obsolete API = removed the 'smart' matching of the policies by policy-filter -- it is done by the policy-handler now Coverage summary Statements : 77.06% ( 870/1129 ) Branches : 53.55% ( 264/493 ) Functions : 78.53% ( 150/191 ) Lines : 77.45% ( 862/1113 ) Change-Id: I5409f32e1acd4870f1d74b466902a796fa10f6c7 Signed-off-by: Alex Shatov <alexs@att.com> Issue-ID: DCAEGEN2-492
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dcae-deployments.js2
-rw-r--r--tests/test_policy.js61
2 files changed, 31 insertions, 32 deletions
diff --git a/tests/test_dcae-deployments.js b/tests/test_dcae-deployments.js
index 664615e..a010017 100644
--- a/tests/test_dcae-deployments.js
+++ b/tests/test_dcae-deployments.js
@@ -104,7 +104,7 @@ const Inventory = {
"owner": "dcaeorch",
"typeName": "svc-type-000",
"typeVersion": 1,
- "blueprintTemplate": "tosca_definitions_version: cloudify_dsl_1_3\nimports:\n - \"http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\"\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R3/dockerplugin/3.2.0/dockerplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R3/relationshipplugin/1.0.0/relationshipplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R3/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n\ninputs:\n dh_override:\n type: string\n default: \"dockerhost\"\n dh_location_id:\n type: string\n default: \"zone1\"\n aaiEnrichmentHost:\n type: string\n default: \"none\"\n aaiEnrichmentPort:\n type: string \n default: 8443\n enableAAIEnrichment:\n type: string\n default: false\n dmaap_host:\n type: string\n default: dmaap.onap-message-router \n dmaap_port:\n type: string\n default: 3904 \n enableRedisCaching:\n type: string\n default: false \n redisHosts:\n type: string \n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0\"\n consul_host:\n type: string\n default: consul-server.onap-consul\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: \"Port for CDAPgui to be exposed\"\n default: \"32010\"\n scn_name: \n default: dcaegen2-analytics_tca_clampinstance_1\n type: string\nnode_templates:\n docker_service_host:\n properties:\n docker_host_override:\n get_input: dh_override\n location_id:\n get_input: dh_location_id\n type: dcae.nodes.SelectedDockerHost\n tca_docker:\n relationships:\n - type: dcae.relationships.component_contained_in\n target: docker_service_host\n - target: tca_policy\n type: cloudify.relationships.depends_on \n type: dcae.nodes.DockerContainerForComponentsUsingDmaap\n properties:\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: '1728000'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: '1728000'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: '86400'\n thresholdCalculatorFlowletInstances: '2'\n app_preferences:\n aaiEnrichmentHost: \n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: 'true'\n aaiEnrichmentPortNumber: '8443'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: DCAE\n aaiEnrichmentUserPassword: DCAE\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment: \n get_input: enableAAIEnrichment\n enableRedisCaching: \n get_input: enableRedisCaching\n redisHosts: \n get_input: redisHosts\n enableAlertCEFFormat: 'false'\n publisherContentType: application/json\n publisherHostName: \n get_input: dmaap_host\n publisherHostPort: \n get_input: dmaap_port \n publisherMaxBatchSize: '1'\n publisherMaxRecoveryQueueSize: '100000'\n publisherPollingInterval: '20000'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: \n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port \n subscriberMessageLimit: '-1'\n subscriberPollingInterval: '30000'\n subscriberProtocol: http\n subscriberTimeoutMS: '-1'\n subscriberTopicName: unauthenticated.SEC_MEASUREMENT_OUTPUT\n tca_policy_default: '{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}'\n service_component_type: dcaegen2-analytics_tca \n docker_config:\n healthcheck:\n endpoint: /\n interval: 15s\n timeout: 1s\n type: http\n image:\n get_input: tag_version \n service_component_name_override: \n get_input: scn_name \n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST: \n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.SEC_MEASUREMENT_OUTPUT\"\n AAIHOST: \n { get_input: aaiEnrichmentHost }\n AAIPORT: \n { get_input: aaiEnrichmentPort }\n CONSUL_HOST: \n { get_input: consul_host }\n CONSUL_PORT: \n { get_input: consul_port }\n CBS_HOST: \n { get_input: cbs_host }\n CBS_PORT: \n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\" \n SERVICE_11011_NAME: \n { get_input: scn_name }\n SERVICE_11015_IGNORE: \"true\" \n ports:\n - concat: [\"11011:\", { get_input: external_port }] \n stop:\n inputs:\n cleanup_image: true \n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n",
+ "blueprintTemplate": "tosca_definitions_version: cloudify_dsl_1_3\nimports:\n - \"http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\"\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dockerplugin/3.2.0/dockerplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/relationshipplugin/1.0.0/relationshipplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n\ninputs:\n dh_override:\n type: string\n default: \"dockerhost\"\n dh_location_id:\n type: string\n default: \"zone1\"\n aaiEnrichmentHost:\n type: string\n default: \"none\"\n aaiEnrichmentPort:\n type: string \n default: 8443\n enableAAIEnrichment:\n type: string\n default: false\n dmaap_host:\n type: string\n default: dmaap.onap-message-router \n dmaap_port:\n type: string\n default: 3904 \n enableRedisCaching:\n type: string\n default: false \n redisHosts:\n type: string \n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0\"\n consul_host:\n type: string\n default: consul-server.onap-consul\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: \"Port for CDAPgui to be exposed\"\n default: \"32010\"\n scn_name: \n default: dcaegen2-analytics_tca_clampinstance_1\n type: string\nnode_templates:\n docker_service_host:\n properties:\n docker_host_override:\n get_input: dh_override\n location_id:\n get_input: dh_location_id\n type: dcae.nodes.SelectedDockerHost\n tca_docker:\n relationships:\n - type: dcae.relationships.component_contained_in\n target: docker_service_host\n - target: tca_policy\n type: cloudify.relationships.depends_on \n type: dcae.nodes.DockerContainerForComponentsUsingDmaap\n properties:\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: '1728000'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: '1728000'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: '86400'\n thresholdCalculatorFlowletInstances: '2'\n app_preferences:\n aaiEnrichmentHost: \n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: 'true'\n aaiEnrichmentPortNumber: '8443'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: DCAE\n aaiEnrichmentUserPassword: DCAE\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment: \n get_input: enableAAIEnrichment\n enableRedisCaching: \n get_input: enableRedisCaching\n redisHosts: \n get_input: redisHosts\n enableAlertCEFFormat: 'false'\n publisherContentType: application/json\n publisherHostName: \n get_input: dmaap_host\n publisherHostPort: \n get_input: dmaap_port \n publisherMaxBatchSize: '1'\n publisherMaxRecoveryQueueSize: '100000'\n publisherPollingInterval: '20000'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: \n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port \n subscriberMessageLimit: '-1'\n subscriberPollingInterval: '30000'\n subscriberProtocol: http\n subscriberTimeoutMS: '-1'\n subscriberTopicName: unauthenticated.SEC_MEASUREMENT_OUTPUT\n tca_policy_default: '{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}'\n service_component_type: dcaegen2-analytics_tca \n docker_config:\n healthcheck:\n endpoint: /\n interval: 15s\n timeout: 1s\n type: http\n image:\n get_input: tag_version \n service_component_name_override: \n get_input: scn_name \n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST: \n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.SEC_MEASUREMENT_OUTPUT\"\n AAIHOST: \n { get_input: aaiEnrichmentHost }\n AAIPORT: \n { get_input: aaiEnrichmentPort }\n CONSUL_HOST: \n { get_input: consul_host }\n CONSUL_PORT: \n { get_input: consul_port }\n CBS_HOST: \n { get_input: cbs_host }\n CBS_PORT: \n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\" \n SERVICE_11011_NAME: \n { get_input: scn_name }\n SERVICE_11015_IGNORE: \"true\" \n ports:\n - concat: [\"11011:\", { get_input: external_port }] \n stop:\n inputs:\n cleanup_image: true \n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n",
"serviceIds": null,
"vnfTypes": ["TESTVNF000"],
"serviceLocations": null,
diff --git a/tests/test_policy.js b/tests/test_policy.js
index 0d7550e..bc424e0 100644
--- a/tests/test_policy.js
+++ b/tests/test_policy.js
@@ -32,7 +32,6 @@ const dh = require('./mock_deployment_handler');
const utils = require('./mock_utils');
const RUN_TS = new Date();
-const RUN_TS_HOURS = RUN_TS.getHours();
const POLICY_ID = 'policy_id';
const POLICY_VERSION = "policyVersion";
@@ -245,7 +244,7 @@ function test_get_policy_components(dh_server) {
});
}
-function test_post_policy_catch_up(dh_server) {
+function test_put_policy_catch_up(dh_server) {
const req_path = "/policy";
const message = JSON.parse(JSON.stringify(message_catch_up));
message.errored_scopes = ["CLAMP.Config_"];
@@ -260,19 +259,19 @@ function test_post_policy_catch_up(dh_server) {
"fail_filtered_2": create_policy("fail_filtered_2", 32, {"ConfigName": "not-match2"}),
"": create_policy("", 1)
};
- const test_txt = "POST " + req_path + " - catchup " + JSON.stringify(message);
+ const test_txt = "put " + req_path + " - catchup " + JSON.stringify(message);
describe(test_txt, () => {
- it('POST policy-update - catchup', function() {
+ it('put policy-update - catchup', function() {
const action_timer = new utils.ActionTimer();
console.log(action_timer.step, test_txt);
const execution_id = "policy_catch_up";
const resp_to_exe = {"status": "none"};
nock_cfy_node_instances(action_timer);
- nock(dh.CLOUDIFY_URL).post(CFY_API_EXECUTIONS)
+ nock(dh.CLOUDIFY_URL).put(CFY_API_EXECUTIONS)
.reply(201, function(uri, requestBody) {
requestBody = JSON.stringify(requestBody);
- console.log(action_timer.step, "on_post", dh.CLOUDIFY_URL, uri, requestBody);
+ console.log(action_timer.step, "on_put", dh.CLOUDIFY_URL, uri, requestBody);
Object.assign(resp_to_exe, JSON.parse(requestBody));
resp_to_exe.status = "pending";
resp_to_exe.created_at = RUN_TS;
@@ -285,7 +284,7 @@ function test_post_policy_catch_up(dh_server) {
resp_to_exe.parameters.operation = OPERATION_POLICY_UPDATE;
resp_to_exe.parameters.type_names = [];
- console.log(action_timer.step, "reply to post", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
+ console.log(action_timer.step, "reply to put", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
return JSON.stringify(resp_to_exe);
});
@@ -315,9 +314,9 @@ function test_post_policy_catch_up(dh_server) {
message.latest_policies[policy_id] = create_policy(policy_id, extra_i);
}
- return chai.request(dh_server.app).post(req_path)
+ return chai.request(dh_server.app).put(req_path)
.set('content-type', 'application/json')
- .set('X-ECOMP-RequestID', 'test_post_policy_catch_up')
+ .set('X-ECOMP-RequestID', 'test_put_policy_catch_up')
.send(message)
.then(function(res) {
console.log(action_timer.step, "res for", test_txt, res.text);
@@ -343,30 +342,30 @@ function test_fail_cfy_policy_catch_up(dh_server) {
message.latest_policies = {
[MONKEYED_POLICY_ID_6]: create_policy(MONKEYED_POLICY_ID_6, 66)
};
- const test_txt = "fail POST " + req_path + " - catchup without execution_id " + JSON.stringify(message);
+ const test_txt = "fail put " + req_path + " - catchup without execution_id " + JSON.stringify(message);
describe(test_txt, () => {
- it('fail POST policy-update - catchup without execution_id', function() {
+ it('fail put policy-update - catchup without execution_id', function() {
const action_timer = new utils.ActionTimer();
console.log(action_timer.step, test_txt);
const execution_id = "policy_catch_up";
const resp_to_exe = {"status": "none"};
nock_cfy_node_instances(action_timer);
- nock(dh.CLOUDIFY_URL).post(CFY_API_EXECUTIONS)
+ nock(dh.CLOUDIFY_URL).put(CFY_API_EXECUTIONS)
.reply(201, function(uri, requestBody) {
requestBody = JSON.stringify(requestBody);
- console.log(action_timer.step, "on_post", dh.CLOUDIFY_URL, uri, requestBody);
+ console.log(action_timer.step, "on_put", dh.CLOUDIFY_URL, uri, requestBody);
Object.assign(resp_to_exe, JSON.parse(requestBody));
resp_to_exe.status = "pending";
- console.log(action_timer.step, "reply to post", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
+ console.log(action_timer.step, "reply to put", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
return JSON.stringify(resp_to_exe);
});
- return chai.request(dh_server.app).post(req_path)
+ return chai.request(dh_server.app).put(req_path)
.set('content-type', 'application/json')
- .set('X-ECOMP-RequestID', 'test_post_policy_catch_up')
+ .set('X-ECOMP-RequestID', 'test_put_policy_catch_up')
.send(message)
.then(function(res) {
console.log(action_timer.step, "res for", test_txt, res.text);
@@ -392,25 +391,25 @@ function test_fail_400_cfy_policy_catch_up(dh_server) {
message.latest_policies = {
[MONKEYED_POLICY_ID_6]: create_policy(MONKEYED_POLICY_ID_6, 66)
};
- const test_txt = "fail 400 POST " + req_path + " - existing_running_execution_error " + JSON.stringify(message);
+ const test_txt = "fail 400 put " + req_path + " - existing_running_execution_error " + JSON.stringify(message);
describe(test_txt, () => {
- it('fail 400 POST policy-update - existing_running_execution_error', function() {
+ it('fail 400 put policy-update - existing_running_execution_error', function() {
const action_timer = new utils.ActionTimer();
console.log(action_timer.step, test_txt);
const execution_id = "policy_catch_up";
const resp_to_exe = {"error_code": "existing_running_execution_error"};
nock_cfy_node_instances(action_timer);
- nock(dh.CLOUDIFY_URL).post(CFY_API_EXECUTIONS).times(5)
+ nock(dh.CLOUDIFY_URL).put(CFY_API_EXECUTIONS).times(5)
.reply(400, function(uri, requestBody) {
- console.log(action_timer.step, "on_post", dh.CLOUDIFY_URL, uri, JSON.stringify(requestBody));
- console.log(action_timer.step, "reply to post", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
+ console.log(action_timer.step, "on_put", dh.CLOUDIFY_URL, uri, JSON.stringify(requestBody));
+ console.log(action_timer.step, "reply to put", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
return JSON.stringify(resp_to_exe);
});
- return chai.request(dh_server.app).post(req_path)
+ return chai.request(dh_server.app).put(req_path)
.set('content-type', 'application/json')
- .set('X-ECOMP-RequestID', 'test_post_policy_catch_up')
+ .set('X-ECOMP-RequestID', 'test_put_policy_catch_up')
.send(message)
.then(function(res) {
console.log(action_timer.step, "res for", test_txt, res.text);
@@ -436,25 +435,25 @@ function test_fail_404_cfy_policy_catch_up(dh_server) {
message.latest_policies = {
[MONKEYED_POLICY_ID_6]: create_policy(MONKEYED_POLICY_ID_6, 66)
};
- const test_txt = "fail 404 POST " + req_path + " - not_found_error " + JSON.stringify(message);
+ const test_txt = "fail 404 put " + req_path + " - not_found_error " + JSON.stringify(message);
describe(test_txt, () => {
- it('fail 404 POST policy-update - not_found_error', function() {
+ it('fail 404 put policy-update - not_found_error', function() {
const action_timer = new utils.ActionTimer();
console.log(action_timer.step, test_txt);
const execution_id = "policy_catch_up";
const resp_to_exe = {"error_code": "not_found_error"};
nock_cfy_node_instances(action_timer);
- nock(dh.CLOUDIFY_URL).post(CFY_API_EXECUTIONS).times(5)
+ nock(dh.CLOUDIFY_URL).put(CFY_API_EXECUTIONS).times(5)
.reply(404, function(uri, requestBody) {
- console.log(action_timer.step, "on_post", dh.CLOUDIFY_URL, uri, JSON.stringify(requestBody));
- console.log(action_timer.step, "reply to post", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
+ console.log(action_timer.step, "on_put", dh.CLOUDIFY_URL, uri, JSON.stringify(requestBody));
+ console.log(action_timer.step, "reply to put", dh.CLOUDIFY_URL, uri, JSON.stringify(resp_to_exe));
return JSON.stringify(resp_to_exe);
});
- return chai.request(dh_server.app).post(req_path)
+ return chai.request(dh_server.app).put(req_path)
.set('content-type', 'application/json')
- .set('X-ECOMP-RequestID', 'test_post_policy_catch_up')
+ .set('X-ECOMP-RequestID', 'test_put_policy_catch_up')
.send(message)
.then(function(res) {
console.log(action_timer.step, "res for", test_txt, res.text);
@@ -476,7 +475,7 @@ function test_fail_404_cfy_policy_catch_up(dh_server) {
dh.add_tests([
test_get_policy_components,
- test_post_policy_catch_up,
+ test_put_policy_catch_up,
test_fail_cfy_policy_catch_up,
test_fail_400_cfy_policy_catch_up,
test_fail_404_cfy_policy_catch_up