Merge "Update NBI docker for master (Casablanca)"
authorGary Wu <gary.i.wu@huawei.com>
Wed, 19 Sep 2018 01:29:45 +0000 (01:29 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 19 Sep 2018 01:29:45 +0000 (01:29 +0000)
112 files changed:
deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json
deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh
deployment/heat/onap-oom/env/gwu/onap-oom.env
deployment/heat/onap-oom/env/huawei/onap-oom.env
deployment/heat/onap-oom/env/tlab/onap-oom.env
deployment/heat/onap-oom/env/windriver/onap-oom-light.env [new file with mode: 0644]
deployment/heat/onap-oom/env/windriver/onap-oom.env
deployment/heat/onap-oom/onap-oom.yaml
deployment/heat/onap-oom/rancher_vm_entrypoint.sh
test/csit/plans/appc/healthcheck/health_check.sh
test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh [new file with mode: 0644]
test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh [new file with mode: 0644]
test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt [new file with mode: 0644]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml
test/csit/plans/policy/apex-pdp/setup.sh [new file with mode: 0644]
test/csit/plans/policy/apex-pdp/teardown.sh [new file with mode: 0644]
test/csit/plans/policy/apex-pdp/testplan.txt [new file with mode: 0644]
test/csit/scripts/dcae-bulkpm/xNFSimulator.sh [new file with mode: 0644]
test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap
test/csit/scripts/optf-has/has/has_script.sh
test/csit/scripts/optf-has/has/music_script.sh
test/csit/scripts/policy/script1.sh
test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot
test/csit/tests/appc/cdt/cdt.robot
test/csit/tests/appc/cdt/data/pd_Configure_vUSP - Revenue Assurance_0.0.1V.yaml
test/csit/tests/appc/cdt/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json
test/csit/tests/appc/cdt/data/reference_AllAction_vUSP - Revenue Assurance_0.0.1V.json
test/csit/tests/appc/healthcheck/LCM_HEALTHCHECK_TIMESTAMP.robot
test/csit/tests/appc/healthcheck/LCM_VM_RESTART_TIMESTAMP.robot
test/csit/tests/appc/healthcheck/LCM_VNF_RESTART_TIMESTAMP.robot
test/csit/tests/common.robot
test/csit/tests/dcae-bulkpm/testcases/__init__.robot [new file with mode: 0644]
test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json [new file with mode: 0644]
test/csit/tests/dcae-bulkpm/testcases/e2e.robot [new file with mode: 0644]
test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py [new file with mode: 0644]
test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
test/csit/tests/dcaegen2/testcases/dcae_ves.robot
test/csit/tests/dcaegen2/testcases/resources/DMaaP.py
test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py
test/csit/tests/dcaegen2/testcases/resources/DcaeVariables.py
test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot
test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot
test/csit/tests/optf-has/has/data/plan_with_hpa.json
test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_mandatory.json
test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_optionals.json
test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json [new file with mode: 0644]
test/csit/tests/optf-has/has/data/plan_with_hpa_simple.json
test/csit/tests/optf-has/has/data/plan_with_hpa_unmatched.json
test/csit/tests/optf-has/has/optf_has_test.robot
test/csit/tests/policy/apex-pdp/apex-pdp-test.robot [new file with mode: 0644]
test/csit/tests/policy/apex-pdp/data/event.json [new file with mode: 0644]
test/csit/tests/policy/suite1/global_properties.robot
test/csit/tests/sdnc/healthcheck/test1.robot
test/csit/tests/vid/resources/docker-compose.yml
test/ete/scripts/teardown-onap.sh
test/mocks/pnfsimulator/README.md
test/mocks/pnfsimulator/config/config.json
test/mocks/pnfsimulator/docker-compose.yml
test/mocks/pnfsimulator/ftpes/tls/pure-ftpd.pem [new file with mode: 0755]
test/mocks/pnfsimulator/ftpes/userpass/pureftpd.passwd [new file with mode: 0755]
test/mocks/pnfsimulator/json_schema/input_validator.json
test/mocks/pnfsimulator/pom.xml
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json [new file with mode: 0644]
test/mocks/sniroemulator/pom.xml
version-manifest/pom.xml
version-manifest/src/main/resources/docker-manifest-staging.csv
version-manifest/src/main/resources/docker-manifest.csv
version-manifest/src/main/resources/java-manifest.csv

index 79dda59..ed4dc10 100644 (file)
         "typeHandlerVersion": "2.0",
         "autoUpgradeMinorVersion": true,
         "settings": {
-            "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-rancher-server.sh;hb=refs/heads/master" ],
+            "fileUris": [ "https://git.onap.org/integration/plain/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh" ],
             "commandToExecute": "[concat('./' , parameters('masterScriptName'),' ',reference(variables('publicIPAddressName')).dnsSettings.fqdn,' ',parameters('privateIPAddress'),' ',parameters('numberOfVms'))]"
            }
         }
         "typeHandlerVersion": "2.0",
         "autoUpgradeMinorVersion": true,
         "settings": {
-            "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-k8s-node.sh;hb=refs/heads/master" ],
+            "fileUris": [ "https://git.onap.org/integration/plain/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh" ],
             "commandToExecute": "[concat('./' , parameters('nodeScriptName'),' ',concat(parameters('privateIPAddress'),'0'))]"
            }
         }
index 1c4373c..fc92c29 100644 (file)
@@ -3,7 +3,7 @@
 set -x
 
 DOCKER_VERSION=17.03
-RANCHER_VERSION=1.6.14
+RANCHER_VERSION=1.6.18
 KUBECTL_VERSION=1.8.10
 HELM_VERSION=2.9.1
 
index cca6c0f..dacb243 100644 (file)
@@ -20,7 +20,7 @@ parameters:
     robot:
       openStackKeyStoneUrl: "http://192.168.1.11:5000"
       openStackPublicNetId: "__public_net_id__"
-      openStackPassword: "${OS_PASSWORD}"
+      openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
       openStackTenantId: "${OS_PROJECT_ID}"
       openStackUserName: "${OS_USERNAME}"
       ubuntu14Image: "trusty"
index 96cf469..4991ab9 100644 (file)
@@ -20,7 +20,7 @@ parameters:
     robot:
       openStackKeyStoneUrl: "http://10.145.122.118:5000"
       openStackPublicNetId: "__public_net_id__"
-      openStackPassword: "${OS_PASSWORD}"
+      openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
       openStackTenantId: "${OS_PROJECT_ID}"
       openStackUserName: "${OS_USERNAME}"
       ubuntu14Image: "trusty"
index fa7cab7..ec3399b 100644 (file)
@@ -19,7 +19,7 @@ parameters:
     robot:
       openStackKeyStoneUrl: "https://bdc1tlab01.research.att.com:5000"
       openStackPublicNetId: "__oam_network_id__" # NOTE: for TLAB, openStackPublicNetId needs to be oam_network_id instead of public_net_id
-      openStackPassword: "${OS_PASSWORD}"
+      openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
       openStackTenantId: "${OS_PROJECT_ID}"
       openStackUserName: "${OS_USERNAME}"
       ubuntu14Image: "Ubuntu 14.04 LTS Generic"
diff --git a/deployment/heat/onap-oom/env/windriver/onap-oom-light.env b/deployment/heat/onap-oom/env/windriver/onap-oom-light.env
new file mode 100644 (file)
index 0000000..75c4f05
--- /dev/null
@@ -0,0 +1,81 @@
+parameters:
+
+  ubuntu_1604_image: ubuntu-16-04-cloud-amd64
+
+  apt_proxy: 10.12.5.2:3142
+  docker_proxy: 10.12.5.2:5000
+
+  rancher_vm_flavor: m1.large
+  # use a smaller image for k8 hosts
+  k8s_vm_flavor: m1.xlarge
+
+  public_net_id: 971040b2-7059-49dc-b220-4fab50cb2ad4
+
+  oam_network_cidr: 10.0.0.0/16
+
+  integration_override_yaml: >
+    global:
+      repository: __docker_proxy__
+      pullPolicy: IfNotPresent
+    robot:
+      openStackKeyStoneUrl: "http://10.12.25.2:5000"
+      openStackPublicNetId: "__public_net_id__"
+      openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+      openStackTenantId: "${OS_PROJECT_ID}"
+      openStackUserName: "${OS_USERNAME}"
+      ubuntu14Image: "ubuntu-14-04-cloud-amd64"
+      ubuntu16Image: "ubuntu-16-04-cloud-amd64"
+      openStackPrivateNetId: "__oam_network_id__"
+      openStackPrivateSubnetId: "__oam_subnet_id__"
+      openStackPrivateNetCidr: "__oam_network_cidr__"
+      openStackOamNetworkCidrPrefix: "10.0"
+      dcaeCollectorIp: "__k8s_1_vm_ip__"
+      vnfPubKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh"
+      demoArtifactsVersion: "1.2.2"
+      scriptVersion: "1.2.1"
+      rancherIpAddress: "__rancher_ip_addr__"
+    so:
+      config:
+        openStackUserName: "${OS_USERNAME}"
+        openStackKeyStoneUrl: "http://10.12.25.2:5000"
+        openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+    appc:
+      replicaCount: 1
+      config:
+        enableClustering: false
+    sdnc:
+      replicaCount: 1
+      config:
+        enableClustering: false
+    clamp:
+      enabled: false
+    pomba:
+      enabled: false
+    cli:
+      enabled: false
+    consul:
+      enabled: false
+    dcaegen2:
+      enabled: false
+    esr:
+      enabled: false
+    log:
+      enabled: false
+    mock:
+      enabled: false
+    msb:
+      enabled: false
+    multicloud:
+      enabled: false
+    nbi:
+      enabled: false
+    oof:
+      enabled: false
+    policy:
+      enabled: false
+    uui:
+      enabled: false
+    vfc:
+      enabled: false
+    vnfsdk:
+      enabled: false
index c9cc2ba..48cc977 100644 (file)
@@ -19,7 +19,7 @@ parameters:
     robot:
       openStackKeyStoneUrl: "http://10.12.25.2:5000"
       openStackPublicNetId: "__public_net_id__"
-      openStackPassword: "${OS_PASSWORD}"
+      openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
       openStackTenantId: "${OS_PROJECT_ID}"
       openStackUserName: "${OS_USERNAME}"
       ubuntu14Image: "ubuntu-14-04-cloud-amd64"
index e8b0ffa..9b9495a 100644 (file)
@@ -205,6 +205,7 @@ resources:
               get_attr: [k8s_3_floating_ip, floating_ip_address],
               get_attr: [k8s_4_floating_ip, floating_ip_address],
               get_attr: [k8s_5_floating_ip, floating_ip_address],
+              get_attr: [k8s_6_floating_ip, floating_ip_address],
             ]
             __k8s_private_ips__: [
               get_attr: [k8s_1_floating_ip, fixed_ip_address],
@@ -212,6 +213,7 @@ resources:
               get_attr: [k8s_3_floating_ip, fixed_ip_address],
               get_attr: [k8s_4_floating_ip, fixed_ip_address],
               get_attr: [k8s_5_floating_ip, fixed_ip_address],
+              get_attr: [k8s_6_floating_ip, fixed_ip_address],
             ]
   k8s_1_private_port:
     type: OS::Neutron::Port
@@ -393,6 +395,42 @@ resources:
           template:
             get_file: k8s_vm_entrypoint.sh
 
+  k8s_6_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_6_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_6_private_port }
+
+  k8s_6_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_6']]
+      image: { get_param: ubuntu_1604_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_6_private_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __docker_proxy__: { get_param: docker_proxy }
+            __apt_proxy__: { get_param: apt_proxy }
+            __docker_version__: { get_param: docker_version }
+            __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+            __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+          template:
+            get_file: k8s_vm_entrypoint.sh
+
 outputs:
   rancher_vm_ip:
     description: The IP address of the rancher instance
@@ -418,3 +456,7 @@ outputs:
     description: The IP address of the k8s_5 instance
     value: { get_attr: [k8s_5_floating_ip, floating_ip_address] }
 
+  k8s_6_vm_ip:
+    description: The IP address of the k8s_6 instance
+    value: { get_attr: [k8s_6_floating_ip, floating_ip_address] }
+
index 6066396..0a636e2 100644 (file)
@@ -250,8 +250,10 @@ sleep 3
 helm repo add local http://127.0.0.1:8879
 helm repo list
 make all
+rsync -avt ~/oom/kubernetes/helm/plugins ~/.helm/
 helm search -l | grep local
-helm install local/onap -n dev --namespace onap -f ~/integration-override.yaml
+helm deploy dev local/onap -f ~/integration-override.yaml --namespace onap | tee ~/helm-deploy.log
+helm list
 
 # Enable auto-completion for kubectl
 echo "source <(kubectl completion bash)" >> ~/.bashrc
index e4cfae8..775188f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 ###############################################################################
-# Copyright 2017 Huawei Technologies Co., Ltd.
+# Copyright 2018 AT&T
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
 SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 echo $SCRIPTS
 
-response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46YWRtaW4=" -X POST -H "X-FromAppId: csit-appc" -H "X-TransactionId: csit-appc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck )
+response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-appc" -H "X-TransactionId: csit-appc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck )
 
 if [ "$response" == "200" ]; then
     echo "APPC health check passed."
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
new file mode 100644 (file)
index 0000000..6df4b2f
--- /dev/null
@@ -0,0 +1,122 @@
+#!/bin/bash
+# Place the scripts in run order:
+#Make sure python-uuid is installed
+
+# Place the scripts in run order:
+source ${SCRIPTS}/dcae-bulkpm/xNFSimulator.sh
+
+# Place the scripts in run order:
+source ${SCRIPTS}/common_functions.sh
+
+# Clone DMaaP Data Router repo
+mkdir -p $WORKSPACE/archives/dmaapdr
+cd $WORKSPACE/archives/dmaapdr
+
+git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
+cd datarouter
+git pull
+cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+
+# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
+docker login -u docker -p docker nexus3.onap.org:10001
+docker-compose up -d
+
+# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
+for i in {1..50}; do
+    if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
+        [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
+        [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
+    then
+        echo "DR Service Running"
+        break
+    else
+        echo sleep $i
+        sleep $i
+    fi
+done
+
+DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
+DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
+DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
+
+#Add the DR_NODE_IP to /etc/hosts
+sudo echo "${DR_NODE_IP} dmaap-dr-node" >> /etc/hosts
+sudo echo "${DR_PROV_IP} dmaap-dr-prov" >> /etc/hosts
+
+echo DR_PROV_IP=${DR_PROV_IP}
+echo DR_NODE_IP=${DR_NODE_IP}
+echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
+
+docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP"
+docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP"
+
+# Start DCAE VES Collector
+cd $WORKSPACE/
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1
+echo VESC_IMAGE=${VESC_IMAGE}
+
+docker run -d  --name vesc -e DMAAPHOST=${HOST_IP} ${VESC_IMAGE}
+VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vesc)
+
+# Clone DMaaP Message Router repo
+mkdir -p $WORKSPACE/archives/dmaapmr
+cd $WORKSPACE/archives/dmaapmr
+git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
+git pull
+cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
+cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/
+
+# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
+docker login -u docker -p docker nexus3.onap.org:10001
+docker-compose up -d
+
+ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1")
+KAFKA=$(docker ps -a -q --filter="name=kafka_1")
+DMAAP=$(docker ps -a -q --filter="name=dmaap_1")
+
+# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
+for i in {1..50}; do
+if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ]
+then
+   echo "DMaaP Service Running"
+   break
+else
+   echo sleep $i
+   sleep $i
+fi
+done
+
+# Get IP address of DMAAP, KAFKA, Zookeeper
+DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
+KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
+ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER)
+
+echo DMAAP_MR_IP=${DMAAP_MR_IP}
+echo KAFKA_IP=${KAFKA_IP}
+echo ZOOKEEPER_IP=${ZOOKEEPER_IP}
+
+# Shutdown DMAAP Container
+docker kill $DMAAP
+
+# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
+sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
+sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties
+
+# Start DMaaP MR containers with docker compose and configuration from docker-compose.yml
+docker-compose build
+docker login -u docker -p docker nexus3.onap.org:10001
+docker-compose up -d
+sleep 5
+
+export VESC_IP=${VESC_IP}
+export HOST_IP=${HOST_IP}
+export DMAAP_MR_IP=${DMAAP_MR_IP}
+#Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}"
+
+pip install jsonschema uuid
+# Wait container ready
+sleep 2
\ No newline at end of file
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
new file mode 100644 (file)
index 0000000..1eb9a4a
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+echo "Starting teardown script"
+kill-instance.sh vesc
+cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
+docker-compose down -v
+cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+docker-compose down -v
+sudo sed -i '/dmaap/d' /etc/hosts
\ No newline at end of file
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt b/test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt
new file mode 100644 (file)
index 0000000..25a5d6e
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+dcae-bulkpm/testcases
index 66cbde2..1673715 100644 (file)
@@ -60,6 +60,25 @@ services:
     networks:
       - ves-hv-default
 
+  unencrypted-ves-hv-collector:
+    image: $DOCKER_REGISTRY/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest
+    ports:
+      - "7060:6060"
+      - "7061:6061/tcp"
+    entrypoint: ["java", "-Dio.netty.leakDetection.level=paranoid", "-cp", "*:", "org.onap.dcae.collectors.veshv.main.MainKt"]
+    command: ["--listen-port", "6061","--config-url", "http://consul:8500/v1/kv/veshv-config", "--ssl-disable"]
+    healthcheck:
+      interval: 10s
+      timeout: 5s
+      retries: 2
+      test: "curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061"
+    depends_on:
+      - kafka
+    volumes:
+      - ./ssl/:/etc/ves-hv/
+    networks:
+      - ves-hv-default
+
   dcae-app-simulator:
     image: $DOCKER_REGISTRY/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-dcae-app-simulator:latest
     ports:
diff --git a/test/csit/plans/policy/apex-pdp/setup.sh b/test/csit/plans/policy/apex-pdp/setup.sh
new file mode 100644 (file)
index 0000000..7ab5b9e
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2018 Ericsson. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+docker run -d --name apex -p 12561:12561 -p 23324:23324 -it nexus3.onap.org:10001/onap/policy-apex-pdp:2.0-SNAPSHOT-latest /bin/bash -c "/opt/app/policy/apex-pdp/bin/apexEngine.sh -c /opt/app/policy/apex-pdp/examples/config/SampleDomain/RESTServerJsonEvent.json"
+
+APEX_IP=`get-instance-ip.sh apex`
+echo APEX IP IS ${APEX_IP}
+Wait for initialization
+for i in {1..10}; do
+   curl -sS ${APEX_IP}:23324 && break
+   echo sleep $i
+   sleep $i
+done
+
+ROBOT_VARIABLES="-v APEX_IP:${APEX_IP}"
diff --git a/test/csit/plans/policy/apex-pdp/teardown.sh b/test/csit/plans/policy/apex-pdp/teardown.sh
new file mode 100644 (file)
index 0000000..ca8e92e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2018 Ericsson. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+kill-instance.sh apex
diff --git a/test/csit/plans/policy/apex-pdp/testplan.txt b/test/csit/plans/policy/apex-pdp/testplan.txt
new file mode 100644 (file)
index 0000000..cee9abd
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+policy/apex-pdp/apex-pdp-test.robot
diff --git a/test/csit/scripts/dcae-bulkpm/xNFSimulator.sh b/test/csit/scripts/dcae-bulkpm/xNFSimulator.sh
new file mode 100644 (file)
index 0000000..1728ef7
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+#This scritt will simulate xNF ftpes functionality.
+#This script will automatic install vsftpd and it will make necessary changes to vsftpd.conf
+sudo apt-get install vsftpd -y
+sudo useradd -m -u 12345 -g users -d /home/ftpuser -s /bin/bash -p "$(echo ftpuser | openssl passwd -1 -stdin)" ftpuser
+sudo chown root:root /home/ftpuser
+sudo mkdir -p /tmp/ftp/rop
+sudo chown nobody:nogroup /tmp/ftp/rop
+sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -subj "/C=IE/ST=ftp/L=Springfield/O=Dis/CN=www.onap.org"
+sudo sed -i -e '/anonymous_enable=/ s/=.*/=NO/' /etc/vsftpd.conf
+sudo sed -i -e '/local_enable=/ s/=.*/=NO/' /etc/vsftpd.conf
+sudo sed -i -e '/write_enable=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/#write_enable=/ s/#write_enable=.*/write_enable=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/chroot_local_user=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e '0,/#chroot_local_user=/ s/#chroot_local_user=.*/chroot_local_user=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/ssl_enable=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e "/ssl_enable=YES/a\\allow_anon_ssl=YES" /etc/vsftpd.conf
+sudo sed -i -e "/allow_anon_ssl=NO/a\\force_local_data_ssl=NO" /etc/vsftpd.conf
+sudo sed -i -e "/force_local_data_ssl=NO/a\\force_local_logins_ssl=NO" /etc/vsftpd.conf
+sudo sed -i -e "/force_local_logins_ssl=NO/a\\ssl_tlsv1=YES" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_tlsv1=YES/a\\ssl_sslv2=NO" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_sslv2=NO/a\\ssl_sslv3=NO" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_sslv3=NO/a\\require_ssl_reuse=NO" /etc/vsftpd.conf
+sudo sed -i -e "/require_ssl_reuse=NO/a\\ssl_ciphers=HIGH" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\hide_ids=YES" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\anon_root=/var/ftp/" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\no_anon_password=YES" /etc/vsftpd.conf
+sudo service vsftpd restart
\ No newline at end of file
index 1f64426..2c5b8d6 100644 (file)
@@ -252,7 +252,7 @@ music_new_version = True
 # Base URL for Music REST API without a trailing slash. (string value)
 server_url = http://localhost:8080/MUSIC/rest/v2
 version = v2
-music_version = "3.0.3"
+music_version = "2.5.3"
 aafuser = conductor
 aafpass = c0nduct0r
 aafns = conductor
index 08bf0bc..2d2eff3 100755 (executable)
@@ -31,6 +31,7 @@ cd ${DIR}
 COND_CONF=/tmp/conductor/properties/conductor.conf
 LOG_CONF=/tmp/conductor/properties/log.conf
 IMAGE_NAME=nexus3.onap.org:10001/onap/optf-has
+IMAGE_VER=1.2.1-SNAPSHOT-latest
 CERT=/tmp/conductor/properties/cert.cer
 KEY=/tmp/conductor/properties/cert.key
 BUNDLE=/tmp/conductor/properties/cert.pem
@@ -69,16 +70,16 @@ curl -vvvvv --noproxy "*" --request GET http://${MUSIC_IP}:8080/MUSIC/rest/v2/ve
 echo "Onboard conductor into music"
 curl -vvvvv --noproxy "*" --request POST http://${MUSIC_IP}:8080/MUSIC/rest/v2/admin/onboardAppWithMusic -H "Content-Type: application/json" --data @${WORKSPACE}/test/csit/tests/optf-has/has/data/onboard.json
 
-docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
-sleep 2
-docker run -d --name cond-api -p "8091:8091" -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
-sleep 2
-docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
-sleep 2
-docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
-sleep 2
-docker run -d --name cond-data -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf -v ${CERT}:/usr/local/bin/cert.cer -v ${KEY}:/usr/local/bin/cert.key -v ${BUNDLE}:/usr/local/bin/cert.pem ${IMAGE_NAME}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
-sleep 2
+docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
+sleep 20
+docker run -d --name cond-api -p "8091:8091" -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
+sleep 20
+docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
+sleep 20
+docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
+sleep 20
+docker run -d --name cond-data -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf -v ${CERT}:/usr/local/bin/cert.cer -v ${KEY}:/usr/local/bin/cert.key -v ${BUNDLE}:/usr/local/bin/cert.pem ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
+sleep 20
 
 COND_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' cond-api`
 ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${COND_IP} 8091
index 1e978c2..7693d7b 100755 (executable)
@@ -27,7 +27,7 @@ echo "# music configuration step";
 CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest
 TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0
 ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
-MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
+MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:2.5.3
 WORK_DIR=/tmp/music
 CASS_USERNAME=nelson24
 CASS_PASSWORD=winman123
@@ -51,10 +51,10 @@ docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001"
 CASSA_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-db`
 echo "CASSANDRA_IP=${CASSA_IP}"
 ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042
-sleep 60
+sleep 150
 # Start Music war
 docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG};
-sleep 15
+sleep 30
 # Start Zookeeper
 docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG};
 #ZOO_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-zk`
@@ -62,7 +62,7 @@ ZOO_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music
 echo "ZOOKEEPER_IP=${ZOO_IP}"
 
 # Delay  between Cassandra/Zookeeper and Tomcat
-sleep 60;
+sleep 120
 
 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
 docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG};
@@ -80,7 +80,7 @@ echo "TOMCAT_IP=${TOMCAT_IP}"
 ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${TOMCAT_IP} 8080
 
 # wait a while to make sure music is totally up and configured
-sleep 60
+sleep 90
 
 echo "inspect docker things for tracing purpose"
 docker inspect music-db
index 7bb9731..12509ed 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright 2017-2018 AT&T Intellectual Property. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -147,7 +147,7 @@ TIME_OUT=600
 INTERVAL=20 
 TIME=0 
 while [ "$TIME" -lt "$TIME_OUT" ]; do 
-    curl -i --user healthcheck:zb!XztG34 -H "ContentType: application/json" -H "Accept: application/json" ${POLICY_IP}:6969/healthcheck && break
+    curl -k -i --user healthcheck:zb!XztG34 -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:6969/healthcheck && break
        
   echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds 
   sleep $INTERVAL 
index dae48a9..78e3522 100644 (file)
@@ -7,7 +7,7 @@ Library       json
 ${MESSAGE}    {"ping": "ok"}
 
 #global variables
-${generatedAID}
+
 
 *** Test Cases ***
 SMS Check SMS API Docker Container
index 03ba3a4..b33bfe7 100644 (file)
 | | Click Link | MY VNFs
 # Verify button element is ready before clicking it.
 | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME}
-| | Click Button | Create New VNF Type or VNFC Type
-| | Page Should Contain | Enter VNF type and VNFC to proceed
+#| | Click Button | Create New VNF Type or VNFC Type
+| | Click Button | Create New VNF Type
+#| | Page Should Contain | Enter VNF type and VNFC to proceed
+| | Page Should Contain | Enter VNF Type
 | | Page Should Contain Element | id=vnfType
 # Proceed without entering any new information
-| | Click Button | Proceed anyway
+#| | Click Button | Proceed anyway
+| | Click Button | Proceed To Upload
 | | Page Should Contain Element | id=cmbAction
 | | Click Button | Upload Reference File
 | | Choose File | id=inputFile |  ${CURDIR}/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json
 | | Click Link | MY VNFs
 # Verify button element is ready before clicking it.
 | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME}
-| | Click Button | Create New VNF Type or VNFC Type
-| | Page Should Contain | Enter VNF type and VNFC to proceed
+#| | Click Button | Create New VNF Type or VNFC Type
+| | Click Button | Create New VNF Type
+#| | Page Should Contain | Enter VNF type and VNFC to proceed
+| | Page Should Contain | Enter VNF Type
 | | Page Should Contain Element | id=vnfType
 # Create a date to use in VNF Type to make it unique
 | | ${THEDATE}  | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True
@@ -93,7 +98,8 @@
 | | Click Link | MY VNFs
 # Verify button element is ready before clicking it.
 | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME}
-| | Click Button | Create New VNF Type or VNFC Type
+#| | Click Button | Create New VNF Type or VNFC Type
+| | Click Button | Create New VNF Type
 | | Wait Until Page Contains Element | id=vnfType | ${LONGTIME}
 # Create a date to use in VNF Type to make it unique
 | | ${THEDATE}  | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True
 | | Click Link | MY VNFs
 # Verify button element is ready before clicking it.
 | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME}
-| | Click Button | Create New VNF Type or VNFC Type
+#| | Click Button | Create New VNF Type or VNFC Type
+| | Click Button | Create New VNF Type
 | | Wait Until Page Contains Element | id=vnfType | ${LONGTIME}
 # Create a date to use in VNF Type to make it unique
 | | ${THEDATE}  | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True
 | | Input Text | id=vnfType | csit${THEDATE}
 # Check the box indicating VNFC templates
 | | Select Checkbox | id=vnfcRequired
-| | Input Text | id=vnfcType | csitVNFC
+#| | Input Text | id=vnfcType | csitVNFC
 | | Click Button | Next
 | | Wait Until Page Contains Element | id=cmbAction | ${LONGTIME}
 # Populate the action and protocol
index cea00f0..ced4a7c 100755 (executable)
@@ -4,7 +4,7 @@ version: V1
 vnf-parameter-list:
 - name: vnf_name
   type: null
-  description: dawnDescript
+  description: CSIT
   required: null
   default: null
   source: Manual
index 90fd0ac..4167806 100755 (executable)
@@ -5,7 +5,7 @@
                        "action-level": "vnf",
                        "scope": {
                                "vnf-type": "csit",
-                               "vnfc-type-list": [],
+                               "vnfc-type-list": ["testvnftype"],
                                "vnfc-type": ""
                        },
                        "template": "Y",
                        "port-number": "",
                        "artifact-list": [
                                {
-                                       "artifact-name": "template_HealthCheck_dawnMay17_0.0.1V.json",
+                                       "artifact-name": "template_HealthCheck_csit_0.0.1V.json",
                                        "artifact-type": "config_template"
                                },
                                {
-                                       "artifact-name": "pd_HealthCheck_dawnMay17_0.0.1V.yaml",
+                                       "artifact-name": "pd_HealthCheck_csit_0.0.1V.yaml",
                                        "artifact-type": "parameter_definitions"
                                },
                                {
-                                       "artifact-name": "param_HealthCheck_dawnMay17_0.0.1V.json",
+                                       "artifact-name": "param_HealthCheck_csit_0.0.1V.json",
                                        "artifact-type": "param_values"
                                }
                        ],
                        "action-level": "vnf",
                        "scope": {
                                "vnf-type": "csit",
-                               "vnfc-type-list": [],
+                               "vnfc-type-list": ["testvnftype"],
                                "vnfc-type": ""
                        },
                        "artifact-list": [
                                {
-                                       "artifact-name": "reference_AllAction_dawnMay17_0.0.1V.json",
+                                       "artifact-name": "reference_AllAction_csit_0.0.1V.json",
                                        "artifact-type": "reference_template"
                                }
                        ]
index f78debe..a575129 100755 (executable)
@@ -5,6 +5,7 @@
                        "action-level": "vnf",
                        "scope": {
                                "vnf-type": "vUSP - Revenue Assurance",
+                               "vnf-type-list": "testvnftype",
                                "vnfc-type": ""
                        },
                        "template": "Y",
@@ -61,7 +62,7 @@
                        "scope": {
                                "vnf-type": "vUSP - Revenue Assurance",
                                "vnfc-type": "",
-                               "vnfc-type-list": []
+                               "vnfc-type-list": ["testvnftype"]
                        },
                        "template": "Y",
                        "vm": [],
@@ -86,7 +87,7 @@
                        "scope": {
                                "vnf-type": "vUSP - Revenue Assurance",
                                "vnfc-type": "",
-                               "vnfc-type-list": []
+                               "vnfc-type-list": ["testvnftype"]
                        },
                        "template": "Y",
                        "vm": [],
                        "scope": {
                                "vnf-type": "vUSP - Revenue Assurance",
                                "vnfc-type": "",
-                               "vnfc-type-list": []
+                               "vnfc-type-list": ["testvnftype"]
                        },
                        "artifact-list": [
                                {
                        ]
                }
        ]
-}
\ No newline at end of file
+}
index cfba50b..1cea75e 100644 (file)
@@ -14,8 +14,8 @@ ${var}
 APPC LCM API HEALTHCHECK
        [Documentation] APPC LCM API HEALTHCHECK 
        Start Virtual Display     1920     1080
-       Open Browser    http://admin:admin@localhost:8282/apidoc/explorer/index.html    chrome
-       Maximize Browser Window 
+       Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html      chrome
+#      Maximize Browser Window 
 #      Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
 
        Reload Page
index 98a8e58..7968d55 100644 (file)
@@ -13,8 +13,8 @@ ${var}
 APPC LCM API VM RESTART
        [Documentation] APPC LCM API VM RESTART 
        Start Virtual Display     1920     1080
-       Open Browser    http://admin:admin@localhost:8282/apidoc/explorer/index.html    chrome
-       Maximize Browser Window
+       Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html    chrome
+#      Maximize Browser Window
 #      Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
        
        Reload Page
index 0f550d3..93c72d7 100644 (file)
@@ -16,8 +16,8 @@ ${var}
 APPC LCM API VNF RESTART
        [Documentation] APPC LCM API VNF RESTART 
        Start Virtual Display     1920     1080
-       Open Browser    http://admin:admin@localhost:8282/apidoc/explorer/index.html    chrome
-       Maximize Browser Window
+       Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html    chrome
+#      Maximize Browser Window
 #      Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
        
        Reload Page
index 944be6b..8af66a5 100644 (file)
@@ -1,22 +1,29 @@
 #Robot functions that will be shared also with other tests
+*** Settings ***
+Library     OperatingSystem
 
 *** Keywords ***
 json_from_file
 #Robot function to extract the json object from a file
     [Arguments]    ${file_path}
-    ${json_file}=    Get file    ${file_path}
+    ${json_file}=    Get File    ${file_path}
     ${json_object}=    Evaluate    json.loads('''${json_file}''')    json
-    [return]    ${json_object}
+    [Return]    ${json_object}
 
 string_from_json
 #Robot function to transform the json object to a string
     [Arguments]    ${json_value}
     ${json_string}=   Stringify Json     ${json_value}
-    [return]    ${json_string}
+    [Return]    ${json_string}
 
 random_ip
 #Robot function to generate a random IP
     [Arguments]
     ${numbers}=    Evaluate    random.sample([x for x in range(1, 256)], 4)    random
     ${generated_ip}=    Catenate    ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]}
-    [return]    ${generated_ip}
\ No newline at end of file
+    [Return]    ${generated_ip}
+
+Get Data From File
+    [Arguments]    ${file}
+    ${data}=    Get File    ${file}
+    [Return]    ${data}
diff --git a/test/csit/tests/dcae-bulkpm/testcases/__init__.robot b/test/csit/tests/dcae-bulkpm/testcases/__init__.robot
new file mode 100644 (file)
index 0000000..7114fd4
--- /dev/null
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation    5G Bulk PM E2E Testcases
diff --git a/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
new file mode 100644 (file)
index 0000000..96068e3
--- /dev/null
@@ -0,0 +1,30 @@
+{
+    "event": {
+        "commonEventHeader": {
+            "version": "4.0.1",
+            "vesEventListenerVersion": "7.0.1",
+            "domain": "notification",
+            "eventName": "Noti_RnNode-Ericsson_FileReady",
+            "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1",
+            "lastEpochMicrosec": 8745745764578,
+            "priority": "Normal",
+            "reportingEntityName": "otenb5309",
+            "sequence": 0,
+            "sourceName": "oteNB5309",
+            "startEpochMicrosec": 8745745764578,
+            "timeZoneOffset": "UTC+05.30"
+        },
+        "notificationFields": {
+            "changeIdentifier": "PM_MEAS_FILES",
+            "changeType": "FileReady",
+            "notificationFieldsVersion": "2.0",
+            "additionalFields": 
+              {
+                "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz",
+                "compression": "gzip",
+                "fileformatType": "org.3GPP.32.435#measCollec",
+                "fileFormatVersion": "V10"
+              }
+        }
+    }
+  }
\ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/e2e.robot b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
new file mode 100644 (file)
index 0000000..69c7953
--- /dev/null
@@ -0,0 +1,40 @@
+*** Settings ***
+Documentation    Testing E2E VES,Dmaap,DFC,DR with File Ready event feed from xNF
+Library           RequestsLibrary
+Library           OperatingSystem
+Library           Collections
+Resource          resources/ves_keywords.robot
+
+
+*** Variables ***
+${VESC_URL}                              http://%{VESC_IP}:8080
+${GLOBAL_APPLICATION_ID}                 robot-ves
+${VES_ANY_EVENT_PATH}                    /eventListener/v7
+${HEADER_STRING}                         content-type=application/json
+${EVENT_DATA_FILE}                       %{WORKSPACE}/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
+
+${TARGETURL_TOPICS}                      http://${DMAAP_MR_IP}:3904/topics
+${TARGETURL_SUBSCR}                      http://${DMAAP_MR_IP}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12?timeout=1000
+*** Test Cases ***
+
+Send VES File Ready Event to VES Collector
+    [Tags]    DCAE-VESC-R1
+    [Documentation]   Post single event and expect 200 Response
+    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
+    ${headers}=   Create Header From String    ${HEADER_STRING}
+    ${resp}=  Publish Event To VES Collector    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    Log    Receive HTTP Status code ${resp.status_code}
+    Should Be Equal As Strings         ${resp.status_code}     202
+
+Check VES Notification Topic is existing in Message Router
+    [Documentation]                 Get the count of the Topics
+    [Timeout]                       1 minute
+    Sleep                           10s
+    ${resp}=                        GetCall                         ${TARGETURL_TOPICS}
+    log                             ${TARGETURL_TOPICS}
+    log                             'JSON Response Code :'${resp}
+    ${topics}=                      Evaluate                        $resp.json().get('topics')
+    log                             ${topics}
+    ${ListLength}=                  Get Length                      ${topics}
+    log                             ${ListLength}
+    List Should Contain Value       ${topics}                       unauthenticated.VES_NOTIFICATION_OUTPUT
diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py b/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py
new file mode 100644 (file)
index 0000000..d1ec981
--- /dev/null
@@ -0,0 +1,25 @@
+'''
+Created on Aug 18, 2017
+
+@author: sw6830
+'''
+from robot.api import logger
+from Queue import Queue
+import uuid, time, json, threading,os, platform, subprocess,paramiko
+
+class VesLibrary(object):
+
+    def __init__(self):
+        pass
+
+    def create_header_from_string(self, dictStr):
+        logger.info("Enter create_header_from_string: dictStr")
+        return dict(u.split("=") for u in dictStr.split(","))
+
+    def Generate_UUID(self):
+        """generate a uuid"""
+        return uuid.uuid4()
+
+if __name__ == '__main__':
+    lib = VesLibrary()
+    time.sleep(100000)
\ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot b/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot
new file mode 100644 (file)
index 0000000..76bc33f
--- /dev/null
@@ -0,0 +1,39 @@
+ *** Settings ***
+Documentation     The main interface for interacting with VES. It handles low level stuff like managing the http request library and VES required fields
+Library              RequestsLibrary
+Library                  ../resources/VesLibrary.py 
+Library           OperatingSystem
+Library           Collections
+Library           requests
+Library           Collections
+Library           String
+
+*** Variables ***
+
+*** Keywords ***
+
+Get Event Data From File
+    [Arguments]    ${jsonfile}
+    ${data}=    OperatingSystem.Get File    ${jsonfile}
+    #Should Not Be_Equal    ${data}    None
+    [return]    ${data}
+
+Publish Event To VES Collector
+    [Documentation]    Send an event to VES Collector
+    [Arguments]     ${url}  ${evtpath}   ${httpheaders}    ${evtdata}
+    Log    Creating session ${url}
+    ${session}=    Create Session      dcaegen2-d1     ${url}
+    ${resp}=   Post Request    dcaegen2-d1     ${evtpath}     data=${evtdata}   headers=${httpheaders}
+    #Log    Received response from dcae ${resp.json()}
+    [return]   ${resp}
+PostCall
+    [Arguments]    ${url}              ${data}
+    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
+    ${resp}=       Evaluate    requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]       ${resp}
+
+GetCall
+    [Arguments]     ${url}
+    ${resp}=           Evaluate    requests.get('${url}')    requests
+    [Return]           ${resp}
+    
\ No newline at end of file
index 1b832f2..15c1c48 100644 (file)
@@ -11,21 +11,47 @@ Test Teardown     VES-HV Collector Test Shutdown
 Client Authorization Suite Setup
     Log   Started Suite: VES-HV Client Authorization
     ${XNF_PORTS_LIST}=    Create List    7000
-    Configure Invalid xNF Simulators On Ports    ${XNF_PORTS_LIST}
+    ${XNF_WITH_INVALID_CERTIFICATES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
+    ...                                               should_use_valid_certs=${false}
+    Set Suite Variable   ${XNF_WITH_INVALID_CERTIFICATES}
+    ${XNF_PORTS_LIST}=    Create List    7001
+    ${XNF_WITHOUT_SSL}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
+    ...                                               should_disable_ssl=${true}
+    Set Suite Variable   ${XNF_WITHOUT_SSL}
+    ${XNF_PORTS_LIST}=    Create List    7002
+    ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
+    ...                                                                                should_disable_ssl=${true}
+    ...                                                                                should_connect_to_unencrypted_hv_ves=${true}
+    Set Suite Variable   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}
     Log   Suite setup finished
 
-
 *** Test Cases ***
 Authorization
     [Documentation]   VES-HV Collector should not authorize XNF with invalid certificate and not route any message
     ...               to topics
 
-    ${SIMULATORS_LIST}=   Get Invalid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_VALID_MESSAGES_REQUEST}
+    Send Messages From xNF Simulators   ${XNF_WITH_INVALID_CERTIFICATES}   ${XNF_VALID_MESSAGES_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
+
+Unencrypted connection from client
+    [Documentation]   VES-HV Collector should not authorize XNF trying to connect through unencrypted connection
+
+    Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL}   ${XNF_VALID_MESSAGES_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
 
+Unencrypted connection on both ends
+    [Documentation]   When run without SSL turned on, VES-HV Collector should route all valid messages
+    ...               from xNF trying to connect through unencrypted connection
+
+    Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}   ${XNF_VALID_MESSAGES_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_5000}
+
 
 *** Variables ***
 ${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
@@ -33,3 +59,4 @@ ${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcae
 ${XNF_VALID_MESSAGES_REQUEST}                  ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json
 
 ${AMOUNT_0}                                    0
+${AMOUNT_5000}                                 5000
index 0d1d928..c0dcd81 100644 (file)
@@ -1,12 +1,19 @@
 import requests
 from robot.api import logger
 
+valid_status_codes = [
+    requests.codes.ok,
+    requests.codes.accepted
+]
+
+
 def session_without_env():
     session = requests.Session()
     session.trust_env = False
     return session
 
+
 def checkStatusCode(status_code, server_name):
-    if status_code != 200:
+    if status_code not in valid_status_codes:
         logger.error("Response status code from " + server_name + ": " + str(status_code))
-        raise (Exception(server_name + " returned status code " + status_code))
\ No newline at end of file
+        raise (Exception(server_name + " returned status code " + status_code))
index b2466d7..26d5a91 100644 (file)
@@ -1,4 +1,3 @@
-from VesHvContainersUtilsLibrary import copy_to_container
 import HttpRequests
 import os
 import docker
@@ -16,13 +15,22 @@ ONE_SECOND_IN_NANOS = 10 ** 9
 
 class XnfSimulatorLibrary:
 
-    def start_xnf_simulators(self, list_of_ports, valid_certs=True):
+    def start_xnf_simulators(self, list_of_ports,
+                             should_use_valid_certs=True,
+                             should_disable_ssl=False,
+                             should_connect_to_unencrypted_hv_ves=False):
         logger.info("Creating " + str(len(list_of_ports)) + " xNF Simulator containers")
         dockerClient = docker.from_env()
-        cert_name_prefix = "" if valid_certs else "invalid_"
+
         self.pullImageIfAbsent(dockerClient)
         logger.info("Using image: " + SIMULATOR_IMAGE_FULL_NAME)
-        simulators_addresses = self.create_simulators(dockerClient, list_of_ports, cert_name_prefix)
+
+        simulators_addresses = self.create_containers(dockerClient,
+                                                      list_of_ports,
+                                                      should_use_valid_certs,
+                                                      should_disable_ssl,
+                                                      should_connect_to_unencrypted_hv_ves)
+
         self.assert_containers_startup_was_successful(dockerClient)
         dockerClient.close()
         return simulators_addresses
@@ -35,34 +43,24 @@ class XnfSimulatorLibrary:
                                                                   "This can take a while.")
             dockerClient.images.pull(SIMULATOR_IMAGE_FULL_NAME)
 
-    def create_simulators(self, dockerClient, list_of_ports, cert_name_prefix):
+    def create_containers(self,
+                          dockerClient,
+                          list_of_ports,
+                          should_use_valid_certs,
+                          should_disable_ssl,
+                          should_connect_to_unencrypted_hv_ves):
         simulators_addresses = []
         for port in list_of_ports:
-            container = self.run_simulator(dockerClient, port,
-                                           collector_certs_lookup_dir + cert_name_prefix + "client.crt",
-                                           collector_certs_lookup_dir + cert_name_prefix + "client.key",
-                                           collector_certs_lookup_dir + cert_name_prefix + "trust.crt"
-                                           )
-
+            xnf = XnfSimulator(port, should_use_valid_certs, should_disable_ssl, should_connect_to_unencrypted_hv_ves)
+            container = self.run_simulator(dockerClient, xnf)
             logger.info("Started container: " + container.name + "  " + container.id)
-            simulators_addresses.append(container.name + ":" + port)
+            simulators_addresses.append(container.name + ":" + xnf.port)
         return simulators_addresses
 
-    def run_simulator(self, dockerClient, port, client_crt_path, client_key_path, client_trust_store):
-        xNF_startup_command = ["--listen-port", port,
-                               "--ves-host", "ves-hv-collector",
-                               "--ves-port", "6061",
-                               "--cert-file", client_crt_path,
-                               "--private-key-file", client_key_path,
-                               "--trust-cert-file", client_trust_store]
-        xNF_healthcheck_command = {
-            "interval": 5 * ONE_SECOND_IN_NANOS,
-            "timeout": 3 * ONE_SECOND_IN_NANOS,
-            "retries": 1,
-            "test": ["CMD", "curl", "--request", "GET",
-                     "--fail", "--silent", "--show-error",
-                     "localhost:" + port + "/healthcheck"]
-        }
+    def run_simulator(self, dockerClient, xnf):
+        xNF_startup_command = xnf.get_startup_command()
+        xNF_healthcheck_command = xnf.get_healthcheck_command()
+        port = xnf.port
         logger.info("Startup command: " + str(xNF_startup_command))
         logger.info("Healthcheck command: " + str(xNF_healthcheck_command))
         return dockerClient.containers.run(SIMULATOR_IMAGE_FULL_NAME,
@@ -72,7 +70,7 @@ class XnfSimulatorLibrary:
                                            network="ves-hv-default",
                                            ports={port + "/tcp": port},
                                            volumes=self.container_volumes(),
-                                           name="ves-hv-collector-xnf-simulator" + port)
+                                           name=xnf.container_name_prefix + port)
 
     def container_volumes(self):
         return {certificates_dir_path: {"bind": collector_certs_lookup_dir, "mode": 'rw'}}
@@ -121,6 +119,46 @@ class XnfSimulatorLibrary:
         HttpRequests.checkStatusCode(resp.status_code, XNF_SIMULATOR_NAME)
 
 
+class XnfSimulator:
+    container_name_prefix = "ves-hv-collector-xnf-simulator"
+
+    def __init__(self,
+                 port,
+                 should_use_valid_certs,
+                 should_disable_ssl,
+                 should_connect_to_unencrypted_hv_ves):
+        self.port = port
+        cert_name_prefix = "" if should_use_valid_certs else "invalid_"
+        certificates_path_with_file_prefix = collector_certs_lookup_dir + cert_name_prefix
+        self.cert_path = certificates_path_with_file_prefix + "client.crt"
+        self.key_path = certificates_path_with_file_prefix + "client.key"
+        self.trust_cert_path = certificates_path_with_file_prefix + "trust.crt"
+        self.disable_ssl = should_disable_ssl
+        self.hv_collector_host = "unencrypted-ves-hv-collector" \
+            if should_connect_to_unencrypted_hv_ves else "ves-hv-collector"
+
+    def get_startup_command(self):
+        startup_command = ["--listen-port", self.port,
+                           "--ves-host", self.hv_collector_host,
+                           "--ves-port", "6061",
+                           "--cert-file", self.cert_path,
+                           "--private-key-file", self.key_path,
+                           "--trust-cert-file", self.trust_cert_path]
+        if (self.disable_ssl):
+            startup_command.append("--ssl-disable")
+        return startup_command
+
+    def get_healthcheck_command(self):
+        return {
+            "interval": 5 * ONE_SECOND_IN_NANOS,
+            "timeout": 3 * ONE_SECOND_IN_NANOS,
+            "retries": 1,
+            "test": ["CMD", "curl", "--request", "GET",
+                     "--fail", "--silent", "--show-error",
+                     "localhost:" + self.port + "/healthcheck"]
+        }
+
+
 class ContainerException(Exception):
     def __init__(self, message):
         super(ContainerException, self).__init__(message)
index 6153afa..89208e4 100644 (file)
@@ -14,7 +14,7 @@ Test Teardown     VES-HV Collector Test Shutdown
 Message Routing Suite Setup
     Log   Started Suite: VES-HV Message Routing
     ${XNF_PORTS_LIST}=    Create List    7000
-    Configure Valid xNF Simulators On Ports    ${XNF_PORTS_LIST}
+    Configure xNF Simulators Using Valid Certificates On Ports    ${XNF_PORTS_LIST}
     Log   Suite setup finished
 
 *** Test Cases ***
@@ -22,8 +22,8 @@ Correct Messages Routing
     [Documentation]   VES-HV Collector should route all valid messages to topics specified in configuration
     ...               and do not change message payload generated in XNF simulator
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_FIXED_PAYLOAD_REQUEST}
+    ${XNF_SIMULATOR}=   Get xNF Simulators Using Valid Certificates
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_FIXED_PAYLOAD_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_25000}
@@ -33,8 +33,8 @@ Correct Messages Routing
 Too big payload message handling
     [Documentation]   VES-HV Collector should interrupt the stream when encountered message with too big payload
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_TOO_BIG_PAYLOAD_REQUEST}
+    ${XNF_SIMULATOR}=   Get xNF Simulators Using Valid Certificates
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_TOO_BIG_PAYLOAD_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...    Assert Dcae App Consumed Less Equal Than   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_25000}
@@ -43,8 +43,8 @@ Too big payload message handling
 Invalid wire frame message handling
     [Documentation]  VES-HV Collector should skip messages with invalid wire frame
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_INVALID_WIRE_FRAME_REQUEST}
+    ${XNF_SIMULATOR}=   Get xNF Simulators Using Valid Certificates
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_INVALID_WIRE_FRAME_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
@@ -54,8 +54,8 @@ Invalid wire frame message handling
 Invalid GPB data message handling
     [Documentation]   VES-HV Collector should skip messages with invalid GPB data
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_INVALID_GPB_DATA_REQUEST}
+    ${XNF_SIMULATOR}=   Get xNF Simulators Using Valid Certificates
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_INVALID_GPB_DATA_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}  ${AMOUNT_50000}
@@ -65,8 +65,8 @@ Invalid GPB data message handling
 Unsupported domain message handling
     [Documentation]   VES-HV Collector should skip messages with unsupported domain
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   1
-    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_UNSUPPORTED_DOMAIN_REQUEST}
+    ${XNF_SIMULATOR}=   Get xNF Simulators Using Valid Certificates
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_UNSUPPORTED_DOMAIN_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
     ...    Assert Dcae App Consumed  ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
index 862a2bc..9b1982a 100644 (file)
@@ -11,14 +11,14 @@ Test Teardown     VES-HV Collector Test Shutdown
 Multiple Clients Handling Suite Setup
     Log   Started Suite: VES-HV Multiple Clients Handling
     ${XNF_PORTS_LIST}=    Create List    7000   7001   7002
-    Configure Valid xNF Simulators On Ports    ${XNF_PORTS_LIST}
+    Configure xNF Simulators Using Valid Certificates On Ports    ${XNF_PORTS_LIST}
     Log   Suite setup finished
 
 *** Test Cases ***
 Handle Multiple Connections
     [Documentation]   VES-HV Collector should handle multiple incoming transmissions
 
-    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   3
+    ${SIMULATORS_LIST}=   Get xNF Simulators Using Valid Certificates   3
     Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_SMALLER_PAYLOAD_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
index bc03de2..58f5cbc 100644 (file)
@@ -4,30 +4,28 @@ Library       VesHvContainersUtilsLibrary
 Library       Collections
 
 *** Keywords ***
-Configure Valid xNF Simulators On Ports
+Configure xNF Simulators Using Valid Certificates On Ports
     [Arguments]    ${XNF_PORTS_LIST}
-    ${VALID_XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    ${true}
+    ${VALID_XNF_SIMULATORS_ADDRESSES}=   Configure xNF Simulators   ${XNF_PORTS_LIST}
     Set Suite Variable    ${VALID_XNF_SIMULATORS_ADDRESSES}
 
-
-Configure Invalid xNF Simulators On Ports
+Configure xNF Simulators
     [Arguments]    ${XNF_PORTS_LIST}
-    ${INVALID_XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    ${false}
-    Set Suite Variable    ${INVALID_XNF_SIMULATORS_ADDRESSES}
-
-
-Get Valid xNF Simulators
-    [Arguments]  ${AMOUNT}
+    ...            ${should_use_valid_certs}=${true}
+    ...            ${should_disable_ssl}=${false}
+    ...            ${should_connect_to_unencrypted_hv_ves}=${false}
+    ${XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators   ${XNF_PORTS_LIST}
+    ...                                                           ${should_use_valid_certs}
+    ...                                                           ${should_disable_ssl}
+    ...                                                           ${should_connect_to_unencrypted_hv_ves}
+    [Return]   ${XNF_SIMULATORS_ADDRESSES}
+
+Get xNF Simulators Using Valid Certificates
+    [Arguments]  ${AMOUNT}=1
     ${SIMULATORS}=   Get Slice From List   ${VALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
     [Return]   ${SIMULATORS}
 
 
-Get Invalid xNF Simulators
-    [Arguments]  ${AMOUNT}
-    ${SIMULATORS}=   Get Slice From List   ${INVALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
-    [Return]   ${SIMULATORS}
-
-
 Send Messages From xNF Simulators
     [Arguments]    ${XNF_HOSTS_LIST}   ${MESSAGE_FILEPATH}
     :FOR   ${HOST}   IN    @{XNF_HOSTS_LIST}
index c71793d..9aca401 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
-    "messagesAmount": 500000
+    "messagesAmount": 5000
   }
 ]
\ No newline at end of file
index fb53f50..642c7d5 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "FIXED_PAYLOAD",
     "messagesAmount": 25000
index fb53f50..642c7d5 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "FIXED_PAYLOAD",
     "messagesAmount": 25000
index 772b03b..f38e9aa 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 50000
index d9cb4c2..22d48c5 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
@@ -23,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -36,7 +37,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "INVALID_GPB_DATA",
     "messagesAmount": 100
@@ -44,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -57,7 +59,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
index 772b03b..f38e9aa 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 50000
index 88d4e32..a7d2219 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
@@ -23,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -36,7 +37,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "INVALID_WIRE_FRAME",
     "messagesAmount": 100
@@ -44,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -57,7 +59,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
index 9d34a7e..89f3e06 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "FIXED_PAYLOAD",
     "messagesAmount": 15000
index 625737e..60c81a8 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "FIXED_PAYLOAD",
     "messagesAmount": 5000
index b1c727a..54836bf 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
@@ -23,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -36,7 +37,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "TOO_BIG_PAYLOAD",
     "messagesAmount": 100
@@ -44,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -57,7 +59,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
index 772b03b..f38e9aa 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 50000
index e37e20d..b3aada5 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -15,7 +15,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
@@ -36,7 +37,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 100
@@ -44,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVRANMEAS",
+      "domain": "HVMEAS",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -57,7 +59,8 @@
       "reportingEntityId": "sample-reporting-entity-id",
       "reportingEntityName": "sample-reporting-entity-name",
       "sourceId": "sample-source-id",
-      "sourceName": "sample-source-name"
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "another-version"
     },
     "messageType": "VALID",
     "messagesAmount": 25000
index 3235a0c..b9e1a4b 100644 (file)
@@ -1,8 +1,8 @@
 {
-  "kafkaBootstrapServers": "kafka:9092",
-  "routing": [
+  "dmaap.kafkaBootstrapServers": "kafka:9092",
+  "collector.routing": [
     {
-      "fromDomain": 11,
+      "fromDomain": "HVMEAS",
       "toTopic": "test-hv-ran-meas"
     }
   ]
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
new file mode 100644 (file)
index 0000000..2ffe356
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"NOK6061ZW2"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.17.123.234",
+      "oamV6IpAddress":""
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
new file mode 100644 (file)
index 0000000..c4a0e72
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"ERI6061ZW3"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"",
+      "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
new file mode 100644 (file)
index 0000000..16963e1
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"NOK6061ZW1"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.16.123.234",
+      "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json
new file mode 100644 (file)
index 0000000..1e3afa9
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"NOK6061ZW4"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"",
+      "oamV6IpAddress":""
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json
new file mode 100644 (file)
index 0000000..126987f
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":""
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.18.123.234",
+      "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
new file mode 100644 (file)
index 0000000..de1f576
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":""
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"",
+      "oamV6IpAddress":""
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
new file mode 100644 (file)
index 0000000..4838f1b
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":""
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"",
+      "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
new file mode 100644 (file)
index 0000000..04ab7ce
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":""
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.17.163.234",
+      "oamV6IpAddress":""
+    }
+  }
+}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
new file mode 100644 (file)
index 0000000..c87e188
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"NOK6061ZW1"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.16.123.234",
+      "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334",
+    }
+  }
+}
index 5150a4b..23d8666 100644 (file)
@@ -1,17 +1,24 @@
 *** Settings ***
 Documentation     Integration tests for PRH.
 ...               PRH receive events from DMaaP and produce or not PNF_READY notification depends on required fields in received event.
-Suite Setup       Run keywords    Create header 
-...                               Create sessions
+Suite Setup       Run keywords    Create header    Create sessions
 Library           resources/PrhLibrary.py
 Resource          resources/prh_library.robot
+Resource          ../../common.robot
 
 *** Variables ***
 ${DMAAP_SIMULATOR_URL}    http://${DMAAP_SIMULATOR}
 ${AAI_SIMULATOR_URL}    http://${AAI_SIMULATOR}
 ${PRH_URL}        http://${PRH}
-${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW1"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.16.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
-${Not_json_format}    ""
+${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
+${EVENT_WITH_IPV4}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
+${EVENT_WITH_IPV6}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
+${EVENT_WITH_MISSING_IPV4_AND_IPV6}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json
+${EVENT_WITH_MISSING_SOURCENAME}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json
+${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
+${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
+${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
+${Not_json_format}    %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
 
 *** Test Cases ***
 Valid DMaaP event can be converted to PNF_READY notification
@@ -19,37 +26,40 @@ Valid DMaaP event can be converted to PNF_READY notification
     [Tags]    PRH    Valid event
     [Template]    Valid event processing
     ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
-    {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW2"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.123.234", "oamV6IpAddress":""}}}
-    {"event": {"commonEventHeader": {"sourceName":"ERI6061ZW3"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"}}}
+    ${EVENT_WITH_IPV4}
+    ${EVENT_WITH_IPV6}
 
 Invalid DMaaP event cannot be converted to PNF_READY notification
     [Documentation]    PRH get invalid event from DMaaP with missing required fields - PRH does not produce PNF_READY notification
     [Tags]    PRH    Invalid event
     [Template]    Invalid event processing
-    {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW4"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}}
-    {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.18.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"}}}
-    {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.163.234", "oamV6IpAddress":""}}}
-    {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"}}}
-    {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}}
+    ${EVENT_WITH_MISSING_IPV4_AND_IPV6}
+    ${EVENT_WITH_MISSING_SOURCENAME}
+    ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4}
+    ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6}
+    ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6}
 
 Get valid event from DMaaP and record in AAI does not exist
     [Documentation]    PRH get valid event from DMaaP with all required fields and in AAI record doesn't exist - PRH does not produce PNF_READY notification
     [Tags]    PRH    Missing AAI record
     [Timeout]    30s
+    ${data}=    Get Data From File    ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
     Set PNF name in AAI    wrong_aai_record
-    Set event in DMaaP    ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+    Set event in DMaaP    ${data}
     Wait Until Keyword Succeeds    100x    300ms    Check PRH log    java.io.IOException: Connection closed prematurely
 
 Event in DMaaP is not JSON format
     [Documentation]    PRH get not JSON format event from DMaaP - PRH does not produce PNF_READY notification
     [Tags]    PRH
-    Set event in DMaaP    ${Not_json_format}
+    ${data}=    Get Data From File    ${Not_json_format}
+    Set event in DMaaP    ${data}
     Wait Until Keyword Succeeds    100x    300ms    Check PRH log    |java.lang.IllegalStateException: Not a JSON Array:
 
 Get valid event from DMaaP and AAI is not responding
     [Documentation]    PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification
     [Tags]    PRH    AAI
     [Timeout]    180s
+    ${data}=    Get Data From File    ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
     Stop AAI
-    Set event in DMaaP    ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+    Set event in DMaaP    ${data}
     Wait Until Keyword Succeeds    100x    300ms    Check PRH log    java.net.UnknownHostException: aai
index c2a8b78..6a95c71 100644 (file)
@@ -23,16 +23,16 @@ class PrhLibrary(object):
         json_to_python = json.loads(json_file)
         ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
         ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
-        header = json_to_python["event"]["commonEventHeader"]["sourceName"]
-        str_json = '{"sourceName":"' + header + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
+        correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+        str_json = '{"correlationId":"' + correlationId + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
         python_to_json = json.dumps(str_json)
         return python_to_json.replace("\\", "")[1:-1]
 
     @staticmethod
     def create_pnf_name(json_file):
         json_to_python = json.loads(json_file)
-        header = json_to_python["event"]["commonEventHeader"]["sourceName"]
-        return header
+        correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+        return correlationId
 
     @staticmethod
     def stop_aai():
@@ -43,4 +43,4 @@ class PrhLibrary(object):
     def create_invalid_notification(self, json_file):
         return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\
             .replace("ipaddress-v4-oam", "oamV4IpAddress").replace("ipaddress-v6-oam", "oamV6IpAddress")\
-            .replace("}", "\\\\n}")
+            .replace("}", "\\n}")
index fa8c0d0..73ce2a2 100644 (file)
@@ -2,6 +2,7 @@
 Library           RequestsLibrary
 Library           Collections
 Library           PrhLibrary.py
+Resource          ../../../common.robot
 
 *** Keywords ***
 Create header
@@ -17,18 +18,20 @@ Create sessions
 Invalid event processing
     [Arguments]    ${input_invalid_event_in_dmaap}
     [Timeout]    30s
-    Set event in DMaaP    ${input_invalid_event_in_dmaap}
-    ${invalid_notification}=    Create invalid notification    ${input_invalid_event_in_dmaap}
-    ${notification}=     Catenate        SEPARATOR= \\\\n        |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created:        ${invalid_notification}
-    Wait Until Keyword Succeeds    100x    100ms    Check PRH log       ${notification}
-    
+    ${data}=    Get Data From File    ${input_invalid_event_in_dmaap}
+    Set event in DMaaP    ${data}
+    ${invalid_notification}=    Create invalid notification    ${data}
+    ${notification}=    Catenate    SEPARATOR= \\n    |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created:    ${invalid_notification}
+    Wait Until Keyword Succeeds    100x    100ms    Check PRH log    ${notification}
+
 Valid event processing
     [Arguments]    ${input_valid_event_in_dmaap}
     [Timeout]    30s
-    ${posted_event_to_dmaap}=    Create PNF_Ready notification    ${input_valid_event_in_dmaap}
-    ${pnf_name}=    Create PNF name    ${input_valid_event_in_dmaap}
+    ${data}=    Get Data From File    ${input_valid_event_in_dmaap}
+    ${posted_event_to_dmaap}=    Create PNF_Ready notification    ${data}
+    ${pnf_name}=    Create PNF name    ${data}
     Set PNF name in AAI    ${pnf_name}
-    Set event in DMaaP    ${input_valid_event_in_dmaap}
+    Set event in DMaaP    ${data}
     Wait Until Keyword Succeeds    100x    300ms    Check PNF_READY notification    ${posted_event_to_dmaap}
 
 Check PRH log
index 393359f..daed35f 100644 (file)
@@ -5,8 +5,9 @@ Library           OperatingSystem
 Library           Collections
 Library           DcaeLibrary
 Resource          resources/dcae_keywords.robot
+Resource          ../../common.robot
 Test Setup        Cleanup VES Events
-Suite Setup       VES Collector Suite Setup DMaaP
+Suite Setup       Run keywords  VES Collector Suite Setup DMaaP  Create sessions  Create header
 Suite Teardown    VES Collector Suite Shutdown DMaaP    
 
 *** Variables ***
@@ -15,13 +16,12 @@ ${VESC_URL}                              http://%{VESC_IP}:8080
 ${VES_ANY_EVENT_PATH}                    /eventListener/v5
 ${VES_BATCH_EVENT_PATH}                 /eventListener/v5/eventBatch
 ${VES_THROTTLE_STATE_EVENT_PATH}         /eventListener/v5/clientThrottlingState
-${HEADER_STRING}                         content-type=application/json
 ${EVENT_DATA_FILE}                       %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json
 ${EVENT_MEASURE_FILE}                    %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json
 ${EVENT_DATA_FILE_BAD}                   %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json
 ${EVENT_BATCH_DATA_FILE}                 %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json
 ${EVENT_THROTTLING_STATE_DATA_FILE}      %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json
-${EVENT_PNF_REGISTRATION}               %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json
+${EVENT_PNF_REGISTRATION}                %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json
 
 #DCAE Health Check
 ${CONFIG_BINDING_URL}                    http://localhost:8443
@@ -30,22 +30,20 @@ ${CB_SERVICE_COMPONENT_PATH}             /service_component/
 ${VES_Service_Name1}                     dcae-controller-ves-collector
 ${VES_Service_Name2}                     ves-collector-not-exist
 
-*** Test Cases ***    
+*** Test Cases ***
 VES Collector Health Check
     [Tags]    DCAE-VESC-R1
     [Documentation]   Ves Collector Health Check
     ${uuid}=    Generate UUID
-    ${session}=    Create Session      dcae    ${VESC_URL}
     ${headers}=  Create Dictionary     Accept=*/*     X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
-    ${resp}=   Get Request     dcae    /healthcheck        headers=${headers}
+    ${resp}=   Get Request     ${suite_dcae_vesc_url_session}  /healthcheck        headers=${headers}
     Should Be Equal As Strings         ${resp.status_code}     200  
 
 Publish Single VES VoLTE Fault Event
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post single event and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE}
+    ${resp}=  Publish Event To VES Collector No Auth    ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     200
     ${isEmpty}=   Is Json Empty    ${resp}
@@ -56,9 +54,8 @@ Publish Single VES VoLTE Fault Event
 Publish Single VES VNF Measurement Event
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post single event and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_MEASURE_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}   ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    ${evtdata}=   Get Data From File   ${EVENT_MEASURE_FILE}
+    ${resp}=  Publish Event To VES Collector No Auth    ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     200
     ${isEmpty}=   Is Json Empty    ${resp}
@@ -69,9 +66,8 @@ Publish Single VES VNF Measurement Event
 Publish VES VoLTE Fault Batch Events
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post batched events and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_BATCH_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_BATCH_EVENT_PATH}  ${headers}  ${evtdata}
+    ${evtdata}=   Get Data From File   ${EVENT_BATCH_DATA_FILE}
+    ${resp}=  Publish Event To VES Collector No Auth    ${VES_BATCH_EVENT_PATH}  ${evtdata}
     Should Be Equal As Strings         ${resp.status_code}     200
     #${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546016
     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546025
@@ -80,10 +76,9 @@ Publish VES VoLTE Fault Batch Events
 Publish Single VES VoLTE Fault Event With Bad Data
     [Tags]    DCAE-VESC-R1
     [Documentation]    Run with JSON Envent with missing comma to expect 400 response
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE_BAD}
-    ${headers}=   Create Header From String    ${HEADER_STRING}  
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE_BAD}
     Log   Send HTTP Request with invalid Json Event Data
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    ${resp}=  Publish Event To VES Collector No Auth    ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     400
     ${isEmpty}=   Is Json Empty    ${resp}
@@ -92,20 +87,18 @@ Publish Single VES VoLTE Fault Event With Bad Data
 Publish VES Event With Invalid Method
     [Tags]    DCAE-VESC-R1
     [Documentation]    Use invalid Put instead of Post method to expect 405 response
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE}
     Log   Send HTTP Request with invalid method Put instead of Post
-    ${resp}=  Publish Event To VES Collector With Put Method No Auth  ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    ${resp}=  Publish Event To VES Collector With Put Method No Auth  ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     404 
     
 Publish VES Event With Invalid URL Path
     [Tags]    DCAE-VESC-R1
     [Documentation]    Use invalid url path to expect 404 response
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE}
     Log   Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  /listener/v5/  ${headers}  ${evtdata}
+    ${resp}=  Publish Event To VES Collector No Auth    /listener/v5/  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     404    
     
@@ -123,10 +116,9 @@ Publish VES Event With Invalid URL Path
 Publish Single VES Fault Event Over HTTPS
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post single event and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE}
     Log  Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD}
-    ${resp}=  Publish Event To VES Collector    ${VESC_URL_HTTPS}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}  sample1  sample1
+    ${resp}=  Publish Event To VES Collector    ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     200
     ${isEmpty}=   Is Json Empty    ${resp}
@@ -137,9 +129,8 @@ Publish Single VES Fault Event Over HTTPS
 Publish Single VES Measurement Event Over HTTPS
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post single event and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_MEASURE_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
+    ${evtdata}=   Get Data From File   ${EVENT_MEASURE_FILE}
+    ${resp}=  Publish Event To VES Collector  ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     200
     ${isEmpty}=   Is Json Empty    ${resp}
@@ -150,9 +141,8 @@ Publish Single VES Measurement Event Over HTTPS
 Publish VES Fault Batch Events Over HTTPS
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post batched events and expect 202 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_BATCH_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  ${VES_BATCH_EVENT_PATH}  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
+    ${evtdata}=   Get Data From File   ${EVENT_BATCH_DATA_FILE}
+    ${resp}=  Publish Event To VES Collector  ${VES_BATCH_EVENT_PATH}  ${evtdata}
     Should Be Equal As Strings         ${resp.status_code}     200
     #${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546016
     ${ret}=  DMaaP Message Receive    ab305d54-85b4-a31b-7db2-fb6b9e546025
@@ -161,19 +151,17 @@ Publish VES Fault Batch Events Over HTTPS
 Publish VES Event With Invalid URL Path HTTPS
     [Tags]    DCAE-VESC-R1
     [Documentation]    Use invalid url path to expect 404 response
-    ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
+    ${evtdata}=   Get Data From File   ${EVENT_DATA_FILE}
     Log   Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path
-    ${resp}=  Publish Event To VES Collector  ${VESC_URL_HTTPS}  /eventlistener/v5  ${headers}  ${evtdata}  ${VESC_HTTPS_USER}  ${VESC_HTTPS_PD}
+    ${resp}=  Publish Event To VES Collector  /eventlistener/v5  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     404
     
 Publish PNF Registration Event  
     [Tags]    DCAE-VESC-R1
     [Documentation]   Post PNF registration event and expect 200 Response 
-    ${evtdata}=   Get Event Data From File   ${EVENT_PNF_REGISTRATION}
-    ${headers}=   Create Header From String    ${HEADER_STRING}
-    ${resp}=  Publish Event To VES Collector No Auth    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
+    ${evtdata}=   Get Data From File   ${EVENT_PNF_REGISTRATION}
+    ${resp}=  Publish Event To VES Collector No Auth    ${VES_ANY_EVENT_PATH}  ${evtdata}
     Log    Receive HTTP Status code ${resp.status_code}
     Should Be Equal As Strings         ${resp.status_code}     200
     ${isEmpty}=   Is Json Empty    ${resp}
index db59557..092b608 100644 (file)
@@ -8,9 +8,13 @@ import posixpath
 import BaseHTTPServer
 import urllib
 import urlparse
-import cgi, sys, shutil, mimetypes
+import cgi
+import sys
+import shutil
+import mimetypes
 from jsonschema import validate
-import jsonschema, json
+import jsonschema
+import json
 import DcaeVariables
 import SimpleHTTPServer
 from robot.api import logger
@@ -25,7 +29,7 @@ EvtSchema = None
 DMaaPHttpd = None
 
 
-def cleanUpEvent():
+def clean_up_event():
     sz = DcaeVariables.VESEventQ.qsize()
     for i in range(sz):
         try:
@@ -33,8 +37,9 @@ def cleanUpEvent():
         except:
             pass
 
-def enqueEvent(evt):
-    if DcaeVariables.VESEventQ != None:
+
+def enque_event(evt):
+    if DcaeVariables.VESEventQ is not None:
         try:
             DcaeVariables.VESEventQ.put(evt)
             if DcaeVariables.IsRobotRun:
@@ -46,12 +51,13 @@ def enqueEvent(evt):
             print (str(e))
             return False
     return False
-            
-def dequeEvent(waitSec=25):
+
+
+def deque_event(wait_sec=25):
     if DcaeVariables.IsRobotRun:
         logger.console("Enter DequeEvent")
     try:
-        evt = DcaeVariables.VESEventQ.get(True, waitSec)
+        evt = DcaeVariables.VESEventQ.get(True, wait_sec)
         if DcaeVariables.IsRobotRun:
             logger.console("DMaaP Event dequeued - size=" + str(len(evt)))
         else:
@@ -64,7 +70,8 @@ def dequeEvent(waitSec=25):
         else:
             print("DMaaP Event dequeue timeout")
         return None
+
+
 class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
       
     def do_PUT(self):
@@ -73,7 +80,7 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         
     def do_POST(self):
         
-        respCode = 0
+        resp_code = 0
         # Parse the form data posted
         '''
         form = cgi.FieldStorage(
@@ -95,21 +102,21 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         '''
         
         if 'POST' not in self.requestline:
-            respCode = 405
+            resp_code = 405
             
         '''
-        if respCode == 0:
+        if resp_code == 0:
             if '/eventlistener/v5' not in self.requestline and '/eventlistener/v5/eventBatch' not in self.requestline and \
                         '/eventlistener/v5/clientThrottlingState' not in self.requestline:
-                respCode = 404
+                resp_code = 404
          
         
-        if respCode == 0:
+        if resp_code == 0:
             if 'Y29uc29sZTpaakprWWpsbE1qbGpNVEkyTTJJeg==' not in str(self.headers):
-                respCode = 401
+                resp_code = 401
         '''  
         
-        if respCode == 0:
+        if resp_code == 0:
             content_len = int(self.headers.getheader('content-length', 0))
             post_body = self.rfile.read(content_len)
             
@@ -123,21 +130,21 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
             if indx != 0:
                 post_body = post_body[indx:]
             
-            if enqueEvent(post_body) == False:
+            if not enque_event(post_body):
                 print "enque event fails"
                    
             global EvtSchema
             try:
-                if EvtSchema == None:
-                    with open(DcaeVariables.CommonEventSchemaV5) as file:
-                        EvtSchema = json.load(file)
+                if EvtSchema is None:
+                    with open(DcaeVariables.CommonEventSchemaV5) as opened_file:
+                        EvtSchema = json.load(opened_file)
                 decoded_body = json.loads(post_body)
                 jsonschema.validate(decoded_body, EvtSchema)
             except:
-                respCode = 400
+                resp_code = 400
         
         # Begin the response
-        if DcaeVariables.IsRobotRun == False:
+        if not DcaeVariables.IsRobotRun:
             print ("Response Message:")
         
         '''
@@ -154,18 +161,18 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
         '''
         
-        if respCode == 0:
+        if resp_code == 0:
             if 'clientThrottlingState' in self.requestline:
                 self.send_response(204)
             else:
                 self.send_response(200)
                 self.send_header('Content-Type', 'application/json')
                 self.end_headers()
-                #self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}")
+                # self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}")
                 self.wfile.write("{'count': 1, 'serverTimeMs': 3}")
                 self.wfile.close()
         else:
-            self.send_response(respCode)
+            self.send_response(resp_code)
         
         '''
         self.end_headers()
@@ -190,8 +197,7 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
                 self.wfile.write('\t%s=%s\n' % (field, form[field].value))
         '''
         return
-    
-    
+
     def do_GET(self):
         """Serve a GET request."""
         f = self.send_head()
@@ -219,7 +225,6 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
         """
         path = self.translate_path(self.path)
-        f = None
         if os.path.isdir(path):
             parts = urlparse.urlsplit(self.path)
             if not parts.path.endswith('/'):
@@ -268,18 +273,18 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
         """
         try:
-            list = os.listdir(path)
+            list_dir = os.listdir(path)
         except os.error:
             self.send_error(404, "No permission to list directory")
             return None
-        list.sort(key=lambda a: a.lower())
+        list_dir.sort(key=lambda a: a.lower())
         f = StringIO()
         displaypath = cgi.escape(urllib.unquote(self.path))
         f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
         f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)
         f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath)
         f.write("<hr>\n<ul>\n")
-        for name in list:
+        for name in list_dir:
             fullname = os.path.join(path, name)
             displayname = linkname = name
             # Append / for directories or @ for symbolic links
@@ -301,7 +306,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         self.end_headers()
         return f
 
-    def translate_path(self, path):
+    @staticmethod
+    def translate_path(path):
         """Translate a /-separated PATH to the local filename syntax.
 
         Components that mean special things to the local file system
@@ -310,8 +316,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
         """
         # abandon query parameters
-        path = path.split('?',1)[0]
-        path = path.split('#',1)[0]
+        path = path.split('?', 1)[0]
+        path = path.split('#', 1)[0]
         # Don't forget explicit trailing slash when normalizing. Issue17324
         trailing_slash = path.rstrip().endswith('/')
         path = posixpath.normpath(urllib.unquote(path))
@@ -327,7 +333,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
             path += '/'
         return path
 
-    def copyfile(self, source, outputfile):
+    @staticmethod
+    def copyfile(source, outputfile):
         """Copy all data between two file objects.
 
         The SOURCE argument is a file object open for reading
@@ -368,26 +375,26 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
             return self.extensions_map['']
 
     if not mimetypes.inited:
-        mimetypes.init() # try to read system mime.types
+        mimetypes.init()  # try to read system mime.types
     extensions_map = mimetypes.types_map.copy()
     extensions_map.update({
-        '': 'application/octet-stream', # Default
+        '': 'application/octet-stream',  # Default
         '.py': 'text/plain',
         '.c': 'text/plain',
         '.h': 'text/plain',
         })
 
-def test(HandlerClass = DMaaPHandler,
-         ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904):
+
+def test(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904):
     print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5
-    with open(DcaeVariables.CommonEventSchemaV5) as file:
+    with open(DcaeVariables.CommonEventSchemaV5) as opened_file:
         global EvtSchema
-        EvtSchema = json.load(file)
+        EvtSchema = json.load(opened_file)
         
     server_address = ('', port)
 
-    HandlerClass.protocol_version = protocol
-    httpd = ServerClass(server_address, HandlerClass)
+    handler_class.protocol_version = protocol
+    httpd = server_class(server_address, handler_class)
     
     global DMaaPHttpd
     DMaaPHttpd = httpd
@@ -395,10 +402,10 @@ def test(HandlerClass = DMaaPHandler,
 
     sa = httpd.socket.getsockname()
     print "Serving HTTP on", sa[0], "port", sa[1], "..."
-    #httpd.serve_forever()
+    # httpd.serve_forever()
+
 
-def _main_ (HandlerClass = DMaaPHandler,
-         ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
     
     if sys.argv[1:]:
         port = int(sys.argv[1])
@@ -406,18 +413,19 @@ def _main_ (HandlerClass = DMaaPHandler,
         port = 3904
     
     print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5
-    with open(DcaeVariables.CommonEventSchemaV5) as file:
+    with open(DcaeVariables.CommonEventSchemaV5) as opened_file:
         global EvtSchema
-        EvtSchema = json.load(file)
+        EvtSchema = json.load(opened_file)
         
     server_address = ('', port)
 
-    HandlerClass.protocol_version = protocol
-    httpd = ServerClass(server_address, HandlerClass)
+    handler_class.protocol_version = protocol
+    httpd = server_class(server_address, handler_class)
 
     sa = httpd.socket.getsockname()
     print "Serving HTTP on", sa[0], "port", sa[1], "..."
     httpd.serve_forever()
-    
+
+
 if __name__ == '__main__':
-    _main_()
\ No newline at end of file
+    _main_()
index e581f1b..b43ee29 100644 (file)
@@ -5,24 +5,34 @@ Created on Aug 18, 2017
 '''
 from robot.api import logger
 from Queue import Queue
-import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko
+import uuid
+import time
+import datetime
+import json
+import threading
+import os
+import platform
+import subprocess
+import paramiko
 import DcaeVariables
 import DMaaP
 
+
 class DcaeLibrary(object):
     
     def __init__(self):
         pass 
     
-    def setup_dmaap_server(self, portNum=3904):
-        if DcaeVariables.HttpServerThread != None:
-            DMaaP.cleanUpEvent()
+    @staticmethod
+    def setup_dmaap_server(port_num=3904):
+        if DcaeVariables.HttpServerThread is not None:
+            DMaaP.clean_up_event()
             logger.console("Clean up event from event queue before test")
             logger.info("DMaaP Server already started")
             return "true"
         
         DcaeVariables.IsRobotRun = True
-        DMaaP.test(port=portNum)
+        DMaaP.test(port=port_num)
         try:
             DcaeVariables.VESEventQ = Queue()
             DcaeVariables.HttpServerThread = threading.Thread(name='DMAAP_HTTPServer', target=DMaaP.DMaaPHttpd.serve_forever)
@@ -34,8 +44,9 @@ class DcaeLibrary(object):
             print (str(e))
             return "false"
             
-    def shutdown_dmaap(self):
-        if DcaeVariables.HTTPD != None:
+    @staticmethod
+    def shutdown_dmaap():
+        if DcaeVariables.HTTPD is not None:
             DcaeVariables.HTTPD.shutdown()
             logger.console("DMaaP Server shut down")
             time.sleep(3)
@@ -43,20 +54,23 @@ class DcaeLibrary(object):
         else:
             return "false"
             
-    def cleanup_ves_events(self):
-        if DcaeVariables.HttpServerThread != None:
-            DMaaP.cleanUpEvent()
+    @staticmethod
+    def cleanup_ves_events():
+        if DcaeVariables.HttpServerThread is not None:
+            DMaaP.clean_up_event()
             logger.console("DMaaP event queue is cleaned up")
             return "true"
         logger.console("DMaaP server not started yet")
         return "false"
     
-    def enable_vesc_https_auth(self):
+    @staticmethod
+    def enable_vesc_https_auth():
+        global client
         if 'Windows' in platform.system():
             try:
                 client = paramiko.SSHClient()
                 client.load_system_host_keys()
-                #client.set_missing_host_key_policy(paramiko.WarningPolicy)
+                # client.set_missing_host_key_policy(paramiko.WarningPolicy)
                 client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                 
                 client.connect(os.environ['CSIT_IP'], port=22, username=os.environ['CSIT_USER'], password=os.environ['CSIT_PD'])
@@ -73,42 +87,42 @@ class DcaeLibrary(object):
         time.sleep(5)
         return  
                    
-    def dmaap_message_receive(self, evtobj, action='contain'):
+    @staticmethod
+    def dmaap_message_receive(evtobj, action='contain'):
         
-        evtStr = DMaaP.dequeEvent()
-        while evtStr != None:
-            logger.console("DMaaP receive VES Event:\n" + evtStr)
+        evt_str = DMaaP.deque_event()
+        while evt_str != None:
+            logger.console("DMaaP receive VES Event:\n" + evt_str)
             if action == 'contain':
-                if evtobj in evtStr:
-                    logger.info("DMaaP Receive Expected Publish Event:\n" + evtStr)
+                if evtobj in evt_str:
+                    logger.info("DMaaP Receive Expected Publish Event:\n" + evt_str)
                     return 'true'
             if action == 'sizematch':
-                if len(evtobj) == len(evtStr):
+                if len(evtobj) == len(evt_str):
                     return 'true'
             if action == 'dictmatch':
-                evtDict = json.loads(evtStr)
-                if cmp(evtobj, evtDict) == 0:
+                evt_dict = json.loads(evt_str)
+                if cmp(evtobj, evt_dict) == 0:
                     return 'true'
-            evtStr = DMaaP.dequeEvent()
+            evt_str = DMaaP.deque_event()
         return 'false'
-    
-    def create_header_from_string(self, dictStr):
-        logger.info("Enter create_header_from_string: dictStr")
-        return dict(u.split("=") for u in dictStr.split(","))
-    
-    def is_json_empty(self, resp):
+
+    @staticmethod
+    def is_json_empty(resp):
         logger.info("Enter is_json_empty: resp.text: " + resp.text)
-        if resp.text == None or len(resp.text) < 2:
+        if resp.text is None or len(resp.text) < 2:
             return 'True'
         return 'False'
     
-    def Generate_UUID(self):
+    @staticmethod
+    def generate_uuid():
         """generate a uuid"""
         return uuid.uuid4()
     
-    def get_json_value_list(self, jsonstr, keyval):
+    @staticmethod
+    def get_json_value_list(jsonstr, keyval):
         logger.info("Enter Get_Json_Key_Value_List")
-        if jsonstr == None or len(jsonstr) < 2:
+        if jsonstr is None or len(jsonstr) < 2:
             logger.info("No Json data found")
             return []
         try:
@@ -122,12 +136,14 @@ class DcaeLibrary(object):
             print str(e)
             return []
         
-    def generate_MilliTimestamp_UUID(self):
+    @staticmethod
+    def generate_millitimestamp_uuid():
         """generate a millisecond timestamp uuid"""
         then = datetime.datetime.now()
         return int(time.mktime(then.timetuple())*1e3 + then.microsecond/1e3)
     
-    def test (self):
+    @staticmethod
+    def test():
         import json
         from pprint import pprint
 
@@ -138,7 +154,6 @@ class DcaeLibrary(object):
         pprint(data)
 
 
-
 if __name__ == '__main__':
     '''
     dictStr = "action=getTable,Accept=application/json,Content-Type=application/json,X-FromAppId=1234908903284"
@@ -156,4 +171,3 @@ if __name__ == '__main__':
     ret = lib.setup_dmaap_server()
     print ret
     time.sleep(100000)
-    
index 4d51a8f..a9456d0 100644 (file)
@@ -1,13 +1,14 @@
+import os
 
-import os, time
 
-def GetEnvironmentVariable(envVarstr):
-    return os.environ.get(envVarstr)
+def get_environment_variable(env_varstr):
+    return os.environ.get(env_varstr)
+
 
 DCAE_HEALTH_CHECK_URL = "http://135.205.228.129:8500"
 DCAE_HEALTH_CHECK_URL1 = "http://135.205.228.170:8500"
 
-CommonEventSchemaV5  = GetEnvironmentVariable('WORKSPACE') + "/test/csit/tests/dcaegen2/testcases/assets/json_events/CommonEventFormat_28.3.json"
+CommonEventSchemaV5 = get_environment_variable('WORKSPACE') + "/test/csit/tests/dcaegen2/testcases/assets/json_events/CommonEventFormat_28.3.json"
 
 HttpServerThread = None
 HTTPD = None
index 98b3415..6820050 100644 (file)
@@ -1,4 +1,4 @@
- *** Settings ***
+*** Settings ***
 Documentation     The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields
 Library              RequestsLibrary
 Library                  DcaeLibrary   
@@ -6,9 +6,23 @@ Library           OperatingSystem
 Library           Collections
 Variables         ../resources/DcaeVariables.py
 Resource          ../resources/dcae_properties.robot
+
 *** Variables ***
 ${DCAE_HEALTH_CHECK_BODY}    %{WORKSPACE}/test/csit/tests/dcae/testcases/assets/json_events/dcae_healthcheck.json
+
 *** Keywords ***
+Create sessions
+    [Documentation]  Create all required sessions
+    Create Session    dcae_vesc_url    ${VESC_URL}
+    Set Suite Variable    ${suite_dcae_vesc_url_session}    dcae_vesc_url
+    ${auth}=  Create List  ${VESC_HTTPS_USER}   ${VESC_HTTPS_PD}
+    Create Session    dcae_vesc_url_https    ${VESC_URL_HTTPS}  auth=${auth}  disable_warnings=1
+    Set Suite Variable    ${suite_dcae_vesc_url_https_session}    dcae_vesc_url_https
+
+Create header
+    ${headers}=    Create Dictionary    Content-Type=application/json
+    Set Suite Variable    ${suite_headers}    ${headers}
+
 Get DCAE Nodes
     [Documentation]    Get DCAE Nodes from Consul Catalog
     #Log    Creating session   ${GLOBAL_DCAE_CONSUL_URL}
@@ -22,7 +36,8 @@ Get DCAE Nodes
     ${NodeListLength}=  Get Length  ${NodeList}  
     ${len}=  Get Length   ${NodeList}   
     Should Not Be Equal As Integers   ${len}   0
-    [return]    ${NodeList}
+    [Return]    ${NodeList}
+
 DCAE Node Health Check
     [Documentation]    Perform DCAE Node Health Check
     [Arguments]    ${NodeName}
@@ -38,18 +53,22 @@ DCAE Node Health Check
     Should Not Be Equal As Integers   ${len}   0
     DCAE Check Health Status    ${NodeName}   ${StatusList[0]}    Serf Health Status
     #Run Keyword if  ${len} > 1  DCAE Check Health Status  ${NodeName}  ${StatusList[1]}  Serf Health Status
+
 DCAE Check Health Status
     [Arguments]    ${NodeName}    ${ItemStatus}   ${CheckType}
     Should Be Equal As Strings    ${ItemStatus}    passing   
     Log   Node: ${NodeName} ${CheckType} check pass ok
+
 VES Collector Suite Setup DMaaP
     [Documentation]   Start DMaaP Mockup Server
     ${ret}=  Setup DMaaP Server
     Should Be Equal As Strings     ${ret}    true
+
 VES Collector Suite Shutdown DMaaP
     [Documentation]   Shutdown DMaaP Mockup Server
     ${ret}=  Shutdown DMaap
     Should Be Equal As Strings     ${ret}    true
+
 Check DCAE Results
     [Documentation]    Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN
     [Arguments]    ${json}
@@ -65,6 +84,7 @@ Check DCAE Results
     \    ${cells}=    Get From Dictionary    ${row}    cells
     \    ${dict}=    Make A Dictionary    ${cells}    ${columns}
     \    Dictionary Should Contain Item    ${dict}    healthTestStatus    GREEN
+
 Make A Dictionary
     [Documentation]    Given a list of column names and a list of dictionaries, map columname=value
     [Arguments]     ${columns}    ${names}    ${valuename}=value
@@ -77,57 +97,49 @@ Make A Dictionary
     \    ${value}=    Get From Dictionary    ${valued}    ${valueName}
     \    Set To Dictionary    ${dict}   ${name}    ${value}     
     [Return]     ${dict}
-Get Event Data From File
-    [Arguments]    ${jsonfile}
-    ${data}=    OperatingSystem.Get File    ${jsonfile}
-    #Should Not Be_Equal    ${data}    None
-    [return]    ${data}
+
 Json String To Dictionary
     [Arguments]  ${json_string}   
     ${json_dict}=  evaluate    json.loads('''${json_string}''')    json
-    [return]   ${json_dict}
+    [Return]   ${json_dict}
+
 Dictionary To Json String
     [Arguments]  ${json_dict}
     ${json_string}=    evaluate    json.dumps(${json_dict})    json
-    [return]    ${json_string}
+    [Return]    ${json_string}
+
 Get DCAE Service Component Status
     [Documentation]   Get the status of a DCAE Service Component
     [Arguments]    ${url}    ${urlpath}     ${usr}    ${passwd}    
     ${auth}=  Create List  ${usr}  ${passwd}
     ${session}=    Create Session      dcae-service-component  ${url}    auth=${auth}
     ${resp}=   Get Request     dcae-service-component  ${urlpath}
-    [return]    ${resp}
+    [Return]    ${resp}
+
 Publish Event To VES Collector No Auth
     [Documentation]    Send an event to VES Collector
-    [Arguments]     ${url}  ${evtpath}   ${httpheaders}    ${evtdata}
-    Log    Creating session ${url}
-    ${session}=    Create Session      dcaegen2-d1     ${url}
-    ${resp}=   Post Request    dcaegen2-d1     ${evtpath}     data=${evtdata}   headers=${httpheaders}
+    [Arguments]     ${evtpath}   ${evtdata}
+    ${resp}=   Post Request    ${suite_dcae_vesc_url_session}  ${evtpath}     data=${evtdata}   headers=${suite_headers}
     #Log    Received response from dcae ${resp.json()}
-    [return]   ${resp}
+    [Return]   ${resp}
+
 Publish Event To VES Collector
     [Documentation]    Send an event to VES Collector
-    [Arguments]     ${url}  ${evtpath}   ${httpheaders}    ${evtdata}   ${user}  ${pd}
-    ${auth}=  Create List  ${user}   ${pd}
-    Log    Creating session ${url}
-    ${session}=    Create Session      dcaegen2-d1     ${url}    auth=${auth}   disable_warnings=1
-    ${resp}=   Post Request    dcaegen2-d1     ${evtpath}     data=${evtdata}   headers=${httpheaders}
+    [Arguments]     ${evtpath}   ${evtdata}
+    ${resp}=   Post Request    ${suite_dcae_vesc_url_https_session}    ${evtpath}     data=${evtdata}   headers=${suite_headers}
     #Log    Received response from dcae ${resp.json()}
-    [return]   ${resp}
+    [Return]   ${resp}
+
 Publish Event To VES Collector With Put Method
     [Documentation]    Send an event to VES Collector
-    [Arguments]     ${url}  ${evtpath}   ${httpheaders}    ${evtdata}   ${user}  ${pd}
-    ${auth}=  Create List  ${user}   ${pd}
-    Log    Creating session ${url}
-    ${session}=    Create Session      dcae-d1         ${url}    auth=${auth}
-    ${resp}=   Put Request     dcae-d1         ${evtpath}     data=${evtdata}   headers=${httpheaders}
+    [Arguments]     ${evtpath}   ${evtdata}
+    ${resp}=   Put Request     ${suite_dcae_vesc_url_https_session}    ${evtpath}     data=${evtdata}   headers=${suite_headers}
     #Log    Received response from dcae ${resp.json()}
-    [return]   ${resp}
+    [Return]   ${resp}
+
 Publish Event To VES Collector With Put Method No Auth
     [Documentation]    Send an event to VES Collector
-    [Arguments]     ${url}  ${evtpath}   ${httpheaders}    ${evtdata}
-    Log    Creating session ${url}
-    ${session}=    Create Session      dcae-d1         ${url}
-    ${resp}=   Put Request     dcae-d1         ${evtpath}     data=${evtdata}   headers=${httpheaders}
+    [Arguments]     ${evtpath}   ${evtdata}
+    ${resp}=   Put Request     ${suite_dcae_vesc_url_session}  ${evtpath}     data=${evtdata}   headers=${suite_headers}
     #Log    Received response from dcae ${resp.json()}
-    [return]   ${resp}
+    [Return]   ${resp}
index 6924888..135ff26 100644 (file)
@@ -1,9 +1,8 @@
+*** Settings ***
 Documentation        store all properties that can change or are used in multiple places here
 ...                    format is all caps with underscores between words and prepended with GLOBAL
 ...                   make sure you prepend them with GLOBAL so that other files can easily see it is from this file.
 
-
-
 *** Variables ***
 ${GLOBAL_APPLICATION_ID}           robot-dcaegen2
 ${GLOBAL_DCAE_CONSUL_URL}          http://135.205.228.129:8500
index bf314a9..2198577 100644 (file)
@@ -1,8 +1,8 @@
-{  
+{
    "name":"vCPE-with-HPA",
-   "template":{  
+   "template":{
       "homing_template_version":"2017-10-10",
-      "parameters":{  
+      "parameters":{
          "service_name":"Residential vCPE",
          "service_id":"vcpe_service_id",
          "customer_lat":45.395968,
          "REQUIRED_DISK":100,
          "pnf_id":"some_pnf_id"
       },
-      "locations":{  
-         "customer_loc":{  
-            "latitude":{  
+      "locations":{
+         "customer_loc":{
+            "latitude":{
                "get_param":"customer_lat"
             },
-            "longitude":{  
+            "longitude":{
                "get_param":"customer_long"
             }
          }
       },
       "demands":{
-         "vG":[  
-            {  
+         "vG":[
+            {
                "inventory_provider":"aai",
                "inventory_type":"cloud"
             }
          ]
       },
       "constraints":{
-        "constraint_vg_customer":{  
+        "constraint_vg_customer":{
             "type":"distance_to_location",
-            "demands":[  
+            "demands":[
                "vG"
             ],
-            "properties":{  
+            "properties":{
                "distance":"< 100 km",
                "location":"customer_loc"
             }
          },
-        "hpa_constraint":{  
+        "hpa_constraint":{
             "type":"hpa",
-            "demands":[  
+            "demands":[
                "vG"
             ],
-            "properties":{  
-               "evaluate":[  
-                  {  
-                     "flavorLabel":"flavor_label_1",
-                     "flavorProperties":[  
-                        {  
+            "properties":{
+               "evaluate":[
+                  {
+                     "id":"vg_1",
+                     "type":"vnfc",
+                     "directives":[
+                         {
+                            "type": "flavor_directives",
+                            "attributes":[
+                                 {
+                                    "attribute_name":"flavor_label_1",
+                                    "attribute_value":""
+                                 }
+                            ]
+                         }
+                     ],
+                     "flavorProperties":[
+                        {
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives": [],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numVirtualCpu",
                                  "hpa-attribute-value":"4",
                                  "operator":">="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"virtualMemSize",
                                  "hpa-attribute-value":"4",
                                  "operator":">=",
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"numa",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives": [],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numaNodes",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"=",
                                  "unit":"GB"
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"=",
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"cpuPinning",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives": [],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"logicalCpuThreadPinningPolicy",
                                  "hpa-attribute-value":"prefer",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"logicalCpuPinningPolicy",
                                  "hpa-attribute-value":"dedicated",
                                  "operator":"="
                         }
                      ]
                   },
-                  {  
-                     "flavorLabel":"flavor_label_2",
-                     "flavorProperties":[  
-                        {  
+                  {
+                     "id":"vg_2",
+                     "type":"vnfc",
+                     "directives":[
+                       {
+                         "type":"flavor_directives",
+                         "attributes":[
+                           {
+                             "attribute_name":"flavor_label_2",
+                             "attribute_value":""
+                           }
+                         ]
+                       }
+                     ],
+                     "flavorProperties":[
+                        {
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numVirtualCpu",
                                  "hpa-attribute-value":"8",
                                  "operator":">="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"virtualMemSize",
                                  "hpa-attribute-value":"16",
                                  "operator":">=",
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"numa",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numaNodes",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"=",
                                  "unit":"GB"
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"=",
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"ovsDpdk",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score": "5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"dataProcessingAccelerationLibrary",
                                  "hpa-attribute-value":"v18.02",
                                  "operator":"="
             }
          }
       },
-      "optimization":{  
-         "minimize":{  
-            "sum":[  
-               {  
-                  "distance_between":[  
+      "optimization":{
+         "minimize":{
+            "sum":[
+               {
+                  "distance_between":[
                      "customer_loc",
                      "vG"
                   ]
                },
-               {  
-                  "distance_between":[  
+               {
+                  "distance_between":[
                      "customer_loc",
                      "vG"
                   ]
index 80685ae..bb613ab 100644 (file)
             "properties":{  
                "evaluate":[  
                   {  
-                     "flavorLabel":"flavor_label_1",
+                     "id":"vg_1",
+                     "type":"vnfc",
+                     "directives":[
+                        {
+                           "type":"flavor_directives",
+                           "attributes":[
+                              {
+                                 "attribute_name":"flavor_label_1",
+                                 "attribute_value":""
+                              }
+                           ]
+                        }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"numVirtualCpu",
@@ -74,6 +87,7 @@
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory":"True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"numaNodes",
                      ]
                   },
                   {  
-                     "flavorLabel":"flavor_label_2",
+                     "id":"vg_2",
+                     "type":"vnfc",
+                     "directives":[
+                        {
+                           "type":"flavor_directives",
+                           "attributes":[
+                              {
+                                 "attribute_name":"flavor_label_2",
+                                 "attribute_value":""
+                              }
+                           ]
+                        }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"numVirtualCpu",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"dataProcessingAccelerationLibrary",
index 4672349..50c23ee 100644 (file)
@@ -1,8 +1,8 @@
-{  
+{
    "name":"vCPE-HPA-Requirement-Optional",
-   "template":{  
+   "template":{
       "homing_template_version":"2017-10-10",
-      "parameters":{  
+      "parameters":{
          "service_name":"Residential vCPE",
          "service_id":"vcpe_service_id",
          "customer_lat":45.395968,
          "REQUIRED_DISK":100,
          "pnf_id":"some_pnf_id"
       },
-      "locations":{  
-         "customer_loc":{  
-            "latitude":{  
+      "locations":{
+         "customer_loc":{
+            "latitude":{
                "get_param":"customer_lat"
             },
-            "longitude":{  
+            "longitude":{
                "get_param":"customer_long"
             }
          }
       },
-      "demands":{  
-         "vG":[  
-            {  
+      "demands":{
+         "vG":[
+            {
                "inventory_provider":"aai",
                "inventory_type":"cloud"
             }
          ]
       },
-      "constraints":{  
-         "constraint_vg_customer":{  
+      "constraints":{
+         "constraint_vg_customer":{
             "type":"distance_to_location",
-            "demands":[  
+            "demands":[
                "vG"
             ],
-            "properties":{  
+            "properties":{
                "distance":"< 100 km",
                "location":"customer_loc"
             }
          },
-         "hpa_constraint":{  
+         "hpa_constraint":{
             "type":"hpa",
-            "demands":[  
+            "demands":[
                "vG"
             ],
-            "properties":{  
-               "evaluate":[  
-                  {  
-                     "flavorLabel":"flavor_label_1",
-                     "flavorProperties":[  
-                        {  
+            "properties":{
+               "evaluate":[
+                  {
+                     "id":"vg_1",
+                     "type":"vnfc",
+                     "directives":[
+                        {
+                           "type":"flavor_directives",
+                           "attributes":[
+                              {
+                                 "attribute_name":"flavor_label_1",
+                                 "attribute_value":""
+                              }
+                           ]
+                        }
+                     ],
+                     "flavorProperties":[
+                        {
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numVirtualCpu",
                                  "hpa-attribute-value":"4",
                                  "operator":">="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"virtualMemSize",
                                  "hpa-attribute-value":"8",
                                  "operator":">=",
                               }
                            ]
                         },
-                         {  
+                         {
                            "hpa-feature":"instructionSetExtensions",
                            "hpa-version":"v1",
                            "architecture":"Intel64",
                            "mandatory": "True",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"instructionSetExtensions",
                                  "hpa-attribute-value":["aes", "sse", "avx", "smt"],
                                  "operator":"ALL",
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"numa",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory":"False",
                            "score":"3",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numaNodes",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"=",
                                  "unit":"GB"
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"=",
                         }
                      ]
                   },
-                  {  
-                     "flavorLabel":"flavor_label_2",
-                     "flavorProperties":[  
-                        {  
+                  {
+                     "id":"vg_2",
+                     "type":"vnfc",
+                     "directives":[
+                        {
+                           "type":"flavor_directives",
+                           "attributes":[
+                              {
+                                 "attribute_name":"flavor_label_2",
+                                 "attribute_value":""
+                              }
+                           ]
+                        }
+                     ],
+                     "flavorProperties":[
+                        {
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numVirtualCpu",
                                  "hpa-attribute-value":"4",
                                  "operator":">="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"virtualMemSize",
                                  "hpa-attribute-value":"8",
                                  "operator":">=",
                               }
                            ]
                         },
-                         {  
+                         {
                            "hpa-feature":"ovsDpdk",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
                            "score":"5",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"dataProcessingAccelerationLibrary",
                                  "hpa-attribute-value":"v18.02",
                                  "operator":"="
                               }
                            ]
                         },
-                        {  
+                        {
                            "hpa-feature":"numa",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory":"False",
                            "score":"3",
-                           "hpa-feature-attributes":[  
-                              {  
+                           "directives":[],
+                           "hpa-feature-attributes":[
+                              {
                                  "hpa-attribute-key":"numaNodes",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaCpu-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"="
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-0",
                                  "hpa-attribute-value":"2",
                                  "operator":"=",
                                  "unit":"GB"
                               },
-                              {  
+                              {
                                  "hpa-attribute-key":"numaMem-1",
                                  "hpa-attribute-value":"4",
                                  "operator":"=",
             }
          }
       },
-      "optimization":{  
-         "minimize":{  
-            "sum":[  
-               {  
-                  "distance_between":[  
+      "optimization":{
+         "minimize":{
+            "sum":[
+               {
+                  "distance_between":[
                      "customer_loc",
                      "vG"
                   ]
diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json
new file mode 100644 (file)
index 0000000..4a6d3bc
--- /dev/null
@@ -0,0 +1,267 @@
+{
+  "name": "vCPE-HPA-Requirement-Optional",
+  "template": {
+    "homing_template_version": "2017-10-10",
+    "parameters": {
+      "service_name": "Residential vCPE",
+      "service_id": "vcpe_service_id",
+      "customer_lat": 45.395968,
+      "customer_long": -71.135344,
+      "REQUIRED_MEM": 4,
+      "REQUIRED_DISK": 100,
+      "pnf_id": "some_pnf_id"
+    },
+    "locations": {
+      "customer_loc": {
+        "latitude": {
+          "get_param": "customer_lat"
+        },
+        "longitude": {
+          "get_param": "customer_long"
+        }
+      }
+    },
+    "demands": {
+      "vG": [
+        {
+          "inventory_provider": "aai",
+          "inventory_type": "cloud"
+        }
+      ]
+    },
+    "constraints": {
+      "constraint_vg_customer": {
+        "type": "distance_to_location",
+        "demands": [
+          "vG"
+        ],
+        "properties": {
+          "distance": "< 100 km",
+          "location": "customer_loc"
+        }
+      },
+      "hpa_constraint": {
+        "type": "hpa",
+        "demands": [
+          "vG"
+        ],
+        "properties": {
+          "evaluate": [
+            {
+              "id":"vg_1",
+              "type":"vnfc",
+              "directives":[
+                {
+                  "type":"flavor_directives",
+                  "attributes":[
+                    {
+                      "attribute_name":"flavor_label_1",
+                      "attribute_value":""
+                    }
+                  ]
+                }
+              ],
+              "flavorProperties": [
+                {
+                  "hpa-feature": "basicCapabilities",
+                  "hpa-version": "v1",
+                  "architecture": "generic",
+                  "mandatory": "True",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "numVirtualCpu",
+                      "hpa-attribute-value": "4",
+                      "operator": ">="
+                    },
+                    {
+                      "hpa-attribute-key": "virtualMemSize",
+                      "hpa-attribute-value": "8",
+                      "operator": ">=",
+                      "unit": "GB"
+                    }
+                  ]
+                },
+                {
+                  "hpa-feature": "instructionSetExtensions",
+                  "hpa-version": "v1",
+                  "architecture": "Intel64",
+                  "mandatory": "True",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "instructionSetExtensions",
+                      "hpa-attribute-value": [
+                        "aes",
+                        "sse",
+                        "avx",
+                        "smt"
+                      ],
+                      "operator": "ALL",
+                      "unit": ""
+                    }
+                  ]
+                },
+                {
+                  "hpa-feature": "numa",
+                  "hpa-version": "v1",
+                  "architecture": "generic",
+                  "mandatory": "False",
+                  "score": "3",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "numaNodes",
+                      "hpa-attribute-value": "2",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaCpu-0",
+                      "hpa-attribute-value": "2",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaCpu-1",
+                      "hpa-attribute-value": "4",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaMem-0",
+                      "hpa-attribute-value": "2",
+                      "operator": "=",
+                      "unit": "GB"
+                    },
+                    {
+                      "hpa-attribute-key": "numaMem-1",
+                      "hpa-attribute-value": "4",
+                      "operator": "=",
+                      "unit": "GB"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "id":"vg_2",
+              "type":"vnfc",
+              "directives":[
+                {
+                  "type":"flavor_directives",
+                  "attributes":[
+                    {
+                      "attribute_name":"flavor_label_2",
+                      "attribute_value":""
+                    }
+                  ]
+                }
+              ],
+              "flavorProperties": [
+                {
+                  "hpa-feature": "basicCapabilities",
+                  "hpa-version": "v1",
+                  "architecture": "generic",
+                  "mandatory": "True",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "numVirtualCpu",
+                      "hpa-attribute-value": "4",
+                      "operator": ">="
+                    },
+                    {
+                      "hpa-attribute-key": "virtualMemSize",
+                      "hpa-attribute-value": "8",
+                      "operator": ">=",
+                      "unit": "GB"
+                    }
+                  ]
+                },
+                {
+                  "hpa-feature": "ovsDpdk",
+                  "hpa-version": "v1",
+                  "architecture": "generic",
+                  "mandatory": "False",
+                  "score": "5",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+                      "hpa-attribute-value": "v18.02",
+                      "operator": "="
+                    }
+                  ]
+                },
+                {
+                  "hpa-feature": "numa",
+                  "hpa-version": "v1",
+                  "architecture": "generic",
+                  "mandatory": "False",
+                  "score": "3",
+                  "directives":[],
+                  "hpa-feature-attributes": [
+                    {
+                      "hpa-attribute-key": "numaNodes",
+                      "hpa-attribute-value": "2",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaCpu-0",
+                      "hpa-attribute-value": "2",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaCpu-1",
+                      "hpa-attribute-value": "4",
+                      "operator": "="
+                    },
+                    {
+                      "hpa-attribute-key": "numaMem-0",
+                      "hpa-attribute-value": "2",
+                      "operator": "=",
+                      "unit": "GB"
+                    },
+                    {
+                      "hpa-attribute-key": "numaMem-1",
+                      "hpa-attribute-value": "4",
+                      "operator": "=",
+                      "unit": "GB"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      }
+    },
+    "optimization": {
+      "minimize": {
+        "sum": [
+          {
+            "product": [
+              100,
+              {
+                "distance_between": [
+                  "customer_loc",
+                  "vG"
+                ]
+              }
+            ]
+          },
+          {
+            "product": [
+              200,
+              {
+                "hpa_score": [
+                  "vG"
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    }
+  },
+  "timeout": 5,
+  "limit": 3
+}
index 25b2262..d343dc8 100644 (file)
             "properties":{  
                "evaluate":[  
                   {  
-                     "flavorLabel":"flavor_label_1",
+                     "id":"vg_1",
+                     "type":"vnfc",
+                     "directives":[
+                         {
+                            "type":"flavor_directives",
+                            "attributes":[
+                               {
+                                  "attribute_name":"flavor_label_1",
+                                  "attribute_value":""
+                               }
+                            ]
+                         }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
+                           "directives":[],
                            "score": "5",
                            "hpa-feature-attributes":[  
                               {  
@@ -65,6 +78,7 @@
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
+                           "directives":[],
                            "score": "5",
                            "hpa-feature-attributes":[  
                               {  
                      ]
                   },
                   {  
-                     "flavorLabel":"flavor_label_2",
+                     "id":"vg_2",
+                     "type":"vnfc",
+                     "directives":[
+                         {
+                            "type":"flavor_directives",
+                            "attributes":[
+                               {
+                                  "attribute_name":"flavor_label_2",
+                                  "attribute_value":""
+                               }
+                            ]
+                         }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "False",
+                           "directives":[],
                            "score": "5",
                            "hpa-feature-attributes":[  
                               {  
index 8a31985..e95eced 100644 (file)
             "properties":{  
                "evaluate":[  
                   {  
-                     "flavorLabel":"flavor_label_1",
+                     "id":"vg_1",
+                     "type":"vnfc",
+                     "directives":[
+                         {
+                            "type":"flavor_directives",
+                            "attributes":[
+                               {
+                                  "attribute_name":"flavor_label_1",
+                                  "attribute_value":""
+                               }
+                            ]
+                         }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory": "True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"numVirtualCpu",
                      ]
                   },
                   {  
-                     "flavorLabel":"flavor_label_2",
+                     "id":"vg_2",
+                     "type":"vnfc",
+                     "directives":[
+                         {
+                            "type":"flavor_directives",
+                            "attributes":[
+                               {
+                                  "attribute_name":"flavor_label_2",
+                                  "attribute_value":""
+                               }
+                            ]
+                         }
+                     ],
                      "flavorProperties":[  
                         {  
                            "hpa-feature":"basicCapabilities",
                            "hpa-version":"v1",
                            "architecture":"generic",
                            "mandatory":"True",
+                           "directives":[],
                            "hpa-feature-attributes":[  
                               {  
                                  "hpa-attribute-key":"numVirtualCpu",
index deba647..3b3ee7a 100644 (file)
@@ -482,6 +482,41 @@ GetPlanWithHpaUnmatched
     Should Be Equal As Integers    ${resp.status_code}    200
     Should Be Equal    not found    ${resultStatus}
 
+# HPA Score Multi objective Optimization
+SendPlanWithHpaScoreMultiObj
+    [Documentation]    It sends a POST request to conductor
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    ${data}=         Get Binary File     ${CURDIR}${/}data${/}plan_with_hpa_score_multi_objective.json
+    &{headers}=      Create Dictionary    Content-Type=application/json  Accept=application/json
+    ${resp}=         Post Request        optf-cond   /v1/plans     data=${data}     headers=${headers}
+    Log To Console              *********************
+    Log To Console              response = ${resp}
+    Log To Console              body = ${resp.text}
+    ${response_json}    json.loads    ${resp.content}
+    ${generatedPlanId}=    Convert To String      ${response_json['id']}
+    Set Global Variable     ${generatedPlanId}
+    Log To Console              generatedPlanId = ${generatedPlanId}
+    Should Be Equal As Integers    ${resp.status_code}    201
+    Sleep    60s    Wait Plan Resolution
+
+GetPlanWithHpaScoreMultiObj
+    [Documentation]    It sends a REST GET request to capture recommendations
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    &{headers}=      Create Dictionary    Content-Type=application/json  Accept=application/json
+    ${resp}=         Get Request        optf-cond   /v1/plans/${generatedPlanId}    headers=${headers}
+    Log To Console              *********************
+    Log To Console              response = ${resp}
+    ${response_json}    json.loads    ${resp.content}
+    ${resultStatus}=    Convert To String      ${response_json['plans'][0]['status']}
+    ${vim-id}=    Convert To String      ${response_json['plans'][0]['recommendations'][0]['vG']['candidate']['vim-id']}
+    # ${hpa_score}=    Convert To String      ${response_json['plans'][0]['recommendations']['vG']['hpa_score']}
+    Set Global Variable     ${resultStatus}
+    Log To Console              resultStatus = ${resultStatus}
+    Log To Console              body = ${resp.text}
+    Should Be Equal As Integers    ${resp.status_code}    200
+    Should Be Equal    done    ${resultStatus}
+    Should Be Equal    HPA-cloud_cloud-region-1    ${vim-id}
+
 
 *** Keywords ***
 
diff --git a/test/csit/tests/policy/apex-pdp/apex-pdp-test.robot b/test/csit/tests/policy/apex-pdp/apex-pdp-test.robot
new file mode 100644 (file)
index 0000000..f1dea17
--- /dev/null
@@ -0,0 +1,14 @@
+*** Settings ***
+Library     Collections
+Library     RequestsLibrary
+Library     OperatingSystem
+Library     json
+
+*** Test Cases ***
+
+Call Apex Policy
+    Create Session   apexSession  http://${APEX_IP}:23324   max_retries=3
+    ${data}=    Get Binary File     ${CURDIR}${/}data${/}event.json
+    &{headers}=  Create Dictionary    Content-Type=application/json    Accept=application/json
+    ${resp}=    Put Request    apexSession    /apex/FirstConsumer/EventIn    data=${data}   headers=${headers}
+    Should Be Equal As Strings    ${resp.status_code}   200
diff --git a/test/csit/tests/policy/apex-pdp/data/event.json b/test/csit/tests/policy/apex-pdp/data/event.json
new file mode 100644 (file)
index 0000000..9dbf279
--- /dev/null
@@ -0,0 +1,11 @@
+{
+    "nameSpace": "org.onap.policy.apex.sample.events",
+    "name": "Event0000",
+    "version": "0.0.1",
+    "source": "REST_0",
+    "target": "apex",
+    "TestSlogan": "Test slogan for External Event0",
+    "TestMatchCase": 3,
+    "TestTimestamp": 1536363522018,
+    "TestTemperature": 9080.866
+}
index 911fdaf..60826bb 100644 (file)
@@ -25,6 +25,6 @@ ${GLOBAL_VM_PRIVATE_KEY}   ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pv
 ${GLOBAL_POLICY_SERVER_URL}    https://%{PDP_IP}:8081
 ${GLOBAL_POLICY_AUTH}  dGVzdHBkcDphbHBoYTEyMw==
 ${GLOBAL_POLICY_CLIENTAUTH}     cHl0aG9uOnRlc3Q=
-${GLOBAL_POLICY_HEALTHCHECK_URL}       http://%{POLICY_IP}:6969
+${GLOBAL_POLICY_HEALTHCHECK_URL}       https://%{POLICY_IP}:6969
 ${GLOBAL_POLICY_USERNAME}      healthcheck
 ${GLOBAL_POLICY_PASSWORD}      zb!XztG34
index 4bf3d25..c002a18 100644 (file)
@@ -14,32 +14,31 @@ ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}  /operations/VNF-API:preload-vnf-topology
 
 Healthcheck API
     Create Session   sdnc  http://localhost:8282/restconf
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}data.json
+    ${data}=    Get File     ${CURDIR}${/}data${/}data.json
     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
     ${resp}=    Post Request    sdnc    ${SDN_HEALTHCHECK_OPERATION_PATH}    data=${data}    headers=${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Be Equal As Strings  ${resp.json()['output']['response-code']}   200
-       
+
 Check SLI-API
     Create Session   sdnc  http://localhost:8282
     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
     ${resp}=    Get Request    sdnc    ${SDN_APIDOCS_URI}    headers=${headers}
-    Log    ${resp.content}
-    Should Contain    ${resp.content}    SLI-API  
+    Log    ${resp.text}
+    Should Contain    ${resp.text}    SLI-API
 
 Check VNF-API
     Create Session   sdnc  http://localhost:8282
     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
     ${resp}=    Get Request    sdnc    ${SDN_APIDOCS_URI}    headers=${headers}
-    Log    ${resp.content}
-    Should Contain    ${resp.content}    VNF-API
+    Log    ${resp.text}
+    Should Contain    ${resp.text}    VNF-API
 
 Test Preload
     Create Session   sdnc  http://localhost:8282/restconf
-    ${data}=    Get Binary File     ${CURDIR}${/}data${/}preload.json
+    ${data}=    Get File     ${CURDIR}${/}data${/}preload.json
     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
     ${resp}=    Post Request    sdnc    ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}    data=${data}    headers=${headers}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Be Equal As Strings  ${resp.json()['output']['response-code']}   200
-
index 93b3170..879c23d 100644 (file)
@@ -1,7 +1,7 @@
 version: '3'
 services:
     vid-server:
-        image: nexus3.onap.org:10001/onap/vid:latest
+        image: nexus3.onap.org:10001/onap/vid:3.0-STAGING-latest
         environment:
             - VID_MYSQL_DBNAME=vid_openecomp_epsdk
             - VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
@@ -23,7 +23,6 @@ services:
         container_name: vid-mariadb
         volumes:
             - ${WORKSPACE}/data/clone/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf
-            - ${WORKSPACE}/data/clone/vid/lf_config/vid-schema.sql:/docker-entrypoint-initdb.d/vid-schema.sql
             - /var/lib/mysql
 
     sdc_simulator:
index 77b8233..4dad43e 100755 (executable)
@@ -51,14 +51,14 @@ if [ "$full_deletion" = true ];then
     sleep 10
 
     # delete all instances
-    openstack server delete $(openstack server list -c ID -f value)
+    openstack server delete $(openstack server list -c ID -f value --project $OS_PROJECT_ID)
     sleep 1
 
     # miscellaneous cleanup
-    openstack floating ip delete $(openstack floating ip list -c ID -f value)
+    openstack floating ip delete $(openstack floating ip list -c ID -f value --project $OS_PROJECT_ID)
     sleep 1
 
-    ROUTERS=$(openstack router list -c ID -f value)
+    ROUTERS=$(openstack router list -c ID -f value --project $OS_PROJECT_ID)
     echo $ROUTERS
     for ROUTER in $ROUTERS; do
         echo $ROUTER;
@@ -69,11 +69,11 @@ if [ "$full_deletion" = true ];then
         openstack router delete $ROUTER
     done
 
-    openstack port delete $(openstack port list -f value -c ID)
-    openstack volume delete $(openstack volume list -f value -c ID)
+    openstack port delete $(openstack port list -f value -c ID --project $OS_PROJECT_ID)
+    openstack volume delete $(openstack volume list -f value -c ID --project $OS_PROJECT_ID)
 
     # delete all except "default" security group
-    SECURITY_GROUPS=$(openstack security group list -c ID -f value | grep -v default)
+    SECURITY_GROUPS=$(openstack security group list -c ID -f value --project $OS_PROJECT_ID | grep -v default)
     openstack security group delete $SECURITY_GROUPS
     sleep 1
 
index d53a075..b1ff560 100644 (file)
@@ -14,6 +14,7 @@ The configuration for simulator is stored in */config/config.json* file.
 It contains all parameters for simulation such as duration time,interval between messages and values of the configurable fields of VES message. 
 If you want to change duration or value of message sending to VES collector you just need to edit this file. 
 The message that is being sent to VES is built inside the simulator and it's content can be found in log of the simulator. 
+Proper config must contain *simulatorParams*, *commonEventHeaderParams* and *pnfRegistrationParams* or notificationParams. 
 
 ###Running simulator   
 The recommended way is to checkout PNF Simulator project from ONAP Git repository and use *simulator*.sh script
@@ -32,6 +33,13 @@ Connection to SFTP server is being done with usage of SSH keys. Private key is s
 In order to download *sftp-file.txt* file simply run *sftp -P 2222 -i ssh/ssh_host_rsa_key sftp-user@localhost:sftp/sftp-file.txt*
 In order to add a new file (e.g. test.zip), put the file into *sftp* directory and run simulator.
 After that again execute sftp command: *sftp -P 2222 -i ssh/ssh_host_rsa_key sftp-user@localhost:sftp/test.zip*
+In order to disable usage of SSH keys and start using password, change in *docker-compose.yml* service *sftp-service* entry *command* from *sftp-user::1001* to *sftp-user:password:1001*
+
+###FTPES support
+PNF Simulator allows to serve files via FTPES server. FTPES server has predefined user: onap with password: pano. 
+In order to connect we execute command *ftp-ssl host* and then enter user name and password.
+In order to download execute command while logged in*get file_name*.
+In order to add a new file execute command while logged in*put file_name*.
 
 ###Developer mode
 For development of PNF Simulator, run *simulator.sh* start-dev in order to run Netopeer.
index 2a67be5..6311d5e 100644 (file)
@@ -1,24 +1,45 @@
-
 {
   "simulatorParams": {
     "vesServerUrl": "http://VES-HOST:VES-PORT/eventListener/v7",
     "testDuration": "10",
     "messageInterval": "1"
   },
-  "messageParams": {
-    "pnf_serialNumber": "6061ZW3",
-    "pnf_vendorName": "Nokia",
-    "pnf_oamV4IpAddress": "val3",
-    "pnf_oamV6IpAddress": "val4",
-    "pnf_unitFamily": "BBU",
-    "pnf_modelNumber": "val6",
-    "pnf_softwareVersion": "val7",
-    "pnf_unitType": "val8",
+  "commonEventHeaderParams": {
     "eventName": "pnfRegistration_Nokia_5gDu",
     "nfNamingCode": "gNB",
     "nfcNamingCode": "oam",
     "sourceName": "NOK6061ZW3",
     "sourceId": "val13",
     "reportingEntityName": "NOK6061ZW3"
+  },
+  "pnfRegistrationParams": {
+    "serialNumber": "6061ZW3",
+    "vendorName": "Nokia",
+    "oamV4IpAddress": "val3",
+    "oamV6IpAddress": "val4",
+    "unitFamily": "BBU",
+    "modelNumber": "val6",
+    "softwareVersion": "val7",
+    "unitType": "val8"
+  },
+  "notificationParams": {
+    "changeIdentifier": "PM_MEAS_FILES",
+    "changeType": "FileReady",
+    "arrayOfNamedHashMap": [
+      {"name": "A20161221.1031-1041.bin.gz", "hashMap": {
+        "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+        "compression": "gzip",
+        "fileformatType": "org.3GPP.32.435#measCollec",
+        "fileFormatVersion": "V10"
+      }
+      },
+      {"name": "A20161222.1042-1102.bin.gz", "hashMap": {
+        "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
+        "compression": "gzip",
+        "fileFormatType": "org.3GPP.32.435#measCollec",
+        "fileFormatVersion": "V10"
+      }
+      }
+    ]
   }
 }
index 5f73cde..f3500d2 100644 (file)
@@ -27,6 +27,7 @@ services:
     restart: on-failure
     depends_on:
       - sftp-server
+      - ftpes-server
 
   sftp-server:
     container_name: sftp-server
@@ -37,4 +38,19 @@ services:
       - ./sftp:/home/sftp-user/sftp
       - ./ssh/ssh_host_rsa_key.pub:/home/sftp-user/.ssh/keys/ssh_host_rsa_key.pub:ro
     restart: on-failure
-    command: sftp-user::1001
\ No newline at end of file
+    command: sftp-user::1001
+
+  ftpes-server:
+    container_name: ftpes-server
+    image: stilliard/pure-ftpd:latest
+    ports:
+      - "2221:21"
+#      - "30000-30009:30000-30009"
+    volumes:
+      - ./ftpes/userpass/:/etc/pure-ftpd/passwd/
+      - ./ftpes/tls/:/etc/ssl/private/
+    environment:
+      PUBLICHOST: localhost
+      ADDED_FLAGS: --tls=2
+#    entrypoint: /run.sh -c 5 -C 5 -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -p 30000:30009
+    restart: on-failure
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/ftpes/tls/pure-ftpd.pem b/test/mocks/pnfsimulator/ftpes/tls/pure-ftpd.pem
new file mode 100755 (executable)
index 0000000..0ce676e
--- /dev/null
@@ -0,0 +1,49 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHbSk5/cABTpCt
+q54QyTkhuhb84nEz5ztKL0hY56fsVtAA2gSAde+qV9YwUIuReOUhAF4RVVt2Lkn/
+1R0yX+0IjrXnO7jYzDj6QhgyqYKb3iQlvShZMMQ7qihn8qBxobk7+O10x6VLS2L8
+WYpQxGXu7T1qXbw10RhrqG8nbXYX+aHMsv9zMt9OYqKSI073OZR2vk3K49Uqcurj
+sXuRJOa10MRsxgA726pr8OLWAWejsoFaqP2fQS3HeT2RnAqPyAgPc0P6n7gxo0JU
+U5dPnrPbsvfdegIFxfc57oZXrLz7nYXkJEcjYTBFSQ+JAaRfx9kNXZ7Gft7EAMyF
+BLemY/0VAgMBAAECggEARD9bSHlKaCgW4xhEM8JpRt2EWG62BukvJSghPiupD/x1
+mpUBzWSO7GC68DXgTZxt7WlOx+fKMRuOP3sTTtX9LFyKa+PIUokxRpOv7EaOaAER
+pciiMkO6JCELSueBeOG7noaF3N0l+CqIaYvLBfDwYV/XELubWV+BV/aAc6HGNFWi
+4bjM+BOBLQstrEeJh2jVylzv4CTtlTs2pwiHFSyrHhudTk5nnATAHn1gi+X42v1A
+zk3UfqADZJmMI0/Roup4YPZ3+6zUzDN2i+qasHexL0OKIjRcSqpgqQoIeKEbKKfw
+sOgiWIR2Xvj7EJmhzJlWgKjk8OLs/7U4QpnD+s0agQKBgQDu3ojqKNWnPHy0Nupm
+tmAs28WLK76R0iZeAd2nwsU2K6lnm9z5o2ab3ffTJVB9kAetKJa3UerKskF/qF9C
+MtjlEn6F++uYFitpLjQevnyrKSqFqbzytDXrQlk+gZLglmi6YylT5k9qLSREAu55
+XS/wbm9XU2Q7sl8oTnZHXptT7QKBgQDVunvqdDn1FaNU9EwQCGPS3QGu+go22xkM
+4Rs2CoHWfqmhGOo8lJKBElDqsXvxggrZLWJe/1lgnELT/9aXS8QLWBnZxpTj9wfd
+igH+CJc3mWnLThmUGdSV/tuHon2IdQ8/1CiGSwIr9kYCnStidUtOXjIbgc6kUTTi
+5wtIGHh4yQKBgQDXJ/0dJbDklRgiX4CdCdLxNPfnlnxt7mN+s6GK1WY7l/JcD8ln
+1qW66aGrP2YT42L2tqOi9hdNgmh66xb6ksBI/XKXjsWz1Ow/Lk3mD2BN76OMh8pY
+trgGc1ndcmrw/qnQkTcNilqn4YdT92wER0rB/0cs2kFjgBQ0QxBI0s+INQKBgA6Y
+2fW9UmgGvk0DEl7V89tm9MJ6mU/9zswuY6lhNlTr+bHi/bx9eTQPiC8/R/PKqesD
+SoCqd/Q9N+M6yfEzX4RW1A0nnuui54qd7lznQUyu0abtApo22WoVKfEti91SAWSe
+nNXvMYrHGyj6iwgCcs47aLiwOOjIExCcLw0RfsjhAoGAc1zaRbrtjjh66FJYjLiJ
+Q6EXfm31ptaQQUn5rQyHMD2VRlajCYV+fv75tezf2dQvJcqHYWrEuY8U+OTbB1TB
+IEqN8ETUeLegl5RgvWoyWinqdbv/0d9LtwVBdtiEQLoYumD934mshEDgzCOOjrBe
+Salcd1vc6y6NiFooPlvloXQ=
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIIDYDCCAkigAwIBAgIJAMH2upKd2yAJMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTgwOTEwMTI1ODE2WhcNMzgwOTA1MTI1ODE2WjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEAx20pOf3AAU6QraueEMk5IboW/OJxM+c7Si9IWOen7FbQANoEgHXvqlfW
+MFCLkXjlIQBeEVVbdi5J/9UdMl/tCI615zu42Mw4+kIYMqmCm94kJb0oWTDEO6oo
+Z/KgcaG5O/jtdMelS0ti/FmKUMRl7u09al28NdEYa6hvJ212F/mhzLL/czLfTmKi
+kiNO9zmUdr5NyuPVKnLq47F7kSTmtdDEbMYAO9uqa/Di1gFno7KBWqj9n0Etx3k9
+kZwKj8gID3ND+p+4MaNCVFOXT56z27L33XoCBcX3Oe6GV6y8+52F5CRHI2EwRUkP
+iQGkX8fZDV2exn7exADMhQS3pmP9FQIDAQABo1MwUTAdBgNVHQ4EFgQUt51lQ+ab
+MTq+w2U/knCsIPb3wrkwHwYDVR0jBBgwFoAUt51lQ+abMTq+w2U/knCsIPb3wrkw
+DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAQ69AktYLQ+VRbojz
+zC0XQ2M1FAkfJI2P0LvPoYxZgId2CnZW3sMIdnJdF+KjvOqeGyFmw+hn8WkoKiWj
+0sxuGmrWt5t+5bF2wcq0CtTeF1/o6DsRhRiJBzmcLe81ItrN6emZSg96xCKzkHBZ
+3nF4fG88vtiYgD932lMStDqQzSTx0FsCGpGaKh9xDmKvlP24NWdM9gyOEsRbDvqd
+vS1Q45Jx0jzkp7X5d0casqBWIZak3z0EVdK7c8Y/GxxTcWfIMINCl9+F9kpTA/ZX
+uARYzrPWaBfDBi2r5acWi/AHJM3U+LgzO5nCKa+38vtjNw3NtbslA4InQ5cU2B8X
+QN8NlQ==
+-----END CERTIFICATE-----
diff --git a/test/mocks/pnfsimulator/ftpes/userpass/pureftpd.passwd b/test/mocks/pnfsimulator/ftpes/userpass/pureftpd.passwd
new file mode 100755 (executable)
index 0000000..7961e71
--- /dev/null
@@ -0,0 +1 @@
+onap:$6$Guq6OMhBdNZ6nTk0$7dLt6hOrAv.in36jzWGd5UgWeDqN3CuKjrzJ.izRTdgZRTszeNYbT2dk7UDh9CLD7pohnB0.k1NSZmRIUB/ID/:1001:1001::/home/ftpusers/onap/./::::::::::::
index 195f4bf..f5573af 100644 (file)
 {
-  "$id": "http://example.com/example.json",
+  "$schema": "http://json-schema.org/draft-04/schema#",
   "type": "object",
-  "definitions": {},
-  "$schema": "http://json-schema.org/draft-07/schema#",
   "properties": {
     "simulatorParams": {
-      "$id": "/properties/simulatorParams",
       "type": "object",
       "properties": {
         "vesServerUrl": {
-          "$id": "/properties/simulatorParams/properties/vesServerUrl",
-          "type": "string",
-          "title": "The Vesserverurl Schema ",
-          "default": "",
-          "examples": [
-            "http://10.42.111.53:VES-PORT/eventListener/v7"
-          ]
+          "type": "string"
         },
         "testDuration": {
-          "$id": "/properties/simulatorParams/properties/testDuration",
-          "type": "string",
-          "title": "The Testduration Schema ",
-          "default": "",
-          "examples": [
-            "10"
-          ]
+          "type": "string"
         },
         "messageInterval": {
-          "$id": "/properties/simulatorParams/properties/messageInterval",
-          "type": "string",
-          "title": "The Messageinterval Schema ",
-          "default": "",
-          "examples": [
-            "1"
-          ]
+          "type": "string"
         }
-      }
+      },
+      "required": [
+        "vesServerUrl",
+        "testDuration",
+        "messageInterval"
+      ]
     },
-    "messageParams": {
-      "$id": "/properties/messageParams",
+    "commonEventHeaderParams": {
       "type": "object",
       "properties": {
-        "pnf_serialNumber": {
-          "$id": "/properties/messageParams/properties/pnf_serialNumber",
-          "type": "string",
-          "title": "The Pnf_serialnumber Schema ",
-          "default": "",
-          "examples": [
-            "6061ZW3"
-          ]
-        },
-        "pnf_vendorName": {
-          "$id": "/properties/messageParams/properties/pnf_vendorName",
-          "type": "string",
-          "title": "The Pnf_vendorname Schema ",
-          "default": "",
-          "examples": [
-            "Nokia"
-          ]
-        },
-        "pnf_oamV4IpAddress": {
-          "$id": "/properties/messageParams/properties/pnf_oamV4IpAddress",
-          "type": "string",
-          "title": "The Pnf_oamv4ipaddress Schema ",
-          "default": "",
-          "examples": [
-            "val3"
-          ]
-        },
-        "pnf_oamV6IpAddress": {
-          "$id": "/properties/messageParams/properties/pnf_oamV6IpAddress",
-          "type": "string",
-          "title": "The Pnf_oamv6ipaddress Schema ",
-          "default": "",
-          "examples": [
-            "val4"
-          ]
-        },
-        "pnf_unitFamily": {
-          "$id": "/properties/messageParams/properties/pnf_unitFamily",
-          "type": "string",
-          "title": "The Pnf_unitfamily Schema ",
-          "default": "",
-          "examples": [
-            "BBU"
-          ]
-        },
-        "pnf_modelNumber": {
-          "$id": "/properties/messageParams/properties/pnf_modelNumber",
-          "type": "string",
-          "title": "The Pnf_modelnumber Schema ",
-          "default": "",
-          "examples": [
-            "val6"
-          ]
-        },
-        "pnf_softwareVersion": {
-          "$id": "/properties/messageParams/properties/pnf_softwareVersion",
-          "type": "string",
-          "title": "The Pnf_softwareversion Schema ",
-          "default": "",
-          "examples": [
-            "val7"
-          ]
-        },
-        "pnf_unitType": {
-          "$id": "/properties/messageParams/properties/pnf_unitType",
-          "type": "string",
-          "title": "The Pnf_unittype Schema ",
-          "default": "",
-          "examples": [
-            "val8"
-          ]
-        },
         "eventName": {
-          "$id": "/properties/messageParams/properties/eventName",
-          "type": "string",
-          "title": "The Eventname Schema ",
-          "default": "",
-          "examples": [
-            "pnfRegistration_Nokia_5gDu"
-          ]
+          "type": "string"
         },
         "nfNamingCode": {
-          "$id": "/properties/messageParams/properties/nfNamingCode",
-          "type": "string",
-          "title": "The Nfnamingcode Schema ",
-          "default": "",
-          "examples": [
-            "gNB"
-          ]
+          "type": "string"
         },
         "nfcNamingCode": {
-          "$id": "/properties/messageParams/properties/nfcNamingCode",
-          "type": "string",
-          "title": "The Nfcnamingcode Schema ",
-          "default": "",
-          "examples": [
-            "oam"
-          ]
+          "type": "string"
         },
         "sourceName": {
-          "$id": "/properties/messageParams/properties/sourceName",
-          "type": "string",
-          "title": "The Sourcename Schema ",
-          "default": "",
-          "examples": [
-            "NOK6061ZW3"
-          ]
+          "type": "string"
         },
         "sourceId": {
-          "$id": "/properties/messageParams/properties/sourceId",
-          "type": "string",
-          "title": "The Sourceid Schema ",
-          "default": "",
-          "examples": [
-            "val13"
-          ]
+          "type": "string"
         },
         "reportingEntityName": {
-          "$id": "/properties/messageParams/properties/reportingEntityName",
-          "type": "string",
-          "title": "The Reportingentityname Schema ",
-          "default": "",
-          "examples": [
-            "NOK6061ZW3"
-          ]
+          "type": "string"
         }
       },
       "required": [
-        "pnf_serialNumber",
-        "pnf_vendorName"
-      ],
-      "anyOf": [
-        {
-          "required": [
-            "pnf_oamV4IpAddress"
-          ]
+        "eventName",
+        "nfNamingCode",
+        "nfcNamingCode",
+        "sourceName",
+        "sourceId",
+        "reportingEntityName"
+      ]
+    },
+
+
+    "pnfRegistrationParams": {
+      "type": "object",
+      "properties": {
+        "serialNumber": {
+          "type": "string"
+        },
+        "vendorName": {
+          "type": "string"
         },
-        {
-          "required": [
-            "pnf_oamV6IpAddress"
+        "oamV4IpAddress": {
+          "type": "string"
+        },
+        "oamV6IpAddress": {
+          "type": "string"
+        },
+        "unitFamily": {
+          "type": "string"
+        },
+        "modelNumber": {
+          "type": "string"
+        },
+        "softwareVersion": {
+          "type": "string"
+        },
+        "unitType": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "serialNumber",
+        "vendorName",
+        "oamV4IpAddress",
+        "oamV6IpAddress",
+        "unitFamily",
+        "modelNumber",
+        "softwareVersion",
+        "unitType"
+      ]
+    },
+    "notificationParams": {
+      "type": "object",
+      "properties": {
+        "changeIdentifier": {
+          "type": "string"
+        },
+        "changeType": {
+          "type": "string"
+        },
+        "arrayOfNamedHashMap": {
+          "type": "array",
+          "items": [
+            {
+              "type": "object",
+              "properties": {
+                "name": {
+                  "type": "string"
+                },
+                "hashMap": {
+                  "type": "object",
+                  "properties": {
+                    "location": {
+                      "type": "string"
+                    },
+                    "compression": {
+                      "type": "string"
+                    },
+                    "fileformatType": {
+                      "type": "string"
+                    },
+                    "fileFormatVersion": {
+                      "type": "string"
+                    }
+                  },
+                  "required": [
+                    "location",
+                    "compression",
+                    "fileformatType",
+                    "fileFormatVersion"
+                  ]
+                }
+              },
+              "required": [
+                "name",
+                "hashMap"
+              ]
+            },
+            {
+              "type": "object",
+              "properties": {
+                "name": {
+                  "type": "string"
+                },
+                "hashMap": {
+                  "type": "object",
+                  "properties": {
+                    "location": {
+                      "type": "string"
+                    },
+                    "compression": {
+                      "type": "string"
+                    },
+                    "fileFormatType": {
+                      "type": "string"
+                    },
+                    "fileFormatVersion": {
+                      "type": "string"
+                    }
+                  },
+                  "required": [
+                    "location",
+                    "compression",
+                    "fileFormatType",
+                    "fileFormatVersion"
+                  ]
+                }
+              },
+              "required": [
+                "name",
+                "hashMap"
+              ]
+            }
           ]
         }
+      },
+      "required": [
+        "changeIdentifier",
+        "changeType",
+        "arrayOfNamedHashMap"
       ]
     }
   },
-  "required": [
-    "simulatorParams",
-    "messageParams"
+
+  "oneOf": [
+    {
+      "required": [
+        "simulatorParams",
+        "commonEventHeaderParams",
+        "pnfRegistrationParams"
+      ]
+    },
+    {
+      "required": [
+        "simulatorParams",
+        "commonEventHeaderParams",
+        "notificationParams"
+      ]
+    }
   ]
+
+
 }
\ No newline at end of file
index 563ee27..b4adcd8 100644 (file)
@@ -4,10 +4,11 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
+
   <parent>
     <groupId>org.onap.oparent</groupId>
     <artifactId>oparent</artifactId>
-    <version>1.1.0</version>
+    <version>1.2.1</version>
   </parent>
 
   <groupId>org.onap.pnfsimulator</groupId>
       </plugin>
     </plugins>
   </build>
-</project>
\ No newline at end of file
+</project>
index fd2b95a..3ebf567 100644 (file)
 
 package org.onap.pnfsimulator.message;
 
-import static org.onap.pnfsimulator.message.MessageConstants.*;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT_ID;
+import static org.onap.pnfsimulator.message.MessageConstants.INTERNAL_HEADER_FIELDS;
+import static org.onap.pnfsimulator.message.MessageConstants.LAST_EPOCH_MICROSEC;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS_VERSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_LAST_SERVICE_DATE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_MANUFACTURE_DATE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS_VERSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY;
+import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY_NORMAL;
+import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE;
+import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE_NUMBER;
+import static org.onap.pnfsimulator.message.MessageConstants.START_EPOCH_MICROSEC;
+import static org.onap.pnfsimulator.message.MessageConstants.VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.VERSION_NUMBER;
+import static org.onap.pnfsimulator.message.MessageConstants.VES_EVENT_LISTENER_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.VES_EVENT_LISTENER_VERSION_NUMBER;
 
 import org.json.JSONObject;
 
@@ -29,9 +46,7 @@ final class JSONObjectFactory {
     static JSONObject generateConstantCommonEventHeader() {
         JSONObject commonEventHeader = new JSONObject();
         long timestamp = System.currentTimeMillis();
-        commonEventHeader.put(DOMAIN, PNF_REGISTRATION);
         commonEventHeader.put(EVENT_ID, generateEventId());
-        commonEventHeader.put(EVENT_TYPE, PNF_REGISTRATION);
         commonEventHeader.put(LAST_EPOCH_MICROSEC, timestamp);
         commonEventHeader.put(PRIORITY, PRIORITY_NORMAL);
         commonEventHeader.put(SEQUENCE, SEQUENCE_NUMBER);
@@ -50,13 +65,20 @@ final class JSONObjectFactory {
         return pnfRegistrationFields;
     }
 
+    static JSONObject generateNotificationFields() {
+        JSONObject notificationFields = new JSONObject();
+        notificationFields.put(NOTIFICATION_FIELDS_VERSION, NOTIFICATION_FIELDS_VERSION_VALUE);
+        return notificationFields;
+    }
+
+
     static String generateEventId() {
         String timeAsString = String.valueOf(System.currentTimeMillis());
         return String.format("registration_%s",
             timeAsString.substring(timeAsString.length() - 11, timeAsString.length() - 3));
     }
 
-    private JSONObjectFactory(){
+    private JSONObjectFactory() {
 
     }
 
index 7861d5f..95e8f69 100644 (file)
@@ -22,9 +22,25 @@ package org.onap.pnfsimulator.message;
 
 public final class MessageConstants {
 
-    public static final String SIMULATOR_PARAMS_CONTAINER = "simulatorParams";
-    public static final String MESSAGE_PARAMS_CONTAINER = "messageParams";
+    public static final String SIMULATOR_PARAMS = "simulatorParams";
+    public static final String COMMON_EVENT_HEADER_PARAMS = "commonEventHeaderParams";
+    public static final String PNF_REGISTRATION_PARAMS = "pnfRegistrationParams";
+    public static final String NOTIFICATION_PARAMS = "notificationParams";
+
+    static final String COMMON_EVENT_HEADER = "commonEventHeader";
+    static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields";
+    static final String NOTIFICATION_FIELDS = "notificationFields";
     static final String EVENT = "event";
+
+    //=============================================================================================
+    //Simulation parameters
+    public static final String VES_SERVER_URL = "vesServerUrl";
+    public static final String TEST_DURATION = "testDuration";
+    public static final String MESSAGE_INTERVAL = "messageInterval";
+
+    //=============================================================================================
+    //commonEventHeader
+    //parameters
     static final String DOMAIN = "domain";
     static final String EVENT_ID = "eventId";
     static final String EVENT_TYPE = "eventType";
@@ -34,32 +50,30 @@ public final class MessageConstants {
     static final String START_EPOCH_MICROSEC = "startEpochMicrosec";
     static final String INTERNAL_HEADER_FIELDS = "internalHeaderFields";
     static final String VERSION = "version";
-    static final String PNF_REGISTRATION_FIELDS_VERSION = "pnfRegistrationFieldsVersion";
-    static final String PNF_LAST_SERVICE_DATE = "lastServiceDate";
-    static final String PNF_MANUFACTURE_DATE = "manufactureDate";
     static final String VES_EVENT_LISTENER_VERSION = "vesEventListenerVersion";
-
-    // mandatory used in json file, but not in java logic
-    //public static final String PNF_OAM_IPV4_ADDRESS = "pnfOamIpv4Address";
-    //public static final String PNF_OAM_IPV6_ADDRESS = "pnfOamIpv6Address";
-    //public static final String PNF_SERIAL_NUMBER = "pnfSerialNumber";
-    //public static final String PNF_VENDOR_NAME = "pnfVendorName";
-    public static final String VES_SERVER_URL = "vesServerUrl";
-    public static final String TEST_DURATION = "testDuration";
-    public static final String MESSAGE_INTERVAL = "messageInterval";
-    static final String PNF_PREFIX = "pnf_";
-    static final String COMMON_EVENT_HEADER = "commonEventHeader";
-    static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields";
-
-
-    //===============================================================
     //constant values
-    static final String PNF_REGISTRATION ="pnfRegistration";
-    static final String PRIORITY_NORMAL = "Normal";
+    static final int SEQUENCE_NUMBER = 0;
     static final String VERSION_NUMBER = "4.0.1";
     static final String VES_EVENT_LISTENER_VERSION_NUMBER = "7.0.1";
+    static final String PRIORITY_NORMAL = "Normal";
+
+    //=============================================================================================
+    //PNF registration
+    //parameters
+    static final String PNF_REGISTRATION_FIELDS_VERSION = "pnfRegistrationFieldsVersion";
+    static final String PNF_LAST_SERVICE_DATE = "lastServiceDate";
+    static final String PNF_MANUFACTURE_DATE = "manufactureDate";
+    //constant values
     static final String PNF_REGISTRATION_FIELDS_VERSION_VALUE = "2.0";
-    static final int SEQUENCE_NUMBER = 0;
+    static final String DOMAIN_PNF_REGISTRATION ="pnfRegistration";
+
+    //=============================================================================================
+    // Notifications
+    //parameters
+    static final String NOTIFICATION_FIELDS_VERSION = "notificationFieldsVersion";
+    //constant values
+    static final String NOTIFICATION_FIELDS_VERSION_VALUE = "2.0";
+    static final String DOMAIN_NOTIFICATION ="notification";
 
     private MessageConstants() {
     }
index 7c3bf9e..13114ee 100644 (file)
 package org.onap.pnfsimulator.message;
 
 import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER;
+import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN;
 import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
-import static org.onap.pnfsimulator.message.MessageConstants.PNF_PREFIX;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS;
+import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN_PNF_REGISTRATION;
+import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN_NOTIFICATION;
 import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
 
 import java.util.Map;
+import java.util.Optional;
 import org.json.JSONObject;
 
 public class MessageProvider {
 
-    public JSONObject createMessage(JSONObject params) {
+    public JSONObject createMessage(JSONObject commonEventHeaderParams, Optional<JSONObject> pnfRegistrationParams,
+        Optional<JSONObject> notificationParams) {
 
-        if (params == null) {
-            throw new IllegalArgumentException("Params object cannot be null");
+        if (!pnfRegistrationParams.isPresent() && !notificationParams.isPresent()) {
+            throw new IllegalArgumentException(
+                "Both PNF registration and notification parameters objects are not present");
         }
+        JSONObject event = new JSONObject();
 
-        Map<String, Object> paramsMap = params.toMap();
-        JSONObject root = new JSONObject();
         JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
-        JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        Map<String, Object> commonEventHeaderFields = commonEventHeaderParams.toMap();
+        commonEventHeaderFields.forEach((key, value) -> {
+            commonEventHeader.put(key, value);
+        });
 
-        paramsMap.forEach((key, value) -> {
+        JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        pnfRegistrationParams.ifPresent(jsonObject -> {
+            copyParametersToFields(jsonObject.toMap(), pnfRegistrationFields);
+            commonEventHeader.put(DOMAIN, DOMAIN_PNF_REGISTRATION);
+            commonEventHeader.put(EVENT_TYPE, DOMAIN_PNF_REGISTRATION);
+            event.put(PNF_REGISTRATION_FIELDS, pnfRegistrationFields);
+        });
 
-            if (key.startsWith(PNF_PREFIX)) {
-                pnfRegistrationFields.put(key.substring(PNF_PREFIX.length()), value);
-            } else {
-                commonEventHeader.put(key, value);
-            }
+        JSONObject notificationFields = JSONObjectFactory.generateNotificationFields();
+        notificationParams.ifPresent(jsonObject -> {
+            copyParametersToFields(jsonObject.toMap(), notificationFields);
+            commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
+            event.put(NOTIFICATION_FIELDS, notificationFields);
         });
 
-        JSONObject event = new JSONObject();
         event.put(COMMON_EVENT_HEADER, commonEventHeader);
-        event.put(PNF_REGISTRATION_FIELDS, pnfRegistrationFields);
+        JSONObject root = new JSONObject();
         root.put(EVENT, event);
         return root;
     }
 
+    private void copyParametersToFields(Map<String, Object> paramersMap, JSONObject fieldsJsonObject) {
+        paramersMap.forEach((key, value) -> {
+            fieldsJsonObject.put(key, value);
+        });
+    }
+
 }
index 3b275a6..506d21b 100644 (file)
@@ -27,7 +27,8 @@ import static org.onap.pnfsimulator.logging.MDCVariables.RESPONSE_CODE;
 import static org.onap.pnfsimulator.logging.MDCVariables.SERVICE_NAME;
 import static org.onap.pnfsimulator.logging.MDCVariables.X_INVOCATION_ID;
 import static org.onap.pnfsimulator.logging.MDCVariables.X_ONAP_REQUEST_ID;
-import static org.onap.pnfsimulator.message.MessageConstants.SIMULATOR_PARAMS_CONTAINER;
+import static org.onap.pnfsimulator.message.MessageConstants.SIMULATOR_PARAMS;
+import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER_PARAMS;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.MESSAGE;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.REMAINING_TIME;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.SIMULATOR_STATUS;
@@ -40,6 +41,7 @@ import java.io.IOException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.util.Optional;
 import java.util.UUID;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -65,7 +67,6 @@ import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-
 @RestController
 @RequestMapping("/simulator")
 public class SimulatorController {
@@ -74,7 +75,6 @@ public class SimulatorController {
     private static final DateFormat RESPONSE_DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss,SSS");
     private final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
     private Simulator simulator;
-
     private JSONValidator validator;
     private SimulatorFactory factory;
 
@@ -90,7 +90,7 @@ public class SimulatorController {
         MDC.put(INVOCATION_ID, headers.getFirst(X_INVOCATION_ID));
         MDC.put(INSTANCE_UUID, UUID.randomUUID().toString());
         MDC.put(SERVICE_NAME, "/simulator/start");
-        LOGGER.info(ENTRY,"Simulator starting");
+        LOGGER.info(ENTRY, "Simulator starting");
 
         if (isSimulatorRunning()) {
             MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
@@ -103,12 +103,15 @@ public class SimulatorController {
 
         try {
             validator.validate(message, "json_schema/input_validator.json");
-
             JSONObject root = new JSONObject(message);
-            JSONObject simulatorParams = root.getJSONObject(SIMULATOR_PARAMS_CONTAINER);
-            JSONObject messageParams = root.getJSONObject(MessageConstants.MESSAGE_PARAMS_CONTAINER);
-
-            simulator = factory.create(simulatorParams, messageParams);
+            JSONObject simulatorParams = root.getJSONObject(SIMULATOR_PARAMS);
+            JSONObject commonEventHeaderParams = root.getJSONObject(COMMON_EVENT_HEADER_PARAMS);
+            Optional<JSONObject> pnfRegistrationFields = root.has(MessageConstants.PNF_REGISTRATION_PARAMS) ? Optional
+                .of(root.getJSONObject(MessageConstants.PNF_REGISTRATION_PARAMS)) : Optional.empty();
+            Optional<JSONObject> notificationFields = root.has(MessageConstants.NOTIFICATION_PARAMS) ? Optional
+                .of(root.getJSONObject(MessageConstants.NOTIFICATION_PARAMS)) : Optional.empty();
+            simulator = factory
+                .create(simulatorParams, commonEventHeaderParams, pnfRegistrationFields, notificationFields);
             simulator.start();
 
             MDC.put(RESPONSE_CODE, OK.toString());
@@ -145,8 +148,7 @@ public class SimulatorController {
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Unexpected exception: " + e.getMessage())
                 .build();
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
index 3948644..046c97c 100644 (file)
@@ -28,6 +28,7 @@ import static org.onap.pnfsimulator.message.MessageConstants.VES_SERVER_URL;
 import com.github.fge.jsonschema.core.exceptions.ProcessingException;
 import java.io.IOException;
 import java.time.Duration;
+import java.util.Optional;
 import org.json.JSONObject;
 import org.onap.pnfsimulator.message.MessageProvider;
 import org.onap.pnfsimulator.simulator.validation.JSONValidator;
@@ -49,13 +50,15 @@ public class SimulatorFactory {
         this.validator = validator;
     }
 
-    public Simulator create(JSONObject simulatorParams, JSONObject messageParams)
+    public Simulator create(JSONObject simulatorParams, JSONObject commonEventHeaderParams,
+        Optional<JSONObject> pnfRegistrationParams, Optional<JSONObject> notificationParams)
         throws ProcessingException, IOException, ValidationException {
         Duration duration = Duration.ofSeconds(parseInt(simulatorParams.getString(TEST_DURATION)));
         Duration interval = Duration.ofSeconds(parseInt(simulatorParams.getString(MESSAGE_INTERVAL)));
         String vesUrl = simulatorParams.getString(VES_SERVER_URL);
 
-        JSONObject messageBody = messageProvider.createMessage(messageParams);
+        JSONObject messageBody = messageProvider
+            .createMessage(commonEventHeaderParams, pnfRegistrationParams, notificationParams);
         validator.validate(messageBody.toString(), DEFAULT_OUTPUT_SCHEMA_PATH);
 
         return Simulator.builder()
index bc3d17f..4331195 100644 (file)
@@ -32,18 +32,14 @@ public class JSONObjectFactoryTest {
     @Test
     public void generateConstantCommonEventHeader_shouldCreateProperly(){
         JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
-        assertEquals(10,commonEventHeader.toMap().size());
-        assertTrue(commonEventHeader.has(DOMAIN));
+        assertEquals(8,commonEventHeader.toMap().size());
         assertTrue(commonEventHeader.has(EVENT_ID));
-        assertTrue(commonEventHeader.has(EVENT_TYPE));
         assertTrue(commonEventHeader.has(LAST_EPOCH_MICROSEC));
         assertTrue(commonEventHeader.has(PRIORITY));
         assertTrue(commonEventHeader.has(SEQUENCE));
         assertTrue(commonEventHeader.has(START_EPOCH_MICROSEC));
         assertTrue(commonEventHeader.has(INTERNAL_HEADER_FIELDS));
         assertTrue(commonEventHeader.has(VERSION));
-        assertEquals(commonEventHeader.get(DOMAIN),PNF_REGISTRATION);
-        assertEquals(commonEventHeader.get(EVENT_TYPE),PNF_REGISTRATION);
         assertEquals(commonEventHeader.get(PRIORITY),PRIORITY_NORMAL);
         assertEquals(commonEventHeader.get(SEQUENCE),SEQUENCE_NUMBER);
         assertEquals(commonEventHeader.get(VERSION),VERSION_NUMBER);
@@ -66,4 +62,12 @@ public class JSONObjectFactoryTest {
         assertTrue(eventId.startsWith("registration_"));
     }
 
+    @Test
+    public void generateNotificationFields_shouldCreateProperly(){
+        JSONObject notificationFields = JSONObjectFactory.generateNotificationFields();
+        assertEquals(1,notificationFields.keySet().size());
+        assertEquals(NOTIFICATION_FIELDS_VERSION_VALUE,notificationFields.get(NOTIFICATION_FIELDS_VERSION));
+
+    }
+
 }
index 3d1f253..aadb54c 100644 (file)
@@ -25,16 +25,21 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER;
 import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS;
 import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
 
+import java.util.Optional;
 import org.json.JSONObject;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
 public class MessageProviderTest {
 
-    private static final String testParamsJson =
-        "{\"key1\": \"val1\",\"key2\": \"val2\",\"pnf_key3\": \"pnfVal3\",\"key4\": \"val4\"}";
+    private static final String testParamsPnfRegistration =
+        "{\"pnfKey1\": \"pnfVal1\",\"pnfKey2\": \"pnfVal2\",\"pnfKey3\": \"pnfVal3\",\"pnfKey4\": \"pnfVal4\"}";
+
+    private static final String testParamsNotification =
+        "{\"notKey1\": \"notVal1\",\"notKey2\": \"notVal2\",\"notKey3\": \"notVal3\",\"notKey4\": \"notVal4\"}";
 
     private static MessageProvider messageProvider;
 
@@ -44,22 +49,25 @@ public class MessageProviderTest {
     }
 
     @Test
-    public void createMessage_should_throw_when_given_null_argument() {
+    public void createMessage_should_throw_when_given_empty_arguments() {
         assertThrows(IllegalArgumentException.class,
-            () -> messageProvider.createMessage(null),
+            () -> messageProvider.createMessage(new JSONObject(), Optional.empty(), Optional.empty()),
             "Params object cannot be null");
     }
 
     @Test
     public void createMessage_should_create_constant_message_when_no_params_specified() {
-        JSONObject message = messageProvider.createMessage(new JSONObject());
+        JSONObject message = messageProvider.createMessage(new JSONObject(), Optional.ofNullable(new JSONObject()),
+            Optional.ofNullable(new JSONObject()));
         JSONObject event = message.getJSONObject(EVENT);
 
         JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
         JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
+        JSONObject notificationFields = event.getJSONObject(NOTIFICATION_FIELDS);
 
         JSONObject expectedCommonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
         JSONObject expectedPnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        JSONObject expectedNotificationFields = JSONObjectFactory.generateNotificationFields();
 
         expectedCommonEventHeader
             .toMap()
@@ -70,22 +78,38 @@ public class MessageProviderTest {
             .toMap()
             .forEach((key, val) -> assertTrue(pnfRegistrationFields.has(key),
                 () -> String.format("Key %s is not present", key)));
+
+        expectedNotificationFields
+            .toMap()
+            .forEach((key, val) -> assertTrue(notificationFields.has(key),
+                () -> String.format("Key %s is not present", key)));
     }
 
+    @Test
+    public void createMessage_should_throw_exception_when_params_specified_as_empty() {
+        assertThrows(IllegalArgumentException.class,
+            () -> messageProvider.createMessage(new JSONObject(), Optional.empty(),
+                Optional.empty()));
+    }
 
     @Test
     public void createMessage_should_add_specified_params_to_valid_subobjects() {
-        JSONObject params = new JSONObject(testParamsJson);
-        JSONObject message = messageProvider.createMessage(params);
+        JSONObject message = messageProvider
+            .createMessage(new JSONObject(), Optional.of(new JSONObject(testParamsPnfRegistration)),
+                Optional.of(new JSONObject(testParamsNotification)));
         JSONObject event = message.getJSONObject(EVENT);
 
         JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
+        assertEquals(10, commonEventHeader.keySet().size());
+
         JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
+        assertEquals("pnfVal1", pnfRegistrationFields.getString("pnfKey1"));
+        assertEquals("pnfVal2", pnfRegistrationFields.getString("pnfKey2"));
+
+        JSONObject notificationFields = event.getJSONObject(NOTIFICATION_FIELDS);
+        assertEquals("notVal1", notificationFields.getString("notKey1"));
+        assertEquals("notVal2", notificationFields.getString("notKey2"));
 
-        assertEquals("pnfVal3", pnfRegistrationFields.getString("key3"));
-        assertEquals("val1", commonEventHeader.getString("key1"));
-        assertEquals("val2", commonEventHeader.getString("key2"));
-        assertEquals("val4", commonEventHeader.getString("key4"));
     }
 
 }
index 8cb1906..3603480 100644 (file)
@@ -55,25 +55,27 @@ class SimulatorControllerTest {
     private static final String JSON_STATUS_EXPRESSION = "$.simulatorStatus";
     private static final String PROPER_JSON = "{\n" +
         "  \"simulatorParams\": {\n" +
-        "    \"vesServerUrl\": \"http://10.154.187.70:8080/eventListener/v5\",\n" +
+        "    \"vesServerUrl\": \"http://10.154.187.70:8080/eventListener/v7\",\n" +
         "    \"testDuration\": \"10\",\n" +
         "    \"messageInterval\": \"1\"\n" +
         "  },\n" +
-        "  \"messageParams\": {\n" +
-        "    \"pnfSerialNumber\": \"val1\",\n" +
-        "    \"pnfVendorName\": \"val2\",\n" +
-        "    \"pnfOamIpv4Address\": \"val3\",\n" +
-        "    \"pnfOamIpv6Address\": \"val4\",\n" +
-        "    \"pnfFamily\": \"val5\",\n" +
-        "    \"pnfModelNumber\": \"val6\",\n" +
-        "    \"pnfSoftwareVersion\": \"val7\",\n" +
-        "    \"pnfType\": \"val8\",\n" +
-        "    \"eventName\": \"val9\",\n" +
-        "    \"nfNamingCode\": \"val10\",\n" +
-        "    \"nfcNamingCode\": \"val11\",\n" +
-        "    \"sourceName\": \"val12\",\n" +
-        "    \"sourceId\": \"val13\",\n" +
-        "    \"reportingEntityName\": \"val14\"\n" +
+        "  \"commonEventHeaderParams\": {\n" +
+        "    \"eventName\": \"val11\",\n" +
+        "    \"nfNamingCode\": \"val12\",\n" +
+        "    \"nfcNamingCode\": \"val13\",\n" +
+        "    \"sourceName\": \"val14\",\n" +
+        "    \"sourceId\": \"val15\",\n" +
+        "    \"reportingEntityName\": \"val16\",\n" +
+        "  },\n" +
+
+        "  \"pnfRegistrationParams\": {\n" +
+        "    \"SerialNumber\": \"val1\",\n" +
+        "    \"VendorName\": \"val2\",\n" +
+        "    \"OamIpv4Address\": \"val3\",\n" +
+        "    \"OamIpv6Address\": \"val4\",\n" +
+        "    \"Family\": \"val5\",\n" +
+        "    \"ModelNumber\": \"val6\",\n" +
+        "    \"SoftwareVersion\": \"val7\",\n" +
         "  }\n" +
         "}";
     private static final String WRONG_JSON = "{\n" +
@@ -119,7 +121,7 @@ class SimulatorControllerTest {
 
     @Test
     void wrongJSONFormatOnStart() throws Exception {
-        when(factory.create(any(), any())).thenReturn(simulator);
+        when(factory.create(any(),any(), any(),any())).thenReturn(simulator);
         doThrow(new ValidationException("")).when(validator).validate(anyString(), anyString());
 
         mockMvc.perform(post("/simulator/start").content(WRONG_JSON))
@@ -134,7 +136,7 @@ class SimulatorControllerTest {
         startSimulator();
 
         verify(validator).validate(anyString(), anyString());
-        verify(factory).create(any(), any());
+        verify(factory).create(any(),any(), any(),any());
         verify(simulator).start();
     }
 
@@ -185,7 +187,7 @@ class SimulatorControllerTest {
     }
 
     private void startSimulator() throws Exception {
-        when(factory.create(any(), any())).thenReturn(simulator);
+        when(factory.create(any(), any(), any(),any())).thenReturn(simulator);
 
         mockMvc
             .perform(post(START_URL).content(PROPER_JSON))
index 970f8cf..ea7a097 100644 (file)
@@ -22,18 +22,21 @@ package org.onap.pnfsimulator.simulator;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_MESSAGE_PARAMS_1;
-import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_MESSAGE_PARAMS_2;
-import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_MESSAGE_PARAMS_3;
+import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_NOTIFICATION_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_PNF_REGISTRATION_PARAMS_1;
+import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_PNF_REGISTRATION_PARAMS_2;
+import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_PNF_REGISTRATION_PARAMS_3;
 import static org.onap.pnfsimulator.simulator.TestMessages.INVALID_SIMULATOR_PARAMS;
-import static org.onap.pnfsimulator.simulator.TestMessages.VALID_MESSAGE_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.VALID_COMMON_EVENT_HEADER_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.VALID_NOTIFICATION_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.VALID_PNF_REGISTRATION_PARAMS;
 import static org.onap.pnfsimulator.simulator.TestMessages.VALID_SIMULATOR_PARAMS;
 
 import com.github.fge.jsonschema.core.exceptions.ProcessingException;
 import java.io.IOException;
+import java.util.Optional;
 import org.json.JSONException;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.onap.pnfsimulator.message.MessageProvider;
 import org.onap.pnfsimulator.simulator.validation.JSONValidator;
@@ -50,16 +53,25 @@ class SimulatorFactoryTest {
     }
 
     @Test
-    void should_successfully_create_simulator_given_valid_params_and_valid_output_message()
+    void should_successfully_create_simulator_given_valid_pnf_registration_params_and_valid_output_message()
         throws ValidationException, IOException, ProcessingException {
-        assertNotNull(simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_MESSAGE_PARAMS));
+        assertNotNull(simulatorFactory.create(VALID_SIMULATOR_PARAMS,VALID_COMMON_EVENT_HEADER_PARAMS,
+            VALID_PNF_REGISTRATION_PARAMS,Optional.empty()));
+    }
+
+    @Test
+    void should_successfully_create_simulator_given_valid_notification_params_and_valid_output_message()
+        throws ValidationException, IOException, ProcessingException {
+        assertNotNull(simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_COMMON_EVENT_HEADER_PARAMS,
+            Optional.empty(), VALID_NOTIFICATION_PARAMS));
     }
 
     @Test
     void should_throw_given_invalid_params() {
         assertThrows(
             JSONException.class,
-            () -> simulatorFactory.create(INVALID_SIMULATOR_PARAMS, VALID_MESSAGE_PARAMS));
+            () -> simulatorFactory.create(INVALID_SIMULATOR_PARAMS,VALID_COMMON_EVENT_HEADER_PARAMS,
+                VALID_PNF_REGISTRATION_PARAMS,Optional.empty()));
     }
 
     @Test
@@ -67,14 +79,22 @@ class SimulatorFactoryTest {
 
         assertThrows(
             ValidationException.class,
-            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_1));
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_COMMON_EVENT_HEADER_PARAMS,
+                INVALID_PNF_REGISTRATION_PARAMS_1, Optional.empty()));
+
+        assertThrows(
+            ValidationException.class,
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_COMMON_EVENT_HEADER_PARAMS,
+                INVALID_PNF_REGISTRATION_PARAMS_2, Optional.empty()));
 
         assertThrows(
             ValidationException.class,
-            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_2));
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_COMMON_EVENT_HEADER_PARAMS,
+                INVALID_PNF_REGISTRATION_PARAMS_3, Optional.empty()));
 
         assertThrows(
             ValidationException.class,
-            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_3));
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_COMMON_EVENT_HEADER_PARAMS,
+                VALID_PNF_REGISTRATION_PARAMS, INVALID_NOTIFICATION_PARAMS));
     }
 }
\ No newline at end of file
index 2f166b2..7511084 100644 (file)
 
 package org.onap.pnfsimulator.simulator;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
 import org.json.JSONObject;
 
 final class TestMessages {
 
-    static final JSONObject VALID_SIMULATOR_PARAMS = new JSONObject(
-        "{\n" +
-            "    \"vesServerUrl\": \"http://10.42.111.42:8080/eventListener/v5\",\n" +
-            "    \"testDuration\": \"10\",\n" +
-            "    \"messageInterval\": \"1\"\n" +
-            "}");
-
-
-    static final JSONObject VALID_MESSAGE_PARAMS = new JSONObject(
-        "{\n"
-            + "    \"pnf_serialNumber\": \"6061ZW3\",\n"
-            + "    \"pnf_vendorName\": \"Nokia\",\n"
-            + "    \"pnf_oamV4IpAddress\": \"val3\",\n"
-            + "    \"pnf_oamV6IpAddress\": \"val4\",\n"
-            + "    \"pnf_unitFamily\": \"BBU\",\n"
-            + "    \"pnf_modelNumber\": \"val6\",\n"
-            + "    \"pnf_softwareVersion\": \"val7\",\n"
-            + "    \"pnf_unitType\": \"val8\",\n"
-            + "    \"eventName\": \"pnfRegistration_Nokia_5gDu\",\n"
-            + "    \"nfNamingCode\": \"gNB\",\n"
-            + "    \"nfcNamingCode\": \"oam\",\n"
-            + "    \"sourceName\": \"NOK6061ZW3\",\n"
-            + "    \"sourceId\": \"val13\",\n"
-            + "    \"reportingEntityName\": \"NOK6061ZW3\"\n"
-            + "  }");
+    static final JSONObject VALID_SIMULATOR_PARAMS = new JSONObject(getContent("validSimulatorParams.json"));
+    static final JSONObject VALID_COMMON_EVENT_HEADER_PARAMS = new JSONObject(getContent("validCommonEventHeaderParams.json"));
+    static final Optional<JSONObject> VALID_PNF_REGISTRATION_PARAMS = Optional
+        .of(new JSONObject(getContent("validPnfRegistrationParams.json")));
+    static final Optional<JSONObject> VALID_NOTIFICATION_PARAMS = Optional
+        .of(new JSONObject(getContent("validNotificationParams.json")));
 
     static final JSONObject INVALID_SIMULATOR_PARAMS = new JSONObject(
         "{\n" +
@@ -57,7 +42,7 @@ final class TestMessages {
             "}");
 
 
-    static final JSONObject INVALID_MESSAGE_PARAMS_1 = new JSONObject(
+    static final Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_1 = Optional.of(new JSONObject(
         "{\n" +
             "    \"pnfSerialNumber\": \"val1\",\n" +
             "    \"pnfVendorName\": \"val2\",\n" +
@@ -71,9 +56,9 @@ final class TestMessages {
             "    \"sourceName\": \"val12\",\n" +
             "    \"sourceId\": \"val13\",\n" +
             "    \"reportingEntityName\": \"val14\"\n" +
-            "}");
+            "}"));
 
-    static final JSONObject INVALID_MESSAGE_PARAMS_2 = new JSONObject(
+    static final Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_2 = Optional.of(new JSONObject(
         "{\n" +
             "    \"pnfVendorName\": \"val2\",\n" +
             "    \"pnfOamIpv4Address\": \"val3\",\n" +
@@ -88,9 +73,9 @@ final class TestMessages {
             "    \"sourceName\": \"val12\",\n" +
             "    \"sourceId\": \"val13\",\n" +
             "    \"reportingEntityName\": \"val14\"\n" +
-            "}");
+            "}"));
 
-    static final JSONObject INVALID_MESSAGE_PARAMS_3 = new JSONObject(
+    static final Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_3 = Optional.of(new JSONObject(
         "{\n" +
             "    \"pnfSerialNumber\": \"val1\",\n" +
             "    \"pnfOamIpv4Address\": \"val3\",\n" +
@@ -104,8 +89,28 @@ final class TestMessages {
             "    \"sourceName\": \"val12\",\n" +
             "    \"sourceId\": \"val13\",\n" +
             "    \"reportingEntityName\": \"val14\"\n" +
-            "}");
+            "}"));
+
+    static final Optional<JSONObject> INVALID_NOTIFICATION_PARAMS = Optional.of(new JSONObject(
+        "{\n" +
+            "    \"mother\": \"val1\",\n" +
+            "    \"father\": \"val3\",\n" +
+            "}"));
+
 
     private TestMessages() {
     }
+
+    private static String getContent(String fileName) {
+        try {
+            String pathAsString = TestMessages.class.getResource(fileName).getPath();
+            StringBuilder stringBuilder = new StringBuilder();
+            Files.readAllLines(Paths.get(pathAsString)).forEach(line -> {
+                stringBuilder.append(line);
+            });
+            return stringBuilder.toString();
+        } catch (IOException e) {
+            throw new RuntimeException(String.format("Cannot read JSON file %s", fileName));
+        }
+    }
 }
diff --git a/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json b/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json
new file mode 100644 (file)
index 0000000..e0f4550
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "eventName": "pnfRegistration_Nokia_5gDu",
+  "nfNamingCode": "gNB",
+  "nfcNamingCode": "oam",
+  "sourceName": "NOK6061ZW3",
+  "sourceId": "val13",
+  "reportingEntityName": "NOK6061ZW3"
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json b/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json
new file mode 100644 (file)
index 0000000..f7f463d
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "changeIdentifier": "PM_MEAS_FILES",
+  "changeType": "FileReady",
+  "arrayOfNamedHashMap": [
+    {"name": "A20161221.1031-1041.bin.gz", "hashMap": {
+      "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+      "compression": "gzip",
+      "fileformatType": "org.3GPP.32.435#measCollec",
+      "fileFormatVersion": "V10"
+    }
+    },
+    {"name": "A20161222.1042-1102.bin.gz", "hashMap": {
+      "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
+      "compression": "gzip",
+      "fileFormatType": "org.3GPP.32.435#measCollec",
+      "fileFormatVersion": "V10"
+    }
+    }
+  ]
+}
diff --git a/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json b/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json
new file mode 100644 (file)
index 0000000..b95f8e6
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "serialNumber": "6061ZW3",
+  "vendorName": "Nokia",
+  "oamV4IpAddress": "val3",
+  "oamV6IpAddress": "val4",
+  "unitFamily": "BBU",
+  "modelNumber": "val6",
+  "softwareVersion": "val7",
+  "unitType": "val8"
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json b/test/mocks/pnfsimulator/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json
new file mode 100644 (file)
index 0000000..6485ee4
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "vesServerUrl": "http://VES-HOST:VES-PORT/eventListener/v7",
+  "testDuration": "10",
+  "messageInterval": "1"
+}
\ No newline at end of file
index 11b556d..288ecb6 100644 (file)
 <parent>
         <groupId>org.onap.oparent</groupId>
         <artifactId>oparent</artifactId>
-        <version>0.1.1</version>
+        <version>1.2.1</version>
 </parent>
 
-<!-- <parent>
-    <groupId>org.springframework.boot</groupId>
-    <artifactId>spring-boot-starter-parent</artifactId>
-    <version>1.5.7.RELEASE</version>
-</parent>
--->
 <properties>
     <dockerLocation>${basedir}/target</dockerLocation>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index bde1933..3c6dea7 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.oparent</groupId>
     <artifactId>oparent</artifactId>
-    <version>1.1.1</version>
+    <version>1.2.1</version>
   </parent>
   <groupId>org.onap.integration</groupId>
   <artifactId>version-manifest</artifactId>
@@ -50,7 +50,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plugin-plugin</artifactId>
-        <version>3.4</version>
+        <version>3.5.2</version>
         <configuration>
           <goalPrefix>version-manifest</goalPrefix>
           <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
index 0b338ab..ad3dae9 100644 (file)
@@ -8,29 +8,32 @@ onap/aaf/aaf_oauth,2.1.2-SNAPSHOT
 onap/aaf/aaf_service,2.1.2-SNAPSHOT
 onap/aaf/sms,2.0.0
 onap/aaf/smsquorumclient,2.0.0
-onap/aai-resources,1.2.2
-onap/aai-traversal,1.2.2
+onap/aai-graphadmin,1.0-STAGING-latest
+onap/aai-resources,1.3-STAGING-latest
+onap/aai-traversal,1.3-STAGING-latest
 onap/aai/esr-gui,1.1.0
 onap/aai/esr-server,1.1.0
 onap/admportal-sdnc-image,1.4-STAGING-latest
 onap/appc-cdt-image,1.4.0-SNAPSHOT-latest
 onap/appc-image,1.4.0-SNAPSHOT-latest
-onap/babel,1.2.0
+onap/babel,1.3-STAGING-latest
 onap/ccsdk-dgbuilder-image,0.3-STAGING-latest
 onap/ccsdk-odl-image,0.3-STAGING-latest
 onap/ccsdk-odlsli-image,0.3-STAGING-latest
-onap/champ,1.2.3
+onap/champ,1.3-STAGING-latest
 onap/clamp,3.0-STAGING-latest
 onap/cli,2.0.2
-onap/data-router,1.2.2
-onap/dmaap/buscontroller,1.0.12
+onap/data-router,1.3-STAGING-latest
+onap/dmaap/buscontroller,1.0.17
+onap/dmaap/datarouter-node,latest
+onap/dmaap/datarouter-prov,latest
 onap/dmaap/dmaap-mr,1.1.6
 onap/dmaap/kafka01101,0.0.1
 onap/externalapi/nbi,3.0.0-latest
-onap/gizmo,1.2.1
+onap/gizmo,1.3-STAGING-latest
 onap/holmes/engine-management,1.2.0-STAGING-latest
 onap/holmes/rule-management,1.2.0-STAGING-latest
-onap/model-loader,1.2.1
+onap/model-loader,1.3-STAGING-latest
 onap/msb/msb_apigateway,1.2.0-STAGING-latest
 onap/msb/msb_discovery,1.2.0-STAGING-latest
 onap/multicloud/framework,1.2.0-STAGING
@@ -43,29 +46,33 @@ onap/music/cassandra_music,3.0.0
 onap/music/music,2.5.3
 onap/music/prom,1.0.5-latest
 onap/oom/kube2msb,1.1.0
-onap/optf-has,1.2.1-STAGING-latest
-onap/optf-osdf,1.2.1-STAGING-latest
-onap/org.onap.dcaegen2.collectors.snmptrap,1.3.0
-onap/org.onap.dcaegen2.collectors.ves.vescollector,1.2.0
+onap/optf-has,1.2.1
+onap/optf-osdf,1.2.1
+onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main,latest
+onap/org.onap.dcaegen2.collectors.snmptrap,1.4.0
+onap/org.onap.dcaegen2.collectors.ves.vescollector,1.3.1
 onap/org.onap.dcaegen2.deployments.bootstrap,1.1.3
-onap/org.onap.dcaegen2.deployments.cm-container,1.3.0
+onap/org.onap.dcaegen2.deployments.cm-container,1.4.1
 onap/org.onap.dcaegen2.deployments.healthcheck-container,1.1.0
-onap/org.onap.dcaegen2.deployments.k8s-bootstrap-container,1.1.11
+onap/org.onap.dcaegen2.deployments.k8s-bootstrap-container,1.4.2
 onap/org.onap.dcaegen2.deployments.redis-cluster-container,1.0.0
 onap/org.onap.dcaegen2.deployments.tca-cdap-container,1.1.0
+onap/org.onap.dcaegen2.deployments.tls-init-container,1.0.0
 onap/org.onap.dcaegen2.platform.cdapbroker,4.1.0
-onap/org.onap.dcaegen2.platform.configbinding,2.1.5
-onap/org.onap.dcaegen2.platform.deployment-handler,2.1.5
-onap/org.onap.dcaegen2.platform.inventory-api,3.0.1
-onap/org.onap.dcaegen2.platform.policy-handler,2.4.5
-onap/org.onap.dcaegen2.platform.servicechange-handler,1.1.4
+onap/org.onap.dcaegen2.platform.configbinding.app-app,2.2.3
+onap/org.onap.dcaegen2.platform.deployment-handler,3.0.1
+onap/org.onap.dcaegen2.platform.inventory-api,3.0.3
+onap/org.onap.dcaegen2.platform.policy-handler,4.3.0
+onap/org.onap.dcaegen2.platform.servicechange-handler,1.1.5
+onap/org.onap.dcaegen2.services.prh.prh-app-server,1.0.0
 onap/policy-apex-pdp,2.0-SNAPSHOT-latest
 onap/policy-drools,1.3-SNAPSHOT-latest
 onap/policy-pe,1.3-SNAPSHOT-latest
-onap/portal-app,2.2.0
-onap/portal-db,2.2.0
-onap/portal-sdk,2.2.0
-onap/portal-wms,2.2.0
+onap/pomba-context-aggregator,latest
+onap/portal-app,2.3.0-STAGING-latest
+onap/portal-db,2.3.0-STAGING-latest
+onap/portal-sdk,2.3.0-STAGING-latest
+onap/portal-wms,2.3.0-STAGING-latest
 onap/sdc-api-tests,1.3-STAGING-latest
 onap/sdc-backend,1.3-STAGING-latest
 onap/sdc-backend-init,1.3-STAGING-latest
@@ -84,9 +91,10 @@ onap/sdnc-ansible-server-image,1.4-STAGING-latest
 onap/sdnc-dmaap-listener-image,1.4-STAGING-latest
 onap/sdnc-image,1.4-STAGING-latest
 onap/sdnc-ueb-listener-image,1.4-STAGING-latest
-onap/search-data-service,1.2.2
+onap/search-data-service,1.3-STAGING-latest
 onap/sniroemulator,1.0.0
 onap/so/api-handler-infra,1.3.0-STAGING-latest
+onap/so/asdc-controller,latest
 onap/so/bpmn-infra,1.3.0-STAGING-latest
 onap/so/catalog-db-adapter,1.3.0-STAGING-latest
 onap/so/openstack-adapter,1.3.0-STAGING-latest
@@ -94,7 +102,7 @@ onap/so/request-db-adapter,1.3.0-STAGING-latest
 onap/so/sdc-controller,1.3.0-STAGING-latest
 onap/so/sdnc-adapter,1.3.0-STAGING-latest
 onap/so/vfc-adapter,1.3.0-STAGING-latest
-onap/sparky-be,1.2.1
+onap/sparky-be,1.3-STAGING-latest
 onap/testsuite,1.3.1-STAGING-latest
 onap/usecase-ui,1.1.1
 onap/usecase-ui/usecase-ui-server,1.1.1
@@ -121,3 +129,5 @@ onap/vnfsdk/ice,1.1.0
 onap/vnfsdk/refrepo,1.1.1
 onap/vnfsdk/refrepo/postgres,1.1.1
 onap/vnfsdk/vnftest,1.1.0
+onap/workflow-backend,1.3.0-SNAPSHOT
+onap/workflow-frontend,1.3.0-SNAPSHOT
index 112607b..bdbedbb 100644 (file)
@@ -41,8 +41,8 @@ onap/multicloud/vio-vesagent,1.0.0
 onap/music/cassandra_music,3.0.0
 onap/music/music,2.5.3
 onap/oom/kube2msb,1.1.0
-onap/optf-has,1.1.1
-onap/optf-osdf,1.1.1
+onap/optf-has,1.2.1
+onap/optf-osdf,1.2.1
 onap/org.onap.dcaegen2.collectors.snmptrap,1.3.0
 onap/org.onap.dcaegen2.collectors.ves.vescollector,1.2.0
 onap/org.onap.dcaegen2.deployments.bootstrap,1.1.3
index 64d78a6..61b1837 100644 (file)
@@ -201,7 +201,7 @@ org.onap.multicloud.openstack,ocata,1.1.2
 org.onap.multicloud.openstack,windriver,1.1.2
 org.onap.multicloud.openstack.vmware,vesagent,1.0.0
 org.onap.multicloud.openstack.vmware,vio,1.1.2
-org.onap.oparent,oparent,1.1.1
+org.onap.oparent,oparent,1.2.1
 org.onap.policy.common,common-modules,1.2.3
 org.onap.policy.drools-applications,drools-pdp-apps,1.2.3
 org.onap.policy.drools-pdp,drools-pdp,1.2.3