Merge "Refactor PM Mapper tests"
authorMariusz Wagner <mariusz.wagner@nokia.com>
Tue, 12 Mar 2019 14:01:32 +0000 (14:01 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 12 Mar 2019 14:01:32 +0000 (14:01 +0000)
plans/dcaegen2-collectors-hv-ves/testsuites/.env
plans/dcaegen2-collectors-hv-ves/testsuites/consul.d/cbs.json [new file with mode: 0644]
plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml
scripts/clamp/start_clamp_containers.sh
tests/clamp/APIs/01__Create_CL_Holmes.robot
tests/clamp/APIs/02__Create_CL_TCA.robot [deleted file]
tests/clamp/APIs/03__VariousApis.robot [deleted file]
tests/clamp/APIs/04__Verify_API_Models.robot [deleted file]
tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot

index a64ba26..7e2fffc 100644 (file)
@@ -8,6 +8,5 @@ DCAE_APP_SIMULATOR_IMAGE=hv-collector-dcae-app-simulator
 # IN XNF_SIMULATOR_LIBRARY PYTHON FILE.
 HV_VES_VERSION=1.1-SNAPSHOT
 
-HV_VES_CONFIG_URL=http://consul:8500/v1/kv/veshv-config?raw=true
 HV_VES_HEALTHCHECK_CMD=curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061
-HV_VES_MAIN_CLASS=org.onap.dcae.collectors.veshv.main.MainKt
\ No newline at end of file
+HV_VES_MAIN_CLASS=org.onap.dcae.collectors.veshv.main.MainKt
diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/consul.d/cbs.json b/plans/dcaegen2-collectors-hv-ves/testsuites/consul.d/cbs.json
new file mode 100644 (file)
index 0000000..0761c7e
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "service": {
+    "name": "cbs",
+    "tags": [
+      "cbs"
+    ],
+    "port": 10000,
+    "address": "config-binding-service"
+  }
+}
index 6717835..ac07eb7 100644 (file)
@@ -6,92 +6,124 @@ networks:
       name: $CONTAINERS_NETWORK
 
 services:
+
+  #
+  # DMaaP Message Router
+  #
+
   zookeeper:
     image: wurstmeister/zookeeper
     ports:
-    - "2181:2181"
+      - "2181:2181"
     networks:
-    - ves-hv-default
+      - ves-hv-default
 
   kafka:
     image: wurstmeister/kafka
     ports:
-    - "9092:9092"
+      - "9092:9092"
     environment:
       KAFKA_ADVERTISED_HOST_NAME: "kafka"
       KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
       KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
       KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092"
     volumes:
-    - /var/run/docker.sock:/var/run/docker.sock
+      - /var/run/docker.sock:/var/run/docker.sock
     depends_on:
-    - zookeeper
+      - zookeeper
     networks:
-    - ves-hv-default
+      - ves-hv-default
+
+
+  #
+  # Consul / CBS
+  #
 
-  consul:
-    image: progrium/consul
+  consul-server:
+    image: docker.io/consul:1.0.6
     ports:
-    - "8500:8500"
+      - "8500:8500"
+    command: ["agent","-bootstrap", "-client=0.0.0.0", "-server", "-ui", "-config-dir=/consul/consul.d"]
+    volumes:
+      - ./consul.d/:/consul/consul.d
+    networks:
+      ves-hv-default:
+        aliases:
+          - consul
+
+  config-binding-service:
+    image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.2.4
+    ports:
+      - "10000:10000"
     environment:
-    - CONSUL_BIND_INTERFACE=eth0
+      CONSUL_HOST: "consul-server"
+    depends_on:
+      - consul-server
     networks:
       ves-hv-default:
         aliases:
-        - consul
-    command: ["-server", "-bootstrap"]
+          - cbs
+  #
+  # DCAE HV VES Collector
+  #
 
   ves-hv-collector:
     image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${HV_VES_IMAGE}:${HV_VES_VERSION}
     ports:
-    - "6060:6060"
-    - "6061:6061/tcp"
+      - "6060:6060"
+      - "6061:6061/tcp"
     command: ["--listen-port", "6061",
-              "--config-url", "${HV_VES_CONFIG_URL}",
               "--kafka-bootstrap-servers", "kafka:9092",
               "--key-store-password", "onaponap",
               "--trust-store-password", "onaponap"]
     environment:
       JAVA_OPTS: "-Dio.netty.leakDetection.level=paranoid"
+      CONSUL_HOST: "consul-server"
+      CONFIG_BINDING_SERVICE: "cbs"
+      HOSTNAME: "dcae-hv-ves-collector"
     healthcheck:
       interval: 10s
       timeout: 5s
       retries: 2
       test: ${HV_VES_HEALTHCHECK_CMD}
-    depends_on:
-    - kafka
     volumes:
-    - ./ssl/:/etc/ves-hv/
+      - ./ssl/:/etc/ves-hv/
+    depends_on:
+      - config-binding-service
+      - kafka
     networks:
-    - ves-hv-default
+      - ves-hv-default
 
   unencrypted-ves-hv-collector:
     image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${HV_VES_IMAGE}:${HV_VES_VERSION}
     ports:
-    - "7060:6060"
-    - "7061:6061/tcp"
+      - "7060:6060"
+      - "7061:6061/tcp"
     command: ["--listen-port", "6061",
-              "--config-url", "${HV_VES_CONFIG_URL}",
               "--kafka-bootstrap-servers", "kafka:9092",
               "--ssl-disable"]
     environment:
       JAVA_OPTS: "-Dio.netty.leakDetection.level=paranoid"
+      CONSUL_HOST: "consul-server"
+      CONFIG_BINDING_SERVICE: "cbs"
+      HOSTNAME: "dcae-hv-ves-collector"
     healthcheck:
       interval: 10s
       timeout: 5s
       retries: 2
       test: ${HV_VES_HEALTHCHECK_CMD}
-    depends_on:
-    - kafka
     volumes:
-    - ./ssl/:/etc/ves-hv/
+      - ./ssl/:/etc/ves-hv/
+    depends_on:
+      - config-binding-service
+      - kafka
     networks:
-    - ves-hv-default
+      - ves-hv-default
 
   dcae-app-simulator:
     image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${DCAE_APP_SIMULATOR_IMAGE}:${HV_VES_VERSION}
     ports:
-    - "6063:6063/tcp"
+      - "6063:6063/tcp"
     command: ["--listen-port", "6063", "--kafka-bootstrap-servers", "kafka:9092", "--kafka-topics", "non-existing-topic"]
     healthcheck:
       interval: 10s
@@ -99,9 +131,9 @@ services:
       retries: 2
       test: "curl --request GET --fail --silent --show-error localhost:6063/healthcheck"
     depends_on:
-    - kafka
+      - kafka
     networks:
       ves-hv-default:
         aliases:
-        - dcae-app-simulator
+          - dcae-app-simulator
 
index 8a176fb..8da8340 100755 (executable)
@@ -49,22 +49,5 @@ if [ "$TIME" -ge "$TIME_OUT" ]; then
    exit 1;
 fi
 
-# To avoid some problem because templates not yet read
-TIME=0
-while [ "$TIME" -lt "$TIME_OUT" ]; do
-  response=$(curl --write-out '%{http_code}' --silent --output /dev/null -u admin:password -vk --key config/org.onap.clamp.keyfile https://localhost:8443/restservices/clds/v1/cldsTempate/template-names); echo $response
+sleep 30
 
-  if [ "$response" == "200" ]; then
-    echo Templates well available
-    break;
-  fi
-
-  echo Sleep: $INTERVAL seconds before testing if templates available. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
-  sleep $INTERVAL
-  TIME=$(($TIME+$INTERVAL))
-done
-
-if [ "$TIME" -ge "$TIME_OUT" ]; then
-   echo TIME OUT: Templates not available in $TIME_OUT seconds... Could cause problems for tests...
-   exit 1;
-fi
index ce4c8df..be63f22 100644 (file)
@@ -19,29 +19,3 @@ Get Requests health check ok
     Create the sessions
     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
-
-Get Requests verify test template found
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/cldsTempate/template-names
-    Should Be Equal As Strings  ${resp.status_code}     200
-    Should Contain Match     ${resp}      *templateHolmes1*
-    Should Contain Match     ${resp}      *templateHolmes2*
-    Should Not Contain Match     ${resp}      *templateHolmes99*
-
-Put Requests to add Close Loop ClHolmes1
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}createClHolmes1.json
-    &{headers}=  Create Dictionary      Content-Type=application/json
-    ${resp}=    Put Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClHolmes1     data=${data}   headers=${headers}
-    Should Be Equal As Strings      ${resp.status_code}     200
-
-Put Requests to add Close Loop ClHolmes2
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}createClHolmes2.json
-    &{headers}=  Create Dictionary      Content-Type=application/json
-    ${resp}=    Put Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClHolmes2     data=${data}   headers=${headers}
-    Should Be Equal As Strings      ${resp.status_code}     200
-
-Get Requests verify CL1 found
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Be Equal As Strings  ${resp.status_code}     200
-    Should Contain Match     ${resp}      *ClHolmes1*
-    Should Contain Match     ${resp}      *ClHolmes2*
-    Should Not Contain Match     ${resp}      *ClHolmes99*
diff --git a/tests/clamp/APIs/02__Create_CL_TCA.robot b/tests/clamp/APIs/02__Create_CL_TCA.robot
deleted file mode 100644 (file)
index 15ab4b1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-*** Settings ***
-Library     Collections
-Library     RequestsLibrary
-Library     OperatingSystem
-Library     json
-
-*** Variables ***
-${login}                     admin
-${passw}                     password
-
-*** Test Cases ***
-Get Requests health check ok
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
-    Should Be Equal As Strings  ${resp.status_code}     200
-
-Get Requests verify test template found
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/cldsTempate/template-names
-    Should Be Equal As Strings  ${resp.status_code}     200
-    Should Contain Match     ${resp}      *templateTCA1*
-    Should Contain Match     ${resp}      *CA2*
-    Should Not Contain Match     ${resp}      *templateTCA99*
-
-Put Requests to add Close Loop ClHolmes1
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}createClTCA1.json
-    &{headers}=  Create Dictionary      Content-Type=application/json
-    ${resp}=    Put Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClTCA1    data=${data}   headers=${headers}
-    Should Be Equal As Strings      ${resp.status_code}     200
-
-Put Requests to add Close Loop ClHolmes2
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}createClTCA2.json
-    &{headers}=  Create Dictionary      Content-Type=application/json
-    ${resp}=    Put Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClTCA2     data=${data}   headers=${headers}
-    Should Be Equal As Strings      ${resp.status_code}     200
-
-Get Requests verify CL1 found
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Be Equal As Strings  ${resp.status_code}     200
-    Should Contain Match     ${resp}      *ClTCA1*
-    Should Contain Match     ${resp}      *ClTCA2*
-    Should Not Contain Match     ${resp}      *ClTCA99*
diff --git a/tests/clamp/APIs/03__VariousApis.robot b/tests/clamp/APIs/03__VariousApis.robot
deleted file mode 100644 (file)
index f327283..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-*** Settings ***
-Library     Collections
-Library     RequestsLibrary
-Library     OperatingSystem
-Library     json
-
-*** Variables ***
-${login}                     admin
-${passw}                     password
-
-*** Test Cases ***
-Get Clamp properties
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/cldsInfo
-    Dictionary Should Contain Key    ${resp.json()}   userName
-    Dictionary Should Contain Key    ${resp.json()}   permissionReadCl
-
-Get Clamp Info
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/cldsInfo
-    Dictionary Should Contain Key    ${resp.json()}   userName
-    Dictionary Should Contain Key    ${resp.json()}   cldsVersion
-
-Get model bpmn by name
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/bpmn/ClHolmes1
-    Should Contain Match    ${resp}   *StartEvent_*
-    Should Contain Match    ${resp}   *VesCollector_*
-    Should Contain Match    ${resp}   *Holmes_*
-    Should Contain Match    ${resp}   *Policy_*
-    Should Contain Match    ${resp}   *EndEvent_*
-
-Get model names
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Contain Match    ${resp}   *ClHolmes1*
-    Should Contain Match    ${resp}   *ClHolmes2*
-    Should Contain Match    ${resp}   *ClTCA1*
-    Should Contain Match    ${resp}   *ClTCA2*
-    Should Not Contain Match    ${resp}   *ClHolmes99*
-    Should Not Contain Match    ${resp}   *ClTCA99*
diff --git a/tests/clamp/APIs/04__Verify_API_Models.robot b/tests/clamp/APIs/04__Verify_API_Models.robot
deleted file mode 100644 (file)
index 9a29a91..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-*** Settings ***
-Library     Collections
-Library     RequestsLibrary
-Library     OperatingSystem
-Library     json
-
-*** Variables ***
-${login}                     admin
-${passw}                     password
-
-*** Test Cases ***
-Verify HolmesModel1
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClHolmes1
-    Should Contain Match    ${resp}   *plateHolmes1*
-    Should Contain Match    ${resp}   *DC1*
-    Should Contain Match    ${resp}   *DC2*
-    Should Contain Match    ${resp}   *Policy1*
-    Should Contain Match    ${resp}   *vnfRecipe*
-    Should Contain Match    ${resp}   *180*
-    Should Contain Match    ${resp}   *345*
-    Should Contain Match    ${resp}   *Config Policy name1*
-
-Verify HolmesModel2
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClHolmes2
-    Should Contain Match    ${resp}   *plateHolmes2*
-    Should Contain Match    ${resp}   *DC2*
-    Should Contain Match    ${resp}   *DC3*
-    Should Contain Match    ${resp}   *Policy2*
-    Should Contain Match    ${resp}   *vnfRecipe*
-    Should Contain Match    ${resp}   *migrate*
-    Should Contain Match    ${resp}   *360*
-    Should Contain Match    ${resp}   *345*
-    Should Contain Match    ${resp}   *Config Policy Name2*
-
-Verify TCAModel1
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClTCA1
-    Should Contain Match    ${resp}   *plateTCA1*
-    Should Contain Match    ${resp}   *enbRecipe*
-    Should Contain Match    ${resp}   *DC1*
-    Should Contain Match    ${resp}   *DC2*
-    Should Contain Match    ${resp}   *Policy3*
-    Should Contain Match    ${resp}   *345*
-    Should Contain Match    ${resp}   *200*
-    Should Contain Match    ${resp}   *ONSET*
-
-Verify TCAModel2
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/ClTCA2
-    Should Contain Match    ${resp}   *lateTCA2*
-    Should Contain Match    ${resp}   *enbRecipe*
-    Should Contain Match    ${resp}   *DC1*
-    Should Contain Match    ${resp}   *DC2*
-    Should Contain Match    ${resp}   *DC3*
-    Should Contain Match    ${resp}   *Policy4*
-    Should Contain Match    ${resp}   *tcaPol*
-    Should Contain Match    ${resp}   *345*
-    Should Contain Match    ${resp}   *300*
-    Should Contain Match    ${resp}   *VM*
-
-Get model names
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Contain Match    ${resp}   *ClHolmes1*
-    Should Contain Match    ${resp}   *ClHolmes2*
-    Should Contain Match    ${resp}   *ClTCA1*
-    Should Contain Match    ${resp}   *ClTCA2*
-    Should Not Contain Match    ${resp}   *ClTCA99*
-    Should Not Contain Match    ${resp}   *ClHolmes99*
-
index 6058008..2b6a578 100644 (file)
@@ -40,7 +40,7 @@ ${HTTP_METHOD_URL}                             http://
 
 ${CONSUL_CONTAINER_HOST}                       consul
 ${CONSUL_CONTAINER_PORT}                       8500
-${CONSUL_VES_HV_CONFIGURATION_KEY_PATH}        /v1/kv/veshv-config
+${CONSUL_VES_HV_CONFIGURATION_KEY_PATH}        /v1/kv/dcae-hv-ves-collector
 
 ${DCAE_APP_CONTAINER_HOST}                     dcae-app-simulator
 ${DCAE_APP_CONTAINER_PORT}                     6063