diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2017-09-12 13:54:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-12 13:54:31 +0000 |
commit | cb5b572f48b50d2f4cf6f08f93ca7a84cdabaddc (patch) | |
tree | 83f3419c7e59e5a24f803bc800469c87e7fa9c14 | |
parent | 840288a354ffde4c81f47827b22fec11552d3df3 (diff) | |
parent | cbcc00cf78a9b1d80275ccc2ff9d38896104fbab (diff) |
Merge "Add pserver suite and fix host ip in pserver suite"
-rw-r--r-- | test/csit/plans/aai/resources/setup.sh | 16 | ||||
-rw-r--r-- | test/csit/tests/aai/resources/suite1/pserver.robot | 39 |
2 files changed, 27 insertions, 28 deletions
diff --git a/test/csit/plans/aai/resources/setup.sh b/test/csit/plans/aai/resources/setup.sh index ee2046078..30b4b29b8 100644 --- a/test/csit/plans/aai/resources/setup.sh +++ b/test/csit/plans/aai/resources/setup.sh @@ -24,16 +24,14 @@ NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) DOCKER_REGISTRY=${NEXUS_DOCKER_REPO} -DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) - -docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +DOCKER_IMAGE_VERSION=1.1-STAGING-latest function wait_for_container() { CONTAINER_NAME="$1"; START_TEXT="$2"; - TIMEOUT=160 + TIMEOUT=240 # wait for the real startup AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l) @@ -43,6 +41,7 @@ function wait_for_container() { AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l) if [ "$TIMEOUT" = "0" ]; then + docker logs ${CONTAINER_NAME}; echo "ERROR: $CONTAINER_NAME deployment failed." exit 1 fi @@ -54,6 +53,7 @@ function wait_for_container() { DOCKER_COMPOSE_CMD="docker-compose"; export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1); export DOCKER_REGISTRY="nexus3.onap.org:10001"; +export AAI_HAPROXY_IMAGE="${AAI_HAPROXY_IMAGE:-aaionap/haproxy}"; export HBASE_IMAGE="${HBASE_IMAGE:-harisekhon/hbase}"; docker pull ${DOCKER_REGISTRY}/openecomp/aai-resources:${DOCKER_IMAGE_VERSION}; @@ -74,9 +74,10 @@ wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0. # Start the resources microservice RESOURCES_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-resources.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); wait_for_container ${RESOURCES_CONTAINER_NAME} '0.0.0.0:8447'; +docker logs ${CONTAINER_NAME}; # Start the traversal microservice -GRAPH_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai-traversal.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1); +GRAPH_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-traversal.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1); wait_for_container ${GRAPH_CONTAINER_NAME} '0.0.0.0:8446'; # Start the haproxy to route requests between resources and traversal @@ -84,12 +85,11 @@ HAPROXY_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.api.simpledemo.openecom echo "A&AI Microservices, resources and traversal, are up and running along with HAProxy"; -docker exec -it $GRAPH_CONTAINER_NAME "/opt/app/aai-traversal/scripts/install/updateQueryData.sh" && { +docker exec $GRAPH_CONTAINER_NAME "/opt/app/aai-traversal/scripts/install/updateQueryData.sh" && { echo "Successfully loaded the widget related data into db"; } || { echo "Unable to load widget related data into db"; } -HAPROXY_IP=$(${SCRIPTS}/get-instance-ip.sh ${HAPROXY_CONTAINER_NAME}); # Set the host ip for robot from the haproxy -ROBOT_VARIABLES="-v HOST_IP:${HAPROXY_IP}" +ROBOT_VARIABLES="-v HOST_IP:`ip addr show docker0 | head -3 | tail -1 | cut -d' ' -f6 | cut -d'/' -f1`" diff --git a/test/csit/tests/aai/resources/suite1/pserver.robot b/test/csit/tests/aai/resources/suite1/pserver.robot index 5a1d9d3ba..55e57bccb 100644 --- a/test/csit/tests/aai/resources/suite1/pserver.robot +++ b/test/csit/tests/aai/resources/suite1/pserver.robot @@ -5,62 +5,61 @@ Library requests Library Collections *** Variables *** -${TARGETURL} https://${HOST_IP}:8443/v11/cloud-infrastructure/pservers/pserver/pserver-test1 +${TARGETURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/pservers/pserver/pserver-test1 ${PSERVERDATA} {"hostname": "pserver-test1"} *** Test Cases *** Run AAI Put Pserver - [Documentation] Create an index and verify success + [Documentation] Create an pserver object ${resp}= PutWithCert ${TARGETURL} ${PSERVERDATA} + log ${TARGETURL} + log ${resp.text} Should Be Equal As Strings ${resp.status_code} 201 Run AAI Get Pserver - [Documentation] Get the document that was just created + [Documentation] Get the pserver object just created ${resp} GetWithCert ${TARGETURL} - ${content}= Evaluate $resp.json() + log ${resp} + log ${resp.json()} Should Be Equal As Strings ${resp.status_code} 200 - ${resource_version}= Evaluate $resp.json()['resource-version'] + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} Run AAI Delete Pserver - [Documentation] Delete the index + [Documentation] Delete the pserver just created ${resp}= DeleteWithCert ${TARGETURL}?resource-version=${resource_version} + log ${resp.text} Should Be Equal As Strings ${resp.status_code} 204 *** Keywords *** PutWithCert [Arguments] ${url} ${data} - ${auth}= Create List AAI AAI - ${uuid}= Generate UUID - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${uuid} X-FromAppId=integration-aai + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') - ${resp}= Evaluate requests.put('${url}', data='${data}', auth=${auth}, headers=${headers}, cert=${certinfo}, verify=False) requests + ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests [return] ${resp} PostWithCert [Arguments] ${url} ${data} ${auth}= Create List AAI AAI - ${uuid}= Generate UUID - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${uuid} X-FromAppId=integration-aai + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') - ${resp}= Evaluate requests.post('${url}', data='${data}', auth=${auth}, headers=${headers}, cert=${certinfo}, verify=False) requests + ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests [return] ${resp} GetWithCert [Arguments] ${url} - ${auth}= Create List AAI AAI - ${uuid}= Generate UUID - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${uuid} X-FromAppId=integration-aai + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') - ${resp}= Evaluate requests.get('${url}', auth=${auth}, headers=${headers}, cert=${certinfo}, verify=False) requests + ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests [return] ${resp} DeleteWithCert [Arguments] ${url} ${auth}= Create List AAI AAI - ${uuid}= Generate UUID - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${uuid} X-FromAppId=integration-aai + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') - ${resp}= Evaluate requests.delete('${url}', auth=${auth}, headers=${headers}, cert=${certinfo}, verify=False) requests + ${resp}= Evaluate requests.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests [return] ${resp} |