Script updates

  - LBAAS integration updates
  - Simple stress/request generator/checker

  Related-PROD: PROD-34629

Change-Id: I45ae3e5570497c098fd5a4c14d86f7a5e45b95b9
diff --git a/scripts/lbaas_integration.sh b/scripts/lbaas_integration.sh
index cdf439a..5cdb5e3 100644
--- a/scripts/lbaas_integration.sh
+++ b/scripts/lbaas_integration.sh
@@ -5,41 +5,51 @@
 #Requires a project, permissive security group, tenant network, floating network, keypair and image/flavor to start the VM.
 
 #Testing of the load balancing is still manual. Start the test in screen, wait until the LB is up and then test it in another tab.
-IMAGE=6d989e06-493f-4f2d-9d07-81650fd04581
-FLAVOR=dfa1ecac-e8a9-408a-b93c-75077272e10e
-NETWORK=5435a882-32f0-4abf-b1f6-3f942f85c3e7
-FIP_NET=ee84f06b-be00-4295-a27a-4c6653e960ef
+now=$(date +'%m-%d-%Y')
+IMAGE=260d1328-5ed0-4e54-a79c-26c98a92ecc9
+FLAVOR=033b82cb-b39f-466c-96c8-cf7c4e910932
+NETWORK=bd76e0b4-e707-4456-905d-834035f8c8e5
+FIP_NET=f424e52d-eefc-4a8c-b51f-490d79a4127b
 KEY=qa-lb-kp
-SGID=008f8c20-133c-4ff8-9ae0-5d8de301b3e7
+SGID=1b53d9e0-c62f-4e2a-b942-3dd2fb356337
 PROTO=TCP
 PORT=22
-LBNAME=qa-testlb
+LBNAME=qa-testlb-${now}
 echo "Spawning the pool VMs"
-openstack server create lb-1 --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
-openstack server create lb-2 --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
-openstack server create lb-3 --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
+openstack server create lb-1-${LBNAME} --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
+openstack server create lb-2-${LBNAME} --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
+openstack server create lb-3-${LBNAME} --image ${IMAGE} --flavor ${FLAVOR} --key ${KEY} --nic net-id=${NETWORK} --security-group ${SGID}
 echo "Obtaining the service subnet ID"
 SUBNET=`openstack network show ${NETWORK}  | grep subnets | awk '{print $4}'`
 echo "Creating the load balancer"
-neutron lbaas-loadbalancer-create --name ${LBNAME} ${SUBNET}
-LB=`neutron lbaas-loadbalancer-list | grep ${LBNAME} | awk '{print $2}'`
+#neutron lbaas-loadbalancer-create --name ${LBNAME} ${SUBNET}
+openstack loadbalancer create --name ${LBNAME} --vip-subnet-id  ${SUBNET}
+#LB=`neutron lbaas-loadbalancer-list | grep ${LBNAME} | awk '{print $2}'`
+LB=`openstack loadbalancer list | grep ${LBNAME} | awk '{print $2}'`
 echo "Obtaining the LB VIP port and adding the permissive security group"
-LB_PORT=`neutron lbaas-loadbalancer-show ${LB} | grep 'port_id' | awk '{print $4}'`
+#LB_PORT=`neutron lbaas-loadbalancer-show ${LB} | grep 'port_id' | awk '{print $4}'`
+LB_PORT=`openstack loadbalancer  show ${LB} | grep 'port_id' | awk '{print $4}'`
 neutron port-update ${LB_PORT} --no-security-groups
 neutron port-update ${LB_PORT} --security-group ${SGID}
 echo "Creating the LB listener and pool"
-LISTENER=`neutron lbaas-listener-create --loadbalancer ${LB} --protocol ${PROTO} --protocol-port ${PORT} --name ${LBNAME}-listener | grep '\ id' | awk '{print $4}'`
-POOL=`neutron lbaas-pool-create --listener ${LISTENER} --protocol ${PROTO} --name ${LBNAME}-pool --lb-algorithm ROUND_ROBIN | grep '\ id' | awk '{print $4}'`
+#LISTENER=`neutron lbaas-listener-create --loadbalancer ${LB} --protocol ${PROTO} --protocol-port ${PORT} --name ${LBNAME}-listener | grep '\ id' | awk '{print $4}'`
+LISTENER=`openstack loadbalancer listener create  --protocol ${PROTO} --protocol-port ${PORT} --name ${LBNAME}-listener  ${LB} | grep '\ id' | awk '{print $4}'`
+#POOL=`neutron lbaas-pool-create --listener ${LISTENER} --protocol ${PROTO} --name ${LBNAME}-pool --lb-algorithm ROUND_ROBIN | grep '\ id' | awk '{print $4}'`
+POOL=`openstack loadbalancer pool create --listener ${LISTENER} --protocol ${PROTO} --name ${LBNAME}-pool --lb-algorithm ROUND_ROBIN | grep '\ id' | awk '{print $4}'`
 echo "Obtaining the fixed IP addresses for the pool VMs"
-IP1=`openstack server show lb-1 | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
-IP2=`openstack server show lb-2 | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
-IP3=`openstack server show lb-3 | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
+IP1=`openstack server show lb-1-${LBNAME} | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
+IP2=`openstack server show lb-2-${LBNAME} | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
+IP3=`openstack server show lb-3-${LBNAME} | grep addresses | awk '{print $4}' | cut -d '=' -f 2`
 echo "Adding the VMs to the pool"
-neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP1}
-neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP2}
-neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP3}
+#neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP1}
+#neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP2}
+#neutron lbaas-member-create --protocol-port ${PORT} ${POOL} --subnet ${SUBNET} --address ${IP3}
+openstack loadbalancer member create --protocol-port ${PORT}  --subnet-id ${SUBNET} --address ${IP1}  ${POOL}
+openstack loadbalancer member create --protocol-port ${PORT}  --subnet-id ${SUBNET} --address ${IP2}  ${POOL}
+openstack loadbalancer member create --protocol-port ${PORT}  --subnet-id ${SUBNET} --address ${IP3}  ${POOL}
 echo "Associating the floating IP with the LB VIP"
-FIP_ID=`neutron floatingip-create ${FIP_NET} | grep '\ id' | awk '{print $4}'`
+#FIP_ID=(neutron floatingip-create ${FIP_NET} | grep '\ id' | awk '{print $4}')
+FIP_ID=$(neutron floatingip-show ${FIP_ID} | grep floating_ip_address | awk '{print $4}')
 neutron floatingip-associate ${FIP_ID} ${LB_PORT}
 FIP_IP=`neutron floatingip-show ${FIP_ID} | grep address | awk '{print $4}'`
 echo Load balancer is up with the floating IP ${FIP_IP}:${PORT}, protocol ${PROTO}. Press Enter for LB decommissioning.
@@ -49,6 +59,6 @@
 neutron lbaas-listener-delete ${LISTENER}
 neutron lbaas-loadbalancer-delete ${LB}
 neutron floatingip-delete ${FIP_ID}
-openstack server delete lb-1
-openstack server delete lb-2
-openstack server delete lb-3
+openstack server delete lb-1-${LBNAME}
+openstack server delete lb-2-${LBNAME}
+openstack server delete lb-3-${LBNAME}
diff --git a/scripts/svc-stress/public.list b/scripts/svc-stress/public.list
new file mode 100644
index 0000000..8759ef3
--- /dev/null
+++ b/scripts/svc-stress/public.list
@@ -0,0 +1,11 @@
+https://nova.nc4.iad0.netskope.com/v2.1/flavors
+https://designate.nc4.iad0.netskope.com/
+https://octavia.nc4.iad0.netskope.com
+https://placement.nc4.iad0.netskope.com/
+https://cloudformation.nc4.iad0.netskope.com/v1
+https://keystone.nc4.iad0.netskope.com/v3
+https://neutron.nc4.iad0.netskope.com
+https://cinder.nc4.iad0.netskope.com/v3/
+https://rgw-store.nc4.iad0.netskope.com/swift/info
+https://glance.nc4.iad0.netskope.com
+https://barbican.nc4.iad0.netskope.com/
diff --git a/scripts/svc-stress/svc-stress.sh b/scripts/svc-stress/svc-stress.sh
new file mode 100644
index 0000000..9365265
--- /dev/null
+++ b/scripts/svc-stress/svc-stress.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+if [[ -z ${token+x} ]]; then
+    export token=$(openstack token issue -c id -f value)
+    echo "# Exported token: ${token}"
+fi
+if [[ -z ${project_id+x} ]]; then
+    export project_id=$(openstack project list -c ID -c Name -f value | grep ${OS_PROJECT_NAME} | cut -d' ' -f1)
+    echo "# Exported project_id: ${project_id}"
+fi
+poke_uri=$(echo ${1/project_id/$project_id})
+
+function ppoke {
+rr=$(curl --insecure -sH "X-Auth-Token: ${token}" $1)
+if [[ $? != 0 ]]; then
+	echo "[$(date +'%H:%M:%S')] Error: $rr"
+else
+	echo "[$(date +'%H:%M:%S')] -> '$1', $(echo $rr | wc -c) bytes"
+fi
+}
+
+cc=50;
+while [[ $cc -gt 0 ]]; do
+	cat $1 | while read svc; do
+		ppoke $svc | grep "Error";
+	done
+	(( cc -= 1 ));
+	echo "$cc to go";
+	sleep 0.1;
+done