From 89e2e616734c565ed204f7b3847c1ff279f615c5 Mon Sep 17 00:00:00 2001 From: Scott Seabolt Date: Fri, 9 Mar 2018 22:55:58 -0500 Subject: Adding Stab JMeter jmx Issue-ID: APPC-456 Change-Id: I16e7c18a503ddb8aeb2ee5d6bf126e83e49e3e9b Signed-off-by: Scott Seabolt --- JMeter/APPC-LCM-Action-V1.jmx | 3131 +++++++++++++++++++++++++++ JMeter/appc-lcm-test-Stability-Test-VM2.csv | 1 + JMeter/appc-lcm-test-Stability-Test-VM3.csv | 1 + JMeter/appc-lcm-test.csv | 1 + JMeter/log_covert.py | 59 + 5 files changed, 3193 insertions(+) create mode 100644 JMeter/APPC-LCM-Action-V1.jmx create mode 100644 JMeter/appc-lcm-test-Stability-Test-VM2.csv create mode 100644 JMeter/appc-lcm-test-Stability-Test-VM3.csv create mode 100644 JMeter/appc-lcm-test.csv create mode 100644 JMeter/log_covert.py diff --git a/JMeter/APPC-LCM-Action-V1.jmx b/JMeter/APPC-LCM-Action-V1.jmx new file mode 100644 index 0000000..8cda521 --- /dev/null +++ b/JMeter/APPC-LCM-Action-V1.jmx @@ -0,0 +1,3131 @@ + + + + + + + false + false + + + + + + + + continue + + false + 1 + + 1 + 1 + 1518473958000 + 1518473958000 + false + + + + + + 1 + + 1 + request_number + 000 + false + + + + , + + appc-lcm-test.csv + false + false + true + shareMode.all + true + dmaap_ip,dmaap_topic_post,dmaap_topic_get,vnf_id,vm_id + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + + + + + + + true + 3 + + + + false + false + + + + false + + + vars.put("RESTART_ACCEPTED","WAITING"); + +StringBuilder timestamp = new StringBuilder(); +//ISO_FORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z' + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "restart", + "correlation-id": "${request_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${__time(yyyy-MM-dd'T'hh:mm:ss.SSS)}Z", + "api-ver": "2.05", + "originator-id": "${request_id}", + "request-id": "${request_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Restart", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/799ea611-bb36-4e49-b043-964f20c442d5\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-READ + POST + true + false + true + false + + HttpClient4 + + + + + + + + false + StringBuilder result = new StringBuilder(); +String newline = System.getProperty("line.separator"); +//int max = Integer.parseInt(Parameters); +//Random random = new Random(); + +//int counter = Integer.parseInt(vars.get("request-id")); + +result.append("{"); +//result.append("\"version\": \"2.01\","); +//result.append("\"rpc-name\": \"restart\","); +//result.append("\"correlation-id\": \"a20e2073-30b1-4357-893b-f5ed57b66ef0-1\","); +//result.append(newline); +//result.append("\"type\": \"request\","); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("\"body\": {"); +//result.append(newline); +//result.append("\"input\": {"); +//result.append(newline); +//result.append("\"common-header\": {"); +//result.append(newline); +//result.append("\"timestamp\": \"2018-2-12T21:25:04.244Z\","); +//result.append(newline); +//result.append("\"api-ver\": \"2.05\","); +//result.append(newline); +//result.append("\"originator-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"request-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"sub-request-id\": \"1\","); +//result.append(newline); +//result.append("\"flags\": {"); +//result.append(newline); +//result.append("\"force\": \"TRUE\","); +//result.append(newline); +//result.append("\"ttl\": 60000"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("},"); +//result.append(newline); +//result.append("\"action\": \"Restart\","); +//result.append(newline); +//result.append("\"action-identifiers\": {"); +//result.append(newline); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +result.append(newline); +result.append("}"); + +vars.put("json",result.toString()); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${RESTART_ACCEPTED}"=="WAITING")} + + + + 1 + + 1 + acceptance_retry + + false + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${request_id}"} + = + true + filter + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-WRITE/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("request_id"); + +log.info("Restart " + requestId + " acceptance response = " + jsonMessage); + +if(jsonMessage != "WAITING"){ + vars.put("RESTART_ACCEPTED",jsonMessage); +} + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + 1 + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "restart", + "correlation-id": "${transaction_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${reqeust_timestamp}", + "api-ver": "2.05", + "originator-id": "${transaction_id}", + "request-id": "${transaction_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Restart", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/799ea611-bb36-4e49-b043-964f20c442d5\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_post} + POST + true + false + true + false + + HttpClient4 + + + + + + false + + + import java.text.SimpleDateFormat; + +String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; +SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); +isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); + +Calendar currentTime = Calendar.getInstance(); + +String timeStampZuluStr = isoFormatter.format(currentTime.getTime()); +vars.put("reqeust_timestamp",timeStampZuluStr); +vars.put("action_accepted","WAITING"); +vars.put("action_completed","WAITING"); +vars.put("accepted_retry_limit","3"); +vars.put("completed_retry_limit","20"); +vars.put("transaction_id",timeStampZuluStr + "-" + ${__threadNum} + "-" + vars.get("request_number")); + +log.info(vars.get("reqeust_timestamp") + " Begin Restart transaction : " + vars.get("transaction_id")); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${action_accepted}"=="WAITING")} + + + + 3000 + + + + 1 + + 1 + acceptance_retry + + true + true + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${transaction_id}"} + = + true + filter + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("acceptance_retry")); +int limit = Integer.parseInt(vars.get("accepted_retry_limit")); + +log.info("Restart " + requestId + " acceptance response = " + jsonMessage + " attempt = " + retries); +log.info("action_accepted=" + vars.get("action_accepted")); +log.info("action_completed=" + vars.get("action_completed")); + +if(jsonMessage != "WAITING"){ + log.info("Received accepted response of '" + jsonMessage + "' for " + requestId); + vars.put("action_accepted",jsonMessage); +}else if(retries >= limit){ + log.info("Reached maximum retries waiting for Accepted response for transaction " + requestId); + vars.put("action_accepted","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + ${__javaScript("${action_accepted}"=="ACCEPTED - request accepted" && "${action_completed}"=="WAITING")} + + + + 10000 + + + + 1 + + 1 + completed_retry + + true + true + + + + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + false + finished_message + "reason\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("finished_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("completed_retry")); +int limit = Integer.parseInt(vars.get("completed_retry_limit")); + +log.info("Restart " + requestId + " completed response = " + jsonMessage + " attempt = " + retries); + +if(jsonMessage != "WAITING"){ + vars.put("action_completed",jsonMessage); +}else if(retries >= limit){ + vars.put("action_completed","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + + continue + + false + 1 + + 1 + 1 + 1518473958000 + 1518473958000 + false + + + + + + 1 + + 1 + request_number + 000 + false + + + + , + + /home/ubuntu/appc-lcm-test-Stability-Test-VM2.csv + false + false + true + shareMode.all + true + dmaap_ip,dmaap_topic_post,dmaap_topic_get,vnf_id,vm_id + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + + + + + + + true + 3 + + + + false + false + + + + false + + + vars.put("STOP_ACCEPTED","WAITING"); + +StringBuilder timestamp = new StringBuilder(); +//ISO_FORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z' + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "stop", + "correlation-id": "${request_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${__time(yyyy-MM-dd'T'hh:mm:ss.SSS)}Z", + "api-ver": "2.05", + "originator-id": "${request_id}", + "request-id": "${request_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Stop", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/c0d9b8c7-9534-4a22-b464-d6aa2c930847\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-READ + POST + true + false + true + false + + HttpClient4 + + + + + + + + false + StringBuilder result = new StringBuilder(); +String newline = System.getProperty("line.separator"); +//int max = Integer.parseInt(Parameters); +//Random random = new Random(); + +//int counter = Integer.parseInt(vars.get("request-id")); + +result.append("{"); +//result.append("\"version\": \"2.01\","); +//result.append("\"rpc-name\": \"restart\","); +//result.append("\"correlation-id\": \"a20e2073-30b1-4357-893b-f5ed57b66ef0-1\","); +//result.append(newline); +//result.append("\"type\": \"request\","); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("\"body\": {"); +//result.append(newline); +//result.append("\"input\": {"); +//result.append(newline); +//result.append("\"common-header\": {"); +//result.append(newline); +//result.append("\"timestamp\": \"2018-2-12T21:25:04.244Z\","); +//result.append(newline); +//result.append("\"api-ver\": \"2.05\","); +//result.append(newline); +//result.append("\"originator-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"request-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"sub-request-id\": \"1\","); +//result.append(newline); +//result.append("\"flags\": {"); +//result.append(newline); +//result.append("\"force\": \"TRUE\","); +//result.append(newline); +//result.append("\"ttl\": 60000"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("},"); +//result.append(newline); +//result.append("\"action\": \"Restart\","); +//result.append(newline); +//result.append("\"action-identifiers\": {"); +//result.append(newline); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +result.append(newline); +result.append("}"); + +vars.put("json",result.toString()); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${STOP_ACCEPTED}"=="WAITING")} + + + + 1 + + 1 + acceptance_retry + + false + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${request_id}"} + = + true + filter + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-WRITE/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("request_id"); + +log.info("Stop " + requestId + " acceptance response = " + jsonMessage); + +if(jsonMessage != "WAITING"){ + vars.put("STOP_ACCEPTED",jsonMessage); +} + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + true + 3 + + + + false + false + + + + false + + + vars.put("START_ACCEPTED","WAITING"); + +StringBuilder timestamp = new StringBuilder(); +//ISO_FORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z' + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "start", + "correlation-id": "${request_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${__time(yyyy-MM-dd'T'hh:mm:ss.SSS)}Z", + "api-ver": "2.05", + "originator-id": "${request_id}", + "request-id": "${request_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Start", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/c0d9b8c7-9534-4a22-b464-d6aa2c930847\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-READ + POST + true + false + true + false + + HttpClient4 + + + + + + + + false + StringBuilder result = new StringBuilder(); +String newline = System.getProperty("line.separator"); +//int max = Integer.parseInt(Parameters); +//Random random = new Random(); + +//int counter = Integer.parseInt(vars.get("request-id")); + +result.append("{"); +//result.append("\"version\": \"2.01\","); +//result.append("\"rpc-name\": \"restart\","); +//result.append("\"correlation-id\": \"a20e2073-30b1-4357-893b-f5ed57b66ef0-1\","); +//result.append(newline); +//result.append("\"type\": \"request\","); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("\"body\": {"); +//result.append(newline); +//result.append("\"input\": {"); +//result.append(newline); +//result.append("\"common-header\": {"); +//result.append(newline); +//result.append("\"timestamp\": \"2018-2-12T21:25:04.244Z\","); +//result.append(newline); +//result.append("\"api-ver\": \"2.05\","); +//result.append(newline); +//result.append("\"originator-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"request-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"sub-request-id\": \"1\","); +//result.append(newline); +//result.append("\"flags\": {"); +//result.append(newline); +//result.append("\"force\": \"TRUE\","); +//result.append(newline); +//result.append("\"ttl\": 60000"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("},"); +//result.append(newline); +//result.append("\"action\": \"Restart\","); +//result.append(newline); +//result.append("\"action-identifiers\": {"); +//result.append(newline); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +result.append(newline); +result.append("}"); + +vars.put("json",result.toString()); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${START_ACCEPTED}"=="WAITING")} + + + + 1 + + 1 + acceptance_retry + + false + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${request_id}"} + = + true + filter + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-WRITE/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("request_id"); + +log.info("Start " + requestId + " acceptance response = " + jsonMessage); + +if(jsonMessage != "WAITING"){ + vars.put("START_ACCEPTED",jsonMessage); +} + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + 1 + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "stop", + "correlation-id": "${transaction_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${reqeust_timestamp}", + "api-ver": "2.05", + "originator-id": "${transaction_id}", + "request-id": "${transaction_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Stop", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/c0d9b8c7-9534-4a22-b464-d6aa2c930847\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_post} + POST + true + false + true + false + + HttpClient4 + + + + + + false + + + import java.text.SimpleDateFormat; + +String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; +SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); +isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); + +Calendar currentTime = Calendar.getInstance(); + +String timeStampZuluStr = isoFormatter.format(currentTime.getTime()); +vars.put("reqeust_timestamp",timeStampZuluStr); +vars.put("action_accepted","WAITING"); +vars.put("action_completed","WAITING"); +vars.put("accepted_retry_limit","3"); +vars.put("completed_retry_limit","20"); +vars.put("transaction_id",timeStampZuluStr + "-" + ${__threadNum} + "-" + vars.get("request_number")); + +log.info(vars.get("reqeust_timestamp") + " Begin Stop transaction : " + vars.get("transaction_id")); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${action_accepted}"=="WAITING")} + + + + 3000 + + + + 1 + + 1 + acceptance_retry + + true + true + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${transaction_id}"} + = + true + filter + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("acceptance_retry")); +int limit = Integer.parseInt(vars.get("accepted_retry_limit")); + +log.info("Stop " + requestId + " acceptance response = " + jsonMessage + " attempt = " + retries); +log.info("action_accepted=" + vars.get("action_accepted")); +log.info("action_completed=" + vars.get("action_completed")); + +if(jsonMessage != "WAITING"){ + log.info("Received accepted response of '" + jsonMessage + "' for " + requestId); + vars.put("action_accepted",jsonMessage); +}else if(retries >= limit){ + log.info("Reached maximum retries waiting for Accepted response for transaction " + requestId); + vars.put("action_accepted","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + ${__javaScript("${action_accepted}"=="ACCEPTED - request accepted" && "${action_completed}"=="WAITING")} + + + + 10000 + + + + 1 + + 1 + completed_retry + + true + true + + + + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + false + finished_message + "reason\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("finished_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("completed_retry")); +int limit = Integer.parseInt(vars.get("completed_retry_limit")); + +log.info("Stop " + requestId + " completed response = " + jsonMessage + " attempt = " + retries); + +if(jsonMessage != "WAITING"){ + vars.put("action_completed",jsonMessage); +}else if(retries >= limit){ + vars.put("action_completed","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "start", + "correlation-id": "${transaction_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${reqeust_timestamp}", + "api-ver": "2.05", + "originator-id": "${transaction_id}", + "request-id": "${transaction_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Start", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/c0d9b8c7-9534-4a22-b464-d6aa2c930847\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_post} + POST + true + false + true + false + + HttpClient4 + + + + + + false + + + import java.text.SimpleDateFormat; + +String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; +SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); +isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); + +Calendar currentTime = Calendar.getInstance(); + +String timeStampZuluStr = isoFormatter.format(currentTime.getTime()); +vars.put("reqeust_timestamp",timeStampZuluStr); +vars.put("action_accepted","WAITING"); +vars.put("action_completed","WAITING"); +vars.put("accepted_retry_limit","3"); +vars.put("completed_retry_limit","20"); +vars.put("transaction_id",timeStampZuluStr + "-" + ${__threadNum} + "-" + vars.get("request_number")); + +log.info(vars.get("reqeust_timestamp") + " Begin Start transaction : " + vars.get("transaction_id")); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${action_accepted}"=="WAITING")} + + + + 3000 + + + + 1 + + 1 + acceptance_retry + + true + true + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${transaction_id}"} + = + true + filter + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("acceptance_retry")); +int limit = Integer.parseInt(vars.get("accepted_retry_limit")); + +log.info("Start " + requestId + " acceptance response = " + jsonMessage + " attempt = " + retries); +log.info("action_accepted=" + vars.get("action_accepted")); +log.info("action_completed=" + vars.get("action_completed")); + +if(jsonMessage != "WAITING"){ + log.info("Received accepted response of '" + jsonMessage + "' for " + requestId); + vars.put("action_accepted",jsonMessage); +}else if(retries >= limit){ + log.info("Reached maximum retries waiting for Accepted response for transaction " + requestId); + vars.put("action_accepted","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + ${__javaScript("${action_accepted}"=="ACCEPTED - request accepted" && "${action_completed}"=="WAITING")} + + + + 10000 + + + + 1 + + 1 + completed_retry + + true + true + + + + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + false + finished_message + "reason\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("finished_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("completed_retry")); +int limit = Integer.parseInt(vars.get("completed_retry_limit")); + +log.info("Start " + requestId + " completed response = " + jsonMessage + " attempt = " + retries); + +if(jsonMessage != "WAITING"){ + vars.put("action_completed",jsonMessage); +}else if(retries >= limit){ + vars.put("action_completed","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + + continue + + false + 1 + + 1 + 1 + 1518473958000 + 1518473958000 + false + + + + + + 1 + + 1 + request_number + 000 + false + + + + , + + /home/ubuntu/appc-lcm-test-Stability-Test-VM3.csv + false + false + true + shareMode.all + true + dmaap_ip,dmaap_topic_post,dmaap_topic_get,vnf_id,vm_id + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + + + + + + + true + 3 + + + + false + false + + + + false + + + vars.put("REBUILD_ACCEPTED","WAITING"); + +StringBuilder timestamp = new StringBuilder(); +//ISO_FORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z' + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "rebuild", + "correlation-id": "${request_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${__time(yyyy-MM-dd'T'hh:mm:ss.SSS)}Z", + "api-ver": "2.05", + "originator-id": "${request_id}", + "request-id": "${request_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Rebuild", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/3b3d77e0-a79d-4c10-bfac-1b3914af1a14\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-READ + POST + true + false + true + false + + HttpClient4 + + + + + + + + false + StringBuilder result = new StringBuilder(); +String newline = System.getProperty("line.separator"); +//int max = Integer.parseInt(Parameters); +//Random random = new Random(); + +//int counter = Integer.parseInt(vars.get("request-id")); + +result.append("{"); +//result.append("\"version\": \"2.01\","); +//result.append("\"rpc-name\": \"restart\","); +//result.append("\"correlation-id\": \"a20e2073-30b1-4357-893b-f5ed57b66ef0-1\","); +//result.append(newline); +//result.append("\"type\": \"request\","); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("\"body\": {"); +//result.append(newline); +//result.append("\"input\": {"); +//result.append(newline); +//result.append("\"common-header\": {"); +//result.append(newline); +//result.append("\"timestamp\": \"2018-2-12T21:25:04.244Z\","); +//result.append(newline); +//result.append("\"api-ver\": \"2.05\","); +//result.append(newline); +//result.append("\"originator-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"request-id\": \"664be3d2-6c12-4f4b-a3e7-c349acced200\","); +//result.append(newline); +//result.append("\"sub-request-id\": \"1\","); +//result.append(newline); +//result.append("\"flags\": {"); +//result.append(newline); +//result.append("\"force\": \"TRUE\","); +//result.append(newline); +//result.append("\"ttl\": 60000"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("},"); +//result.append(newline); +//result.append("\"action\": \"Restart\","); +//result.append(newline); +//result.append("\"action-identifiers\": {"); +//result.append(newline); +//result.append("\"vnf-id\": \"APPC_Test_VM\""); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +//result.append(newline); +//result.append("}"); +result.append(newline); +result.append("}"); + +vars.put("json",result.toString()); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${REBUILD_ACCEPTED}"=="WAITING")} + + + + 1 + + 1 + acceptance_retry + + false + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${request_id}"} + = + true + filter + + + + 10.12.5.252 + 3904 + http + + /events/APPC-LCM-WRITE/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("request_id"); + +log.info("Rebuild " + requestId + " acceptance response = " + jsonMessage); + +if(jsonMessage != "WAITING"){ + vars.put("REBUILD_ACCEPTED",jsonMessage); +} + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + 1 + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + true + + + + false + { + "version": "2.01", + "rpc-name": "rebuild", + "correlation-id": "${transaction_id}", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "${reqeust_timestamp}", + "api-ver": "2.05", + "originator-id": "${transaction_id}", + "request-id": "${transaction_id}", + "sub-request-id": "1", + "flags": { + "force": "TRUE", + "ttl": 60000 + } + }, + "action": "Rebuild", + "action-identifiers": { + "vnf-id": "${vnf_id}", + "vserver-id": "${vm-id}" + }, + "payload": "{\"vm-id\":\"http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/3b3d77e0-a79d-4c10-bfac-1b3914af1a14\", \"identity-url\": \"http://10.12.25.2:5000/v2.0\",\"skip-hypervisor-check\":\"true\"}" + } + } +} + = + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_post} + POST + true + false + true + false + + HttpClient4 + + + + + + false + + + import java.text.SimpleDateFormat; + +String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; +SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); +isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); + +Calendar currentTime = Calendar.getInstance(); + +String timeStampZuluStr = isoFormatter.format(currentTime.getTime()); +vars.put("reqeust_timestamp",timeStampZuluStr); +vars.put("action_accepted","WAITING"); +vars.put("action_completed","WAITING"); +vars.put("accepted_retry_limit","3"); +vars.put("completed_retry_limit","20"); +vars.put("transaction_id",timeStampZuluStr + "-" + ${__threadNum} + "-" + vars.get("request_number")); + +log.info(vars.get("reqeust_timestamp") + " Begin Restart transaction : " + vars.get("transaction_id")); + + + + + + Content-Type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + ${__javaScript("${action_accepted}"=="WAITING")} + + + + 3000 + + + + 1 + + 1 + acceptance_retry + + true + true + + + + + + + true + {"class":"Equals","field":"correlation-id","value":"${transaction_id}"} + = + true + filter + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + accept_message_old + $.body.output.status.message + + WAITING + + + + false + accept_message + "message\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("accept_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("acceptance_retry")); +int limit = Integer.parseInt(vars.get("accepted_retry_limit")); + +log.info("Rebuild " + requestId + " acceptance response = " + jsonMessage + " attempt = " + retries); +log.info("action_accepted=" + vars.get("action_accepted")); +log.info("action_completed=" + vars.get("action_completed")); + +if(jsonMessage != "WAITING"){ + log.info("Received accepted response of '" + jsonMessage + "' for " + requestId); + vars.put("action_accepted",jsonMessage); +}else if(retries >= limit){ + log.info("Reached maximum retries waiting for Accepted response for transaction " + requestId); + vars.put("action_accepted","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + ${__javaScript("${action_accepted}"=="ACCEPTED - request accepted" && "${action_completed}"=="WAITING")} + + + + 10000 + + + + 1 + + 1 + completed_retry + + true + true + + + + + + + ${dmaap_ip} + 3904 + http + + /events/${dmaap_topic_get}/appc-jmeter/${__threadNum} + GET + true + false + true + false + + HttpClient4 + + + + + + + + Content-Type + application/json + + + + + + false + finished_message + "reason\\":\\"(.*?)\\" + $1$ + WAITING + 1 + + + + true + + + String jsonMessage = vars.get("finished_message"); +String requestId = vars.get("transaction_id"); +int retries = Integer.parseInt(vars.get("completed_retry")); +int limit = Integer.parseInt(vars.get("completed_retry_limit")); + +log.info("Rebuild " + requestId + " completed response = " + jsonMessage + " attempt = " + retries); + +if(jsonMessage != "WAITING"){ + vars.put("action_completed",jsonMessage); +}else if(retries >= limit){ + vars.put("action_completed","TIMEOUT"); +} + + + groovy + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + + + + + + diff --git a/JMeter/appc-lcm-test-Stability-Test-VM2.csv b/JMeter/appc-lcm-test-Stability-Test-VM2.csv new file mode 100644 index 0000000..fd573ac --- /dev/null +++ b/JMeter/appc-lcm-test-Stability-Test-VM2.csv @@ -0,0 +1 @@ +10.12.5.5,APPC-LCM-READ,APPC-LCM-WRITE,Stability-Test-VM2,c0d9b8c7-9534-4a22-b464-d6aa2c930847 diff --git a/JMeter/appc-lcm-test-Stability-Test-VM3.csv b/JMeter/appc-lcm-test-Stability-Test-VM3.csv new file mode 100644 index 0000000..ea47bcb --- /dev/null +++ b/JMeter/appc-lcm-test-Stability-Test-VM3.csv @@ -0,0 +1 @@ +10.12.5.5,APPC-LCM-READ,APPC-LCM-WRITE,Stability-Test-VM3,3b3d77e0-a79d-4c10-bfac-1b3914af1a14 diff --git a/JMeter/appc-lcm-test.csv b/JMeter/appc-lcm-test.csv new file mode 100644 index 0000000..e3f9167 --- /dev/null +++ b/JMeter/appc-lcm-test.csv @@ -0,0 +1 @@ +10.12.5.5,APPC-LCM-READ,APPC-LCM-WRITE,Stability-Test-VM1,799ea611-bb36-4e49-b043-964f20c442d5 diff --git a/JMeter/log_covert.py b/JMeter/log_covert.py new file mode 100644 index 0000000..ec8478a --- /dev/null +++ b/JMeter/log_covert.py @@ -0,0 +1,59 @@ +#! /usr/bin/env python + + + +#### Command line arguments +import argparse +parser = argparse.ArgumentParser(description="Convert delimited file from one delimiter to another; defaults to converting pipe-delimited to CSV.") +parser.add_argument("--delim-input", action="store", dest="delim_in", default="|", required=False, help="Input file delimiter; pipe is default (|)", nargs='?', metavar="'|'") +parser.add_argument("--delim-output", action="store", dest="delim_out", default=",", required=False, help="Output file delimiter; comma is default (,)", nargs='?', metavar="','") +parser.add_argument("--remove-line-char", action="store_true", dest="remove_line_char", default=False, help="remove \\n and \\r characters in fields and replace with spaces") +parser.add_argument("--quote-char", action="store", dest="quote_char", default='"', required=False, help="quote character; defaults to double quote (\")", nargs='?', metavar="\"") +parser.add_argument("-i", "--input", action="store", dest="input", required=False, help="input file; if not specified, take from standard input.", nargs='?', metavar="file.csv") +parser.add_argument("-o", "--output", action="store", dest="output", required=False, help="output file; if not specified, write to standard output", nargs='?', metavar="file.pipe") +parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="increase verbosity") +args = parser.parse_args() + +# Conversion for logs begins here. +import argparse +import csv +import sys + +if args.input: + file_reader = file.reader(open(args.input, 'rb'), delimiter=args.dlm_in, quotechar=args.quote_char) +else: + file_reader = file.reader(sys.stdin, delimiter=args.dlm_in, quotechar=args.quote_char) + +if args.output: + h_outfile = open(args.output, 'wb') +else: + h_outfile = sys.stdout + +for row in file_reader: + row = args.dlm_out.join(row) + if args.remove_line_char: + row = row.replace('\n', ' ').replace('\r', ' ') + h_outfile.write("%s\n" % (row)) + h_outfile.flush() \ No newline at end of file -- cgit 1.2.3-korg