Merge "Updated the docker-staging-manifest to new version"
authorGary Wu <gary.i.wu@huawei.com>
Wed, 5 Sep 2018 20:17:21 +0000 (20:17 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 5 Sep 2018 20:17:21 +0000 (20:17 +0000)
205 files changed:
deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json [new file with mode: 0644]
deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json [new file with mode: 0644]
deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh [new file with mode: 0644]
deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh [new file with mode: 0644]
deployment/heat/onap-oom/k8s_vm_entrypoint.sh
deployment/heat/onap-oom/onap-oom.yaml
deployment/heat/onap-oom/parts/onap-oom-1.yaml
deployment/heat/onap-oom/parts/onap-oom-2.yaml
deployment/heat/onap-oom/rancher_vm_entrypoint.sh
deployment/heat/onap-oom/scripts/deploy.sh
deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml [new file with mode: 0644]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh [new file with mode: 0755]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/Makefile [new file with mode: 0644]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/README.md [new file with mode: 0644]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh [new file with mode: 0755]
test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/testplan.txt [new file with mode: 0644]
test/csit/plans/dcaegen2/prh-testsuites/setup.sh
test/csit/plans/dmaap-buscontroller/ssl/setup.sh [new file with mode: 0755]
test/csit/plans/dmaap-buscontroller/ssl/teardown.sh [new file with mode: 0644]
test/csit/plans/dmaap-buscontroller/ssl/testplan.txt [new file with mode: 0644]
test/csit/plans/dmaap-buscontroller/with_dr/setup.sh [new file with mode: 0755]
test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh [new file with mode: 0755]
test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt [new file with mode: 0755]
test/csit/plans/dmaap-buscontroller/with_mr/setup.sh
test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh
test/csit/plans/dmaap-datarouter/dr-suite/setup.sh [new file with mode: 0755]
test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh [new file with mode: 0755]
test/csit/plans/dmaap-datarouter/dr-suite/testplan.txt [new file with mode: 0755]
test/csit/plans/multicloud-pike/functionality1/setup.sh [new file with mode: 0644]
test/csit/plans/multicloud-pike/functionality1/teardown.sh [new file with mode: 0644]
test/csit/plans/multicloud-pike/functionality1/testplan.txt [new file with mode: 0644]
test/csit/plans/multicloud-pike/hpa-discovery/setup.sh [new file with mode: 0644]
test/csit/plans/multicloud-pike/hpa-discovery/teardown.sh [new file with mode: 0644]
test/csit/plans/multicloud-pike/hpa-discovery/testplan.txt [new file with mode: 0644]
test/csit/plans/music/music-test-plan/setup.sh
test/csit/plans/music/music-test-plan/teardown.sh
test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/setup.sh
test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/teardown.sh
test/csit/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh
test/csit/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh
test/csit/plans/vfc-gvnfm-vnfres/sanity-check/setup.sh
test/csit/plans/vfc-gvnfm-vnfres/sanity-check/teardown.sh
test/csit/plans/vfc-nfvo-catalog/sanity-check/setup.sh
test/csit/plans/vfc-nfvo-catalog/sanity-check/teardown.sh
test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh
test/csit/plans/vfc-nfvo-lcm/sanity-check/teardown.sh
test/csit/plans/vid/healthCheck/setup.sh
test/csit/plans/vnfsdk-pkgtools/sanity-check/setup.sh
test/csit/plans/vnfsdk-pkgtools/sanity-check/testplan.txt
test/csit/run-csit.sh
test/csit/scripts/clamp/python-lib/CustomSeleniumLibrary.py [new file with mode: 0755]
test/csit/scripts/clamp/start_clamp_containers.sh
test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
test/csit/scripts/dmaap-buscontroller/dr-launch.sh [new file with mode: 0644]
test/csit/scripts/dmaap-buscontroller/onapCSIT.env
test/csit/scripts/dmaap-message-router/dmaap-mr-launch.sh
test/csit/scripts/dmaap-message-router/dmaap-mr-teardown.sh
test/csit/scripts/externalapi-nbi/start_nbi_containers.sh
test/csit/scripts/multicloud-pike/generic_sim/Dockerfile [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/aai/responses.yml [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/cinder/responses.yml [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/generic_sim.py [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/glance/responses.yml [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/keystone/responses.yml [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/log_parser.py [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/nova/responses.yml [new file with mode: 0644]
test/csit/scripts/multicloud-pike/generic_sim/requirements.txt [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/scripts/vid/start_vid_containers.sh
test/csit/tests/clamp/APIs/01__Create_CL_Holmes.robot
test/csit/tests/clamp/APIs/02__Create_CL_TCA.robot
test/csit/tests/clamp/APIs/03__VariousApis.robot
test/csit/tests/clamp/APIs/04__Verify_API_Models.robot
test/csit/tests/clamp/UIs/01__Create_Holmes_model.robot
test/csit/tests/clamp/UIs/02__Create_TCA_model.robot
test/csit/tests/clamp/UIs/03__Verify_UI_Models.robot
test/csit/tests/clamp/UIs/04__Submit_deploy_chain_Holmes.robot
test/csit/tests/clamp/UIs/05__Submit_deploy_chain_TCA.robot
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json [new file with mode: 0644]
test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json [new file with mode: 0644]
test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
test/csit/tests/dmaap-buscontroller/ssl_suite/__init__.robot [new file with mode: 0644]
test/csit/tests/dmaap-buscontroller/ssl_suite/test1.robot [new file with mode: 0644]
test/csit/tests/dmaap-buscontroller/with_dr/orig [new file with mode: 0755]
test/csit/tests/dmaap-buscontroller/with_dr/test1.robot [new file with mode: 0644]
test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot [new file with mode: 0755]
test/csit/tests/holmes/testcase/RuleMgt/Rule-Mgt.robot
test/csit/tests/multicloud-pike/provision/hpa_multicloud.robot [new file with mode: 0644]
test/csit/tests/multicloud-pike/provision/sanity_test_multicloud.robot [new file with mode: 0644]
test/csit/tests/music/music-suite/music-test.robot
test/csit/tests/optf-has/has/optf_has_test.robot
test/csit/tests/policy/suite1/global_properties.robot
test/csit/tests/sdc/nightly/test1.robot
test/csit/tests/sdc/sanity/test1.robot
test/csit/tests/sdc/uiSanity/test1.robot
test/csit/tests/vid/resources/docker-compose.yml [new file with mode: 0644]
test/csit/tests/vid/resources/simulators/SDC.py [new file with mode: 0644]
test/csit/tests/vid/resources/simulators/SDC_simulator [new file with mode: 0644]
test/csit/tests/vid/resources/simulators/cert.pem [new file with mode: 0644]
test/csit/tests/vid/resources/simulators/key.pem [new file with mode: 0644]
test/csit/tests/vid/resources/simulators/sdc_get_response.json [new file with mode: 0644]
test/csit/tests/vnfsdk-pkgtools/tosca-metadata/create_validate_digest_signing.robot [new file with mode: 0644]
test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test.crt [new file with mode: 0644]
test/csit/tests/vnfsdk-pkgtools/tosca-metadata/test.key [new file with mode: 0644]
test/ete/labs/gwu/apt-proxy.sh
test/ete/labs/gwu/onap-openstack-template.env
test/ete/labs/huawei/apt-proxy.sh
test/ete/labs/huawei/onap-openstack-template.env
test/ete/labs/tlab/apt-proxy.sh
test/ete/labs/tlab/onap-openstack-template.env
test/ete/labs/windriver/apt-proxy.sh
test/ete/labs/windriver/onap-openstack-template.env
test/ete/scripts/deploy-onap.sh
test/ete/scripts/teardown-onap.sh
test/mocks/pnfsimulator/README.md
test/mocks/pnfsimulator/config/config.json
test/mocks/pnfsimulator/deployment/PnP_PNF_sim_heat_template.yml [new file with mode: 0644]
test/mocks/pnfsimulator/docker-compose.dev.yml [deleted file]
test/mocks/pnfsimulator/docker-compose.yml
test/mocks/pnfsimulator/json_schema/input_validator.json [new file with mode: 0644]
test/mocks/pnfsimulator/json_schema/output_validator_ves_schema_30.0.1.json [new file with mode: 0644]
test/mocks/pnfsimulator/netconf/pnf-simulator.data.xml
test/mocks/pnfsimulator/netconf/pnf-simulator.yang
test/mocks/pnfsimulator/pom.xml
test/mocks/pnfsimulator/sftp/sftp-file.txt [new file with mode: 0644]
test/mocks/pnfsimulator/simulator.sh
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/Main.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/logging/MDCVariables.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java [new file with mode: 0644]
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/netconfmonitor/NetconfConfigurationCheckingTask.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorService.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfiguration.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCache.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReader.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriter.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConnectionParams.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/Simulator.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapter.java
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/JSONValidator.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/ParamsValidator.java [deleted file]
test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/ValidationException.java
test/mocks/pnfsimulator/src/main/resources/log4j2.xml [deleted file]
test/mocks/pnfsimulator/src/main/resources/logback.xml [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCacheTest.java [moved from test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfSessionFactory.java with 60% similarity]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReaderTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriterTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/util/DateUtilTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/util/ResponseBuilderTest.java
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImplTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/validation/JSONValidatorTest.java [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/invalid-test-schema.json [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/logback-test.xml [new file with mode: 0644]
test/mocks/pnfsimulator/src/test/resources/valid-test-schema.json [new file with mode: 0644]
test/mocks/pnfsimulator/ssh/ssh_host_rsa_key [new file with mode: 0644]
test/mocks/pnfsimulator/ssh/ssh_host_rsa_key.pub [new file with mode: 0644]
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
version-manifest/src/main/scripts/upgrade-oparent.sh [new file with mode: 0755]

diff --git a/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json b/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json
new file mode 100644 (file)
index 0000000..79dda59
--- /dev/null
@@ -0,0 +1,422 @@
+{
+  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+  "contentVersion": "1.0.0.0",
+  "parameters": {
+    "centosOSVersion": {
+      "type": "string",
+      "defaultValue": "16.04.0-LTS",
+      "allowedValues": [
+        "12.04.5-LTS","14.04.5-LTS","15.10","16.04.0-LTS"
+      ],
+      "metadata": {
+        "description": "The OS"
+      }
+    },
+    "numberOfVms": {
+      "type": "int",
+      "defaultValue": 5,
+      "minValue": 1,
+      "maxValue": 15,
+      "metadata": {
+        "description": "Number of VMs to provision"
+      }
+    },
+    "privateIPAddress": {
+      "type": "string",
+         "defaultValue": "10.0.0.2",
+      "metadata": {
+        "description": "Static Private IP will be assigned to the machine"
+      }
+    },
+    "masterScriptName": {
+      "type": "string",
+      "metadata": {
+        "description": "entrypoint script name for k8s master"
+      }
+    },
+    "nodeScriptName": {
+      "type": "string",
+      "metadata": {
+        "description": "entrypoint script name for k8s node"
+      }
+    },
+    "vmSize": {
+      "type": "string",
+      "defaultValue": "Standard_D14_v2",
+      "allowedValues": [
+        "Standard_E8_v3",
+        "Standard_E2_v3",
+        "Standard_D1",
+           "Standard_D16s_v3",
+        "Standard_D4_v2",
+        "Standard_D32s_v3",
+        "Standard_E16_v3",
+        "Standard_D14_v2",
+        "Standard_D13_v2",
+        "Standard_E64_v3"
+      ],
+      "metadata": {
+        "description": "VM size"
+      }
+    },
+    "dnslabel": {
+      "type": "string",
+      "metadata": {
+        "description": "Unique DNS label to assign DNS name"
+      }
+    }
+
+  },
+  "variables": {
+    "dnsLabelPrefix": "[concat('dns-',uniquestring(resourceGroup().id))]",
+    "customData": [ "userdata.txt" ], 
+    "vmName": "[concat('k8s-host-', substring(uniquestring(resourceGroup().id),0,4))]",
+    "adminUsername": "[concat('ubuntu')]",
+    "adminPassword": "Qwertyuiop@@1",
+    "sshKeyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5zrmH1dHgXbNwP2qbNVySScnFVcEP25HBd2VJu2PiJLDhwgHj44Lj9ZvLyRFCetqd8CAKnLV5qy37rwaCtlH/t8Qb36cUGPhegxpF2++uTY0b6K7Zb6hEMBNw3J1z+GU7OoVwZJhsNAw4t8/7WWmJA4Owo99TJkEKvhCYjBCLoC5sIvG/lJsaFIG8A5MjnBlwgSZ3FsUU+aY1KYZUztodkyv7laDMOinwSvJggKrCugsqZdVo5bhmcSFbqrZa/a/wgqeok+79W0/DLh5Tlf7By46ASDKGnFlwDshPu++I3KMU3eRz0rJLOKeIUCz7k80X0WJ6BrSS7l+IrpDXV1M5 ubuntu@aria",
+    "storageAccountName": "[concat('salinuxvm', substring(uniquestring(resourceGroup().id),0,4))]",
+    "imagePublisher": "Canonical",
+    "imageOffer": "UbuntuServer",
+    "nicName": "[concat('VMNic-',variables('vmName'))]",
+    "dnsPrefix": "[concat(variables('dnsLabelPrefix'),'-',substring(uniquestring(resourceGroup().id),0,4))]",
+    "addressPrefix": "10.0.0.0/16",
+    "subnetName": "Subnet",
+    "subnetPrefix": "10.0.0.0/24",
+    "storageAccountType": "Standard_LRS",
+    "publicIPAddressType": "Dynamic",
+         "publicIPAddressName": "nicLoop100",
+    "virtualNetworkName": "[concat('VNET-',variables('vmName'))]",
+    "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets/', variables('virtualNetworkName'), variables('subnetName'))]",
+    "networkSecurityGroupName": "[concat(variables('vmName'), '_obrien_local_nsg')]",
+    "sshKeyPathRoot": "[concat('/root/','/.ssh/authorized_keys')]",
+    "sshKeyPath": "[concat('/home/',variables('adminUsername'),'/.ssh/authorized_keys')]",
+    "availabilitySetName": "[concat('availabilitySet-',substring(uniquestring(resourceGroup().id),0,4))]"
+  },
+  "resources": [
+    {
+      "type": "Microsoft.Compute/availabilitySets",
+      "name": "[variables('availabilitySetName')]",
+      "apiVersion": "2016-04-30-preview",
+      "location": "[resourceGroup().location]",
+      "properties": {
+        "managed": true,
+        "platformFaultDomainCount": 3,
+        "platformUpdateDomainCount": 3
+      }
+    },
+    {
+      "type": "Microsoft.Storage/storageAccounts",
+      "name": "[variables('storageAccountName')]",
+      "apiVersion": "2017-06-01",
+      "location": "[resourceGroup().location]",
+      "sku": {
+        "name": "[variables('storageAccountType')]"
+      },
+      "kind": "Storage",
+      "properties": {}
+    },
+    {
+      "apiVersion": "2017-03-01",
+      "type": "Microsoft.Network/networkSecurityGroups",
+      "name": "[variables('networkSecurityGroupName')]",
+      "location": "[resourceGroup().location]",
+      "tags": {
+        "displayName": "NSG"
+      },
+      "properties": {
+        "securityRules": [
+         {
+            "name": "SSHAllowAny",
+            "properties": {
+              "description": "SSHAllowAny",
+              "protocol": "TCP",
+              "sourcePortRange": "*",
+              "destinationPortRange": "22",
+              "sourceAddressPrefix": "*",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 100,
+              "direction": "Inbound"
+            }
+          },
+          {
+            "name": "DockerAllowAny",
+            "properties": {
+              "description": "DockerAllowAny",
+              "protocol": "TCP",
+              "sourcePortRange": "*",
+              "destinationPortRange": "2376",
+              "sourceAddressPrefix": "*",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 110,
+              "direction": "Inbound"
+            }
+          },
+          {
+            "name": "port500-UdpAllowAny",
+            "properties": {
+              "description": "port500-udpAllowAny",
+              "protocol": "UDP",
+              "sourcePortRange": "*",
+              "destinationPortRange": "500",
+              "sourceAddressPrefix": "*",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 120,
+              "direction": "Inbound"
+            }
+          },
+          {
+            "name": "port4500-UdpAllowAny",
+            "properties": {
+              "description": "port4500-udpAllowAny",
+              "protocol": "UDP",
+              "sourcePortRange": "*",
+              "destinationPortRange": "4500",
+              "sourceAddressPrefix": "*",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 130,
+              "direction": "Inbound"
+            }
+          },
+
+          {
+            "name": "port_10249-10255_172",
+            "properties": {
+              "description": "port_10249-10255_172",
+              "protocol": "*",
+              "sourcePortRange": "*",
+              "destinationPortRange": "10249-10255",
+              "sourceAddressPrefix": "*",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 140,
+              "direction": "Inbound"
+            }
+          },
+          {
+            "name": "in-rule",
+            "properties": {
+              "description": "All in",
+              "protocol": "Tcp",
+              "sourcePortRange": "*",
+              "destinationPortRange": "*",
+              "sourceAddressPrefix": "Internet",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 170,
+              "direction": "Inbound"
+            }
+          },
+          {
+            "name": "block-8080",
+            "properties": {
+              "description": "block-8080",
+              "protocol": "Tcp",
+              "sourcePortRange": "8080",
+              "destinationPortRange": "*",
+              "sourceAddressPrefix": "Internet",
+              "destinationAddressPrefix": "*",
+              "access": "Deny",
+              "priority": 104,
+              "direction": "Outbound"
+            }
+          },
+          {
+            "name": "out-rule",
+            "properties": {
+              "description": "All out",
+              "protocol": "Tcp",
+              "sourcePortRange": "*",
+              "destinationPortRange": "*",
+              "sourceAddressPrefix": "Internet",
+              "destinationAddressPrefix": "*",
+              "access": "Allow",
+              "priority": 110,
+              "direction": "Outbound"
+            }
+          }
+        ]
+      }
+    },
+    {
+      "apiVersion": "2017-04-01",
+      "type": "Microsoft.Network/virtualNetworks",
+      "name": "[variables('virtualNetworkName')]",
+      "location": "[resourceGroup().location]",
+      "dependson": [
+        "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
+      ],
+      "properties": {
+        "addressSpace": {
+          "addressPrefixes": [
+            "[variables('addressPrefix')]"
+          ]
+        },
+        "subnets": [
+          {
+            "name": "[variables('subnetName')]",
+            "properties": {
+              "addressPrefix": "[variables('subnetPrefix')]",
+              "networkSecurityGroup": {
+                "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
+              }
+            }
+          }
+        ]
+      }
+    },
+    {
+      "apiVersion": "2017-08-01",
+      "type": "Microsoft.Network/networkInterfaces",
+      "name": "[concat(variables('nicName'), copyindex())]",
+      "location": "[resourceGroup().location]",
+      "copy": {
+        "name": "nicLoop",
+        "count": "[parameters('numberOfVms')]"
+      },
+      "dependsOn": [
+        "[resourceId('Microsoft.Network/publicIPAddresses/', concat('nicLoop',copyIndex(100)))]",
+        "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
+      ],
+      "properties": {
+        "ipConfigurations": [
+          {
+            "name": "ipconfig1",
+            "properties": {
+              "privateIPAllocationMethod": "Static",
+              "privateIPAddress": "[concat(parameters('privateIPAddress'),copyindex())]",
+              "publicIPAddress": {
+                "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat('nicLoop',copyIndex(100)))]"
+              },
+              "subnet": {
+                "id": "[variables('subnetRef')]"
+              }
+            }
+          }
+        ]
+      }
+    },
+    {
+      "apiVersion": "2017-04-01",
+      "type": "Microsoft.Network/publicIPAddresses",
+      "name": "[concat('nicLoop',copyIndex(100))]",
+      "location": "[resourceGroup().location]",
+      "copy": {
+        "name": "nicLoop",
+        "count": "[parameters('numberOfVms')]" 
+      },
+      "properties": {
+        "publicIPAllocationMethod": "Dynamic",
+        "dnsSettings": {
+          "domainNameLabel": "[concat(variables('vmName'),parameters('dnslabel'), copyIndex(1000))]"
+        }
+      }
+    },
+    {
+      "apiVersion": "2017-03-30",
+      "type": "Microsoft.Compute/virtualMachines",
+      "name": "[concat(variables('vmName'), copyindex())]",
+      "copy": {
+        "name": "virtualMachineLoop",
+        "count": "[parameters('numberOfVms')]"
+      },
+      "location": "[resourceGroup().location]",
+      "dependsOn": [
+        "nicLoop",
+        "[concat('Microsoft.Compute/availabilitySets/',variables('availabilitySetName'))]"
+      ],
+      "properties": {
+        "hardwareProfile": {
+          "vmSize": "[parameters('vmSize')]"
+        },
+        "availabilitySet": {
+          "id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
+        },
+        "osProfile": {
+          "computerName": "[concat(variables('vmName'), copyindex())]",
+          "adminUsername": "[variables('adminUsername')]",
+          "adminPassword": "[variables('adminPassword')]",
+          "linuxConfiguration": {
+            "disablePasswordAuthentication": false,
+            "ssh": {
+              "publicKeys": [
+                {
+                  "path": "[variables('sshKeyPath')]",
+                  "keyData": "[variables('sshKeyData')]"
+                }
+              ]
+            }
+          }
+        },
+        "storageProfile": {
+          "imageReference": {
+            "publisher": "[variables('imagePublisher')]",
+            "offer": "[variables('imageOffer')]",
+            "sku": "[parameters('centosOSVersion')]",
+            "version": "latest"
+          },
+          "osDisk": {
+            "diskSizeGB": 127,
+            "createOption": "FromImage"
+          }
+        },
+        "networkProfile": {
+          "networkInterfaces": [
+            {
+              "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'),copyindex()))]"
+            }
+          ]
+        },
+        "diagnosticsProfile": {
+          "bootDiagnostics": {
+            "enabled": true,
+            "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
+          }
+        }
+      }
+    },
+       {
+    "apiVersion": "2015-06-15",
+    "type": "Microsoft.Compute/virtualMachines/extensions",
+    "name": "[concat(variables('vmName'), '0','/onap')]",
+    "location": "[resourceGroup().location]",
+    "dependsOn": ["virtualMachineLoop"],
+    "properties": {
+        "publisher": "Microsoft.Azure.Extensions",
+        "type": "CustomScript",
+        "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" ],
+            "commandToExecute": "[concat('./' , parameters('masterScriptName'),' ',reference(variables('publicIPAddressName')).dnsSettings.fqdn,' ',parameters('privateIPAddress'),' ',parameters('numberOfVms'))]"
+           }
+        }
+     },
+       {
+    "apiVersion": "2015-06-15",
+    "type": "Microsoft.Compute/virtualMachines/extensions",
+    "name": "[concat(variables('vmName'), copyindex(1),'/onap')]",
+       "copy": {
+        "name": "virtualMachineExtnLoop",
+        "count": "[sub(parameters('numberOfVms'),1)]" 
+      },
+    "location": "[resourceGroup().location]",
+    "dependsOn": [
+      "virtualMachineLoop"
+    ],
+    "properties": {
+        "publisher": "Microsoft.Azure.Extensions",
+        "type": "CustomScript",
+        "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" ],
+            "commandToExecute": "[concat('./' , parameters('nodeScriptName'),' ',concat(parameters('privateIPAddress'),'0'))]"
+           }
+        }
+     }
+  ]
+}
diff --git a/deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json b/deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json
new file mode 100644 (file)
index 0000000..081ef7f
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
+  "contentVersion": "1.0.0.0",
+  "parameters": {
+      "numberOfVms": { "value": 12 },
+      "vmSize": { "value": "Standard_D4_v2" },
+      "masterScriptName": { "value": "azure-rancher-server.sh" },
+      "nodeScriptName": { "value": "azure-k8s-node.sh" },
+      "dnslabel": { "value": "ranchercluster" }
+  }
+}
diff --git a/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh b/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh
new file mode 100644 (file)
index 0000000..919d148
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+DOCKER_VERSION=17.03
+KUBECTL_VERSION=1.8.10
+HELM_VERSION=2.9.1
+
+# setup root access - default login: oom/oom - comment out to restrict access too ssh key only
+sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+service sshd restart
+echo -e "oom\noom" | passwd root
+
+apt-get update
+curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh
+mkdir -p /etc/systemd/system/docker.service.d/
+cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
+[Service]
+ExecStart=
+ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001
+EOF
+systemctl daemon-reload
+systemctl restart docker
+apt-mark hold docker-ce
+
+#IP_ADDY=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
+#HOSTNAME=`hostname`
+
+#echo "$IP_ADDY $HOSTNAME" >> /etc/hosts
+
+docker login -u docker -p docker nexus3.onap.org:10001
+
+sudo apt-get install make -y
+
+sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
+sudo chmod +x ./kubectl
+sudo mv ./kubectl /usr/local/bin/kubectl
+sudo mkdir ~/.kube
+wget http://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo tar -zxvf helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo mv linux-amd64/helm /usr/local/bin/helm
+
+# install nfs
+sudo apt-get install nfs-common -y
+
+MASTER_IP=$1
+
+#Create NFS directory
+sudo mkdir -p /dockerdata-nfs
+
+#Mount the remote NFS directory to the local one
+sudo mount $MASTER_IP:/dockerdata-nfs /dockerdata-nfs/
+echo "$MASTER_IP:/dockerdata-nfs /dockerdata-nfs  nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" | sudo tee -a /etc/fstab
+
+exit 0
diff --git a/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh b/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh
new file mode 100644 (file)
index 0000000..1c4373c
--- /dev/null
@@ -0,0 +1,190 @@
+#!/bin/bash
+
+set -x
+
+DOCKER_VERSION=17.03
+RANCHER_VERSION=1.6.14
+KUBECTL_VERSION=1.8.10
+HELM_VERSION=2.9.1
+
+# setup root access - default login: oom/oom - comment out to restrict access too ssh key only
+sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+service sshd restart
+echo -e "oom\noom" | passwd root
+
+apt-get update
+curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh
+mkdir -p /etc/systemd/system/docker.service.d/
+cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
+[Service]
+ExecStart=
+ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001
+EOF
+systemctl daemon-reload
+systemctl restart docker
+apt-mark hold docker-ce
+
+#IP_ADDY=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
+#HOSTNAME=`hostname`
+
+#echo "$IP_ADDY $HOSTNAME" >> /etc/hosts
+
+docker login -u docker -p docker nexus3.onap.org:10001
+
+sudo apt-get install make -y
+
+sudo docker run -d --restart=unless-stopped -p 8080:8080 --name rancher_server rancher/server:v$RANCHER_VERSION
+sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
+sudo chmod +x ./kubectl
+sudo mv ./kubectl /usr/local/bin/kubectl
+sudo mkdir ~/.kube
+wget http://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo tar -zxvf helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo mv linux-amd64/helm /usr/local/bin/helm
+
+# nfs server
+sudo apt-get install nfs-kernel-server -y
+
+sudo mkdir -p /nfs_share
+sudo chown nobody:nogroup /nfs_share/
+
+
+sudo mkdir -p /dockerdata-nfs
+sudo chmod 777 -R /dockerdata-nfs
+sudo chown nobody:nogroup /dockerdata-nfs/
+
+NFS_EXP="*(rw,sync,no_root_squash,no_subtree_check) "
+
+echo "/dockerdata-nfs "$NFS_EXP | sudo tee -a /etc/exports
+
+#Restart the NFS service
+sudo exportfs -a
+sudo systemctl restart nfs-kernel-server
+
+echo "wait before installing rancher server"
+sleep 60
+
+# Create ONAP environment on rancher and register the nodes...
+SERVER=$1
+PRIVATE_IP=$2
+NODE_COUNT=$3
+
+echo "SERVER: ${SERVER}"
+echo "PRIVATE_IP: ${PRIVATE_IP}"
+echo "NODE_COUNT: ${NODE_COUNT}"
+#install sshpass to login to the k8s nodes to run rancher agent
+sudo apt-get install sshpass
+
+# create kubernetes environment on rancher using cli
+RANCHER_CLI_VER=0.6.7
+KUBE_ENV_NAME='onap'
+wget https://releases.rancher.com/cli/v${RANCHER_CLI_VER}/rancher-linux-amd64-v${RANCHER_CLI_VER}.tar.gz
+sudo tar -zxvf rancher-linux-amd64-v${RANCHER_CLI_VER}.tar.gz
+sudo cp rancher-v${RANCHER_CLI_VER}/rancher .
+sudo chmod +x ./rancher
+
+sudo apt install jq -y
+echo "wait for rancher server container to finish - 3 min"
+sleep 60
+echo "2 more min"
+sleep 60
+echo "1 min left"
+sleep 60
+echo "get public and private tokens back to the rancher server so we can register the client later"
+API_RESPONSE=`curl -s 'http://$SERVER:8080/v2-beta/apikey' -d '{"type":"apikey","accountId":"1a1","name":"autoinstall","description":"autoinstall","created":null,"kind":null,"removeTime":null,"removed":null,"uuid":null}'`
+# Extract and store token
+echo "API_RESPONSE: $API_RESPONSE"
+KEY_PUBLIC=`echo $API_RESPONSE | jq -r .publicValue`
+KEY_SECRET=`echo $API_RESPONSE | jq -r .secretValue`
+echo "publicValue: $KEY_PUBLIC secretValue: $KEY_SECRET"
+
+export RANCHER_URL=http://${SERVER}:8080
+export RANCHER_ACCESS_KEY=$KEY_PUBLIC
+export RANCHER_SECRET_KEY=$KEY_SECRET
+./rancher env ls
+echo "wait 60 sec for rancher environments can settle before we create the onap kubernetes one"
+sleep 60
+
+echo "Creating kubernetes environment named ${KUBE_ENV_NAME}"
+./rancher env create -t kubernetes $KUBE_ENV_NAME > kube_env_id.json
+PROJECT_ID=$(<kube_env_id.json)
+echo "env id: $PROJECT_ID"
+export RANCHER_HOST_URL=http://${SERVER}:8080/v1/projects/$PROJECT_ID
+echo "you should see an additional kubernetes environment usually with id 1a7"
+./rancher env ls
+# optionally disable cattle env
+
+# add host registration url
+# https://github.com/rancher/rancher/issues/2599
+# wait for REGISTERING to ACTIVE
+echo "sleep 60 to wait for REG to ACTIVE"
+./rancher env ls
+sleep 30
+echo "check on environments again before registering the URL response"
+./rancher env ls
+sleep 30
+REG_URL_RESPONSE=`curl -X POST -u $KEY_PUBLIC:$KEY_SECRET -H 'Accept: application/json' -H 'ContentType: application/json' -d '{"name":"$SERVER"}' "http://$SERVER:8080/v1/projects/$PROJECT_ID/registrationtokens"`
+echo "REG_URL_RESPONSE: $REG_URL_RESPONSE"
+echo "wait for server to finish url configuration - 2 min"
+sleep 60
+echo "60 more sec"
+sleep 60
+
+# see registrationUrl in
+REGISTRATION_TOKENS=`curl http://$SERVER:8080/v2-beta/registrationtokens`
+echo "REGISTRATION_TOKENS: $REGISTRATION_TOKENS"
+REGISTRATION_URL=`echo $REGISTRATION_TOKENS | jq -r .data[0].registrationUrl`
+REGISTRATION_DOCKER=`echo $REGISTRATION_TOKENS | jq -r .data[0].image`
+REGISTRATION_TOKEN=`echo $REGISTRATION_TOKENS | jq -r .data[0].token`
+echo "Registering host for image: $REGISTRATION_DOCKER url: $REGISTRATION_URL registrationToken: $REGISTRATION_TOKEN"
+HOST_REG_COMMAND=`echo $REGISTRATION_TOKENS | jq -r .data[0].command`
+
+#Loop using the private IP and the no of VMS to SSH into each machine
+for i in `seq 1 $((${NODE_COUNT}-1))`;
+do
+       NODE_IP=${PRIVATE_IP}$i
+       sshpass -p "oom" ssh -o StrictHostKeyChecking=no root@${NODE_IP} "hostnamectl set-hostname node$i && docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/racher:/var/lib/rancher $REGISTRATION_DOCKER $RANCHER_URL/v1/scripts/$REGISTRATION_TOKEN"
+done
+
+echo "waiting 10 min for host registration to finish"
+sleep 540
+echo "1 more min"
+sleep 60
+#read -p "wait for host registration to complete before generating the client token....."
+
+# base64 encode the kubectl token from the auth pair
+# generate this after the host is registered
+KUBECTL_TOKEN=$(echo -n 'Basic '$(echo -n "$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | base64 -w 0) | base64 -w 0)
+echo "KUBECTL_TOKEN base64 encoded: ${KUBECTL_TOKEN}"
+# add kubectl config - NOTE: the following spacing has to be "exact" or kubectl will not connect - with a localhost:8080 error
+cat > ~/.kube/config <<EOF
+apiVersion: v1
+kind: Config
+clusters:
+- cluster:
+    api-version: v1
+    insecure-skip-tls-verify: true
+    server: "https://$SERVER:8080/r/projects/$PROJECT_ID/kubernetes:6443"
+  name: "${ENVIRON}"
+contexts:
+- context:
+    cluster: "${ENVIRON}"
+    user: "${ENVIRON}"
+  name: "${ENVIRON}"
+current-context: "${ENVIRON}"
+users:
+- name: "${ENVIRON}"
+  user:
+    token: "$KUBECTL_TOKEN"
+
+EOF
+
+echo "run the following if you installed a higher kubectl version than the server"
+echo "helm init --upgrade"
+echo "Verify all pods up on the kubernetes system - will return localhost:8080 until a host is added"
+echo "kubectl get pods --all-namespaces"
+kubectl get pods --all-namespaces
+
+
+exit 0
index 11d8057..54a6741 100644 (file)
@@ -12,6 +12,7 @@
 printenv
 
 mkdir -p /opt/config
+echo "__docker_version__" > /opt/config/docker_version.txt
 echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
 echo "__rancher_private_ip_addr__" > /opt/config/rancher_private_ip_addr.txt
 HOST_IP=$(hostname -I)
@@ -41,7 +42,7 @@ apt-get -y install linux-image-extra-$(uname -r) jq nfs-common
 cd ~
 
 # install docker 17.03
-curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
+curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh
 usermod -aG docker ubuntu
 
 # Fix virtual memory allocation for onap-log:elasticsearch:
index 867f242..5c99bdb 100644 (file)
@@ -35,22 +35,50 @@ parameters:
     type: string
     description: Content for integration_override.yaml
 
-  gerrit_branch:
+  integration_gerrit_branch:
     type: string
     default: "master"
 
-  gerrit_refspec:
+  integration_gerrit_refspec:
+    type: string
+    default: "refs/heads/master"
+
+  oom_gerrit_branch:
+    type: string
+    default: "master"
+
+  oom_gerrit_refspec:
     type: string
     default: "refs/heads/master"
 
   docker_manifest:
     type: string
-    default: "docker-manifest.csv"
+    default: ""
 
   key_name:
     type: string
     default: "onap_key"
 
+  docker_version:
+    type: string
+    default: "17.03"
+
+  rancher_version:
+    type: string
+    default: "1.6.18"
+
+  rancher_agent_version:
+    type: string
+    default: "1.2.10"
+
+  kubectl_version:
+    type: string
+    default: "1.8.10"
+
+  helm_version:
+    type: string
+    default: "2.9.1"
+
 resources:
   random-str:
     type: OS::Heat::RandomString
@@ -153,9 +181,16 @@ resources:
             __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
             __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
             __integration_override_yaml__: { get_param: integration_override_yaml }
-            __gerrit_branch__: { get_param: gerrit_branch }
-            __gerrit_refspec__: { get_param: gerrit_refspec }
+            __integration_gerrit_branch__: { get_param: integration_gerrit_branch }
+            __integration_gerrit_refspec__: { get_param: integration_gerrit_refspec }
+            __oom_gerrit_branch__: { get_param: oom_gerrit_branch }
+            __oom_gerrit_refspec__: { get_param: oom_gerrit_refspec }
             __docker_manifest__: { get_param: docker_manifest }
+            __docker_version__: { get_param: docker_version }
+            __rancher_version__: { get_param: rancher_version }
+            __rancher_agent_version__: { get_param: rancher_agent_version }
+            __kubectl_version__: { get_param: kubectl_version }
+            __helm_version__: { get_param: helm_version }
             __public_net_id__: { get_param: public_net_id }
             __oam_network_cidr__: { get_param: oam_network_cidr }
             __oam_network_id__: { get_resource: oam_network }
@@ -204,6 +239,7 @@ resources:
           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:
@@ -238,6 +274,7 @@ resources:
           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:
@@ -272,6 +309,7 @@ resources:
           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:
@@ -306,6 +344,7 @@ resources:
           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:
@@ -340,6 +379,7 @@ resources:
           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:
index 000ef6a..8031505 100644 (file)
@@ -32,22 +32,50 @@ parameters:
     type: string
     description: Content for integration_override.yaml
 
-  gerrit_branch:
+  integration_gerrit_branch:
     type: string
     default: "master"
 
-  gerrit_refspec:
+  integration_gerrit_refspec:
+    type: string
+    default: "refs/heads/master"
+
+  oom_gerrit_branch:
+    type: string
+    default: "master"
+
+  oom_gerrit_refspec:
     type: string
     default: "refs/heads/master"
 
   docker_manifest:
     type: string
-    default: "docker-manifest.csv"
+    default: ""
 
   key_name:
     type: string
     default: "onap_key"
 
+  docker_version:
+    type: string
+    default: "17.03"
+
+  rancher_version:
+    type: string
+    default: "1.6.18"
+
+  rancher_agent_version:
+    type: string
+    default: "1.2.10"
+
+  kubectl_version:
+    type: string
+    default: "1.8.10"
+
+  helm_version:
+    type: string
+    default: "2.9.1"
+
 resources:
   random-str:
     type: OS::Heat::RandomString
index f0a0a8b..463635b 100644 (file)
@@ -27,6 +27,7 @@
           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:
index 098abbd..6066396 100644 (file)
@@ -19,10 +19,17 @@ echo "__public_net_id__" > /opt/config/public_net_id.txt
 echo "__oam_network_cidr__" > /opt/config/oam_network_cidr.txt
 echo "__oam_network_id__" > /opt/config/oam_network_id.txt
 echo "__oam_subnet_id__" > /opt/config/oam_subnet_id.txt
-echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
-echo "__gerrit_refspec__" > /opt/config/gerrit_refspec.txt
+echo "__integration_gerrit_branch__" > /opt/config/integration_gerrit_branch.txt
+echo "__integration_gerrit_refspec__" > /opt/config/integration_gerrit_refspec.txt
+echo "__oom_gerrit_branch__" > /opt/config/oom_gerrit_branch.txt
+echo "__oom_gerrit_refspec__" > /opt/config/oom_gerrit_refspec.txt
 echo "__docker_manifest__" > /opt/config/docker_manifest.txt
 echo "__docker_proxy__" > /opt/config/docker_proxy.txt
+echo "__docker_version__" > /opt/config/docker_version.txt
+echo "__rancher_version__" > /opt/config/rancher_version.txt
+echo "__rancher_agent_version__" > /opt/config/rancher_agent_version.txt
+echo "__kubectl_version__" > /opt/config/kubectl_version.txt
+echo "__helm_version__" > /opt/config/helm_version.txt
 
 cat <<EOF > /opt/config/integration-override.yaml
 __integration_override_yaml__
@@ -84,21 +91,22 @@ systemctl restart nfs-kernel-server
 
 cd ~
 
-# install docker 17.03
-curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
+# install docker __docker_version__
+curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh
 usermod -aG docker ubuntu
 
-docker run --restart unless-stopped -d -p 8080:8080  -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v1.2.9 __docker_proxy__/rancher/server:v1.6.14
+# install rancher __rancher_version__
+docker run --restart unless-stopped -d -p 8080:8080  -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v__rancher_agent_version__ __docker_proxy__/rancher/server:v__rancher_version__
 
-# install kubernetes 1.8.10
-curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
+# install kubectl __kubectl_version__
+curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v__kubectl_version__/bin/linux/amd64/kubectl
 chmod +x ./kubectl
 sudo mv ./kubectl /usr/local/bin/kubectl
 mkdir ~/.kube
 
-# install helm
-wget -q http://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz
-tar -zxvf helm-v2.8.2-linux-amd64.tar.gz
+# install helm __helm_version__
+wget -q http://storage.googleapis.com/kubernetes-helm/helm-v__helm_version__-linux-amd64.tar.gz
+tar -zxvf helm-v__helm_version__-linux-amd64.tar.gz
 sudo mv linux-amd64/helm /usr/local/bin/helm
 
 echo export RANCHER_IP=__rancher_private_ip_addr__ > api-keys-rc
@@ -208,24 +216,29 @@ git config --global log.decorate auto
 
 # Clone OOM:
 cd ~
-git clone -b master https://gerrit.onap.org/r/oom
+git clone -b __oom_gerrit_branch__ https://gerrit.onap.org/r/oom
 cd oom
-git log -1
-git tag -a "deploy0" -m "initial deployment"
+git fetch https://gerrit.onap.org/r/oom __oom_gerrit_refspec__
+git checkout FETCH_HEAD
 git checkout -b workarounds
+git log -1
 
 # Clone integration
 cd ~
-git clone -b __gerrit_branch__ https://gerrit.onap.org/r/integration
+git clone -b __integration_gerrit_branch__ https://gerrit.onap.org/r/integration
 cd integration
-git fetch https://gerrit.onap.org/r/integration __gerrit_refspec__
+git fetch https://gerrit.onap.org/r/integration __integration_gerrit_refspec__
 git checkout FETCH_HEAD
 
-cd version-manifest/src/main/scripts
-./update-oom-image-versions.sh ../resources/__docker_manifest__ ~/oom/
+if [ ! -z "__docker_manifest__" ]; then
+    cd version-manifest/src/main/scripts
+    ./update-oom-image-versions.sh ../resources/__docker_manifest__ ~/oom/
+fi
 
 cd ~/oom
 git diff
+git commit -a -m "apply manifest versions"
+git tag -a "deploy0" -m "initial deployment"
 
 
 # Run ONAP:
index 8a41a78..c9cd005 100755 (executable)
@@ -9,14 +9,51 @@
 #     http://www.apache.org/licenses/LICENSE-2.0
 #
 
+install_name="onap-oom"
+full_deletion=false
+
 if [ -z "$WORKSPACE" ]; then
     export WORKSPACE=`git rev-parse --show-toplevel`
 fi
 
+usage() { echo "Usage: $0 [ -r ] <env-name>" 1>&2; exit 1; }
+
+
+while getopts ":rq" o; do
+    case "${o}" in
+        r)
+            echo "The following command will delete all information relating to onap within your enviroment"
+            read -p "Are you certain this is what you want? (type y to confirm):" answer
+
+            if [ $answer = "y" ] || [ $answer = "Y" ] || [ $answer = "yes" ] || [ $answer = "Yes"]; then
+                echo "This may delete the work of other colleages within the same enviroment"
+                read -p "Are you certain this is what you want? (type y to confirm):" answer2
+
+                if [ $answer2 = "y" ] || [ $answer2 = "Y" ] || [ $answer2 = "yes" ] || [ $answer2 = "Yes"]; then
+                    full_deletion=true
+                else
+                    echo "Ending program"
+                    exit 1
+                fi
+            else
+                echo "Ending program"
+                exit 1
+            fi
+            ;;
+        q)
+            full_deletion=true
+            ;;
+        *)
+            usage
+            ;;
+    esac
+done
+shift $((OPTIND-1))
+
 if [ "$#" -ne 1 ]; then
-    echo "Usage: $0 <env-name>"
-    exit 1
+   usage
 fi
+
 ENV_FILE=$1
 
 SSH_KEY=~/.ssh/onap_key
@@ -27,20 +64,24 @@ SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
 export OS_PASSWORD_ENCRYPTED=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p)
 
 for n in $(seq 1 5); do
-    $WORKSPACE/test/ete/scripts/teardown-onap.sh
+    if [ $full_deletion = true ] ; then
+        $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $install_name -q
+    else
+        $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $install_name
+    fi
 
     cd $WORKSPACE/deployment/heat/onap-oom
     envsubst < $ENV_FILE > $ENV_FILE~
 
-    if ! openstack stack create -t ./onap-oom.yaml -e $ENV_FILE~ onap-oom; then
+    if ! openstack stack create -t ./$install_name.yaml -e $ENV_FILE~ $install_name; then
         break
     fi
 
-    while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value onap-oom)" ]; do
+    while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $install_name)" ]; do
         sleep 20
     done
 
-    STATUS=$(openstack stack show -c stack_status -f value onap-oom)
+    STATUS=$(openstack stack show -c stack_status -f value $install_name)
     echo $STATUS
     if [ "CREATE_COMPLETE" != "$STATUS" ]; then
         break
@@ -48,8 +89,8 @@ for n in $(seq 1 5); do
 
     for i in $(seq 1 30); do
        sleep 30
-       RANCHER_IP=$(openstack stack output show onap-oom rancher_vm_ip -c output_value -f value)
-        K8S_IP=$(openstack stack output show onap-oom k8s_1_vm_ip -c output_value -f value)
+       RANCHER_IP=$(openstack stack output show $install_name rancher_vm_ip -c output_value -f value)
+        K8S_IP=$(openstack stack output show $install_name k8s_1_vm_ip -c output_value -f value)
        timeout 1 ping -c 1 "$RANCHER_IP" && break
     done
 
index 33d2c3d..092b2a1 100755 (executable)
@@ -51,9 +51,16 @@ cat <<EOF
             __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
             __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
             __integration_override_yaml__: { get_param: integration_override_yaml }
-            __gerrit_branch__: { get_param: gerrit_branch }
-            __gerrit_refspec__: { get_param: gerrit_refspec }
+            __integration_gerrit_branch__: { get_param: integration_gerrit_branch }
+            __integration_gerrit_refspec__: { get_param: integration_gerrit_refspec }
+            __oom_gerrit_branch__: { get_param: oom_gerrit_branch }
+            __oom_gerrit_refspec__: { get_param: oom_gerrit_refspec }
             __docker_manifest__: { get_param: docker_manifest }
+            __docker_version__: { get_param: docker_version }
+            __rancher_version__: { get_param: rancher_version }
+            __rancher_agent_version__: { get_param: rancher_agent_version }
+            __kubectl_version__: { get_param: kubectl_version }
+            __helm_version__: { get_param: helm_version }
             __public_net_id__: { get_param: public_net_id }
             __oam_network_cidr__: { get_param: oam_network_cidr }
             __oam_network_id__: { get_resource: oam_network }
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml
new file mode 100644 (file)
index 0000000..66cbde2
--- /dev/null
@@ -0,0 +1,78 @@
+version: "3"
+
+networks:
+  ves-hv-default:
+    external:
+      name: $CONTAINERS_NETWORK
+
+services:
+  zookeeper:
+    image: wurstmeister/zookeeper
+    ports:
+      - "2181:2181"
+    networks:
+      - ves-hv-default
+
+  kafka:
+    image: wurstmeister/kafka
+    ports:
+      - "9092:9092"
+    environment:
+      KAFKA_ADVERTISED_HOST_NAME: "kafka"
+      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
+      KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
+      KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092"
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock
+    depends_on:
+      - zookeeper
+    networks:
+      - ves-hv-default
+
+  consul:
+    image: progrium/consul
+    ports:
+      - "8500:8500"
+    environment:
+      - CONSUL_BIND_INTERFACE=eth0
+    networks:
+      ves-hv-default:
+        aliases:
+           - consul
+    command: ["-server", "-bootstrap"]
+
+  ves-hv-collector:
+    image: $DOCKER_REGISTRY/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest
+    ports:
+      - "6060:6060"
+      - "6061: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"]
+    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:
+      - "6063:6063/tcp"
+    command: ["--listen-port", "6063", "--kafka-bootstrap-servers", "kafka:9092", "--kafka-topics", "ves_hvRanMeas"]
+    healthcheck:
+      interval: 10s
+      timeout: 5s
+      retries: 2
+      test: "curl --request GET --fail --silent --show-error localhost:6063/healthcheck"
+    depends_on:
+      - kafka
+    networks:
+      ves-hv-default:
+        aliases:
+           - dcae-app-simulator
\ No newline at end of file
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh
new file mode 100755 (executable)
index 0000000..6b527fc
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+pip uninstall -y docker-py
+pip install docker
+
+COMPOSE_VERSION=1.22.0
+COMPOSE_LOCATION='/usr/local/bin/docker-compose'
+sudo curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o ${COMPOSE_LOCATION}
+sudo chmod +x ${COMPOSE_LOCATION}
+
+
+echo "Removing not used docker networks"
+docker network prune -f
+
+export CONTAINERS_NETWORK=ves-hv-default
+echo "Creating network for containers: ${CONTAINERS_NETWORK}"
+docker network create ${CONTAINERS_NETWORK}
+
+cd ssl
+make FILE=client
+make FILE=server
+make FILE=invalid_client CA=invalid_trust
+cd ..
+
+export DOCKER_REGISTRY="nexus3.onap.org:10001"
+docker-compose up -d
+
+mkdir ${WORKSPACE}/archives/containers_logs
+
+export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries"
\ No newline at end of file
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/Makefile b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/Makefile
new file mode 100644 (file)
index 0000000..5fddc6b
--- /dev/null
@@ -0,0 +1,32 @@
+FILE=sample
+CA_PASSWD=onap
+SUBJ=/C=PL/ST=DL/L=Wroclaw/O=Nokia/OU=MANO
+CA=trust
+
+sign: $(FILE).crt
+
+clean:
+       rm -f *.crt *.key *.srl *.csr
+
+generate-ca-certificate: $(CA).crt
+
+generate-private-key: $(FILE).key
+
+create-public-key: $(FILE).pub
+
+create-sign-request: $(FILE).csr
+
+$(CA).crt:
+       openssl req -new -x509 -keyout $(CA).key -out $(CA).crt -days 365 -passout pass:$(CA_PASSWD) -subj "$(SUBJ)"
+
+$(FILE).key:
+       openssl genpkey -algorithm RSA -out $(FILE).key -pkeyopt rsa_keygen_bits:2048
+
+$(FILE).pub: $(FILE).key
+       openssl x509 -req -days 360 -in client.csr -CA $(CA).crt -CAkey $(CA).key -CAcreateserial -out client.crt
+
+$(FILE).csr: $(FILE).key
+       openssl req -new -sha256 -key $(FILE).key -out $(FILE).csr -subj "$(SUBJ)"
+
+$(FILE).crt: $(CA).crt $(FILE).csr
+       openssl x509 -req -days 360 -in $(FILE).csr -CA $(CA).crt -CAkey $(CA).key -out $(FILE).crt -CAcreateserial -passin pass:$(CA_PASSWD)
\ No newline at end of file
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/README.md b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/README.md
new file mode 100644 (file)
index 0000000..174c166
--- /dev/null
@@ -0,0 +1,18 @@
+# Generating SSL certificates
+
+Typical usage:
+
+```shell
+make FILE=client
+make FILE=server
+```
+
+Will generate CA certificate and signed client and server certificates.
+
+More "low-level" usage:
+
+```shell
+make generate-ca-certificate
+make generate-private-key FILE=client
+make sign FILE=client
+```
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh
new file mode 100755 (executable)
index 0000000..84d3666
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+cd ssl
+make clean
+cd ..
+
+docker-compose logs > ${WORKSPACE}/archives/containers_logs/docker-compose.log
+docker-compose down
+docker-compose rm -f
+
+docker network rm ${CONTAINERS_NETWORK}
\ No newline at end of file
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/testplan.txt b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/testplan.txt
new file mode 100644 (file)
index 0000000..e9a7f63
--- /dev/null
@@ -0,0 +1,4 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+dcaegen2-collectors-hv-ves/testcases
+
index 058ed20..a5ce48b 100644 (file)
@@ -9,6 +9,9 @@ export AAI_SIMULATOR="aai_simulator"
 cd ${WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/resources/
 
 docker login -u docker -p docker nexus3.onap.org:10001
+pip uninstall -y docker-py
+pip uninstall -y docker
+pip install -U docker
 docker-compose up -d --build
 
 # Wait for initialization of Docker containers
@@ -37,7 +40,7 @@ echo PRH_IP=${PRH_IP}
 echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP}
 echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP}
 
-# Wait for initialization of docker services
+# Wait for initialization of PRH services
 for i in {1..10}; do
     curl -sS -m 1 localhost:8100/heartbeat && break
     echo sleep ${i}
@@ -53,5 +56,3 @@ docker start prh
 
 # #Pass any variables required by Robot test suites in ROBOT_VARIABLES
 ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100"
-
-pip install docker==2.7.0
diff --git a/test/csit/plans/dmaap-buscontroller/ssl/setup.sh b/test/csit/plans/dmaap-buscontroller/ssl/setup.sh
new file mode 100755 (executable)
index 0000000..e40f62d
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+# 
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 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.
+# 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.
+# ============LICENSE_END=========================================================
+# 
+#
+
+
+# Place the scripts in run order:
+source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/start-mock.sh
+start_mock "aaf" 
+AAF_IP=${IP}
+start_mock "mrc" 3905
+MRC_IP=${IP} 
+start_mock "drps" 8443
+DRPS_IP=${IP}
+
+source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh 
+dmaapbc_launch $AAF_IP $MRC_IP $DRPS_IP
+DMAAPBC_IP=${IP}
+
+
+echo "AAF_IP=$AAF_IP MRC_IP=$MRC_IP DRPS_IP=$DRPS_IP DMAAPBC_IP=$DMAAPBC_IP"
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v AAF_IP:${AAF_IP} -v MRC_IP:${MRC_IP} -v DRPS_IP:${DRPS_IP} -v DMAAPBC_IP:${DMAAPBC_IP}"
+
+set -x
+${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh ${DMAAPBC_IP} ${DRPS_IP} ${MRC_IP} https
+set +x
diff --git a/test/csit/plans/dmaap-buscontroller/ssl/teardown.sh b/test/csit/plans/dmaap-buscontroller/ssl/teardown.sh
new file mode 100644 (file)
index 0000000..1b041a4
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+# 
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 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.
+# 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.
+# ============LICENSE_END=========================================================
+# 
+#
+kill-instance.sh aaf-mock
+kill-instance.sh drps-mock
+kill-instance.sh mrc-mock
+kill-instance.sh dmaapbc
+
diff --git a/test/csit/plans/dmaap-buscontroller/ssl/testplan.txt b/test/csit/plans/dmaap-buscontroller/ssl/testplan.txt
new file mode 100644 (file)
index 0000000..e106e7b
--- /dev/null
@@ -0,0 +1,4 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+dmaap-buscontroller/ssl_suite
+
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/setup.sh b/test/csit/plans/dmaap-buscontroller/with_dr/setup.sh
new file mode 100755 (executable)
index 0000000..7cefa72
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+# 
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 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.
+# 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.
+# ============LICENSE_END=========================================================
+# 
+#
+
+source ${SCRIPTS}/common_functions.sh
+
+
+if [ "$USE_EXISTING_DMAAP" = "Y" ]
+then
+       ROBOT_VARIABLES="-v AAF_IP:0.0.0 -v MRC_IP:0.0.0.0 -v DRPS_IP:172.17.0.3 -v DMAAPBC_IP:172.17.0.4"
+else
+
+       # Place the scripts in run order:
+       source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dr-launch.sh
+       dmaap_dr_launch
+       DRPS_IP=${IP}
+
+       #source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/start-mock.sh
+       #start_mock "aaf" 
+       #AAF_IP=${IP}
+       AAF_IP=0.0.0.0
+       #start_mock "drps" 
+       #DRPS_IP=${IP}
+       MRC_IP=0.0.0.0
+
+       source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh 
+       dmaapbc_launch $AAF_IP $MRC_IP $DRPS_IP
+       DMAAPBC_IP=${IP}
+
+
+       echo "AAF_IP=$AAF_IP MRC_IP=$MRC_IP DRPS_IP=$DRPS_IP DMAAPBC_IP=$DMAAPBC_IP"
+
+       # Pass any variables required by Robot test suites in ROBOT_VARIABLES
+       ROBOT_VARIABLES="-v AAF_IP:${AAF_IP} -v MRC_IP:${MRC_IP} -v DRPS_IP:${DRPS_IP} -v DMAAPBC_IP:${DMAAPBC_IP}"
+       set -x
+       ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh ${DMAAPBC_IP} ${DRPS_IP} ${MRC_IP} https
+       set +x
+fi
+
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh b/test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh
new file mode 100755 (executable)
index 0000000..23ae60a
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 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.
+# 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.
+# ============LICENSE_END=========================================================
+
+if [ "$KEEP_DMAAP" != "Y" ]
+then
+kill-instance.sh dmaapbc
+cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+docker-compose down -v
+fi
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt b/test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt
new file mode 100755 (executable)
index 0000000..04c6838
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order.
+dmaap-buscontroller/with_dr
index 3b604fe..bcd19b5 100755 (executable)
@@ -31,9 +31,9 @@ else
        MRC_IP=${IP}
 
        source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/start-mock.sh
-       #start_mock "aaf" 
-       #AAF_IP=${IP}
-       AAF_IP=0.0.0.0
+       start_mock "aaf" 
+       AAF_IP=${IP}
+       #AAF_IP=0.0.0.0
        #start_mock "drps" 
        #DRPS_IP=${IP}
        DRPS_IP=0.0.0.0
index f35b022..3feebe0 100644 (file)
@@ -25,5 +25,6 @@ if [ "$KEEP_DMAAP" != "Y" ]
 then
 dmaap_mr_teardown
 kill-instance.sh dmaapbc
+kill-instance.sh aaf-mock
 fi
 
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh b/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
new file mode 100755 (executable)
index 0000000..e5debfc
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+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/
+
+sed -i 's/10003/10001/g' docker-compose.yml
+# 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)
+
+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"
+
+#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}"
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh b/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh
new file mode 100755 (executable)
index 0000000..033a001
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+docker-compose down -v
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/testplan.txt b/test/csit/plans/dmaap-datarouter/dr-suite/testplan.txt
new file mode 100755 (executable)
index 0000000..8349a05
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order.
+dmaap-datarouter/dr-suite
diff --git a/test/csit/plans/multicloud-pike/functionality1/setup.sh b/test/csit/plans/multicloud-pike/functionality1/setup.sh
new file mode 100644 (file)
index 0000000..57e8181
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Copyright (c) 2017-2018 Intel, Inc.
+#
+# 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.
+
+pushd ${SCRIPTS}
+
+# start multicloud-pike
+./run-instance.sh nexus3.onap.org:10001/onap/multicloud/openstack-pike:latest multicloud-pike
+SERVICE_IP=$(./get-instance-ip.sh multicloud-pike)
+SERVICE_PORT=9007
+popd
+
+if [[ $no_proxy && $no_proxy != *$SERVICE_IP* ]]; then
+       export no_proxy+=$no_proxy,$SERVICE_IP
+fi
+
+for i in {1..50}; do
+    curl -sS ${SERVICE_IP}:${SERVICE_PORT} && break
+    echo sleep $i
+    sleep $i
+done
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES+="-v SERVICE_IP:${SERVICE_IP} "
+ROBOT_VARIABLES+="-v SERVICE_PORT:${SERVICE_PORT} "
diff --git a/test/csit/plans/multicloud-pike/functionality1/teardown.sh b/test/csit/plans/multicloud-pike/functionality1/teardown.sh
new file mode 100644 (file)
index 0000000..13b7062
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+# Copyright (c) 2017-2018 Intel, Inc.
+#
+# 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.
+
+# This script is sourced by run-csit.sh after Robot test completion.
+kill-instance.sh multicloud-pike
diff --git a/test/csit/plans/multicloud-pike/functionality1/testplan.txt b/test/csit/plans/multicloud-pike/functionality1/testplan.txt
new file mode 100644 (file)
index 0000000..7f46016
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+multicloud-pike/provision/sanity_test_multicloud.robot
diff --git a/test/csit/plans/multicloud-pike/hpa-discovery/setup.sh b/test/csit/plans/multicloud-pike/hpa-discovery/setup.sh
new file mode 100644 (file)
index 0000000..cbcc302
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Copyright 2018 Intel Corporation, Inc
+# 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.
+
+cd ${SCRIPTS}
+
+source common_functions.sh
+
+generic_sim_path=${WORKSPACE}/test/csit/scripts/multicloud-pike/generic_sim
+multicloud_provision_path=${WORKSPACE}/test/csit/tests/multicloud-pike/provision
+# start generic simulator for openstack mock and AAI mock
+if [[ -z $(docker images -q generic_sim) ]]; then
+    pushd $generic_sim_path
+    docker build -t generic_sim .
+    popd
+fi
+
+function start_simulator ()
+{
+    local service_name=$1
+    local service_port=$2
+
+    ./run-instance.sh generic_sim $service_name "-v ${multicloud_provision_path}/${service_name}/:/tmp/generic_sim/ -v ${generic_sim_path}/${service_name}/:/etc/generic_sim/ -p $service_port:8080"
+    wait_for_service_init localhost:$service_port
+    bypass_ip_adress $service_name
+}
+
+start_simulator nova 8774
+start_simulator glance 9292
+start_simulator cinder 8776
+start_simulator keystone 5000
+start_simulator aai 8443
+
+# start multicloud-pike
+./run-instance.sh nexus3.onap.org:10001/onap/multicloud/openstack-pike multicloud-pike "-t -e AAI_SERVICE_URL=http://aai:8080/aai -e no_proxy=$no_proxy -p 9007:9007"
+SERVICE_IP=$(./get-instance-ip.sh multicloud-pike)
+SERVICE_PORT=9007
+
+docker network create hpa-net
+for container in aai keystone glance cinder nova multicloud-pike; do
+    docker network connect hpa-net $container
+done
+
+bypass_ip_adress $SERVICE_IP
+wait_for_service_init ${SERVICE_IP}:${SERVICE_PORT}
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES+="-v SERVICE_IP:${SERVICE_IP} "
+ROBOT_VARIABLES+="-v SERVICE_PORT:${SERVICE_PORT} "
diff --git a/test/csit/plans/multicloud-pike/hpa-discovery/teardown.sh b/test/csit/plans/multicloud-pike/hpa-discovery/teardown.sh
new file mode 100644 (file)
index 0000000..7d6c953
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright 2018 Intel Corporation, Inc
+# 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.
+
+for container in aai keystone cinder glance nova multicloud-pike; do
+    kill-instance.sh $container
+done
+docker network rm hpa-net
diff --git a/test/csit/plans/multicloud-pike/hpa-discovery/testplan.txt b/test/csit/plans/multicloud-pike/hpa-discovery/testplan.txt
new file mode 100644 (file)
index 0000000..5914cbb
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+multicloud-pike/provision/hpa_multicloud.robot
index ddfdfc0..ce5d108 100755 (executable)
@@ -27,7 +27,7 @@ source ${WORKSPACE}/test/csit/scripts/music/music-scripts/music_script.sh
 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
+TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.5
 ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
 MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
 WORK_DIR=/tmp/music
@@ -38,6 +38,8 @@ MUSIC_PROPERTIES=/tmp/music/properties
 MUSIC_LOGS=/tmp/music/logs
 mkdir -p ${MUSIC_PROPERTIES}
 mkdir -p ${MUSIC_LOGS}
+mkdir -p ${MUSIC_LOGS}/MUSIC
+
 
 cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties
 
@@ -77,6 +79,19 @@ echo "TOMCAT_IP=${TOMCAT_IP}"
 
 ${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${TOMCAT_IP} 8080
 
+sleep 20;
+echo "get the tomcat logs to make sure its running music properly"
+echo "======== TOMCAT Logs =============="
+docker logs music-tomcat
+# Needed only if we need to look at localhost logs.
+#echo "===== MUSIC localhost Log ===================="
+#docker exec music-tomcat /bin/bash -c "cat /usr/local/tomcat/logs/localhost*"
+
+echo "===== MUSIC Log ===================="
+ls -al $MUSIC_LOGS/MUSIC
+docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/music.log"
+echo "===== MUSIC error log =================="
+docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/error.log"
 
 echo "inspect docker things for tracing purpose"
 docker inspect music-db
@@ -89,6 +104,7 @@ docker network inspect music-net
 echo "dump music content just after music is started"
 docker exec music-db /usr/bin/nodetool status
 docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'DESCRIBE keyspace admin'
 docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
 
 
index e9982ae..a5f7423 100755 (executable)
 #
 # add here below the killing of all docker containers used for music CSIT testing
 #
+echo "dump music.log files"
+ls -alF /tmp/music
+ls -alFR /tmp/music
+ls -alF /tmp/music/properties
+cat /tmp/music/properties/music.properties
+echo "===== MUSIC log =================="
+docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/music.log"
+#cat /tmp/music/logs/MUSIC/music.log
+echo "===== MUSIC error log =================="
+docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/error.log"
+#cat /tmp/music/logs/MUSIC/error.log
+
 echo "##########################################################";
 echo "#";
 echo "# music scripts docker containers killing";
@@ -39,13 +51,6 @@ sleep 5;
 
 docker volume rm music-vol
 
-echo "dump music.log files"
-ls -alF /tmp/music
-ls -alF /tmp/music/properties
-cat /tmp/music/properties/music.properties
-cat /tmp/music/logs/MUSIC/music.log
-cat /tmp/music/logs/MUSIC/error.log
-
 #rm -Rf /tmp/music
 
 
index 63782a9..f82f228 100755 (executable)
@@ -32,6 +32,10 @@ docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY
 MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
 echo MSB_IAG_IP=${MSB_IAG_IP}
 
+docker run -d -p 3306:3306 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
 # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
 for i in {1..10}; do
     curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
@@ -39,12 +43,19 @@ for i in {1..10}; do
     sleep $i
 done
 
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
 # wait for container initalization
 echo sleep 30
 sleep 30
 
 # start vfc-vnflcm
-docker run -d --name vfc-vnflcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/vnflcm
+docker run -d --name vfc-vnflcm -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnflcm
 VNFLCM_IP=`get-instance-ip.sh vfc-vnflcm`
 
 # Wait for initialization
index f78acd3..aebb252 100755 (executable)
@@ -19,4 +19,5 @@
 kill-instance.sh msb_internal_apigateway
 kill-instance.sh msb_discovery
 kill-instance.sh msb_consul
+kill-instance.sh vfc-db
 kill-instance.sh vfc-vnflcm
index 8a3f9af..3c985aa 100755 (executable)
@@ -32,6 +32,10 @@ docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY
 MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
 echo MSB_IAG_IP=${MSB_IAG_IP}
 
+docker run -d -p 3306:3306 --name vfc-db nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
 # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
 for i in {1..10}; do
     curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
@@ -39,12 +43,19 @@ for i in {1..10}; do
     sleep $i
 done
 
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
 # wait for container initalization
 echo sleep 30
 sleep 30
 
 # start vfc-vnfmgr
-docker run -d --name vfc-vnfmgr -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/vnfmgr
+docker run -d --name vfc-vnfmgr -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnfmgr
 VNFMGR_IP=`get-instance-ip.sh vfc-vnfmgr`
 for i in {1..10}; do
     curl -sS -m 1 ${VNFMGR_IP}:8803 && break
index 572c2f3..cfabe42 100755 (executable)
@@ -19,4 +19,5 @@
 kill-instance.sh msb_internal_apigateway
 kill-instance.sh msb_discovery
 kill-instance.sh msb_consul
+kill-instance.sh vfc-db
 kill-instance.sh vfc-vnfmgr
index e976f92..a0ea986 100755 (executable)
@@ -31,6 +31,10 @@ docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY
 MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
 echo MSB_IAG_IP=${MSB_IAG_IP}
 
+docker run -d -p 3306:3306 --name vfc-db nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
 # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
 for i in {1..10}; do
     curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
@@ -38,11 +42,18 @@ for i in {1..10}; do
     sleep $i
 done
 
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
 # wait for container initalization
 echo sleep 60
 sleep 60
 # start vfc-vnfres
-docker run -d --name vfc-vnfres -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/vnfres
+docker run -d --name vfc-vnfres -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnfres
 VNFRES_IP=`get-instance-ip.sh vfc-vnfres`
 
 # Wait for initialization
index edd857d..09db55b 100755 (executable)
@@ -19,4 +19,5 @@
 kill-instance.sh msb_internal_apigateway
 kill-instance.sh msb_discovery
 kill-instance.sh msb_consul
+kill-instance.sh vfc-db
 kill-instance.sh vfc-vnfres
index 3576e23..d839fa5 100644 (file)
@@ -33,6 +33,10 @@ docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP -e "
 MSB_IP==`get-instance-ip.sh msb_internal_apigateway`
 echo MSB_IP=${MSB_IP}
 
+docker run -d -p 3306:3306 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
 # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
 for i in {1..10}; do
     curl -sS -m 1 ${CONSUL_IP}:8500 && curl -sS -m 1 ${DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IP}:80 && break
@@ -40,12 +44,19 @@ for i in {1..10}; do
     sleep $i
 done
 
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
 # Need some time so service info can be synced from discovery to api gateway
 echo sleep 60
 sleep 60
 
 # start vfc-catalog
-docker run -d --name vfc-catalog -v /var/lib/mysql -e MSB_ADDR=${DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/catalog
+docker run -d --name vfc-catalog -v /var/lib/mysql -e MSB_ADDR=${DISCOVERY_IP}:10081 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/catalog
 CATALOG_IP=`get-instance-ip.sh vfc-catalog`
 for i in {1..10}; do
     curl -sS -m 1 ${CATALOG_IP}:8806 && break
index 68d5b60..d498e34 100644 (file)
@@ -19,4 +19,5 @@
 kill-instance.sh msb_internal_apigateway
 kill-instance.sh msb_discovery
 kill-instance.sh msb_consul
+kill-instance.sh vfc-db
 kill-instance.sh vfc-catalog
index 74b0ab6..7a739ba 100755 (executable)
@@ -32,6 +32,10 @@ docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY
 MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
 echo MSB_IAG_IP=${MSB_IAG_IP}
 
+docker run -d -p 3306:3306 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
 # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
 for i in {1..10}; do
     curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
@@ -39,12 +43,25 @@ for i in {1..10}; do
     sleep $i
 done
 
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
+docker ps > 1.txt
+cat 1.txt
+echo "****************************"
+docker logs -f vfc-db > 2.txt &
+cat 2.txt
+
 # Need some time so service info can be synced from discovery to api gateway
 echo sleep 60
 sleep 60
 
 # start vfc-nslcm
-docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/nslcm
+docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/nslcm
 NSLCM_IP=`get-instance-ip.sh vfc-nslcm`
 
 # Wait for initialization
@@ -54,5 +71,15 @@ for i in {1..10}; do
     sleep $i
 done
 
+curl http://${NSLCM_IP}:8403/api/nslcm/v1/swagger.json
+
+docker logs -f vfc-nslcm > 3.txt &
+cat 3.txt
+
+docker cp vfc-nslcm:/service/vfc/nfvo/lcm/logs/runtime_lcm.log ./
+cat runtime_lcm.log
+
+
+
 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
 ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v NSLCM_IP:${NSLCM_IP} -v SCRIPTS:${SCRIPTS}"
index c74850d..6ddf755 100755 (executable)
@@ -19,4 +19,5 @@
 kill-instance.sh msb_internal_apigateway
 kill-instance.sh msb_discovery
 kill-instance.sh msb_consul
+kill-instance.sh vfc-db
 kill-instance.sh vfc-nslcm
index a117a6c..ce308cf 100644 (file)
@@ -32,4 +32,3 @@ echo BE_IP=${BE_IP}
 
 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
 ROBOT_VARIABLES="-v BE_IP:${BE_IP}"
-
index 7e109b7..3921bb0 100755 (executable)
@@ -24,7 +24,9 @@ cd $WORKSPACE/archives
 git clone -b master --single-branch http://gerrit.onap.org/r/vnfsdk/pkgtools.git pkgtools
 cd $WORKSPACE/archives/pkgtools
 git pull
-python setup.py install
+echo "To install vnfsdk pkgtools git head revision: $(git rev-parse HEAD)"
+python setup.py egg_info
+pip install .
 
 pip freeze | tee $WORKSPACE/archives/_pip-freeze-after-setup.txt
 
index f47c44e..05ff05a 100644 (file)
@@ -1,3 +1,4 @@
 # Test suites are relative paths under [integration.git]/test/csit/tests/.
 # Place the suites in run order.
 vnfsdk-pkgtools/tosca-metadata/create_open.robot
+vnfsdk-pkgtools/tosca-metadata/create_validate_digest_signing.robot
index 4b2a571..a048a0d 100755 (executable)
@@ -105,9 +105,10 @@ pip install --upgrade ${ROBOT_VENV}/src/onap/testsuite/python-testing-utils
 pip freeze
 
 # install chrome driver
+google-chrome --version
 if [ ! -x ${ROBOT_VENV}/bin/chromedriver ]; then
     pushd ${ROBOT_VENV}/bin
-    wget -N http://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
+    wget -N http://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
     unzip chromedriver_linux64.zip
     chmod +x chromedriver
     popd
diff --git a/test/csit/scripts/clamp/python-lib/CustomSeleniumLibrary.py b/test/csit/scripts/clamp/python-lib/CustomSeleniumLibrary.py
new file mode 100755 (executable)
index 0000000..ad11b11
--- /dev/null
@@ -0,0 +1,20 @@
+from Selenium2Library import Selenium2Library
+from selenium.webdriver.common.keys import Keys
+import time
+
+class CustomSeleniumLibrary(Selenium2Library):
+    def insert_into_prompt(self, text):
+        alert = None
+        try:
+            time.sleep(5)
+            listOfFields = text.split(" ")
+            allInOneString=""
+            for temp in listOfFields:
+               allInOneString=allInOneString+temp+Keys.TAB
+
+            alert= self._current_browser().switch_to_alert()
+            alert.send_keys(allInOneString)
+        except WebDriverException:
+            raise RuntimeError('There were no alert')
+
+
index dc0b4fe..23b1705 100755 (executable)
@@ -32,7 +32,7 @@ TIME_OUT=600
 INTERVAL=5
 TIME=0
 while [ "$TIME" -lt "$TIME_OUT" ]; do
-  response=$(curl --write-out '%{http_code}' --silent --output /dev/null -vk --key config/org.onap.clamp.keyfile https://localhost:8443/restservices/clds/v1/clds/healthcheck); echo $response
+  response=$(curl --write-out '%{http_code}' --silent --output /dev/null -vk --key config/org.onap.clamp.keyfile https://localhost:8443/restservices/clds/v1/healthcheck); echo $response
 
   if [ "$response" == "200" ]; then
     echo Clamp and its database well started in $TIME seconds
index 96ac40f..804603f 100755 (executable)
@@ -3,6 +3,21 @@
 # $1 is the IP address of the buscontroller
 # $2 is the IP address of the DRPS
 # $3 is the IP address of the MRC
+# $4 is the protocol (defaults to http)
+
+PROTO=${4:-http}
+if [ "$PROTO" = "http" ]
+then
+       PORT=8080
+       CURLOPT="-v"
+       MRPORT=3904
+       DRPORT=8080
+else
+       PORT=8443
+       CURLOPT="-v -k"
+       MRPORT=3905
+       DRPORT=8443
+fi
 
 # INITIALIZE: dmaap object
 JSON=/tmp/$$.dmaap
@@ -10,7 +25,7 @@ cat << EOF > $JSON
 {
        "version": "1",
        "topicNsRoot": "org.onap.dmaap",
-       "drProvUrl": "http://${2}:8080",
+       "drProvUrl": "${PROTO}://dmaap-dr-prov:${DRPORT}",
        "dmaapName": "onapCSIT",
        "bridgeAdminTopic": "MM_AGENT_PROV"
 
@@ -18,7 +33,7 @@ cat << EOF > $JSON
 EOF
 
 echo "Initializing /dmaap endpoint"
-curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap 
+curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/dmaap 
 
 
 
@@ -35,7 +50,7 @@ cat << EOF > $JSON
 EOF
 
 echo "Initializing /dcaeLocations endpoint"
-curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dcaeLocations 
+curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/dcaeLocations 
 
 
 # INITIALIZE: MR object in 1 site
@@ -52,10 +67,10 @@ cat << EOF > $JSON
        "dcaeLocationName": "csit-sanfrancisco",
        "fqdn": "$DOCKER_HOST",
        "topicProtocol" : "http",
-       "topicPort": "3904"
+       "topicPort": "${MRPORT}"
 
 }
 EOF
 
 echo "Initializing /mr_clusters endpoint"
-curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters
+curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/mr_clusters
index 688ce7d..317c17f 100755 (executable)
@@ -12,7 +12,16 @@ function dmaapbc_launch() {
 
        TMP_CFG=/tmp/docker-databus-controller.conf
        . ./onapCSIT.env > $TMP_CFG
-       docker run -d --name $CONTAINER_NAME -v $TMP_CFG:/opt/app/config/conf $TAG
+       ADDHOSTS=""
+       if [ ! -z "$2" ]
+       then
+               ADDHOSTS="$ADDHOSTS --add-host=message-router:$2"
+       fi
+       if [ ! -z "$3" ]
+       then
+               ADDHOSTS="$ADDHOSTS --add-host=dmaap-dr-prov:$3"
+       fi
+       docker run -d $ADDHOSTS --name $CONTAINER_NAME -v $TMP_CFG:/opt/app/config/conf $TAG
        IP=`get-instance-ip.sh ${CONTAINER_NAME}`
 
        # Wait for initialization
diff --git a/test/csit/scripts/dmaap-buscontroller/dr-launch.sh b/test/csit/scripts/dmaap-buscontroller/dr-launch.sh
new file mode 100644 (file)
index 0000000..abc0aae
--- /dev/null
@@ -0,0 +1,59 @@
+
+#!/bin/bash
+
+#!/bin/bash
+
+# script to launch DMaaP DR  docker containers
+# sets global var IP with assigned IP address of DR Prov
+
+function dmaap_dr_launch() {
+        IP=""
+
+
+       # This next section was copied from scripts/dmaap-datarouter/dr-suite/setup.sh
+       # and slightly modified...
+
+       # 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/
+
+       sed -i 's/10003/10001/g' docker-compose.yml
+       # 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)
+
+       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"
+
+       #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}"
+
+        IP=${DR_GATEWAY_IP}
+}
index 58432e6..db86581 100644 (file)
@@ -8,7 +8,7 @@
 # Only need to set values where defaults aren't appropriate
 #
 cat <<!EOF
-DMAAPBC_INT_HTTPS_PORT=0
+DMAAPBC_INT_HTTPS_PORT=8443
 DMAAPBC_PG_ENABLED=false
 DMAAPBC_INSTANCE_NAME=ONAP-CSIT
 DMAAPBC_AAF_URL=https://${1}:1080/proxy/
index c439a97..64f1720 100755 (executable)
@@ -31,6 +31,7 @@ source ${SCRIPTS}/common_functions.sh
 # (kafka and zk containers are not called externally)
 
 function dmaap_mr_launch() {
+               COMPOSE_PREFIX=docker-compose
                # Clone DMaaP Message Router repo
                mkdir -p $WORKSPACE/archives/dmaapmr
                cd $WORKSPACE/archives/dmaapmr
@@ -45,12 +46,13 @@ function dmaap_mr_launch() {
                # 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
+               docker ps
 
                # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
                for i in {1..50}; do
-                       if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \
-                               [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
-                               [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] 
+                       if [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_dmaap_1) ] && \
+                               [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_zookeeper_1) ] && \
+                               [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_dmaap_1) ] 
                        then
                                echo "DMaaP Service Running"    
                                break                   
@@ -61,10 +63,10 @@ function dmaap_mr_launch() {
                done
 
 
-               DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
+               DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${COMPOSE_PREFIX}_dmaap_1)
                IP=${DMAAP_MR_IP}
-               KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
-               ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
+               KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${COMPOSE_PREFIX}_kafka_1)
+               ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${COMPOSE_PREFIX}_zookeeper_1)
 
                echo DMAAP_MR_IP=${DMAAP_MR_IP}
                echo IP=${IP}
@@ -84,9 +86,9 @@ function dmaap_mr_launch() {
 
                # Wait for initialization of Docker containers
                for i in {1..50}; do
-                               if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \
-                                               [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
-                                               [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
+                               if [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_dmaap_1) ] && \
+                                               [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_zookeeper_1) ] && \
+                                               [ $(docker inspect --format '{{ .State.Running }}' ${COMPOSE_PREFIX}_dmaap_1) ]
                                then
                                                echo "DMaaP Service Running"
                                                break
index f573857..ac6d798 100755 (executable)
@@ -18,7 +18,7 @@
 #
 
 function dmaap_mr_teardown() {
-kill-instance.sh dockercompose_dmaap_1 
-kill-instance.sh dockercompose_kafka_1 
-kill-instance.sh dockercompose_zookeeper_1
+kill-instance.sh docker-compose_dmaap_1 
+kill-instance.sh docker-compose_kafka_1 
+kill-instance.sh docker-compose_zookeeper_1
 }
index 61026d7..1d1d0fd 100644 (file)
@@ -16,8 +16,8 @@
 
 NEXUS_USERNAME=docker
 NEXUS_PASSWD=docker
-NEXUS_DOCKER_REPO=nexus3.onap.org:10001
-DOCKER_IMAGE_VERSION=latest
+export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
+export DOCKER_IMAGE_VERSION=latest
 
 echo "This is ${WORKSPACE}/test/csit/scripts/externalapi-nbi/start_nbi_containers.sh"
 
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/Dockerfile b/test/csit/scripts/multicloud-pike/generic_sim/Dockerfile
new file mode 100644 (file)
index 0000000..688b58a
--- /dev/null
@@ -0,0 +1,12 @@
+FROM python:2.7
+
+EXPOSE 8080
+
+RUN mkdir -p /{tmp,etc}/generic_sim
+
+WORKDIR /opt/generic_sim/
+
+COPY . .
+RUN pip install --no-cache-dir -r requirements.txt
+
+CMD [ "python", "generic_sim.py" ]
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/aai/responses.yml b/test/csit/scripts/multicloud-pike/generic_sim/aai/responses.yml
new file mode 100644 (file)
index 0000000..2762807
--- /dev/null
@@ -0,0 +1,189 @@
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne:
+  GET:
+    body: '{"cloud-owner":"CloudOwner","cloud-region-id":"RegionOne","cloud-type":"openstack","owner-defined-type":"t1","cloud-region-version":"RegionOne","identity-url":"http://keystone:8080/v3","cloud-zone":"z1","complex-name":"clli1","sriov-automation":false,"cloud-extra-info":"","resource-version":"1524845154715"}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/internal:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/internal","Node
+      Not Found:No Node of type availability-zone found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/internal","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/nova:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/nova","Node
+      Not Found:No Node of type availability-zone found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/nova","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/100:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/100","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/100","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/110:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/110","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/110","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/111:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/111","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/111","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/112:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/112","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/112","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/113:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/113","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/113","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/114:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/114","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/114","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/115:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/115","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/115","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/116:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/116","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/116","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/117:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/117","Node
+      Not Found:No Node of type flavor found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/117","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/660709df-e90b-471f-ac57-d8c2555e573d:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/660709df-e90b-471f-ac57-d8c2555e573d","Node
+      Not Found:No Node of type image found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/660709df-e90b-471f-ac57-d8c2555e573d","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3543226ffed44daf90a2f71f36c00b8d:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3543226ffed44daf90a2f71f36c00b8d","Node
+      Not Found:No Node of type tenant found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3543226ffed44daf90a2f71f36c00b8d","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b8f5d85bbcd84af28d7caa62d39f05c7:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b8f5d85bbcd84af28d7caa62d39f05c7","Node
+      Not Found:No Node of type tenant found at: cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b8f5d85bbcd84af28d7caa62d39f05c7","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne:
+  GET:
+    body: '{"cloud-owner":"CloudOwner","cloud-region-id":"RegionOne","cloud-type":"openstack","owner-defined-type":"t1","cloud-region-version":"RegionOne","identity-url":"http://multicloud-pike:80/api/multicloud-titanium_cloud/v0/CloudOwner_RegionOne/identity/v2.0","cloud-zone":"z1","complex-name":"clli1","sriov-automation":false,"cloud-extra-info":"","resource-version":"1524845276291"}'
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/esr-system-info-list:
+  GET:
+    body: '{"esr-system-info":[{"esr-system-info-id":"4ce895ad-82f7-4476-b5eb-d19d19585da2","service-url":"http://keystone:8080/v3","user-name":"admin","password":"secret","system-type":"VIM","ssl-insecure":true,"cloud-domain":"Default","default-tenant":"admin","resource-version":"1524845155617"}]}'
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/pservers/pserver/compute-0:
+  GET:
+    body: '{"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource
+      not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","cloud-infrastructure/pservers/pserver/compute-0","Node
+      Not Found:No Node of type pserver found at: cloud-infrastructure/pservers/pserver/compute-0","ERR.5.4.6114"]}}}'
+    content_type: application/json
+    status_code: 200
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
+aai/v13/cloud-infrastructure/pservers/pserver/compute-0/relationship-list/relationship:
+  PUT:
+    body: ''
+    content_type: application/json
+    status_code: 200
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/cinder/responses.yml b/test/csit/scripts/multicloud-pike/generic_sim/cinder/responses.yml
new file mode 100644 (file)
index 0000000..d9657a5
--- /dev/null
@@ -0,0 +1,5 @@
+/snapshots/detail:
+  get:
+    body: '{"snapshots": []}'
+    content_type: application/json
+    status_code: 200
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/generic_sim.py b/test/csit/scripts/multicloud-pike/generic_sim/generic_sim.py
new file mode 100644 (file)
index 0000000..4392b65
--- /dev/null
@@ -0,0 +1,109 @@
+# Copyright 2018 Intel Corporation, Inc
+# 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.
+
+import json
+import logging
+
+import web
+from web import webapi
+import yaml
+
+urls = (
+  '/(.*)','MockController'
+)
+
+def setup_logger(name, log_file, level=logging.DEBUG):
+    print("Configuring the logger...")
+    handler = logging.FileHandler(log_file)
+    formatter = logging.Formatter('%(message)s')
+    handler.setFormatter(formatter)
+
+    logger = logging.getLogger(name)
+    logger.setLevel(level)
+    logger.addHandler(handler)
+
+    return logger
+
+
+class MockResponse:
+    def __init__(self, http_verb, status_code,
+                 content_type="application/json", body="{}",
+                 headers={}):
+        self.http_verb = http_verb.lower()
+        self.status_code = status_code
+        self.content_type = content_type
+        self.body = body
+        self.headers = headers
+
+def _parse_responses(parsed_responses):
+    result = {}
+    for path, responses in parsed_responses.iteritems():
+        new_path = path
+        if path.startswith("/"):
+            new_path = path[1:]
+
+        result[new_path] = []
+        for http_verb, response in responses.iteritems():
+            result[new_path].append(MockResponse(http_verb, **response))
+    return result
+
+def load_responses(filename):
+    print("Loading responses from configuration file..")
+    with open(filename) as yaml_file:
+        responses_file = yaml.safe_load(yaml_file)
+    responses_map = _parse_responses(responses_file)
+    return responses_map
+
+
+class MockController:
+
+    def _do_action(self, action):
+        logger.info('{}'.format(web.ctx.env.get('wsgi.input').read()))
+        action = action.lower()
+        url = web.ctx['fullpath']
+        try:
+            if url.startswith("/"):
+                url = url[1:]
+            response = [ r for r in responses_map[url] if r.http_verb == action][0]
+            for header, value in response.headers.iteritems():
+                web.header(header, value)
+            web.header('Content-Type', response.content_type)
+            print(response.body)
+            return response.body
+        except:
+            webapi.NotFound()
+
+    def DELETE(self, url):
+        return self._do_action("delete")
+
+    def HEAD(self, url):
+        return self._do_action("head")
+
+    def PUT(self, url):
+        return self._do_action("put")
+
+    def GET(self, url):
+        return self._do_action("get")
+
+    def POST(self, url):
+        return self._do_action("post")
+
+    def PATCH(self, url):
+        return self._do_action("patch")
+
+
+logger = setup_logger('mock_controller', '/tmp/generic_sim/output.log')
+responses_map = load_responses('/etc/generic_sim/responses.yml')
+app = web.application(urls, globals())
+if __name__ == "__main__":
+    app.run()
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/glance/responses.yml b/test/csit/scripts/multicloud-pike/generic_sim/glance/responses.yml
new file mode 100644 (file)
index 0000000..d842235
--- /dev/null
@@ -0,0 +1,73 @@
+/v2/images:
+  get:
+    body: '{"images": [{"status": "active", "schema": "/v2/schemas/image",
+      "virtual_size": null, "description": "", "tags": [], "container_format":
+      "bare", "created_at": "2018-04-21T06:12:13Z", "disk_format": "raw",
+      "updated_at": "2018-04-21T06:12:24Z", "visibility": "public", "id":
+      "660709df-e90b-471f-ac57-d8c2555e573d", "owner": "b8f5d85bbcd84af28d7caa62d39f05c7",
+      "protected": false, "min_ram": 0, "file": "/v2/images/660709df-e90b-471f-ac57-d8c2555e573d/file",
+      "checksum": "683f86920d4c922cb5c55d99d646b895", "min_disk": 0, "size":
+      1697597440, "self": "/v2/images/660709df-e90b-471f-ac57-d8c2555e573d", "store":
+      "file", "name": "tis4-centos-guest"}], "first": "/v2/images", "schema":
+      "/v2/schemas/images"}'
+    content_type: application/json
+    status_code: 200
+/v2/schemas/image:
+  get:
+    body: '{"additionalProperties": {"type": "string"}, "name": "image",
+      "links": [{"href": "{self}", "rel": "self"}, {"href": "{file}",
+      "rel": "enclosure"}, {"href": "{schema}", "rel": "describedby"}],
+      "properties": {"container_format": {"enum": [null, "ami", "ari", "aki",
+      "bare", "ovf", "ova", "docker"], "type": ["null", "string"], "description":
+      "Format of the container"}, "min_ram": {"type": "integer", "description":
+      "Amount of ram (in MB) required to boot image."}, "ramdisk_id": {"pattern":
+      "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$",
+      "type": ["null", "string"], "description": "ID of image stored in Glance
+      that should be used as the ramdisk when booting an AMI-style image.", "is_base":
+      false}, "locations": {"items": {"required": ["url", "metadata"], "type":
+      "object", "properties": {"url": {"type": "string", "maxLength":
+      255}, "metadata": {"type": "object"}}}, "type": "array", "description":
+      "A set of URLs to access the image file kept in external store"}, "file":
+      {"readOnly": true, "type": "string", "description": "An image file
+      url"}, "owner": {"type": ["null", "string"], "description": "Owner
+      of the image", "maxLength": 255}, "id": {"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$",
+      "type": "string", "description": "An identifier for the image"}, "size":
+      {"readOnly": true, "type": ["null", "integer"], "description": "Size
+      of image file in bytes"}, "os_distro": {"type": "string", "description":
+      "Common name of operating system distribution as specified in https://docs.openstack.org/python-glanceclient/latest/cli/property-keys.html",
+      "is_base": false}, "self": {"readOnly": true, "type": "string", "description":
+      "An image self url"}, "disk_format": {"enum": [null, "ami", "ari",
+      "aki", "vhd", "vhdx", "vmdk", "raw", "qcow2", "vdi", "iso",
+      "ploop"], "type": ["null", "string"], "description": "Format of the
+      disk"}, "os_version": {"type": "string", "description": "Operating
+      system version as specified by the distributor", "is_base": false}, "direct_url":
+      {"readOnly": true, "type": "string", "description": "URL to access
+      the image file kept in external store"}, "schema": {"readOnly": true, "type":
+      "string", "description": "An image schema url"}, "status": {"readOnly":
+      true, "enum": ["queued", "saving", "active", "killed", "deleted",
+      "pending_delete", "deactivated"], "type": "string", "description":
+      "Status of the image"}, "tags": {"items": {"type": "string", "maxLength":
+      255}, "type": "array", "description": "List of strings related to the
+      image"}, "kernel_id": {"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$",
+      "type": ["null", "string"], "description": "ID of image stored in Glance
+      that should be used as the kernel when booting an AMI-style image.", "is_base":
+      false}, "visibility": {"enum": ["community", "public", "private",
+      "shared"], "type": "string", "description": "Scope of image accessibility"},
+      "updated_at": {"readOnly": true, "type": "string", "description":
+      "Date and time of the last image modification"}, "min_disk": {"type":
+      "integer", "description": "Amount of disk space (in GB) required to boot
+      image."}, "virtual_size": {"readOnly": true, "type": ["null", "integer"],
+      "description": "Virtual size of image in bytes"}, "instance_uuid": {"type":
+      "string", "description": "Metadata which can be used to record which instance
+      this image is associated with. (Informational only, does not create an instance
+      snapshot.)", "is_base": false}, "name": {"type": ["null", "string"],
+      "description": "Descriptive name for the image", "maxLength": 255}, "checksum":
+      {"readOnly": true, "type": ["null", "string"], "description": "md5
+      hash of image contents.", "maxLength": 32}, "created_at": {"readOnly":
+      true, "type": "string", "description": "Date and time of image registration"},
+      "protected": {"type": "boolean", "description": "If true, image will
+      not be deletable."}, "architecture": {"type": "string", "description":
+      "Operating system architecture as specified in https://docs.openstack.org/python-glanceclient/latest/cli/property-keys.html",
+      "is_base": false}}}'
+    content_type: application/json
+    status_code: 200
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/keystone/responses.yml b/test/csit/scripts/multicloud-pike/generic_sim/keystone/responses.yml
new file mode 100644 (file)
index 0000000..422ec7b
--- /dev/null
@@ -0,0 +1,44 @@
+projects:
+  get:
+    body: '{"projects": [{"is_domain": false, "description": "admin tenant",
+      "links": {"self": "http://keystone:8080/v3/projects/b8f5d85bbcd84af28d7caa62d39f05c7"},
+      "enabled": true, "domain_id": "default", "parent_id": "default", "id":
+      "b8f5d85bbcd84af28d7caa62d39f05c7", "name": "admin"}, {"is_domain":
+      false, "description": "Tenant for the openstack services", "links": {"self":
+      "http://keystone:8080/v3/projects/3543226ffed44daf90a2f71f36c00b8d"},
+      "enabled": true, "domain_id": "default", "parent_id": "default", "id":
+      "3543226ffed44daf90a2f71f36c00b8d", "name": "services"}], "links": {"self":
+      "http://keystone:8080/v3/projects", "next": null, "previous": null}}'
+    content_type: application/json
+    status_code: 200
+v3/auth/tokens:
+  post:
+    body: '{"token": {"methods": ["password"], "expires_at": "2019-11-06T15:32:17.893769Z",
+      "user": { "domain": {"id": "default", "name": "Default"},
+      "id": "423f19a4ac1e4f48bbb4180756e6eb6c", "name": "admin", "password_expires_at": null },
+      "audit_ids": [ "ZzZwkUflQfygX7pdYDBCQQ"], "catalog": [ 
+      { "endpoints": [ 
+      { "id": "1", "interface": "public", "region": "RegionOne", "url": "http://keystone:8080" },
+      { "id": "2", "interface": "internal", "region": "RegionOne", "url": "http://keystone:8080" },
+      { "id": "3", "interface": "admin", "region": "RegionOne", "url": "http://keystone:8080" }
+      ], "id": "1", "type": "identity", "name": "keystone"},
+      { "endpoints": [ 
+      { "id": "1", "interface": "public", "region": "RegionOne", "url": "http://glance:8080" },
+      { "id": "2", "interface": "internal", "region": "RegionOne", "url": "http://glance:8080" },
+      { "id": "3", "interface": "admin", "region": "RegionOne", "url": "http://glance:8080" }
+      ], "id": "2", "type": "image", "name": "glance"},
+      { "endpoints": [ 
+      { "id": "1", "interface": "public", "region": "RegionOne", "url": "http://cinder:8080" },
+      { "id": "2", "interface": "internal", "region": "RegionOne", "url": "http://cinder:8080" },
+      { "id": "3", "interface": "admin", "region": "RegionOne", "url": "http://cinder:8080" }
+      ], "id": "2", "type": "volumev3", "name": "cinder"},
+      { "endpoints": [ 
+      { "id": "1", "interface": "public", "region": "RegionOne", "url": "http://nova:8080" },
+      { "id": "2", "interface": "internal", "region": "RegionOne", "url": "http://nova:8080" },
+      { "id": "3", "interface": "admin", "region": "RegionOne", "url": "http://nova:8080" }
+      ], "id": "3", "type": "compute", "name": "nova"}],
+      "issued_at": "2015-11-06T14:32:17.893797Z"}}'
+    content_type: application/json
+    status_code: 200
+    headers:
+      X-Subject-Token: 423f19a4ac1e4f48bbb4180756e6eb6c
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/log_parser.py b/test/csit/scripts/multicloud-pike/generic_sim/log_parser.py
new file mode 100644 (file)
index 0000000..1334e60
--- /dev/null
@@ -0,0 +1,61 @@
+import argparse
+
+import yaml
+
+
+def _find_aai_response_content(inp):
+    return inp.split("||||")[1].split("with response content = ")[1]
+
+def _find_openstack_url(inp):
+    return inp.split("||||")[1].split("making request with URI:")[1]
+
+def _find_openstack_response_content(inp):
+    return inp.split("||||")[1].split("with content:")[1].replace("u'", "'")
+
+def _add_response(all_responses, url, http_verb, body, status_code=200, content_type="application/json"):
+    if url not in all_responses.keys():
+        all_responses[url] = {
+            http_verb: {
+                "status_code": status_code,
+                "content_type": content_type,
+                "body": body
+            }
+        }
+    elif http_verb not in all_responses[url].keys():
+        all_responses[url][http_verb] = {
+            "status_code": status_code,
+            "content_type": content_type,
+            "body": body
+        }
+
+def parse_lines(content, aai_ip):
+    aai_pattern = "https://%s:30233/" % aai_ip
+    openstack_pattern = "making request with URI:"
+
+    openstack_responses = {}
+    aai_responses = {}
+    for i, line in enumerate(content):
+        current_line = line.strip()
+        if aai_pattern in current_line and "DEBUG" not in current_line:
+            url = current_line.split(" ")[8][:-1].replace(aai_pattern, "")
+            _add_response(aai_responses, url, current_line.split(" ")[9][:-1],
+                _find_aai_response_content(content[i + 3]))
+        elif openstack_pattern in current_line:
+            _add_response(openstack_responses,
+                _find_openstack_url(current_line), "get",
+                _find_openstack_response_content(content[i + 2]))
+
+    return [
+    { "file": "nova.yml", "responses": openstack_responses },
+    { "file": "aai.yml", "responses": aai_responses }
+    ]
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description='Convert logs to responses YAML tree file.')
+    parser.add_argument('--log-file', type=argparse.FileType('r'), help="Log file to be parsed", required=True)
+    parser.add_argument('--aai-ip', help="A&AI IP Address", required=True)
+    args = parser.parse_args()
+
+    for mock_responses in parse_lines(args.log_file.readlines(), args.aai_ip):
+        with open(mock_responses["file"], 'w') as yaml_file:
+            yaml.dump(mock_responses["responses"], yaml_file, default_flow_style=False)
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/nova/responses.yml b/test/csit/scripts/multicloud-pike/generic_sim/nova/responses.yml
new file mode 100644 (file)
index 0000000..9446971
--- /dev/null
@@ -0,0 +1,177 @@
+/flavors/110/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"hw:cpu_policy": "dedicated", "hw:mem_page_size":
+      "large", "hw:cpu_sockets": "2", "hw:cpu_threads": "8", "hw:numa_mem.1":
+      "2048", "hw:numa_mem.0": "2048", "hw:capabilities:cpu_info:features":
+      "avx,acpi", "aggregate_instance_extra_specs:storage": "local_image", "hw:numa_nodes":
+      "2", "hw:numa_cpus.0": "0,1", "hw:numa_cpus.1": "2,3,4,5", "hw:cpu_cores":
+      "4", "hw:cpu_thread_policy": "prefer", "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:4"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/111/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"aggregate_instance_extra_specs:storage": "local_image"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/112/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"hw:cpu_policy": "dedicated", "hw:cpu_thread_policy":
+      "isolate", "aggregate_instance_extra_specs:storage": "local_image"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/113/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"hw:cpu_cores": "8", "hw:cpu_threads": "16",
+      "aggregate_instance_extra_specs:storage": "local_image", "hw:cpu_sockets":
+      "2"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/114/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"aggregate_instance_extra_specs:storage": "local_image",
+      "hw:mem_page_size": "small"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/115/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"hw:numa_mem.1": "1024", "hw:numa_mem.0": "1024",
+      "aggregate_instance_extra_specs:storage": "local_image", "hw:numa_nodes":
+      "2", "hw:numa_cpus.0": "0,1", "hw:numa_cpus.1": "2,3"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/116/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"hw:capabilities:cpu_info:features": "avx,aes",
+      "aggregate_instance_extra_specs:storage": "local_image"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/117/os-extra_specs:
+  get:
+    body: '{"extra_specs": {"aggregate_instance_extra_specs:storage": "local_image",
+      "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:6"}}'
+    content_type: application/json
+    status_code: 200
+/flavors/detail:
+  get:
+    body: '{"flavors": [{"name": "f.small", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/100",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/100",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "100"}, {"name":
+      "onap.hpa.all", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/110",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/110",
+      "rel": "bookmark"}], "ram": 4096, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 6, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "110"}, {"name":
+      "onap.hpa.basic", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/111",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/111",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 4, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "111"}, {"name":
+      "onap.hpa.cpupinning", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/112",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/112",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 4, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "112"}, {"name":
+      "onap.hpa.cputopology", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/113",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/113",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "113"}, {"name":
+      "onap.hpa.hugepage", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/114",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/114",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "114"}, {"name":
+      "onap.hpa.numa", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/115",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/115",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 4, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "115"}, {"name":
+      "onap.hpa.instruction", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/116",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/116",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "116"}, {"name":
+      "onap.hpa.passthrough", "links": [{"href": "http://nova:8080/v2.1/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/117",
+      "rel": "self"}, {"href": "http://nova:8080/b8f5d85bbcd84af28d7caa62d39f05c7/flavors/117",
+      "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false,
+      "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor":
+      1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "117"}]}'
+    content_type: application/json
+    status_code: 200
+/os-availability-zone/detail:
+  get:
+    body: '{"availabilityZoneInfo": [{"zoneState": {"available": true}, "hosts":
+      {"controller-0": {"nova-conductor": {"available": true, "active": true,
+      "updated_at": "2018-04-27T16:05:25.272674"}, "nova-consoleauth": {"available":
+      true, "active": true, "updated_at": "2018-04-27T16:05:21.875274"}, "nova-scheduler":
+      {"available": true, "active": true, "updated_at": "2018-04-27T16:05:25.286846"}}},
+      "zoneName": "internal"}, {"zoneState": {"available": false}, "hosts":
+      null, "zoneName": "nova"}]}'
+    content_type: application/json
+    status_code: 200
+/os-hypervisors/detail:
+  get:
+    body: '{
+       "hypervisors": [{
+               "status": "disabled",
+               "service": {
+                       "host": "compute-0",
+                       "disabled_reason": null,
+                       "id": 11
+               },
+               "vcpus_used": 0.0,
+               "hypervisor_type": "QEMU",
+               "id": 1,
+               "local_gb_used": 0,
+               "state": "down",
+               "hypervisor_hostname": "compute-0",
+               "host_ip": "192.168.204.162",
+               "memory_mb": 51562,
+               "current_workload": 0,
+               "vcpus": 42,
+               "free_ram_mb": 51562,
+               "running_vms": 0,
+               "free_disk_gb": 1740,
+               "hypervisor_version": 2010000,
+               "disk_available_least": 1740,
+               "local_gb": 1833,
+               "cpu_info": "{\"vendor\": \"Intel\", \"model\": \"IvyBridge\", \"arch\": \"x86_64\", \"features\": [\"pge\", \"avx\", \"xsaveopt\", \"clflush\", \"sep\", \"syscall\",\"tsc-deadline\",\"dtes64\",\"msr\",\"fsgsbase\",\"xsave\",\"vmx\",\"erms\",\"xtpr\",\"cmov\",\"smep\",\"pcid\",\"est\",\"pat\",\"monitor\",\"smx\",\"pbe\",\"lm\",\"tsc\",\"nx\",\"fxsr\",\"tm\",\"sse4.1\",\"pae\",\"sse4.2\",\"pclmuldq\",\"acpi\",\"vme\",\"popcnt\",\"mmx\",\"osxsave\",\"cx8\",\"mce\",\"de\",\"rdtscp\",\"ht\",\"dca\",\"lahf_lm\",\"pdcm\",\"mca\",\"pdpe1gb\",\"a    pic\",\"sse\",\"f16c\",\"pse\",\"ds\",\"invtsc\",\"pni\",\"tm2\",\"aes\",\"sse2\",\"ss\",\"ds_cpl\",\"arat\",\"ssse3\",\"fpu\",\"cx16\",\"pse36\",\"mtrr\",\"rdrand\",\"x2apic\"],\"topology\": {\"cores\": 12,\"cells\": 2,\"threads\": 2,\"sockets\": 1}}",
+               "memory_mb_used ": 0
+       }]
+}'
+    content_type: application/json
+    status_code: 200
+/os-hypervisors/detail?hypervisor_hostname_pattern=controller-0:
+  get:
+    body: '{
+       "hypervisors": [{
+               "status": "disabled",
+               "service": {
+                       "host": "compute-0",
+                       "disabled_reason": null,
+                       "id": 11
+               },
+               "vcpus_used": 0.0,
+               "hypervisor_type": "QEMU",
+               "id": 1,
+               "local_gb_used": 0,
+               "state": "down",
+               "hypervisor_hostname": "compute-0",
+               "host_ip": "192.168.204.162",
+               "memory_mb": 51562,
+               "current_workload": 0,
+               "vcpus": 42,
+               "free_ram_mb": 51562,
+               "running_vms": 0,
+               "free_disk_gb": 1740,
+               "hypervisor_version": 2010000,
+               "disk_available_least": 1740,
+               "local_gb": 1833,
+               "cpu_info": "{\"vendor\": \"Intel\", \"model\": \"IvyBridge\", \"arch\": \"x86_64\", \"features\": [\"pge\", \"avx\", \"xsaveopt\", \"clflush\", \"sep\", \"syscall\",\"tsc-deadline\",\"dtes64\",\"msr\",\"fsgsbase\",\"xsave\",\"vmx\",\"erms\",\"xtpr\",\"cmov\",\"smep\",\"pcid\",\"est\",\"pat\",\"monitor\",\"smx\",\"pbe\",\"lm\",\"tsc\",\"nx\",\"fxsr\",\"tm\",\"sse4.1\",\"pae\",\"sse4.2\",\"pclmuldq\",\"acpi\",\"vme\",\"popcnt\",\"mmx\",\"osxsave\",\"cx8\",\"mce\",\"de\",\"rdtscp\",\"ht\",\"dca\",\"lahf_lm\",\"pdcm\",\"mca\",\"pdpe1gb\",\"a    pic\",\"sse\",\"f16c\",\"pse\",\"ds\",\"invtsc\",\"pni\",\"tm2\",\"aes\",\"sse2\",\"ss\",\"ds_cpl\",\"arat\",\"ssse3\",\"fpu\",\"cx16\",\"pse36\",\"mtrr\",\"rdrand\",\"x2apic\"],\"topology\": {\"cores\": 12,\"cells\": 2,\"threads\": 2,\"sockets\": 1}}",
+               "memory_mb_used ": 0
+       }]
+}'
+    content_type: application/json
+    status_code: 200
diff --git a/test/csit/scripts/multicloud-pike/generic_sim/requirements.txt b/test/csit/scripts/multicloud-pike/generic_sim/requirements.txt
new file mode 100644 (file)
index 0000000..ac1d7dd
--- /dev/null
@@ -0,0 +1,2 @@
+PyYAML
+web.py
index a8e8484..1f64426 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 = "2.4.22"
+music_version = "3.0.3"
 aafuser = conductor
 aafpass = c0nduct0r
 aafns = conductor
index ee5479e..08bf0bc 100755 (executable)
@@ -63,6 +63,10 @@ echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}"
 sed  -i -e "s%msb.onap.org:8082/%${MULTICLOUDSIM_IP}:8082/%g" /tmp/conductor/properties/conductor.conf
 
 #onboard conductor into music
+echo "Query MUSIC to check for reachability. Query Version"
+curl -vvvvv --noproxy "*" --request GET http://${MUSIC_IP}:8080/MUSIC/rest/v2/version -H "Content-Type: application/json"
+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
index fdd9a3e..1e978c2 100755 (executable)
@@ -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
 # Start Music war
 docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG};
-
+sleep 15
 # 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`
@@ -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 10
+sleep 60
 
 echo "inspect docker things for tracing purpose"
 docker inspect music-db
index d2229aa..7bb9731 100755 (executable)
@@ -160,7 +160,7 @@ INTERVAL=20
 TIME=0 
 while [ "$TIME" -lt "$TIME_OUT" ]; do 
        
-       curl -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break
+       curl -k -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' https://${PDP_IP}:8081/pdp/api/getConfig && 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 d7f6e38..c4bdae2 100644 (file)
 # ============LICENSE_END============================================
 # ===================================================================
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
 
 echo "This is ${WORKSPACE}/test/csit/scripts/vid/start_vid_containers.sh"
 
-
-RELEASE=vid:1.1-STAGING-latest
-CONFIG_PATH=${WORKSPACE}/data/clone/vid/lf_config
-
 export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
-export PREFIX='nexus3.onap.org:10001/openecomp'
-
-#start Maria-DB
-docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp_epsdk -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v ${CONFIG_PATH}/vid-my.cnf:/etc/mysql/my.cnf -v ${CONFIG_PATH}/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10
-
-#start VID server
 
-docker run -e VID_MYSQL_DBNAME=vid_openecomp_epsdk -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d nexus3.onap.org:10001/openecomp/${RELEASE}
+cd ${WORKSPACE}/test/csit/tests/vid/resources
+docker-compose up -d --build
 
 # WAIT 5 minutes maximum and test every 5 seconds if VID up using HealthCheck API
 
index 1f54738..ce4c8df 100644 (file)
@@ -17,7 +17,7 @@ Create the sessions
 *** Test Cases ***
 Get Requests health check ok
     Create the sessions
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Get Requests verify test template found
index 213c231..15ab4b1 100644 (file)
@@ -10,14 +10,14 @@ ${passw}                     password
 
 *** Test Cases ***
 Get Requests health check ok
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Get Requests verify test template found
     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/cldsTempate/template-names
     Should Be Equal As Strings  ${resp.status_code}     200
     Should Contain Match     ${resp}      *templateTCA1*
-    Should Contain Match     ${resp}      *templateTCA2*
+    Should Contain Match     ${resp}      *CA2*
     Should Not Contain Match     ${resp}      *templateTCA99*
 
 Put Requests to add Close Loop ClHolmes1
index 50dd78e..f327283 100644 (file)
@@ -10,9 +10,9 @@ ${passw}                     password
 
 *** Test Cases ***
 Get Clamp properties
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/properties
-    Dictionary Should Contain Key    ${resp.json()}   global
-    Dictionary Should Contain Key    ${resp.json()['global']}   location
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/cldsInfo
+    Dictionary Should Contain Key    ${resp.json()}   userName
+    Dictionary Should Contain Key    ${resp.json()}   permissionReadCl
 
 Get Clamp Info
     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/cldsInfo
index 7b9e2bc..42c5c43 100644 (file)
@@ -51,7 +51,7 @@ Verify TCAModel2
     Should Contain Match    ${resp}   *DC2*
     Should Contain Match    ${resp}   *DC3*
     Should Contain Match    ${resp}   *Policy4*
-    Should Contain Match    ${resp}   *vLoadBalancer*
+    Should Contain Match    ${resp}   *tcaPol*
     Should Contain Match    ${resp}   *345*
     Should Contain Match    ${resp}   *300*
     Should Contain Match    ${resp}   *VM*
index c9b7d8c..305044c 100644 (file)
@@ -3,7 +3,7 @@ Library     Collections
 Library     RequestsLibrary
 Library     OperatingSystem
 Library     json
-Library     Selenium2Library
+Library     ../../../scripts/clamp/python-lib/CustomSeleniumLibrary.py
 Library     XvfbRobot
 
 *** Variables ***
@@ -22,19 +22,23 @@ Create the sessions
 *** Test Cases ***
 Get Requests health check ok
     Create the sessions
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Open Browser
 # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line.
     Start Virtual Display    1920    1080
-    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
+    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
+
+Reply to authentication popup
+    Run Keyword And Ignore Error    Insert into prompt    ${login} ${passw}
+    Confirm action
+
+Good Login to Clamp UI and Verify logged in
     Set Window Size    1920    1080
     ${title}=    Get Title
     Should Be Equal    CLDS    ${title}
-
-Good Login to Clamp UI and Verify logged in
     Wait Until Element Is Visible       xpath=//*[@class="navbar-brand logo_name ng-binding"]       timeout=60
     Element Text Should Be      xpath=//*[@class="navbar-brand logo_name ng-binding"]       expected=Hello:admin
 
@@ -88,8 +92,3 @@ Save Model from Menu
 
 Close Browser
     Close Browser
-
-Verify Holmes CL well created
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Contain Match    ${resp}   *HolmesModel1*
-    Should Not Contain Match    ${resp}   *HolmesModel99*
index 7ee2757..0dc0a8a 100644 (file)
@@ -3,7 +3,7 @@ Library     Collections
 Library     RequestsLibrary
 Library     OperatingSystem
 Library     json
-Library     Selenium2Library
+Library     ../../../scripts/clamp/python-lib/CustomSeleniumLibrary.py
 Library     XvfbRobot
 
 *** Variables ***
@@ -15,19 +15,23 @@ ${BASE_URL}                  https://localhost:8443
 
 *** Test Cases ***
 Get Requests health check ok
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Open Browser
 # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line.
     Start Virtual Display    1920    1080
-    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
+    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
+
+Reply to authentication popup
+    Run Keyword And Ignore Error    Insert into prompt    ${login} ${passw}
+    Confirm action
+
+Good Login to Clamp UI and Verify logged in
     Set Window Size    1920    1080
     ${title}=    Get Title
     Should Be Equal    CLDS    ${title}
-
-Good Login to Clamp UI and Verify logged in
     Wait Until Element Is Visible       xpath=//*[@class="navbar-brand logo_name ng-binding"]       timeout=60
     Element Text Should Be      xpath=//*[@class="navbar-brand logo_name ng-binding"]       expected=Hello:admin
 
@@ -88,8 +92,3 @@ Save Model from Menu
 
 Close Browser
     Close Browser
-
-Verify TCA CL well create
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
-    Should Contain Match    ${resp}   *TCAModel1*
-    Should Not Contain Match    ${resp}   *TCAModel99*
index 9116964..66bc3b1 100644 (file)
@@ -9,6 +9,16 @@ ${login}                     admin
 ${passw}                     password
 
 *** Test Cases ***
+Verify Holmes CL well created
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
+    Should Contain Match    ${resp}   *HolmesModel1*
+    Should Not Contain Match    ${resp}   *HolmesModel99*
+
+Verify TCA CL well create
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model-names
+    Should Contain Match    ${resp}   *TCAModel1*
+    Should Not Contain Match    ${resp}   *TCAModel99*
+
 Verify HolmesModel1
     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/HolmesModel1
     Should Contain Match    ${resp}   *templateHolmes1*
@@ -25,7 +35,7 @@ Verify HolmesModel1
 Verify TCAModel1
     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/model/TCAModel1
     Should Contain Match    ${resp}   *templateTCA1*
-    Should Contain Match    ${resp}   *c95b0e7c-c1f0-4287-9928-7964c5377a46*
+    Should Contain Match    ${resp}   *DESIGN*
     Should Contain Match    ${resp}   *vnfRecipe*
     Should Contain Match    ${resp}   *DC1*
     Should Contain Match    ${resp}   *DC3*
index a6ccb99..de10a27 100644 (file)
@@ -3,7 +3,7 @@ Library     Collections
 Library     RequestsLibrary
 Library     OperatingSystem
 Library     json
-Library     Selenium2Library
+Library     ../../../scripts/clamp/python-lib/CustomSeleniumLibrary.py
 Library     XvfbRobot
 
 *** Variables ***
@@ -15,19 +15,23 @@ ${BASE_URL}                  https://localhost:8443
 
 *** Test Cases ***
 Get Requests health check ok
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Open Browser
 # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line.
     Start Virtual Display    1920    1080
-    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
+    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
+
+Reply to authentication popup
+    Run Keyword And Ignore Error    Insert into prompt    ${login} ${passw}
+    Confirm action
+
+Good Login to Clamp UI and Verify logged in
     Set Window Size    1920    1080
     ${title}=    Get Title
     Should Be Equal    CLDS    ${title}
-
-Good Login to Clamp UI and Verify logged in
     Wait Until Element Is Visible       xpath=//*[@class="navbar-brand logo_name ng-binding"]       timeout=60
     Element Text Should Be      xpath=//*[@class="navbar-brand logo_name ng-binding"]       expected=Hello:admin
 
index 6330ead..2b95530 100644 (file)
@@ -3,7 +3,7 @@ Library     Collections
 Library     RequestsLibrary
 Library     OperatingSystem
 Library     json
-Library     Selenium2Library
+Library     ../../../scripts/clamp/python-lib/CustomSeleniumLibrary.py
 Library     XvfbRobot
 
 *** Variables ***
@@ -15,19 +15,23 @@ ${BASE_URL}                  https://localhost:8443
 
 *** Test Cases ***
 Get Requests health check ok
-    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/clds/healthcheck
+    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
     Should Be Equal As Strings  ${resp.status_code}     200
 
 Open Browser
 # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line.
     Start Virtual Display    1920    1080
-    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
+    Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
+
+Reply to authentication popup
+    Run Keyword And Ignore Error    Insert into prompt    ${login} ${passw}
+    Confirm action
+
+Good Login to Clamp UI and Verify logged in
     Set Window Size    1920    1080
     ${title}=    Get Title
     Should Be Equal    CLDS    ${title}
-
-Good Login to Clamp UI and Verify logged in
     Wait Until Element Is Visible       xpath=//*[@class="navbar-brand logo_name ng-binding"]       timeout=60
     Element Text Should Be      xpath=//*[@class="navbar-brand logo_name ng-binding"]       expected=Hello:admin
 
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
new file mode 100644 (file)
index 0000000..c0a96db
--- /dev/null
@@ -0,0 +1,56 @@
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+Library       ConsulLibrary
+Library       VesHvContainersUtilsLibrary
+
+Suite Setup       HV-VES Collector Suites Setup
+
+*** Keywords ***
+HV-VES Collector Suites Setup
+    Log   Started Suite: HV-VES
+    Configure collector
+    Configure Dcae App
+    Log   Suite setup finished
+
+
+Configure collector
+    ${CONSUL_API_ACCESS}=   Get Consul Api Access Url   ${HTTP_METHOD_URL}   ${CONSUL_CONTAINER_HOST}   ${CONSUL_CONTAINER_PORT}
+    ${CONSUL_API_URL}=  Catenate   SEPARATOR=   ${CONSUL_API_ACCESS}   ${CONSUL_VES_HV_CONFIGURATION_KEY_PATH}
+    Publish HV VES Configuration In Consul    ${CONSUL_API_URL}   ${VES_HV_CONFIGURATION_JSON_FILEPATH}
+
+Configure Dcae App
+    ${DCAE_APP_API_ACCESS}=   Get Dcae App Api Access Url   ${HTTP_METHOD_URL}   ${DCAE_APP_CONTAINER_HOST}   ${DCAE_APP_CONTAINER_PORT}
+
+    ${DCAE_APP_API_MESSAGE_RESET_URL}=   Catenate   SEPARATOR=   ${DCAE_APP_API_ACCESS}   ${DCAE_APP_API_MESSAGES_RESET_PATH}
+    Set Suite Variable    ${DCAE_APP_API_MESSAGE_RESET_URL}    children=True
+
+    ${DCAE_APP_API_MESSAGES_COUNT_URL}=  Catenate   SEPARATOR=   ${DCAE_APP_API_ACCESS}   ${DCAE_APP_API_MESSAGES_COUNT_PATH}
+    Set Suite Variable    ${DCAE_APP_API_MESSAGES_COUNT_URL}    children=True
+
+    ${DCAE_APP_API_MESSAGES_VALIDATION_URL}=  Catenate   SEPARATOR=   ${DCAE_APP_API_ACCESS}   ${DCAE_APP_API_MESSAGES_VALIDATION_PATH}
+    Set Suite Variable    ${DCAE_APP_API_MESSAGES_VALIDATION_URL}    children=True
+
+    ${DCAE_APP_API_TOPIC_CONFIGURATION_URL}=  Catenate   SEPARATOR=   ${DCAE_APP_API_ACCESS}   ${DCAE_APP_API_TOPIC_CONFIGURATION_PATH}
+    Wait until keyword succeeds   10 sec   5 sec
+    ...    Configure Dcae App Simulator To Consume Messages From Topics   ${DCAE_APP_API_TOPIC_CONFIGURATION_URL}  ${ROUTED_MESSAGES_TOPIC}
+
+
+*** Variables ***
+${HTTP_METHOD_URL}                             http://
+
+${CONSUL_CONTAINER_HOST}                       consul
+${CONSUL_CONTAINER_PORT}                       8500
+${CONSUL_VES_HV_CONFIGURATION_KEY_PATH}        /v1/kv/veshv-config
+
+${DCAE_APP_CONTAINER_HOST}                     dcae-app-simulator
+${DCAE_APP_CONTAINER_PORT}                     6063
+${DCAE_APP_API_TOPIC_CONFIGURATION_PATH}       /configuration/topics
+${DCAE_APP_API_MESSAGES_RESET_PATH}            /messages
+${DCAE_APP_API_MESSAGES_PATH}                  /messages/all
+${DCAE_APP_API_MESSAGES_COUNT_PATH}            ${DCAE_APP_API_MESSAGES_PATH}/count
+${DCAE_APP_API_MESSAGES_VALIDATION_PATH}       ${DCAE_APP_API_MESSAGES_PATH}/validate
+
+${ROUTED_MESSAGES_TOPIC}                       test-hv-ran-meas
+
+${VES_HV_RESOURCES}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources
+${VES_HV_CONFIGURATION_JSON_FILEPATH}          ${VES_HV_RESOURCES}/ves-hv-configuration.json
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot
new file mode 100644 (file)
index 0000000..1b832f2
--- /dev/null
@@ -0,0 +1,35 @@
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+
+Resource      resources/common-keywords.robot
+
+Suite Setup       Client Authorization Suite Setup
+Suite Teardown    VES-HV Collector Suite Teardown
+Test Teardown     VES-HV Collector Test Shutdown
+
+*** Keywords ***
+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}
+    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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
+
+
+*** Variables ***
+${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
+
+${XNF_VALID_MESSAGES_REQUEST}                  ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json
+
+${AMOUNT_0}                                    0
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py
new file mode 100644 (file)
index 0000000..52d7e0e
--- /dev/null
@@ -0,0 +1,16 @@
+from robot.api import logger
+import HttpRequests
+
+CONSUL_NAME = "Consul"
+
+class ConsulLibrary:
+
+    def publish_hv_ves_configuration_in_consul(self, consul_url, consul_configuration_filepath):
+        logger.info("Reading consul configuration file from: " + consul_configuration_filepath)
+        file = open(consul_configuration_filepath, "rb")
+        data = file.read()
+        file.close()
+
+        logger.info("PUT at: " + consul_url)
+        resp = HttpRequests.session_without_env().put(consul_url, data=data, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, CONSUL_NAME)
\ No newline at end of file
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
new file mode 100644 (file)
index 0000000..ab3b1e2
--- /dev/null
@@ -0,0 +1,46 @@
+import HttpRequests
+from robot.api import logger
+
+DCAE_APP_NAME = "DCAE App"
+
+
+class DcaeAppSimulatorLibrary:
+
+    def configure_dcae_app_simulator_to_consume_messages_from_topics(self, app_url, topics):
+        logger.info("PUT at: " + app_url)
+        resp = HttpRequests.session_without_env().put(app_url, data={'topics': topics}, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+    def assert_DCAE_app_consumed(self, app_url, expected_messages_amount):
+        logger.info("GET at: " + app_url)
+        resp = HttpRequests.session_without_env().get(app_url, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+        assert resp.content == expected_messages_amount, \
+            "Messages consumed by simulator: " + resp.content + " expecting: " + expected_messages_amount
+
+    def assert_DCAE_app_consumed_less_equal_than(self, app_url, messages_threshold):
+        logger.info("GET at: " + app_url)
+        resp = HttpRequests.session_without_env().get(app_url, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+        logger.debug("Messages consumed by simulator: " + resp.content +
+                     " expecting more than 0 and less/equal than " + messages_threshold)
+
+        assert 0 < int(resp.content) <= int(messages_threshold), \
+            "Messages consumed by simulator: " + resp.content + \
+            " expecting more than 0 and less/equal than " + messages_threshold
+
+    def reset_DCAE_app_simulator(self, app_url):
+        logger.info("DELETE at: " + app_url)
+        resp = HttpRequests.session_without_env().delete(app_url, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+    def assert_DCAE_app_consumed_proper_messages(self, app_url, message_filepath):
+        logger.info("POST at: " + app_url)
+        file = open(message_filepath, "rb")
+        data = file.read()
+        file.close()
+
+        resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py
new file mode 100644 (file)
index 0000000..0d1d928
--- /dev/null
@@ -0,0 +1,12 @@
+import requests
+from robot.api import logger
+
+def session_without_env():
+    session = requests.Session()
+    session.trust_env = False
+    return session
+
+def checkStatusCode(status_code, server_name):
+    if status_code != 200:
+        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
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py
new file mode 100644 (file)
index 0000000..989a796
--- /dev/null
@@ -0,0 +1,69 @@
+from time import time
+
+from robot.api import logger
+import os.path
+import docker
+from io import BytesIO
+from os.path import basename
+from tarfile import TarFile, TarInfo
+
+LOCALHOST = "localhost"
+
+
+class VesHvContainersUtilsLibrary:
+
+    def get_consul_api_access_url(self, method, image_name, port):
+        return self.create_url(
+            method,
+            self.get_instance_address(image_name, port)
+        )
+
+    def get_xnf_sim_api_access_url(self, method, host):
+        if is_running_inside_docker():
+            return self.create_url(method, host)
+        else:
+            logger.info("File `/.dockerenv` not found. Assuming local environment and using localhost.")
+            port_from_container_name = str(host)[-4:]
+            return self.create_url(method, LOCALHOST + ":" + port_from_container_name)
+
+    def get_dcae_app_api_access_url(self, method, image_name, port):
+        return self.create_url(
+            method,
+            self.get_instance_address(image_name, port)
+        )
+
+    def get_instance_address(self, image_name, port):
+        if is_running_inside_docker():
+            return image_name + ":" + port
+        else:
+            logger.info("File `/.dockerenv` not found. Assuming local environment and using localhost.")
+            return LOCALHOST + ":" + port
+
+    def create_url(self, method, host_address):
+        return method + host_address
+
+def is_running_inside_docker():
+    return os.path.isfile("/.dockerenv")
+
+def copy_to_container(container_id, filepaths, path='/etc/ves-hv'):
+    with create_archive(filepaths) as archive:
+        docker.APIClient('unix:///var/run/docker.sock') \
+            .put_archive(container=container_id, path=(path), data=archive)
+
+
+def create_archive(filepaths):
+    tarstream = BytesIO()
+    tarfile = TarFile(fileobj=tarstream, mode='w')
+    for filepath in filepaths:
+        file = open(filepath, 'r')
+        file_data = file.read()
+
+        tarinfo = TarInfo(name=basename(file.name))
+        tarinfo.size = len(file_data)
+        tarinfo.mtime = time()
+
+        tarfile.addfile(tarinfo, BytesIO(file_data))
+
+    tarfile.close()
+    tarstream.seek(0)
+    return tarstream
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py
new file mode 100644 (file)
index 0000000..b2466d7
--- /dev/null
@@ -0,0 +1,126 @@
+from VesHvContainersUtilsLibrary import copy_to_container
+import HttpRequests
+import os
+import docker
+from robot.api import logger
+from time import sleep
+
+XNF_SIMULATOR_NAME = "xNF Simulator"
+SIMULATOR_IMAGE_NAME = "onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-xnf-simulator"
+SIMULATOR_IMAGE_FULL_NAME = os.getenv("DOCKER_REGISTRY") + "/" + SIMULATOR_IMAGE_NAME + ":latest"
+WORKSPACE_ENV = os.getenv("WORKSPACE")
+certificates_dir_path = WORKSPACE_ENV + "/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/"
+collector_certs_lookup_dir = "/etc/ves-hv/"
+ONE_SECOND_IN_NANOS = 10 ** 9
+
+
+class XnfSimulatorLibrary:
+
+    def start_xnf_simulators(self, list_of_ports, valid_certs=True):
+        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)
+        self.assert_containers_startup_was_successful(dockerClient)
+        dockerClient.close()
+        return simulators_addresses
+
+    def pullImageIfAbsent(self, dockerClient):
+        try:
+            dockerClient.images.get(SIMULATOR_IMAGE_FULL_NAME)
+        except:
+            logger.console("Image " + SIMULATOR_IMAGE_FULL_NAME + " will be pulled from repository. "
+                                                                  "This can take a while.")
+            dockerClient.images.pull(SIMULATOR_IMAGE_FULL_NAME)
+
+    def create_simulators(self, dockerClient, list_of_ports, cert_name_prefix):
+        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"
+                                           )
+
+            logger.info("Started container: " + container.name + "  " + container.id)
+            simulators_addresses.append(container.name + ":" + 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"]
+        }
+        logger.info("Startup command: " + str(xNF_startup_command))
+        logger.info("Healthcheck command: " + str(xNF_healthcheck_command))
+        return dockerClient.containers.run(SIMULATOR_IMAGE_FULL_NAME,
+                                           command=xNF_startup_command,
+                                           healthcheck=xNF_healthcheck_command,
+                                           detach=True,
+                                           network="ves-hv-default",
+                                           ports={port + "/tcp": port},
+                                           volumes=self.container_volumes(),
+                                           name="ves-hv-collector-xnf-simulator" + port)
+
+    def container_volumes(self):
+        return {certificates_dir_path: {"bind": collector_certs_lookup_dir, "mode": 'rw'}}
+
+    def assert_containers_startup_was_successful(self, dockerClient):
+        checks_amount = 6
+        check_interval_in_seconds = 5
+        for _ in range(checks_amount):
+            sleep(check_interval_in_seconds)
+            all_containers_healthy = True
+            for container in self.get_simulators_list(dockerClient):
+                all_containers_healthy = all_containers_healthy and self.is_container_healthy(container)
+            if (all_containers_healthy):
+                return
+        raise ContainerException("One of xNF simulators containers did not pass the healthcheck.")
+
+    def is_container_healthy(self, container):
+        container_health = container.attrs['State']['Health']['Status']
+        return container_health == 'healthy' and container.status == 'running'
+
+    def stop_and_remove_all_xnf_simulators(self, suite_name):
+        dockerClient = docker.from_env()
+        for container in self.get_simulators_list(dockerClient):
+            logger.info("Stopping and removing container: " + container.id)
+            log_filename = WORKSPACE_ENV + "/archives/containers_logs/" + \
+                           suite_name.split(".")[-1] + "_" + container.name + ".log"
+            file = open(log_filename, "w+")
+            file.write(container.logs())
+            file.close()
+            container.stop()
+            container.remove()
+        dockerClient.close()
+
+    def get_simulators_list(self, dockerClient):
+        return dockerClient.containers.list(filters={"ancestor": SIMULATOR_IMAGE_FULL_NAME}, all=True)
+
+    def send_messages(self, simulator_url, message_filepath):
+        logger.info("Reading message to simulator from: " + message_filepath)
+
+        file = open(message_filepath, "rb")
+        data = file.read()
+        file.close()
+
+        logger.info("POST at: " + simulator_url)
+        resp = HttpRequests.session_without_env().post(simulator_url, data=data, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, XNF_SIMULATOR_NAME)
+
+
+class ContainerException(Exception):
+    def __init__(self, message):
+        super(ContainerException, self).__init__(message)
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot
new file mode 100644 (file)
index 0000000..6153afa
--- /dev/null
@@ -0,0 +1,93 @@
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+Library       XnfSimulatorLibrary
+Library       VesHvContainersUtilsLibrary
+Library       Collections
+
+Resource      resources/common-keywords.robot
+
+Suite Setup       Message Routing Suite Setup
+Suite Teardown    VES-HV Collector Suite Teardown
+Test Teardown     VES-HV Collector Test Shutdown
+
+*** Keywords ***
+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}
+    Log   Suite setup finished
+
+*** Test Cases ***
+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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_25000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_FIXED_PAYLOAD_REQUEST}
+
+
+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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed Less Equal Than   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_25000}
+
+
+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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_INVALID_WIRE_FRAME_REQUEST}
+
+
+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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}  ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_INVALID_GPB_DATA_REQUEST}
+
+
+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}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed  ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_UNSUPPORTED_DOMAIN_REQUEST}
+
+*** Variables ***
+${HTTP_METHOD_URL}                             http://
+
+${XNF_SIM_API_PATH}                            /simulator/async
+
+${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
+${XNF_FIXED_PAYLOAD_REQUEST}                   ${VES_HV_SCENARIOS}/fixed-payload/xnf-fixed-payload-request.json
+${XNF_TOO_BIG_PAYLOAD_REQUEST}                 ${VES_HV_SCENARIOS}/too-big-payload/xnf-too-big-payload-request.json
+${XNF_INVALID_WIRE_FRAME_REQUEST}              ${VES_HV_SCENARIOS}/invalid-wire-frame/xnf-invalid-wire-frame-request.json
+${XNF_INVALID_GPB_DATA_REQUEST}                ${VES_HV_SCENARIOS}/invalid-gpb-data/xnf-invalid-gpb-data-request.json
+${XNF_UNSUPPORTED_DOMAIN_REQUEST}              ${VES_HV_SCENARIOS}/unsupported-domain/xnf-unsupported-domain-request.json
+
+${DCAE_FIXED_PAYLOAD_REQUEST}                  ${VES_HV_SCENARIOS}/fixed-payload/dcae-fixed-payload-request.json
+${DCAE_INVALID_WIRE_FRAME_REQUEST}             ${VES_HV_SCENARIOS}/invalid-wire-frame/dcae-invalid-wire-frame-request.json
+${DCAE_INVALID_GPB_DATA_REQUEST}               ${VES_HV_SCENARIOS}/invalid-gpb-data/dcae-invalid-gpb-data-request.json
+${DCAE_UNSUPPORTED_DOMAIN_REQUEST}             ${VES_HV_SCENARIOS}/unsupported-domain/dcae-unsupported-domain-request.json
+
+${AMOUNT_25000}                                25000
+${AMOUNT_50000}                                50000
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot
new file mode 100644 (file)
index 0000000..862a2bc
--- /dev/null
@@ -0,0 +1,35 @@
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+
+Resource      resources/common-keywords.robot
+
+Suite Setup       Multiple Clients Handling Suite Setup
+Suite Teardown    VES-HV Collector Suite Teardown
+Test Teardown     VES-HV Collector Test Shutdown
+
+*** Keywords ***
+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}
+    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
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_SMALLER_PAYLOAD_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_15000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_SMALLER_PAYLOAD_REQUEST}
+
+
+*** Variables ***
+${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
+
+${XNF_SMALLER_PAYLOAD_REQUEST}                 ${VES_HV_SCENARIOS}/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json
+${DCAE_SMALLER_PAYLOAD_REQUEST}                ${VES_HV_SCENARIOS}/multiple-simulators-payload/dcae-smaller-valid-request.json
+
+${AMOUNT_15000}                                15000
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
new file mode 100644 (file)
index 0000000..bc03de2
--- /dev/null
@@ -0,0 +1,50 @@
+*** Settings ***
+Library       XnfSimulatorLibrary
+Library       VesHvContainersUtilsLibrary
+Library       Collections
+
+*** Keywords ***
+Configure Valid xNF Simulators On Ports
+    [Arguments]    ${XNF_PORTS_LIST}
+    ${VALID_XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    ${true}
+    Set Suite Variable    ${VALID_XNF_SIMULATORS_ADDRESSES}
+
+
+Configure Invalid xNF Simulators On Ports
+    [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}
+    ${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}
+    \    ${XNF_SIM_API_ACCESS}=   Get xNF Sim Api Access Url   ${HTTP_METHOD_URL}   ${HOST}
+    \    ${XNF_SIM_API_URL}=  Catenate   SEPARATOR=   ${XNF_SIM_API_ACCESS}   ${XNF_SIM_API_PATH}
+    \    Send messages   ${XNF_SIM_API_URL}   ${MESSAGE_FILEPATH}
+
+
+VES-HV Collector Test Shutdown
+    Reset DCAE App Simulator  ${DCAE_APP_API_MESSAGE_RESET_URL}
+
+
+VES-HV Collector Suite Teardown
+    Stop And Remove All Xnf Simulators   ${SUITE NAME}
+
+*** Variables ***
+${HTTP_METHOD_URL}                             http://
+
+${XNF_SIM_API_PATH}                            /simulator/async
+
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json
new file mode 100644 (file)
index 0000000..c71793d
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 500000
+  }
+]
\ No newline at end of file
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json
new file mode 100644 (file)
index 0000000..fb53f50
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "FIXED_PAYLOAD",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json
new file mode 100644 (file)
index 0000000..fb53f50
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "FIXED_PAYLOAD",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json
new file mode 100644 (file)
index 0000000..772b03b
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json
new file mode 100644 (file)
index 0000000..d9cb4c2
--- /dev/null
@@ -0,0 +1,65 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "INVALID_GPB_DATA",
+    "messagesAmount": 100
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json
new file mode 100644 (file)
index 0000000..772b03b
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json
new file mode 100644 (file)
index 0000000..88d4e32
--- /dev/null
@@ -0,0 +1,65 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "INVALID_WIRE_FRAME",
+    "messagesAmount": 100
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json
new file mode 100644 (file)
index 0000000..9d34a7e
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "FIXED_PAYLOAD",
+    "messagesAmount": 15000
+  }
+]
\ No newline at end of file
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json
new file mode 100644 (file)
index 0000000..625737e
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "FIXED_PAYLOAD",
+    "messagesAmount": 5000
+  }
+]
\ No newline at end of file
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json
new file mode 100644 (file)
index 0000000..b1c727a
--- /dev/null
@@ -0,0 +1,65 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "TOO_BIG_PAYLOAD",
+    "messagesAmount": 100
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json
new file mode 100644 (file)
index 0000000..772b03b
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json
new file mode 100644 (file)
index 0000000..e37e20d
--- /dev/null
@@ -0,0 +1,65 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "FAULT",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 100
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "HVRANMEAS",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json
new file mode 100644 (file)
index 0000000..3235a0c
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "kafkaBootstrapServers": "kafka:9092",
+  "routing": [
+    {
+      "fromDomain": 11,
+      "toTopic": "test-hv-ran-meas"
+    }
+  ]
+}
\ No newline at end of file
index 3cac3b4..b1f84fd 100644 (file)
@@ -25,8 +25,6 @@ services:
     build:
       context: simulator
       dockerfile: DMaaP_simulator
-      args:
-        - https_proxy=${HTTPS_PROXY}
     ports:
       - "2222:2222"
     container_name: dmaap_simulator
@@ -35,8 +33,6 @@ services:
      build:
        context: simulator
        dockerfile: AAI_simulator
-       args:
-         - https_proxy=${HTTPS_PROXY}
      ports:
       - "3333:3333"
      container_name: aai_simulator
index ca8bdd1..e70d8d3 100644 (file)
@@ -1,11 +1,12 @@
-import BaseHTTPServer
+from http.server import BaseHTTPRequestHandler
+from http.server import HTTPServer
 import re
 import sys
 
 pnfs = 'Empty'
 
 
-class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class AAIHandler(BaseHTTPRequestHandler):
     def do_PUT(self):
         if re.search('/set_pnfs', self.path):
             global pnfs
@@ -16,7 +17,7 @@ class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         return
 
     def do_PATCH(self):
-        pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs
+        pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
         if re.search('wrong_aai_record', self.path):
             self.send_response(400)
             self.end_headers()
@@ -33,7 +34,7 @@ def _header_200_and_json(self):
     self.end_headers()
 
 
-def _main_(handler_class=AAIHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+def _main_(handler_class=AAIHandler, server_class=HTTPServer, protocol="HTTP/1.0"):
 
     if sys.argv[1:]:
         port = int(sys.argv[1])
@@ -46,7 +47,7 @@ def _main_(handler_class=AAIHandler, server_class=BaseHTTPServer.HTTPServer, pro
     httpd = server_class(server_address, handler_class)
 
     sa = httpd.socket.getsockname()
-    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    print("Serving HTTP on", sa[0], "port", sa[1], "...")
     httpd.serve_forever()
 
 
index dd2d194..2103784 100644 (file)
@@ -1,12 +1,13 @@
-import BaseHTTPServer
+from http.server import BaseHTTPRequestHandler
+from http.server import HTTPServer
 import re
 import sys
 
-posted_event_from_prh = 'Empty'
+posted_event_from_prh = b'Empty'
 received_event_to_get_method = 'Empty'
 
 
-class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class DMaaPHandler(BaseHTTPRequestHandler):
     def do_PUT(self):
         if re.search('/set_get_event', self.path):
             global received_event_to_get_method
@@ -29,11 +30,9 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT/OpenDcae-c12/c12', self.path):
             _header_200_and_json(self)
             self.wfile.write(received_event_to_get_method)
-            self.wfile.close()
         elif re.search('/events/pnfReady', self.path):
             _header_200_and_json(self)
             self.wfile.write(posted_event_from_prh)
-            self.wfile.close()
 
         return
 
@@ -44,7 +43,7 @@ def _header_200_and_json(self):
     self.end_headers()
 
 
-def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+def _main_(handler_class=DMaaPHandler, server_class=HTTPServer, protocol="HTTP/1.0"):
 
     if sys.argv[1:]:
         port = int(sys.argv[1])
@@ -57,7 +56,7 @@ def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, p
     httpd = server_class(server_address, handler_class)
 
     sa = httpd.socket.getsockname()
-    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    print("Serving HTTP on", sa[0], "port", sa[1], "...")
     httpd.serve_forever()
 
 
diff --git a/test/csit/tests/dmaap-buscontroller/ssl_suite/__init__.robot b/test/csit/tests/dmaap-buscontroller/ssl_suite/__init__.robot
new file mode 100644 (file)
index 0000000..41c7a00
--- /dev/null
@@ -0,0 +1,3 @@
+*** Settings ***
+Documentation    dmaap-buscontroller - Suite 1
+
diff --git a/test/csit/tests/dmaap-buscontroller/ssl_suite/test1.robot b/test/csit/tests/dmaap-buscontroller/ssl_suite/test1.robot
new file mode 100644 (file)
index 0000000..999c6ba
--- /dev/null
@@ -0,0 +1,77 @@
+*** Settings ***
+Library       OperatingSystem
+Library       RequestsLibrary
+Library       HttpLibrary.HTTP
+Library       Collections
+Library       String
+
+*** Variables ***
+${MESSAGE}    Hello, world!
+${DBC_URI}    /webapi
+
+*** Test Cases ***
+String Equality Test
+    Should Be Equal    ${MESSAGE}    Hello, world!
+
+Dir Test
+    [Documentation]    Check if /tmp exists
+    Log                ${MESSAGE}
+    CheckDir           /tmp
+
+Url Test
+    [Documentation]    Check if www.onap.org can be reached
+    Create Session     openo          http://www.onap.org
+    CheckUrl           openo          /                        200
+
+HTTPS Heartbeat Test
+    [Documentation]        Check ${DBC_URI}/info SSL endpoint
+    Create Session         heartbeat          https://${DMAAPBC_IP}:8443
+    CheckUrl               heartbeat          ${DBC_URI}/info   204
+
+HTTPS Dmaap Init Test
+    [Documentation]        Check ${DBC_URI}/dmaap SSL endpoint
+    Create Session         heartbeat          https://${DMAAPBC_IP}:8443
+    CheckStatus               heartbeat          ${DBC_URI}/dmaap   "VALID"
+
+HTTPS Dmaap dcaeLocations Test
+    [Documentation]        Check ${DBC_URI}/dcaeLocations SSL endpoint
+    Create Session         heartbeat          https://${DMAAPBC_IP}:8443
+    CheckStatus0               heartbeat          ${DBC_URI}/dcaeLocations   "VALID"
+
+HTTPS Dmaap mr_clusters Test
+    [Documentation]        Check ${DBC_URI}/mr_clusters SSL endpoint
+    Create Session         heartbeat          https://${DMAAPBC_IP}:8443
+    CheckStatus0               heartbeat          ${DBC_URI}/mr_clusters   "VALID"
+
+
+*** Keywords ***
+CheckDir
+    [Arguments]                 ${path}
+    Directory Should Exist      ${path}
+
+CheckUrl
+    [Arguments]                  ${session}   ${path}     ${expect}
+    ${resp}=                     Get Request          ${session}               ${path}
+    Should Be Equal As Integers  ${resp.status_code}  ${expect}
+
+CheckStatus
+    [Arguments]                  ${session}   ${path}     ${expect}
+    ${resp}=                     Get Request          ${session}               ${path}
+    log                          ${resp.content}
+    ${val}=                      Get Json value       ${resp.content}     /status
+    log                          ${val}
+    should be equal as strings   ${val}      ${expect}
+
+CheckStatus0
+    [Arguments]                  ${session}   ${path}     ${expect}
+    ${resp}=                     Get Request          ${session}               ${path}
+    log                          ${resp.json()}
+    log                          ${resp.content}
+# silliness to strip off the brackets returned for a List to get a Dict
+    ${t1}=                       Remove String       ${resp.content}       [
+    ${dict}=                     Remove String       ${t1}                 ]
+    log                          ${dict}
+    ${val}=                      Get Json value       ${dict}     /status
+    log                          ${val}
+    should be equal as strings   ${val}      ${expect}
+
diff --git a/test/csit/tests/dmaap-buscontroller/with_dr/orig b/test/csit/tests/dmaap-buscontroller/with_dr/orig
new file mode 100755 (executable)
index 0000000..fcac202
--- /dev/null
@@ -0,0 +1,116 @@
+*** Settings ***
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           requests
+Library           Collections
+Library           String
+
+*** Variables ***
+${TARGET_URL}                   https://${DR_PROV_IP}:8443
+${TARGET_URL_FEED}              https://${DR_PROV_IP}:8443/feed/1
+${TARGET_URL_SUBSCRIBE}         https://${DR_PROV_IP}:8443/subscribe/1
+${TARGET_URL_SUBSCRIPTION}      https://${DR_PROV_IP}:8443/subs/1
+${TARGET_URL_PUBLISH}           https://${DR_NODE_IP}:8443/publish/1/csit_test
+${CREATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${UPDATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${SUBSCRIBE_DATA}               {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
+${UPDATE_SUBSCRIPTION_DATA}     {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
+${FEED_CONTENT_TYPE}            application/vnd.att-dr.feed
+${SUBSCRIBE_CONTENT_TYPE}       application/vnd.att-dr.subscription
+${PUBLISH_FEED_CONTENT_TYPE}    application/octet-stream
+
+*** Test Cases ***
+Run Feed Creation
+    [Documentation]                 Feed Creation
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL}         ${CREATE_FEED_DATA}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Subscribe to Feed
+    [Documentation]                 Subscribe to Feed
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL_SUBSCRIBE}    ${SUBSCRIBE_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIBE}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Publish Feed
+    [Documentation]                 Publish to Feed
+    [Timeout]                       1 minute
+    Sleep                           10s                              Behaviour was noticed where feed was not created in time for publish to be sent
+    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_PUBLISH}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Update Subscription
+    [Documentation]                 Update Subscription to suspend and change delivery credentials
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_SUBSCRIPTION}    ${UPDATE_SUBSCRIPTION_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIPTION}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_SUBSCRIPTION}    ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "password":"sg481n","user":"sg481n"
+    log                             'JSON Response Code:'${resp}
+
+Run Update Feed
+    [Documentation]                 Update Feed description and suspend
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_FEED}    ${UPDATE_FEED_DATA}      ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_FEED}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_FEED}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "UPDATED-CSIT_Test"
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Subscription
+    [Documentation]                 Delete Subscription
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_SUBSCRIPTION}    sg481n
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Feed
+    [Documentation]                 Delete Feed
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_FEED}    rs873m
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+*** Keywords ***
+PostCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+PutCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}    Authorization=Basic cnM4NzNtOnJzODczbQ==
+    ${resp}=         Evaluate            requests.put('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+GetCall
+    [Arguments]      ${url}              ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.get('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+DeleteCall
+    [Arguments]      ${url}              ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}
+    ${resp}=         Evaluate            requests.delete('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
diff --git a/test/csit/tests/dmaap-buscontroller/with_dr/test1.robot b/test/csit/tests/dmaap-buscontroller/with_dr/test1.robot
new file mode 100644 (file)
index 0000000..a3aef42
--- /dev/null
@@ -0,0 +1,143 @@
+*** Settings ***
+Resource          ../../common.robot
+Library           Collections
+Library           json
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           HttpLibrary.HTTP
+Library           String
+
+
+*** Variables ***
+${MESSAGE}    Hello, world!
+${DBC_URI}    webapi
+${DBC_URL}    http://${DMAAPBC_IP}:8080/${DBC_URI}
+${LOC}          csit-sanfrancisco
+${PUB_CORE}     "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.pub", "action": [ "pub", "view" ] 
+${SUB_CORE}     "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.sub", "action": [ "sub", "view" ] 
+${PUB}          { ${PUB_CORE} }
+${SUB}          { ${SUB_CORE} }
+${FEED1_DATA}  { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
+${FEED2_DATA}  { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
+${PUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
+${SUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
+${TOPIC2_DATA}  { "topicName":"singleMRtopic2", "topicDescription":"generated for CSIT", "owner":"dgl", "clients": [ ${PUB}, ${SUB}] }
+${TOPIC3_DATA}  { "topicName":"singleMRtopic3", "topicDescription":"generated for CSIT", "owner":"dgl"}
+#${PUB3_DATA}    { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${PUB_CORE} }
+#${SUB3_DATA}    { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${SUB_CORE} }
+
+
+
+*** Test Cases ***
+Url Test
+    [Documentation]    Check if www.onap.org can be reached
+    Create Session     sanity          http://onap.readthedocs.io
+    ${resp}=           Get Request   sanity    /  
+    Should Be Equal As Integers  ${resp.status_code}  200
+
+(DMAAP-441c1)
+    [Documentation]        Create Feed w no clients POST ${DBC_URI}/feeds endpoint
+    ${resp}=         PostCall    ${DBC_URL}/feeds    ${FEED1_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  200   
+
+(DMAAP-441c2)
+    [Documentation]        Create Feed w clients POST ${DBC_URI}/feeds endpoint
+    ${resp}=         PostCall    ${DBC_URL}/feeds    ${FEED2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  200   
+
+(DMAAP-441c3)
+    [Documentation]        Add Publisher to existing feed
+    ${resp}=         PostCall    ${DBC_URL}/dr_pubs    ${PUB2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  201   
+    ${tmp}=          Get Json Value      ${resp.text}           /pubId
+    ${tmp}=          Remove String       ${tmp}         \"
+    Set Suite Variable          ${pubId}    ${tmp}
+
+(DMAAP-441c4)
+    [Documentation]        Add Subscriber to existing feed
+    ${resp}=         PostCall    ${DBC_URL}/dr_subs    ${SUB2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  201   
+    ${tmp}=          Get Json Value      ${resp.text}           /subId
+    ${tmp}=          Remove String       ${tmp}         \"
+    Set Suite Variable          ${subId}    ${tmp}
+
+(DMAAP-443)
+    [Documentation]        List existing feeds
+    Create Session     get          ${DBC_URL}
+    ${resp}=         Get Request    get       /feeds
+    Should Be Equal As Integers  ${resp.status_code}  200
+
+(DMAAP-444)
+    [Documentation]        Delete existing subscriber
+    ${resp}=         DelCall    ${DBC_URL}/dr_subs/${subId}
+    Should Be Equal As Integers  ${resp.status_code}  204
+
+(DMAAP-445)
+    [Documentation]        Delete existing publisher
+    ${resp}=         DelCall    ${DBC_URL}/dr_pubs/${pubId}
+    Should Be Equal As Integers  ${resp.status_code}  204
+
+#(DMAAP-294)
+#    [Documentation]        Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
+#    ${resp}=         PostCall    ${DBC_URL}/topics    ${TOPIC2_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  201
+#
+#(DMAAP-295)
+#    [Documentation]        Create Topic w no clients and then add a client POST ${DBC_URI}/mr_clients endpoint
+#    ${resp}=         PostCall    ${DBC_URL}/topics    ${TOPIC3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  201   
+#    ${resp}=         PostCall    ${DBC_URL}/mr_clients    ${PUB3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  200   
+#    ${resp}=         PostCall    ${DBC_URL}/mr_clients    ${SUB3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  200   
+#
+#(DMAAP-297)
+#    [Documentation]    Query for all topics and specific topic
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics  
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#
+#(DMAAP-301)
+#    [Documentation]    Delete a subscriber
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#      ${tmp}=            Get Json Value      ${resp.text}           /clients/1/mrClientId
+#      ${clientId}=       Remove String       ${tmp}         \"
+#    ${resp}=           DelCall   ${DBC_URL}/mr_clients/${clientId}
+#    Should Be Equal As Integers  ${resp.status_code}  204
+#
+#(DMAAP-302)
+#    [Documentation]    Delete a publisher
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#      ${tmp}=            Get Json Value      ${resp.text}           /clients/0/mrClientId
+#      ${clientId}=       Remove String       ${tmp}         \"
+#    ${resp}=           DelCall   ${DBC_URL}/mr_clients/${clientId}
+#    Should Be Equal As Integers  ${resp.status_code}  204
+
+
+*** Keywords ***
+CheckDir
+    [Arguments]                 ${path}
+    Directory Should Exist      ${path}
+
+CheckUrl
+    [Arguments]                  ${session}   ${path}     ${expect}
+    ${resp}=                     Get  Request          ${session} ${path} 
+    Should Be Equal As Integers  ${resp.status_code}  ${expect}
+
+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}
+
+DelCall
+    [Arguments]    ${url}           
+    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
+    ${resp}=       Evaluate    requests.delete('${url}', headers=${headers},verify=False)    requests
+    [Return]       ${resp}
diff --git a/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot b/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot
new file mode 100755 (executable)
index 0000000..fcac202
--- /dev/null
@@ -0,0 +1,116 @@
+*** Settings ***
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           requests
+Library           Collections
+Library           String
+
+*** Variables ***
+${TARGET_URL}                   https://${DR_PROV_IP}:8443
+${TARGET_URL_FEED}              https://${DR_PROV_IP}:8443/feed/1
+${TARGET_URL_SUBSCRIBE}         https://${DR_PROV_IP}:8443/subscribe/1
+${TARGET_URL_SUBSCRIPTION}      https://${DR_PROV_IP}:8443/subs/1
+${TARGET_URL_PUBLISH}           https://${DR_NODE_IP}:8443/publish/1/csit_test
+${CREATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${UPDATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${SUBSCRIBE_DATA}               {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
+${UPDATE_SUBSCRIPTION_DATA}     {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
+${FEED_CONTENT_TYPE}            application/vnd.att-dr.feed
+${SUBSCRIBE_CONTENT_TYPE}       application/vnd.att-dr.subscription
+${PUBLISH_FEED_CONTENT_TYPE}    application/octet-stream
+
+*** Test Cases ***
+Run Feed Creation
+    [Documentation]                 Feed Creation
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL}         ${CREATE_FEED_DATA}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Subscribe to Feed
+    [Documentation]                 Subscribe to Feed
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL_SUBSCRIBE}    ${SUBSCRIBE_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIBE}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Publish Feed
+    [Documentation]                 Publish to Feed
+    [Timeout]                       1 minute
+    Sleep                           10s                              Behaviour was noticed where feed was not created in time for publish to be sent
+    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_PUBLISH}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Update Subscription
+    [Documentation]                 Update Subscription to suspend and change delivery credentials
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_SUBSCRIPTION}    ${UPDATE_SUBSCRIPTION_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIPTION}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_SUBSCRIPTION}    ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "password":"sg481n","user":"sg481n"
+    log                             'JSON Response Code:'${resp}
+
+Run Update Feed
+    [Documentation]                 Update Feed description and suspend
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_FEED}    ${UPDATE_FEED_DATA}      ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_FEED}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_FEED}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "UPDATED-CSIT_Test"
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Subscription
+    [Documentation]                 Delete Subscription
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_SUBSCRIPTION}    sg481n
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Feed
+    [Documentation]                 Delete Feed
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_FEED}    rs873m
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+*** Keywords ***
+PostCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+PutCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}    Authorization=Basic cnM4NzNtOnJzODczbQ==
+    ${resp}=         Evaluate            requests.put('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+GetCall
+    [Arguments]      ${url}              ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.get('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+DeleteCall
+    [Arguments]      ${url}              ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}
+    ${resp}=         Evaluate            requests.delete('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
index 9ec6585..55e57ec 100644 (file)
@@ -39,7 +39,7 @@ query_rule_with_existing_id
 
 query_rule_with_non_existing_id
     [Documentation]    Query a rule with a non-existing ID.
-    ${response}    queryConditionRule    {"ruleid":"invalidid"}
+    ${response}    queryConditionRule    {"ruleId":"invalidid"}
     ${respJson}    to json    ${response.content}
     ${count}    get from dictionary    ${respJson}    totalCount
     run keyword if    ${count}!=0    fail
@@ -53,7 +53,7 @@ query_rule_with_partial_existing_name
 
 query_rule_with_partial_non_existing_name
     [Documentation]    Query rules with (a part of) a non-existing name.
-    ${response}    queryConditionRule    {"rulename":"zte2017"}
+    ${response}    queryConditionRule    {"ruleName":"zte2017"}
     ${respJson}    to json    ${response.content}
     ${count}    get from dictionary    ${respJson}    totalCount
     run keyword if    ${count}!=0    fail
diff --git a/test/csit/tests/multicloud-pike/provision/hpa_multicloud.robot b/test/csit/tests/multicloud-pike/provision/hpa_multicloud.robot
new file mode 100644 (file)
index 0000000..f96b542
--- /dev/null
@@ -0,0 +1,17 @@
+*** settings ***
+Library     Collections
+Library     RequestsLibrary
+
+*** Variables ***
+@{return_ok_list}=             200  201  202
+${queryregistration_url}       /api/multicloud-pike/v0/CloudOwner_RegionOne/registry
+
+
+*** Test Cases ***
+OcataRegistryTest
+    [Documentation]            Register openstack cloud resources
+    ${headers}                 Create Dictionary       Content-Type=application/json           Accept=application/json
+    Create Session             web_session             http://${SERVICE_IP}:${SERVICE_PORT}    headers=${headers}
+    ${resp}=                   Post Request            web_session                             ${queryregistration_url}
+    ${response_code}=          Convert To String       ${resp.status_code}
+    List Should Contain Value  ${return_ok_list}       ${response_code}
diff --git a/test/csit/tests/multicloud-pike/provision/sanity_test_multicloud.robot b/test/csit/tests/multicloud-pike/provision/sanity_test_multicloud.robot
new file mode 100644 (file)
index 0000000..36fcea3
--- /dev/null
@@ -0,0 +1,22 @@
+*** settings ***
+Library     Collections
+Library     RequestsLibrary
+Library     OperatingSystem
+Library     json
+
+*** Variables ***
+@{return_ok_list}=   200  201  202
+${queryswagger_pike_url}    /api/multicloud-pike/v0/swagger.json
+
+
+*** Test Cases ***
+OcataSwaggerTest
+    [Documentation]    query swagger info rest test
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${SERVICE_IP}:${SERVICE_PORT}    headers=${headers}
+    ${resp}=  Get Request    web_session    ${queryswagger_pike_url}
+    ${response_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${response_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${swagger_version}=    Convert To String      ${response_json['swagger']}
+    Should Be Equal    ${swagger_version}    2.0
index 9f8e435..9fc937e 100644 (file)
@@ -5,6 +5,9 @@ Library       json
 
 *** Variables ***
 ${MESSAGE}    {"ping": "ok"}
+${BASIC}    Basic
+${AUTHVALUE}    bXVzaWM6bXVzaWM=
+${Authorization}    ${BASIC} ${AUTHVALUE}
 
 #global variables
 ${generatedAID}
@@ -60,7 +63,7 @@ Music AddOnBoarding
     [Documentation]    It sends a REST POST request to Music to Onboard a new application
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}onboard.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   Content-Type=application/json  Accept=application/json
     ${resp}=         Post Request        musicaas   /MUSIC/rest/v2/admin/onboardAppWithMusic    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -75,7 +78,7 @@ Music CreateKeyspace
     [Documentation]    It sends a REST POST request to Music to create a new keyspace in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}createkeyspace.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Post Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -86,7 +89,7 @@ Music CreateTable
     [Documentation]    It sends a REST POST request to Music to create a new Table in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}createtable.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Post Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -97,7 +100,7 @@ Music InsertRow
     [Documentation]    It sends a REST POST request to Music to create a new row in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}insertrow_eventual.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Post Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1   data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -107,7 +110,7 @@ Music InsertRow
 Music ReadRowJustInserted
     [Documentation]    It sends a REST GET request to Music to Read the row just inserted in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Get Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1   headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -118,7 +121,7 @@ Music UpdateRowInAtomicWay
     [Documentation]    It sends a REST PUT request to Music to create a new row in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}updaterow_atomic.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Put Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1   data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -128,7 +131,7 @@ Music UpdateRowInAtomicWay
 Music ReadRowAfterUpdate
     [Documentation]    It sends a REST GET request to Music to Read the row just inserted in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Get Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1   headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -139,7 +142,7 @@ Music DeleteRow
     [Documentation]    It sends a REST DELETE request to Music to delete a row in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}deleterow_eventual.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json  Accept=application/json
     ${resp}=         Delete Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1   data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -150,7 +153,7 @@ Music DropTable
     [Documentation]    It sends a REST Delete request to Music to drop one existing Table in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}droptable.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
     ${resp}=         Delete Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -161,7 +164,7 @@ Music DropKeyspace
     [Documentation]    It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra
     Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}dropkeyspace.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
     ${resp}=         Delete Request        musicaas   /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
@@ -173,7 +176,7 @@ Music DeleteOnBoarding
     [Documentation]    It sends a REST DELETE request to Music to remove a previosly onboarded application
     Create Session   musicaas             ${MUSIC_HOSTNAME}:${MUSIC_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}onboard.json
-    &{headers}=      Create Dictionary    ns=lb7254    userId=music    password=music   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
+    &{headers}=      Create Dictionary    ns=lb7254    Authorization=${Authorization}   aid=${generatedAID}   Content-Type=application/json   Accept=application/json
     ${resp}=         Delete Request        musicaas   /MUSIC/rest/v2/admin/onboardAppWithMusic    data=${data}    headers=${headers}
     Log To Console              *********************
     Log To Console              response = ${resp}
index 815ffa8..deba647 100644 (file)
@@ -115,6 +115,7 @@ Get Root Url
     Log To Console              response = ${resp}
     Log To Console              body = ${resp.text}
     Should Be Equal As Integers    ${resp.status_code}    200
+    Sleep    10s    Wait For 10 seconds
 
 Conductor AddHealthcheck Row Into Music
     [Documentation]    It sends a REST PUT request to Music to inject healthcheck plan
index f406bbf..911fdaf 100644 (file)
@@ -22,9 +22,9 @@ ${GLOBAL_AAI_CLOUD_OWNER}    Rackspace
 ${GLOBAL_BUILD_NUMBER}    31
 ${GLOBAL_VM_PRIVATE_KEY}   ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt
 # policy info - everything is from the private oam network (also called ecomp private network)
-${GLOBAL_POLICY_SERVER_URL}    http://%{PDP_IP}:8081
+${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_USERNAME}      healthcheck
-${GLOBAL_POLICY_PASSWORD}      zb!XztG34
\ No newline at end of file
+${GLOBAL_POLICY_PASSWORD}      zb!XztG34
index 6d4dc24..3705d8f 100644 (file)
@@ -7,9 +7,9 @@ Library           json
 *** Test Cases ***
 Get Requests health check ok
     [Tags]    get
-    CreateSession    sdc-be    http://localhost:8080
+    CreateSession    sdc-be    http://localhost:8181
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
-    ${resp}=    Get Request    sdc-be    /sdc2/rest/healthCheck    headers=&{headers}
+    ${resp}=    Get Request    sdc-be    /sdc1/rest/healthCheck    headers=&{headers}
     Should Be Equal As Strings    ${resp.status_code}    200
     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
     : FOR    ${ELEMENT}    IN    @{ITEMS}
index 6d4dc24..3705d8f 100644 (file)
@@ -7,9 +7,9 @@ Library           json
 *** Test Cases ***
 Get Requests health check ok
     [Tags]    get
-    CreateSession    sdc-be    http://localhost:8080
+    CreateSession    sdc-be    http://localhost:8181
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
-    ${resp}=    Get Request    sdc-be    /sdc2/rest/healthCheck    headers=&{headers}
+    ${resp}=    Get Request    sdc-be    /sdc1/rest/healthCheck    headers=&{headers}
     Should Be Equal As Strings    ${resp.status_code}    200
     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
     : FOR    ${ELEMENT}    IN    @{ITEMS}
index 6d4dc24..3705d8f 100644 (file)
@@ -7,9 +7,9 @@ Library           json
 *** Test Cases ***
 Get Requests health check ok
     [Tags]    get
-    CreateSession    sdc-be    http://localhost:8080
+    CreateSession    sdc-be    http://localhost:8181
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
-    ${resp}=    Get Request    sdc-be    /sdc2/rest/healthCheck    headers=&{headers}
+    ${resp}=    Get Request    sdc-be    /sdc1/rest/healthCheck    headers=&{headers}
     Should Be Equal As Strings    ${resp.status_code}    200
     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
     : FOR    ${ELEMENT}    IN    @{ITEMS}
diff --git a/test/csit/tests/vid/resources/docker-compose.yml b/test/csit/tests/vid/resources/docker-compose.yml
new file mode 100644 (file)
index 0000000..93b3170
--- /dev/null
@@ -0,0 +1,35 @@
+version: '3'
+services:
+    vid-server:
+        image: nexus3.onap.org:10001/onap/vid:latest
+        environment:
+            - VID_MYSQL_DBNAME=vid_openecomp_epsdk
+            - VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+            - ASDC_CLIENT_REST_HOST=localhost
+            - ASDC_CLIENT_REST_PORT=8443
+        ports:
+            - "8080:8080"
+        container_name: vid-server
+        links:
+            - vid-mariadb:vid-mariadb-docker-instance
+
+    vid-mariadb:
+        image: mariadb:10
+        environment:
+            - MYSQL_DATABASE=vid_openecomp_epsdk
+            - MYSQL_USER=vidadmin
+            - MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+            - MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY
+        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:
+        build:
+            context: simulators
+            dockerfile: SDC_simulator
+        ports:
+        - "8443:8443"
+        container_name: sdc_simulator
\ No newline at end of file
diff --git a/test/csit/tests/vid/resources/simulators/SDC.py b/test/csit/tests/vid/resources/simulators/SDC.py
new file mode 100644 (file)
index 0000000..e99a0bd
--- /dev/null
@@ -0,0 +1,37 @@
+import ssl
+from http.server import BaseHTTPRequestHandler, HTTPServer
+
+from sys import argv
+
+DEFAULT_PORT = 8443
+
+
+class SDCHandler(BaseHTTPRequestHandler):
+
+    def __init__(self, request, client_address, server):
+        self.response_on_get = self._read_on_get_response()
+        super().__init__(request, client_address, server)
+
+    def do_GET(self):
+        self.send_response(200)
+        self._set_headers()
+
+        self.wfile.write(self.response_on_get.encode("utf-8"))
+        return
+
+    def _set_headers(self):
+        self.send_header('Content-Type', 'application/json')
+        self.end_headers()
+
+    @staticmethod
+    def _read_on_get_response():
+        with open('sdc_get_response.json', 'r') as file:
+            return file.read()
+
+
+if __name__ == '__main__':
+    SDCHandler.protocol_version = "HTTP/1.1"
+
+    httpd = HTTPServer(('', DEFAULT_PORT), SDCHandler)
+    httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, certfile='cert.pem', keyfile='key.pem')
+    httpd.serve_forever()
diff --git a/test/csit/tests/vid/resources/simulators/SDC_simulator b/test/csit/tests/vid/resources/simulators/SDC_simulator
new file mode 100644 (file)
index 0000000..c099787
--- /dev/null
@@ -0,0 +1,15 @@
+FROM alpine:latest
+
+RUN apk add --no-cache python3 && \
+    python3 -m ensurepip && \
+    rm -r /usr/lib/python*/ensurepip && \
+    pip3 install --upgrade pip setuptools && \
+    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
+    if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
+       rm -r /root/.cache
+
+ADD SDC.py /
+
+EXPOSE 8443
+
+CMD [ "python", "./SDC.py" ]
diff --git a/test/csit/tests/vid/resources/simulators/cert.pem b/test/csit/tests/vid/resources/simulators/cert.pem
new file mode 100644 (file)
index 0000000..cea1e37
--- /dev/null
@@ -0,0 +1,74 @@
+Bag Attributes
+    friendlyName: 1
+    localKeyID: 54 69 6D 65 20 31 35 33 35 36 31 39 34 30 35 39 30 38
+subject=/C=US/ST=Michigan/L=Southfield/O=ATT Services, Inc./OU=ASDC/CN=mtanjv9sdcf51.aic.cip.att.com
+issuer=/C=US/O=Symantec Corporation/OU=Symantec Trust Network/CN=Symantec Class 3 Secure Server CA - G4
+-----BEGIN CERTIFICATE-----
+MIIGDzCCBPegAwIBAgIQfZLBdhhGhkOBcXuI5oF0gTANBgkqhkiG9w0BAQsFADB+
+MQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAd
+BgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxLzAtBgNVBAMTJlN5bWFudGVj
+IENsYXNzIDMgU2VjdXJlIFNlcnZlciBDQSAtIEc0MB4XDTE1MTIwOTAwMDAwMFoX
+DTE2MTIwODIzNTk1OVowgYkxCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhNaWNoaWdh
+bjETMBEGA1UEBwwKU291dGhmaWVsZDEbMBkGA1UECgwSQVRUIFNlcnZpY2VzLCBJ
+bmMuMQ0wCwYDVQQLDARBU0RDMSYwJAYDVQQDDB1tdGFuanY5c2RjZjUxLmFpYy5j
+aXAuYXR0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOup99Ff
+gk02lwXv535Y1FCCE8vL47BKj96h6to8rXwwN+9W+xiVEIgDXKOWBC7W8iEP2tOd
+Smzi3wsZIivaFh2yPGtj1z0a7WuA7wNw1fJF4WGr4VFaxHbMBaPOZHa3D+iIduWP
+H/t6ECEzfGRRtTt+mVCpV8Rx+v/q8d0yO114u/WBtbGGlIPDJcrHLRODnjM+mkjq
+EwfoR9qqqjbJhjUkUujGM/qVKm3YAjMIZ1ldteRXUew4xI/Foo6u3hqJwbYIJf3r
+fzWCt+fIyktDsm/c1w9HcX+8R0alK90bjC2D5auukIfbmhxd4MR9NBAH0SFleQtw
+SQLN6GYMVexhUEECAwEAAaOCAnswggJ3MCgGA1UdEQQhMB+CHW10YW5qdjlzZGNm
+NTEuYWljLmNpcC5hdHQuY29tMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgWgMB0G
+A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBhBgNVHSAEWjBYMFYGBmeBDAEC
+AjBMMCMGCCsGAQUFBwIBFhdodHRwczovL2Quc3ltY2IuY29tL2NwczAlBggrBgEF
+BQcCAjAZGhdodHRwczovL2Quc3ltY2IuY29tL3JwYTAfBgNVHSMEGDAWgBRfYM9h
+kFXfhEMUimAqsvV69EMY7zArBgNVHR8EJDAiMCCgHqAchhpodHRwOi8vc3Muc3lt
+Y2IuY29tL3NzLmNybDBXBggrBgEFBQcBAQRLMEkwHwYIKwYBBQUHMAGGE2h0dHA6
+Ly9zcy5zeW1jZC5jb20wJgYIKwYBBQUHMAKGGmh0dHA6Ly9zcy5zeW1jYi5jb20v
+c3MuY3J0MIIBBQYKKwYBBAHWeQIEAgSB9gSB8wDxAHYA3esdK3oNT6Ygi4GtgWhw
+fi6OnQHVXIiNPRHEzbbsvswAAAFRh4XRnAAABAMARzBFAiBXZqph5qeHUUnY8OkH
+jJLo454/8c9IBB7asjEYWYoBPQIhAKAwvP8KfqilgawBkuRV7r41P8Xd3Yi72RQO
+1Dvpi8rkAHcApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFRh4XR
+3AAABAMASDBGAiEAon+cZcRpSsuo1aiCtaN3aAG0EqJb/1jJ4m4Q/qo1nEoCIQCr
+KrBNyywa4OTmSVSAsyazbnMr5ldimxNORhhtyGeFLDANBgkqhkiG9w0BAQsFAAOC
+AQEAG3/Mq8F0wbCpOOMCq4dZwgLENBjor9b9UljQZ+sgt7Nn00bfGdxY4MKtOTiK
+9ks/nV9sW0KyvhsZvLPPgdSCnu0MZogWQsKqQDkIkJoHtFRSaYTT1vLAIoKz/dN+
+SBS71EzFH92lMfiFtAjfTrFady0/6z7lp4VZwbXLWjHw6LQESENc29Xw1jpCVkg8
+iB2n/qCFfyw3HuvP+eW2TLmnHOl0tda1vrYKCXT2n7HepiJM3g9yLjb/w3MuxEmw
+dj1DqRemXtOUJW0mQXn1mRBjXEunzHoCr3GaeSU6G3RbIzXr34Hsv4IbggkhRula
+gQIYidtDmw0PS1kyaFvlhZkd1g==
+-----END CERTIFICATE-----
+Bag Attributes
+    friendlyName: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+subject=/C=US/O=Symantec Corporation/OU=Symantec Trust Network/CN=Symantec Class 3 Secure Server CA - G4
+issuer=/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G5
+-----BEGIN CERTIFICATE-----
+MIIFODCCBCCgAwIBAgIQUT+5dDhwtzRAQY0wkwaZ/zANBgkqhkiG9w0BAQsFADCB
+yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
+ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
+U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
+ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5IC0gRzUwHhcNMTMxMDMxMDAwMDAwWhcNMjMxMDMwMjM1OTU5WjB+MQsw
+CQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNV
+BAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxLzAtBgNVBAMTJlN5bWFudGVjIENs
+YXNzIDMgU2VjdXJlIFNlcnZlciBDQSAtIEc0MIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAstgFyhx0LbUXVjnFSlIJluhL2AzxaJ+aQihiw6UwU35VEYJb
+A3oNL+F5BMm0lncZgQGUWfm893qZJ4Itt4PdWid/sgN6nFMl6UgfRk/InSn4vnlW
+9vf92Tpo2otLgjNBEsPIPMzWlnqEIRoiBAMnF4scaGGTDw5RgDMdtLXO637QYqzu
+s3sBdO9pNevK1T2p7peYyo2qRA4lmUoVlqTObQJUHypqJuIGOmNIrLRM0XWTUP8T
+L9ba4cYY9Z/JJV3zADreJk20KQnNDz0jbxZKgRb78oMQw7jW2FUyPfG9D72MUpVK
+Fpd6UiFjdS8W+cRmvvW1Cdj/JwDNRHxvSz+w9wIDAQABo4IBYzCCAV8wEgYDVR0T
+AQH/BAgwBgEB/wIBADAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vczEuc3ltY2Iu
+Y29tL3BjYTMtZzUuY3JsMA4GA1UdDwEB/wQEAwIBBjAvBggrBgEFBQcBAQQjMCEw
+HwYIKwYBBQUHMAGGE2h0dHA6Ly9zMi5zeW1jYi5jb20wawYDVR0gBGQwYjBgBgpg
+hkgBhvhFAQc2MFIwJgYIKwYBBQUHAgEWGmh0dHA6Ly93d3cuc3ltYXV0aC5jb20v
+Y3BzMCgGCCsGAQUFBwICMBwaGmh0dHA6Ly93d3cuc3ltYXV0aC5jb20vcnBhMCkG
+A1UdEQQiMCCkHjAcMRowGAYDVQQDExFTeW1hbnRlY1BLSS0xLTUzNDAdBgNVHQ4E
+FgQUX2DPYZBV34RDFIpgKrL1evRDGO8wHwYDVR0jBBgwFoAUf9Nlp8Ld7LvwMAnz
+Qzn6Aq8zMTMwDQYJKoZIhvcNAQELBQADggEBAF6UVkndji1l9cE2UbYD49qecxny
+H1mrWH5sJgUs+oHXXCMXIiw3k/eG7IXmsKP9H+IyqEVv4dn7ua/ScKAyQmW/hP4W
+Ko8/xabWo5N9Q+l0IZE1KPRj6S7t9/Vcf0uatSDpCr3gRRAMFJSaXaXjS5HoJJtG
+QGX0InLNmfiIEfXzf+YzguaoxX7+0AjiJVgIcWjmzaLmFN5OUiQt/eV5E1PnXi8t
+TRttQBVSK/eHiXgSgW7ZTaoteNTCLD0IX4eRnh8OsN4wUmSGiaqdZpwOdgyA8nTY
+Kvi4Os7X1g8RvmurFPW9QaAiY4nxug9vKWNmLT+sjHLF+8fk1A/yO0+MKcc=
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/test/csit/tests/vid/resources/simulators/key.pem b/test/csit/tests/vid/resources/simulators/key.pem
new file mode 100644 (file)
index 0000000..641d13f
--- /dev/null
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDrqffRX4JNNpcF
+7+d+WNRQghPLy+OwSo/eoeraPK18MDfvVvsYlRCIA1yjlgQu1vIhD9rTnUps4t8L
+GSIr2hYdsjxrY9c9Gu1rgO8DcNXyReFhq+FRWsR2zAWjzmR2tw/oiHbljx/7ehAh
+M3xkUbU7fplQqVfEcfr/6vHdMjtdeLv1gbWxhpSDwyXKxy0Tg54zPppI6hMH6Efa
+qqo2yYY1JFLoxjP6lSpt2AIzCGdZXbXkV1HsOMSPxaKOrt4aicG2CCX96381grfn
+yMpLQ7Jv3NcPR3F/vEdGpSvdG4wtg+WrrpCH25ocXeDEfTQQB9EhZXkLcEkCzehm
+DFXsYVBBAgMBAAECggEBAOkwoYCzIktnFh+Q2R9DpKsZW59QXDfoP95LmAlk+0Gk
+sOSKzCHx9o6vzO4uFmuG08Z1WtIElU2TXKMttotv3Gx8Hp8hBy12xLGYvmlIMNvv
+2+n62xTWXQs0LOx+4Rg7Yml1Bzl1227KxMUlnhPiahO53NldB/Th2D197OA0wVtl
+o3d753CNs+vVk1Z8RTUWrW1ZNHdfQNa1zrNo3Q5/evnlt+mAhFbUIKB3FgMk4N4/
+EjnTH6d+MEUD1sVCNruxqv8PZzRzzJEU/8gzy0WAPFAGOOC7hgU3n7dIEEkjvoIw
+HlZD5c6I+3AzYq08CtUwWI09pNVlznqoOY6d548YusUCgYEA9cHOUXiafXFupqpT
+HwE18Yk5sqISpPwS8yip4NPPUv+W9qvCpdkFvV3HRMlICWJGoerRsALEQYY5fsvY
+7lk1avunprbIa9XLUrvb4ydJYynFhKjXkfTAmyCmbvH8t10BfDNuXT098+4M4HpG
+YW2Arl9Db7RoOBwQtPFX2RmYOM8CgYEA9Xx4TbsbT1C6c49aDZmuFeBXDEaMTDYS
+CC50MqMQpfoqS5QVyjl7JzP/dIz9CcUExFz7MOmYCp8yocXnLwxGDrZjZMkwEz15
+8WUGj4WMpSpUSRmGEVnoVE5bRazq37vhbOwh8gcKhF1ifVgwm+Rjs+4g6DwmSR8l
+4CVK6lWrCe8CgYEA5QR7kR6z0Wywse4N0dnd/D1mIFq6xzcFLcZaMOMR1IXMmAjO
+NqF8oNDQjwCH+f60VdWvHLgnTeyYjdnHSa6mghEMVecF9L/iXzIjopaM5DUcFRkG
+8sRD7QxLLR6i4/lvFeAT3B3jKvtO0q4AAnD6NwUdoe5cJNW6l/REalNYsK8CgYBw
+n7lF2CiwW9YevE7RXIc8rB7jl943/LqLHFzc+mjh7QLIh9jzXSm+E6IIY8KXX9dP
+C2WGzDSf8ue0xmnI8PWXPGAfVhoDSboPYI0A/YFIKUJgAyC6ByiKvSQstCdRnA3Q
+/giY1Fgj4AAWh4ZNjxua6g4Y3bem5m5nBlT3a3Q76wKBgQDSMFNfVNWautPQvcYB
+iu9oQhbXVkjh+ToFWq6pW4VaWhEf/6hqvihc6PcB7FXJ1v1/ybko6cIgVmFUt43s
+it1q5aLy3v6GTS/UnDZI3r5oECEuLeUqnHm3qilbatUtwvxghgdwGK+YG0yTfS3y
+GqdNDH5YdJJMyiLdQlLIzJb/XQ==
+-----END PRIVATE KEY-----
diff --git a/test/csit/tests/vid/resources/simulators/sdc_get_response.json b/test/csit/tests/vid/resources/simulators/sdc_get_response.json
new file mode 100644 (file)
index 0000000..9f7e118
--- /dev/null
@@ -0,0 +1,301 @@
+{
+  "service": {
+    "uuid": "2763bc78-8523-482f-895b-0c0db7364224",
+    "invariantUuid": "abb2dc66-b211-49d2-ab2f-8774694136fa",
+    "name": "Bare2",
+    "version": "1.0",
+    "toscaModelURL": null,
+    "category": "Network L1-3",
+    "serviceType": "",
+    "serviceRole": "",
+    "description": "Bare2",
+    "serviceEcompNaming": "true",
+    "instantiationType": "ClientConfig",
+    "inputs": {}
+  },
+  "vnfs": {
+    "95e654c0-676b-4386-8a69 0": {
+      "uuid": "d6395498-7ecb-4eba-bf84-4380f6e9cdcf",
+      "invariantUuid": "16262b97-bcb1-4033-8f9f-a3016eaf1ec3",
+      "description": "vendor software product",
+      "name": "95e654c0-676b-4386-8a69",
+      "version": "1.0",
+      "customizationUuid": "34a3b91d-8d73-4412-bf4e-c6456741007f",
+      "inputs": {},
+      "commands": {},
+      "properties": {
+        "vf_module_id": "vTrafficPNG",
+        "repo_url_blob": "https://nexus.onap.org/content/sites/raw",
+        "unprotected_private_subnet_id": "zdfw1fwl01_unprotected_sub",
+        "public_net_id": "PUT THE PUBLIC NETWORK ID HERE",
+        "vfw_private_ip_0": "192.168.10.100",
+        "onap_private_subnet_id": "PUT THE ONAP PRIVATE NETWORK NAME HERE",
+        "onap_private_net_cidr": "10.0.0.0/16",
+        "image_name": "PUT THE VM IMAGE NAME HERE (UBUNTU 1404)",
+        "flavor_name": "PUT THE VM FLAVOR NAME HERE (m1.medium suggested)",
+        "vnf_id": "vPNG_Firewall_demo_app",
+        "vpg_name_0": "zdfw1fwl01pgn01",
+        "vpg_private_ip_1": "10.0.100.2",
+        "vsn_private_ip_0": "192.168.20.250",
+        "vpg_private_ip_0": "192.168.10.200",
+        "protected_private_net_cidr": "192.168.20.0/24",
+        "unprotected_private_net_cidr": "192.168.10.0/24",
+        "nf_naming": "{ecomp_generated_naming=true}",
+        "multi_stage_design": "false",
+        "onap_private_net_id": "PUT THE ONAP PRIVATE NETWORK NAME HERE",
+        "unprotected_private_net_id": "zdfw1fwl01_unprotected",
+        "availability_zone_max_count": "1",
+        "demo_artifacts_version": "1.2.1",
+        "pub_key": "PUT YOUR PUBLIC KEY HERE",
+        "key_name": "vfw_key",
+        "repo_url_artifacts": "https://nexus.onap.org/content/repositories/releases",
+        "install_script_version": "1.2.1",
+        "cloud_env": "PUT openstack OR rackspace HERE"
+      },
+      "type": "VF",
+      "modelCustomizationName": "95e654c0-676b-4386-8a69 0",
+      "vfModules": {
+        "95e654c0676b43868a690..95e654c0676b43868a69..base_vpkg..module-0": {
+          "uuid": "12082e9d-a854-48cc-8243-e24b26199856",
+          "invariantUuid": "239419df-3375-49fe-9dd4-73b3393858ba",
+          "customizationUuid": "32c824f7-5910-4d7a-88ad-188d4905675d",
+          "description": null,
+          "name": "95e654c0676b43868a69..base_vpkg..module-0",
+          "version": "1",
+          "volumeGroupAllowed": false,
+          "commands": {},
+          "modelCustomizationName": "95e654c0676b43868a69..base_vpkg..module-0",
+          "properties": {
+            "min_vf_module_instances": {
+              "name": "min_vf_module_instances",
+              "value": 1,
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "The minimum instances of this VF-Module",
+              "default": null,
+              "type": "integer"
+            },
+            "vf_module_label": {
+              "name": "vf_module_label",
+              "value": "base_vpkg",
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "Alternate textual key used to reference this VF-Module model.  Must be unique within the VNF model\n",
+              "default": null,
+              "type": "string"
+            },
+            "max_vf_module_instances": {
+              "name": "max_vf_module_instances",
+              "value": 1,
+              "entrySchema": null,
+              "required": false,
+              "constraints": [],
+              "description": "The maximum instances of this VF-Module",
+              "default": null,
+              "type": "integer"
+            },
+            "vfc_list": {
+              "name": "vfc_list",
+              "value": null,
+              "entrySchema": {
+                "description": "<vfc_id>:<count>",
+                "type": "string"
+              },
+              "required": false,
+              "constraints": [],
+              "description": "Identifies the set of VM types and their count included in the VF-Module\n",
+              "default": null,
+              "type": "map"
+            },
+            "vf_module_type": {
+              "name": "vf_module_type",
+              "value": "Base",
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "",
+              "default": null,
+              "type": "string"
+            },
+            "vf_module_description": {
+              "name": "vf_module_description",
+              "value": null,
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "Description of the VF-modules contents and purpose   (e.g. \"Front-End\" or \"Database Cluster\")\n",
+              "default": null,
+              "type": "string"
+            },
+            "initial_count": {
+              "name": "initial_count",
+              "value": 1,
+              "entrySchema": null,
+              "required": false,
+              "constraints": [],
+              "description": "The initial count of instances of the VF-Module. The value must be in the  range between min_vfmodule_instances and max_vfmodule_instances. If no value provided the initial count is the min_vfmodule_instances.\n",
+              "default": null,
+              "type": "integer"
+            },
+            "volume_group": {
+              "name": "volume_group",
+              "value": false,
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "\"true\" indicates that this VF Module model requires attachment to a Volume   Group.  VID operator must select the Volume Group instance to attach to a VF-Module  at deployment time.\n",
+              "default": false,
+              "type": "boolean"
+            },
+            "availability_zone_count": {
+              "name": "availability_zone_count",
+              "value": null,
+              "entrySchema": null,
+              "required": false,
+              "constraints": [],
+              "description": "Quantity of Availability Zones needed for this VF-Module     (source: Extracted from VF-Module HEAT template)\n",
+              "default": null,
+              "type": "integer"
+            },
+            "isBase": {
+              "name": "isBase",
+              "value": false,
+              "entrySchema": null,
+              "required": true,
+              "constraints": [],
+              "description": "Whether this module should be deployed before other modules",
+              "default": false,
+              "type": "boolean"
+            }
+          }
+        }
+      },
+      "volumeGroups": {}
+    }
+  },
+  "networks": {},
+  "configurations": {},
+  "serviceProxies": {},
+  "vfModules": {
+    "95e654c0676b43868a690..95e654c0676b43868a69..base_vpkg..module-0": {
+      "uuid": "12082e9d-a854-48cc-8243-e24b26199856",
+      "invariantUuid": "239419df-3375-49fe-9dd4-73b3393858ba",
+      "customizationUuid": "32c824f7-5910-4d7a-88ad-188d4905675d",
+      "description": null,
+      "name": "95e654c0676b43868a69..base_vpkg..module-0",
+      "version": "1",
+      "volumeGroupAllowed": false,
+      "commands": {},
+      "modelCustomizationName": "95e654c0676b43868a69..base_vpkg..module-0",
+      "properties": {
+        "min_vf_module_instances": {
+          "name": "min_vf_module_instances",
+          "value": 1,
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "The minimum instances of this VF-Module",
+          "default": null,
+          "type": "integer"
+        },
+        "vf_module_label": {
+          "name": "vf_module_label",
+          "value": "base_vpkg",
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "Alternate textual key used to reference this VF-Module model.  Must be unique within the VNF model\n",
+          "default": null,
+          "type": "string"
+        },
+        "max_vf_module_instances": {
+          "name": "max_vf_module_instances",
+          "value": 1,
+          "entrySchema": null,
+          "required": false,
+          "constraints": [],
+          "description": "The maximum instances of this VF-Module",
+          "default": null,
+          "type": "integer"
+        },
+        "vfc_list": {
+          "name": "vfc_list",
+          "value": null,
+          "entrySchema": {
+            "description": "<vfc_id>:<count>",
+            "type": "string"
+          },
+          "required": false,
+          "constraints": [],
+          "description": "Identifies the set of VM types and their count included in the VF-Module\n",
+          "default": null,
+          "type": "map"
+        },
+        "vf_module_type": {
+          "name": "vf_module_type",
+          "value": "Base",
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "",
+          "default": null,
+          "type": "string"
+        },
+        "vf_module_description": {
+          "name": "vf_module_description",
+          "value": null,
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "Description of the VF-modules contents and purpose   (e.g. \"Front-End\" or \"Database Cluster\")\n",
+          "default": null,
+          "type": "string"
+        },
+        "initial_count": {
+          "name": "initial_count",
+          "value": 1,
+          "entrySchema": null,
+          "required": false,
+          "constraints": [],
+          "description": "The initial count of instances of the VF-Module. The value must be in the  range between min_vfmodule_instances and max_vfmodule_instances. If no value provided the initial count is the min_vfmodule_instances.\n",
+          "default": null,
+          "type": "integer"
+        },
+        "volume_group": {
+          "name": "volume_group",
+          "value": false,
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "\"true\" indicates that this VF Module model requires attachment to a Volume   Group.  VID operator must select the Volume Group instance to attach to a VF-Module  at deployment time.\n",
+          "default": false,
+          "type": "boolean"
+        },
+        "availability_zone_count": {
+          "name": "availability_zone_count",
+          "value": null,
+          "entrySchema": null,
+          "required": false,
+          "constraints": [],
+          "description": "Quantity of Availability Zones needed for this VF-Module     (source: Extracted from VF-Module HEAT template)\n",
+          "default": null,
+          "type": "integer"
+        },
+        "isBase": {
+          "name": "isBase",
+          "value": false,
+          "entrySchema": null,
+          "required": true,
+          "constraints": [],
+          "description": "Whether this module should be deployed before other modules",
+          "default": false,
+          "type": "boolean"
+        }
+      }
+    }
+  },
+  "volumeGroups": {},
+  "pnfs": {}
+}
\ No newline at end of file
diff --git a/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/create_validate_digest_signing.robot b/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/create_validate_digest_signing.robot
new file mode 100644 (file)
index 0000000..470b7c3
--- /dev/null
@@ -0,0 +1,21 @@
+*** settings ***
+Library           OperatingSystem
+
+
+*** Variables ***
+${csarpath}       ${SCRIPTS}/../tests/vnfsdk-pkgtools/tosca-metadata/csar
+${keyfile}       ${SCRIPTS}/../tests/vnfsdk-pkgtools/tosca-metadata/test.key
+${create_output}  ${OUTPUT DIR}/test_signing.csar
+
+*** Test Cases ***
+Create CSAR package
+    [Documentation]    Create CSAR package
+    ${output}=    Run    vnfsdk csar-create -d ${create_output} --manifest test_entry.mf --history ChangeLog.txt --tests Tests --licenses Licenses --certificate test.crt --privkey ${keyfile} ${csarpath} test_entry.yaml
+    Log  ${output}
+    File Should Exist  ${create_output}
+
+Validate CSAR package
+    [Documentation]    Validate CSAR package
+    ${rc}  ${output}=    Run and Return RC And Output    vnfsdk csar-validate ${create_output}
+    Should Be Equal As Integers  ${rc}  0
+    Log  ${output}
diff --git a/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test.crt b/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test.crt
new file mode 100644 (file)
index 0000000..63c85d4
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAggCCQDrDujRIFtRTDANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJQ
+VDEPMA0GA1UECAwGTGlzYm9hMQ8wDQYDVQQHDAZMaXNib2ExFDASBgNVBAoMC0V4
+YW1wbGUgT3JnMCAXDTE4MDgyNDA2MjY1OVoYDzIxMTYwMjEyMDYyNjU5WjBdMQsw
+CQYDVQQGEwJQVDEPMA0GA1UECAwGTGlzYm9hMQ8wDQYDVQQHDAZMaXNib2ExFDAS
+BgNVBAoMC0V4YW1wbGUgT3JnMRYwFAYDVQQDDA0qLmV4YW1wbGUub3JnMIIBIjAN
+BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwVDDqoO+C5dxgi1nnky+D4qqVdFG
+mX3H4q6zFPUAkve3gElfttuDfbmN+OYCWhvKcjUN1Y2xjt+0aeRJVuQ+eumEX/1F
+76i2t9c66fWPtdZ0V8IuDc2ajNxbKiAwYrwVl3AS2tJ32psHRLvpmLoOVz9UXY0J
+rDwr274Z38wIqEGrUQ9hdOebEggeVu6Mv3pZUBYGGo9VX1/PTZguOaP85nC193Ux
+SJe2+KV6aoc0odiokFmWK2JJrNb8bMjrQcQqp86JMW1DHyon5sF6edTIilxgC+SH
+gapT5hZeoNnh3rAgHiWXF8ZOvho341s+7I78pbEtqCXNbF3VqikFlWmStQIDAQAB
+MA0GCSqGSIb3DQEBCwUAA4IBAQCh8CffE1amceKSb7USEfkpsDbNYo+IWMDyVo9g
+WQOYVIqIFGS8RMzs43Y6nIYJ/9pJUG10Qc4Yq1ZEqsV771Fz6WHx3zlJakVww/Ph
+CxbakjO3EzIHVjEWIu3sUfMdyOeF0ZDHDnfQZYWC17d2jE+s8rH2epl2h1jhi8fS
+i+eT2QDv8lHAM2mdM4jSwoCSsN7FImRxcYPoCxYwVkjVkmHhEMaUdqa1LKY/0YBf
+PFm0pVDCBJZZvKGql44eKiaY/GNW9IyzQFprT8V1rhD1fbTBFXghVGVaUi2Am3JD
++eZYMzd4rzFLZm8bjNm0Oler1UJSR1K91lOEig3M8FTN6JRE
+-----END CERTIFICATE-----
diff --git a/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/test.key b/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/test.key
new file mode 100644 (file)
index 0000000..06781d1
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAwVDDqoO+C5dxgi1nnky+D4qqVdFGmX3H4q6zFPUAkve3gElf
+ttuDfbmN+OYCWhvKcjUN1Y2xjt+0aeRJVuQ+eumEX/1F76i2t9c66fWPtdZ0V8Iu
+Dc2ajNxbKiAwYrwVl3AS2tJ32psHRLvpmLoOVz9UXY0JrDwr274Z38wIqEGrUQ9h
+dOebEggeVu6Mv3pZUBYGGo9VX1/PTZguOaP85nC193UxSJe2+KV6aoc0odiokFmW
+K2JJrNb8bMjrQcQqp86JMW1DHyon5sF6edTIilxgC+SHgapT5hZeoNnh3rAgHiWX
+F8ZOvho341s+7I78pbEtqCXNbF3VqikFlWmStQIDAQABAoIBAEWZ+pjuDgLGaAvi
+pSgNoXCfEG0NiEnDS7CGDdxByg8gOWVrBZckudcOc9tllPs0flNYXr7A4Wj7ik2F
+8BHk48oFQa/91KxRJlhSmdeanj9uEz11oHc/y6FjxT8Jj+I8rdl0dJVsqdJ/dsJ8
+lcJzWq53Er0MBquIjpHzhAVbxNIvEjQvuIyKPEomrvNN49fR5J7ExH8n1OnkuFRJ
+L4L98inXPtcQF2Xgorh2YwhV0DiY5X88TZMCZ8m7CB0DhwZSMueFWa6Aj4m5G0HQ
+kalXU3bCeBu66s3sXZHuGg1oF3MwwO7BX3/1fg8LoaLEvYHAOXH5PNRUzAgh7/mA
+dneVYoECgYEA69oHQ9VvXGpqHnE5spAtmyJn7v32zXEPUibdqPCNrGXznvzXM+Do
+xHB4K51H8wE/WGT/LGgVcubqr62f/SvmyO6RVOS+DRY4aYKyFif0+7mVHgWhoYOg
+oEaODZrKdxC4SrSYaogsDCH7bdkh1VdJhCDx6ppUGXs9/ZfKJn9kG+0CgYEA0dR9
+BQ6qnrBDrZg7vW/xV/iL/PGsJVBUt7oAkN7g4Ub42eTjAhIPdMxipgAkj6EbhoBO
+KpWELvRqC3oTUVutdTvRhdgummNKToZNaYG7CK5X6bsQh7l6tqLVkE1WqoT4yXvA
+1ez7iOhOsTvugYLlRJd3MTNiKw6c9Pr5ihIHyOkCgYEAsMRtk4LBfzNmq8BS7Skw
+dUhZO39u3dVyFTF6CqeYl3CmIjAAnypfavOcrZupFFGIB5lSwxaTlNXLabYo5hhk
+VY6wsD7szmQsDbBeB0sVSyFxyNmRpbtAxT98MmgkfQ60AZHPdnDvCnzhtBf8Sqis
+OfJzPlFC3QJImOuOIEJ0ZpUCgYAtwj0RYUVsHdxkexJsGYF0Qculeb6k1IPlHTcK
+YNCB0ExsmDG5Pd8JBZltwhI3EFdEWa6yMrEE3GBT6GdWErwdGNJ0cdSX7pdB0KAJ
+JjV3iy241waf0p8kPRZ9xZ/kx+LJbad7/5ZLIP4oQH2e2MDO2IkxvZbm9OTdt+27
+Yns4IQKBgEuQv0JTt+o6/1cwZkMvXDKf0vW2nbPG9gbP3gy9Js0mOG0eWYCsNehO
+DGLViyV2XURCskM4ZSA7Xc71lbCFhOV+jDXEipAjw8S8WJWdTraoF1QV12YEdlL/
+KdcxuJKVX8vdE9UCOxH/wcDG/JXAHX3qrMudJgAp598nyk6g2cNt
+-----END RSA PRIVATE KEY-----
index 74a180b..b2d5d1f 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-sed -i '/#!\/bin\/bash/a\
+sed -i '/^            #!\/bin\/bash/a\
             # sleep up to 3 minutes to avoid disk contention\
             sleep $((RANDOM / 200))\
             mkdir -p /etc/docker\
index 516312b..3071356 100644 (file)
@@ -84,7 +84,7 @@ parameters:
   sdnc_ip_addr: 172.16.7.1
   vid_ip_addr: 172.16.8.1
   clamp_ip_addr: 172.16.12.1
-  openo_ip_addr: 172.16.14.1
+  multiserv_ip_addr: 172.16.14.1
   music_ip_addr: 172.16.15.1
   oof_ip_addr: 172.16.16.1
   aaf_ip_addr: 172.16.13.1
index 6fec3d0..1e2ccd6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-sed -i '/#!\/bin\/bash/a\
+sed -i '/^            #!\/bin\/bash/a\
             mkdir -p /etc/docker\
             cat > /etc/docker/daemon.json <<EOF\
             {\
index ee4f229..c682dc5 100644 (file)
@@ -84,7 +84,7 @@ parameters:
   sdnc_ip_addr: 172.16.7.1
   vid_ip_addr: 172.16.8.1
   clamp_ip_addr: 172.16.12.1
-  openo_ip_addr: 172.16.14.1
+  multiserv_ip_addr: 172.16.14.1
   music_ip_addr: 172.16.15.1
   oof_ip_addr: 172.16.16.1
   aaf_ip_addr: 172.16.13.1
index 3cf5474..9203844 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-sed -i '/#!\/bin\/bash/a\
+sed -i '/^            #!\/bin\/bash/a\
             mkdir -p /etc/docker\
             cat > /etc/docker/daemon.json <<EOF\
             {\
index 6f5b960..feded7f 100644 (file)
@@ -85,7 +85,7 @@ parameters:
   sdnc_ip_addr: 10.0.7.1
   vid_ip_addr: 10.0.8.1
   clamp_ip_addr: 10.0.12.1
-  openo_ip_addr: 10.0.14.1
+  multiserv_ip_addr: 10.0.14.1
   music_ip_addr: 10.0.15.1
   oof_ip_addr: 10.0.16.1
   aaf_ip_addr: 10.0.13.1
index 365b5d0..13c8221 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-sed -i '/#!\/bin\/bash/a\
+sed -i '/^            #!\/bin\/bash/a\
             mkdir -p /etc/docker\
             cat > /etc/docker/daemon.json <<EOF\
             {\
index 1e333cc..b18bd62 100644 (file)
@@ -84,7 +84,7 @@ parameters:
   sdnc_ip_addr: 10.0.7.1
   vid_ip_addr: 10.0.8.1
   clamp_ip_addr: 10.0.12.1
-  openo_ip_addr: 10.0.14.1
+  multiserv_ip_addr: 10.0.14.1
   music_ip_addr: 10.0.15.1
   oof_ip_addr: 10.0.16.1
   aaf_ip_addr: 10.0.13.1
index 182e398..2fd0556 100755 (executable)
@@ -28,6 +28,7 @@ fi
 SENTINEL='Docker versions and branches'
 
 mkdir -p ${LAB_DIR}/target
+rsync -avt $DEMO_DIR/heat/ONAP/ ${LAB_DIR}/target/
 YAML_FILE=${LAB_DIR}/target/onap_openstack.yaml
 ENV_FILE=${LAB_DIR}/target/onap_openstack.env
 YAML_SRC=${DEMO_DIR}/heat/ONAP/onap_openstack.yaml
@@ -61,10 +62,10 @@ fi
 
 
 # tear down old deployment
-$WORKSPACE/test/ete/scripts/teardown-onap.sh
+$WORKSPACE/test/ete/scripts/teardown-onap.sh -q
 
 # create new stack
-STACK="ete-$(uuidgen | cut -c-8)"
+STACK="onap-heat-$(uuidgen | cut -c-4)"
 echo "New Stack Name: ${STACK}"
 if ! openstack stack create -t ${YAML_FILE} -e ${ENV_FILE} $STACK; then
     exit 1
index 9080e20..61e643b 100755 (executable)
 #!/bin/bash -x
 
+full_deletion=false
+
+usage() { echo "Usage: $0 [-n <string>] [-r]" 1>&2; exit 1; }
+
+while getopts ":rqn:" o; do
+    case "${o}" in
+
+        r)
+            echo "The following command will delete all information relating to onap within your enviroment"
+            read -p "Are you certain this is what you want? (type y to confirm):" answer
+
+            if [ $answer = "y" ] || [ $answer = "Y" ] || [ $answer = "yes" ] || [ $answer = "Yes"]; then
+                echo "This may delete the work of other colleages within the same enviroment"
+                read -p "Are you certain this is what you want? (type y to confirm):" answer2
+                
+                if [ $answer2 = "y" ] || [ $answer2 = "Y" ] || [ $answer2 = "yes" ] || [ $answer2 = "Yes"]; then
+                    full_deletion=true
+                else 
+                    echo "Ending program"
+                    exit 1
+                fi
+            else 
+                echo "Ending program"
+                exit 1
+            fi
+            ;;
+        q)
+            full_deletion=true
+            ;;
+        n)
+            install_name=${OPTARG}
+            ;;
+
+        *)
+            usage
+            ;;
+    esac
+done
+shift $((OPTIND-1))
+
 if [ -z "$WORKSPACE" ]; then
     export WORKSPACE=`git rev-parse --show-toplevel`
 fi
 
 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
 
-# delete all instances
-openstack server delete $(openstack server list -c ID -f value)
-sleep 1
-
-# miscellaneous cleanup
-openstack floating ip delete $(openstack floating ip list -c ID -f value)
-sleep 1
-
-ROUTERS=$(openstack router list -c ID -f value)
-echo $ROUTERS
-for ROUTER in $ROUTERS; do
-    echo $ROUTER;
-    PORTS=$(openstack router show $ROUTER  -c "interfaces_info" -f "value" | jq -r '.[].port_id')
-    for PORT in $PORTS; do
-        openstack router remove port $ROUTER $PORT
+if [ "$full_deletion" = true ];then 
+    echo "Commencing delete, press CRTL-C to stop"
+    sleep 10
+
+    # delete all instances
+    openstack server delete $(openstack server list -c ID -f value)
+    sleep 1
+
+    # miscellaneous cleanup
+    openstack floating ip delete $(openstack floating ip list -c ID -f value)
+    sleep 1
+
+    ROUTERS=$(openstack router list -c ID -f value)
+    echo $ROUTERS
+    for ROUTER in $ROUTERS; do
+        echo $ROUTER;
+        PORTS=$(openstack router show $ROUTER  -c "interfaces_info" -f "value" | jq -r '.[].port_id')
+        for PORT in $PORTS; do
+            openstack router remove port $ROUTER $PORT
+        done
+        openstack router delete $ROUTER
     done
-    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)
+    openstack volume delete $(openstack volume list -f value -c ID)
+
+    # delete all except "default" security group
+    SECURITY_GROUPS=$(openstack security group list -c ID -f value | grep -v default)
+    openstack security group delete $SECURITY_GROUPS
+    sleep 1
 
-# delete all except "default" security group
-SECURITY_GROUPS=$(openstack security group list -c ID -f value | grep -v default)
-openstack security group delete $SECURITY_GROUPS
-sleep 1
 
+    # Delete all existing stacks
+    STACKS=$(openstack stack list -c "Stack Name" -f value)
 
-# Delete all existing stacks
-STACKS=$(openstack stack list -c "Stack Name" -f value)
+    if [ ! -z "${STACKS}" ]; then
+        openstack stack delete -y $STACKS
+        for STACK in ${STACKS}; do
+            until [ "DELETE_IN_PROGRESS" != "$(openstack stack show -c stack_status -f value $STACK)" ]; do
+                sleep 2
+            done
+        done
+    else
+        echo "No existing stacks to delete."
+    fi
+
+else 
+    #Restrained teardown 
+    echo "Restrained teardown"
+    
+    STACK=$install_name
 
-if [ ! -z "${STACKS}" ]; then
-    openstack stack delete -y $STACKS
-    for STACK in ${STACKS}; do
+    if [ ! -z "${STACK}" ]; then
+        openstack stack delete $STACK
+        
         until [ "DELETE_IN_PROGRESS" != "$(openstack stack show -c stack_status -f value $STACK)" ]; do
-            sleep 2
+        sleep 2
         done
-    done
-else
-    echo "No existing stacks to delete."
-fi
+    else
+        echo "No existing stack with the name $install_name."
+    fi
+fi
\ No newline at end of file
index 5b9871a..d53a075 100644 (file)
@@ -1,2 +1,45 @@
-# pnf-simulator
-Generate VES event related to PNF integration.
+# PNF Simulator
+Simulator that generates VES events related to PNF PNP integration.
+
+##Downloading simulator
+Official version of simulator can be downloaded for public ONAP docker registry as image.
+*docker login -u anonymous -p anonymous nexus3.onap.org:10003*
+
+Another option is to checkout PNF Simulator project from ONAP Git repository.
+
+##Usage of simulator
+
+###Configuration
+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. 
+
+###Running simulator   
+The recommended way is to checkout PNF Simulator project from ONAP Git repository and use *simulator*.sh script
+If you copy *simulator.sh* script to another location, keep in mind to copy also *docker-compose.yml* and directories: *config,json_schema and netconf*.
+In order to run simulator, invoke ./simulator.sh start
+Script downloads if necessary needed Docker images and runs instances of these images.
+
+###Logging
+It is possible to get access to logs by invocation of *./simulator.sh* logs. 
+The content of the logs is related to the last simulator run. 
+Every start of simulator will generate new logs. 
+
+###SFTP support
+PNF Simulator allows to serve files via SFTP server. SFTP server has predefined user sftp-user. 
+Connection to SFTP server is being done with usage of SSH keys. Private key is stored in *ssh* directory.
+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*
+
+###Developer mode
+For development of PNF Simulator, run *simulator.sh* start-dev in order to run Netopeer.
+After that it is possible to run PNF Simulator from IDE.
+
+
+
+
+
+
+
index b7eb1cc..2a67be5 100644 (file)
@@ -1,23 +1,24 @@
+
 {
   "simulatorParams": {
-    "vesServerUrl": "http://10.154.187.70:8080/eventListener/v5",
+    "vesServerUrl": "http://VES-HOST:VES-PORT/eventListener/v7",
     "testDuration": "10",
     "messageInterval": "1"
   },
   "messageParams": {
-    "pnfSerialNumber": "val1",
-    "pnfVendorName": "val2",
-    "pnfOamIpv4Address": "val3",
-    "pnfOamIpv6Address": "val4",
-    "pnfFamily": "val5",
-    "pnfModelNumber": "val6",
-    "pnfSoftwareVersion": "val7",
-    "pnfType": "val8",
-    "eventName": "val9",
-    "nfNamingCode": "val10",
-    "nfcNamingCode": "val11",
-    "sourceName": "val12",
+    "pnf_serialNumber": "6061ZW3",
+    "pnf_vendorName": "Nokia",
+    "pnf_oamV4IpAddress": "val3",
+    "pnf_oamV6IpAddress": "val4",
+    "pnf_unitFamily": "BBU",
+    "pnf_modelNumber": "val6",
+    "pnf_softwareVersion": "val7",
+    "pnf_unitType": "val8",
+    "eventName": "pnfRegistration_Nokia_5gDu",
+    "nfNamingCode": "gNB",
+    "nfcNamingCode": "oam",
+    "sourceName": "NOK6061ZW3",
     "sourceId": "val13",
-    "reportingEntityName": "val14"
+    "reportingEntityName": "NOK6061ZW3"
   }
 }
diff --git a/test/mocks/pnfsimulator/deployment/PnP_PNF_sim_heat_template.yml b/test/mocks/pnfsimulator/deployment/PnP_PNF_sim_heat_template.yml
new file mode 100644 (file)
index 0000000..d9acc9e
--- /dev/null
@@ -0,0 +1,129 @@
+description: Heat template that deploys PnP PNF simulator
+heat_template_version: '2013-05-23'
+parameters:
+  flavor_name: {description: Type of instance (flavor) to be used, label: Flavor,
+    type: string}
+  image_name: {description: Image to be used for compute instance, label: Image name
+      or ID, type: string}
+  key_name: {description: Public/Private key pair name, label: Key pair name, type: string}
+  public_net_id: {description: Public network that enables remote connection to VNF,
+    label: Public network name or ID, type: string}
+  private_net_id: {type: string, description: Private network id, label: Private network name or ID}
+  private_subnet_id: {type: string, description: Private subnet id, label: Private subnetwork name or ID}
+  proxy: {type: string, description: Proxy, label: Proxy, default: ""}
+resources:
+  PNF_PnP_simualtor:
+    type: OS::Nova::Server
+    properties:
+      key_name: { get_param: key_name }
+      image: { get_param: image_name }
+      flavor: { get_param: flavor_name }
+      networks:
+      - port: { get_resource: PNF_PnP_simualtor_port0 }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          template: |
+            #!/bin/bash
+
+            set_versions () {
+                    DOCKER_COMPOSE_VERSION=1.22.0
+            }
+
+
+            enable_root_ssh () {
+                sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+                sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+                service sshd restart
+                echo -e "arthur\narthur" | passwd root
+            }
+
+            update_os () {
+                dnf -y install fedora-upgrade
+            }
+
+            docker_install_configure () {
+                dnf -y remove docker \
+                              docker-client \
+                              docker-client-latest \
+                              docker-common \
+                              docker-latest \
+                              docker-latest-logrotate \
+                              docker-logrotate \
+                              docker-selinux \
+                              docker-engine-selinux \
+                              docker-engine
+                dnf -y install dnf-plugins-core
+                dnf config-manager \
+                 --add-repo \
+                https://download.docker.com/linux/fedora/docker-ce.repo
+                dnf -y install docker-ce
+                systemctl start docker
+                mkdir -p /etc/systemd/system/docker.service.d/
+                cat > /etc/systemd/system/docker.service.d/override.conf<< EOF
+            [Service]
+            Environment="HTTP_PROXY=$proxy"
+            Environment="HTTPS_PROXY=$proxy"
+            EOF
+                systemctl daemon-reload
+                systemctl restart docker
+                docker login -u docker -p docker nexus3.onap.org:10003
+            }
+            docker_compose_install () {
+                curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
+                chmod +x /usr/local/bin/docker-compose
+            }
+            pnf_sim_file_checkout () {
+                mkdir ~/sim/
+                mkdir ~/sim/ssh
+                cd ~/sim/ssh/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/ssh/ssh_host_rsa_key;hb=HEAD" -O ssh_host_rsa_key
+                cd ~/sim/ssh/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/ssh/ssh_host_rsa_key.pub;hb=HEAD" -O ssh_host_rsa_key.pub
+                mkdir ~/sim/sftp
+                cd ~/sim/sftp/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/sftp/sftp-file.txt;hb=HEAD" -O sftp-file.txt
+                mkdir ~/sim/config
+                cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/config.json;hb=HEAD" -O config.json
+                cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/netconf.env;hb=HEAD" -O netconf.env
+                mkdir ~/sim/json_schema
+                cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/input_validator.json;hb=HEAD" -O input_validator.json
+                cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/output_validator_ves_schema_30.0.1.json;hb=HEAD" -O output_validator_ves_schema_30.0.1.json
+                mkdir ~/sim/netconf
+                cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.data.xml;hb=HEAD" -O pnf-simulator.data.xml
+                cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.yang;hb=HEAD" -O pnf-simulator.yang
+                cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/docker-compose.yml;hb=HEAD" -O docker-compose.yml
+                cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/simulator.sh;hb=HEAD" -O simulator.sh
+                chmod 654 ~/sim/simulator.sh
+            }
+
+            start_simulator (){
+               ~/sim/simulator.sh start
+            }
+
+            set_versions
+            enable_root_ssh
+            update_os
+            docker_install_configure
+            docker_compose_install
+            pnf_sim_file_checkout
+            start_simulator
+          params:
+            $proxy: { get_param: proxy }
+  PNF_PnP_simualtor_port0:
+    type: OS::Neutron::Port
+    properties:
+      network_id: { get_param: private_net_id }
+      security_groups:
+        - default
+      fixed_ips:
+        - subnet_id: { get_param: private_subnet_id }
+  PNF_PnP_simualtor_public:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: PNF_PnP_simualtor_port0 }
+outputs:
+  PNF_PnP_simualtor_private_ip:
+    description: IP address of PNF_PnP_simualtor in private network
+    value: { get_attr: [ PNF_PnP_simualtor, first_address ] }
+  PNF_PnP_simualtor_public_ip:
+    description: Floating IP address of PNF_PnP_simualtor in public network
+    value: { get_attr: [ PNF_PnP_simualtor_public, floating_ip_address ] }
diff --git a/test/mocks/pnfsimulator/docker-compose.dev.yml b/test/mocks/pnfsimulator/docker-compose.dev.yml
deleted file mode 100644 (file)
index c389eee..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-version: '3'
-
-services:
-  pnf-simulator:
-    container_name: pnf-simulator
-    image: pnf-simulator:latest
-    ports:
-      - "5000:5000"
-    volumes:
-      - ./logs:/var/log
-    env_file:
-      - ./config/netconf.env
-    depends_on:
-      - netopeer
-
-  netopeer:
-    container_name: netopeer
-    image: sysrepo/sysrepo-netopeer2:latest
-    ports:
-      - "830:830"
-    env_file:
-      - ./config/netconf.env
-    volumes:
-      - ./netconf:/netconf
index af9494a..5f73cde 100644 (file)
@@ -8,8 +8,10 @@ services:
       - "5000:5000"
     volumes:
       - ./logs:/var/log
+      - ./json_schema:/json_schema
     env_file:
       - ./config/netconf.env
+    restart: on-failure
     depends_on:
       - netopeer
 
@@ -18,7 +20,21 @@ services:
     image: sysrepo/sysrepo-netopeer2:latest
     ports:
       - "830:830"
+    volumes:
+      - ./netconf:/netconf
     env_file:
       - ./config/netconf.env
+    restart: on-failure
+    depends_on:
+      - sftp-server
+
+  sftp-server:
+    container_name: sftp-server
+    image: atmoz/sftp:alpine
+    ports:
+      - "2222:22"
     volumes:
-      - ./netconf:/netconf
+      - ./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
diff --git a/test/mocks/pnfsimulator/json_schema/input_validator.json b/test/mocks/pnfsimulator/json_schema/input_validator.json
new file mode 100644 (file)
index 0000000..195f4bf
--- /dev/null
@@ -0,0 +1,193 @@
+{
+  "$id": "http://example.com/example.json",
+  "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"
+          ]
+        },
+        "testDuration": {
+          "$id": "/properties/simulatorParams/properties/testDuration",
+          "type": "string",
+          "title": "The Testduration Schema ",
+          "default": "",
+          "examples": [
+            "10"
+          ]
+        },
+        "messageInterval": {
+          "$id": "/properties/simulatorParams/properties/messageInterval",
+          "type": "string",
+          "title": "The Messageinterval Schema ",
+          "default": "",
+          "examples": [
+            "1"
+          ]
+        }
+      }
+    },
+    "messageParams": {
+      "$id": "/properties/messageParams",
+      "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"
+          ]
+        },
+        "nfNamingCode": {
+          "$id": "/properties/messageParams/properties/nfNamingCode",
+          "type": "string",
+          "title": "The Nfnamingcode Schema ",
+          "default": "",
+          "examples": [
+            "gNB"
+          ]
+        },
+        "nfcNamingCode": {
+          "$id": "/properties/messageParams/properties/nfcNamingCode",
+          "type": "string",
+          "title": "The Nfcnamingcode Schema ",
+          "default": "",
+          "examples": [
+            "oam"
+          ]
+        },
+        "sourceName": {
+          "$id": "/properties/messageParams/properties/sourceName",
+          "type": "string",
+          "title": "The Sourcename Schema ",
+          "default": "",
+          "examples": [
+            "NOK6061ZW3"
+          ]
+        },
+        "sourceId": {
+          "$id": "/properties/messageParams/properties/sourceId",
+          "type": "string",
+          "title": "The Sourceid Schema ",
+          "default": "",
+          "examples": [
+            "val13"
+          ]
+        },
+        "reportingEntityName": {
+          "$id": "/properties/messageParams/properties/reportingEntityName",
+          "type": "string",
+          "title": "The Reportingentityname Schema ",
+          "default": "",
+          "examples": [
+            "NOK6061ZW3"
+          ]
+        }
+      },
+      "required": [
+        "pnf_serialNumber",
+        "pnf_vendorName"
+      ],
+      "anyOf": [
+        {
+          "required": [
+            "pnf_oamV4IpAddress"
+          ]
+        },
+        {
+          "required": [
+            "pnf_oamV6IpAddress"
+          ]
+        }
+      ]
+    }
+  },
+  "required": [
+    "simulatorParams",
+    "messageParams"
+  ]
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/json_schema/output_validator_ves_schema_30.0.1.json b/test/mocks/pnfsimulator/json_schema/output_validator_ves_schema_30.0.1.json
new file mode 100644 (file)
index 0000000..385ba25
--- /dev/null
@@ -0,0 +1,2432 @@
+{
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title": "VES Event Listener Common Event Format",
+    "type": "object",
+    "properties": {
+        "event": {"$ref": "#/definitions/event"},
+        "eventList": {"$ref": "#/definitions/eventList"}
+    },
+    
+    "definitions": {
+        "schemaHeaderBlock": {
+            "description": "schema date, version, author and associated API",
+            "type": "object",
+            "properties": {
+                "associatedApi": {
+                    "description": "VES Event Listener",
+                    "type": "string"
+                },
+                "lastUpdatedBy": {
+                    "description": "re2947",
+                    "type": "string"
+                },
+                "schemaDate": {
+                    "description": "July 31, 2018",
+                    "type": "string"
+                },
+                "schemaVersion": {
+                    "description": "30.0.1",
+                    "type": "number"
+                }
+            }
+        },
+        "schemaLicenseAndCopyrightNotice": {
+            "description": "Copyright (c) 2018, AT&T Intellectual Property.  All rights reserved",
+            "type": "object",
+            "properties": {
+                "apacheLicense2.0": {
+                    "description": "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:",
+                    "type": "string"
+                },
+                "licenseUrl": {
+                    "description": "http://www.apache.org/licenses/LICENSE-2.0",
+                    "type": "string"
+                },
+                "asIsClause": {
+                    "description": "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.",
+                    "type": "string"
+                },
+                "permissionsAndLimitations": {
+                    "description": "See the License for the specific language governing permissions and limitations under the License.",
+                    "type": "string"
+                }
+            }
+        },
+        "arrayOfJsonObject": {
+            "description": "array of json objects described by name, schema and other meta-information",
+            "type": "array",
+            "items": {
+                "$ref": "#/definitions/jsonObject"
+            }
+        },
+        "arrayOfNamedHashMap": {
+            "description": "array of named hashMaps",
+            "type": "array",
+            "items": {
+                "$ref": "#/definitions/namedHashMap"
+            }
+        },
+        "codecsInUse": {
+            "description": "number of times an identified codec was used over the measurementInterval",
+            "type": "object",
+            "properties": {
+                "codecIdentifier": { "type": "string" },
+                "numberInUse": { "type": "integer" }
+            },
+            "additionalProperties": false,
+            "required": [ "codecIdentifier", "numberInUse" ]
+        },
+        "commonEventHeader": {
+            "description": "fields common to all events",
+            "type": "object",
+            "properties": {
+                "domain": {
+                    "description": "the eventing domain associated with the event",
+                    "type": "string",
+                    "enum": [
+                        "fault",
+                        "heartbeat",
+                        "measurement",
+                        "mobileFlow",
+                        "notification",
+                        "other",
+                        "pnfRegistration",
+                        "sipSignaling",
+                        "stateChange",
+                        "syslog",
+                        "thresholdCrossingAlert",
+                        "voiceQuality"
+                    ]
+                },
+                "eventId": {
+                    "description": "event key that is unique to the event source",
+                    "type": "string"
+                },
+                "eventName": {
+                    "description": "unique event name",
+                    "type": "string"
+                },
+                "eventType": {
+                    "description": "for example - applicationNf, guestOS, hostOS, platform",
+                    "type": "string"
+                },
+                "internalHeaderFields": { "$ref": "#/definitions/internalHeaderFields" },
+                "lastEpochMicrosec": {
+                    "description": "the latest unix time aka epoch time associated with the event from any component--as microseconds elapsed since 1 Jan 1970 not including leap seconds",
+                    "type": "number"
+                },
+                "nfcNamingCode": {
+                    "description": "3 character network function component type, aligned with vfc naming standards",
+                    "type": "string"
+                },
+                "nfNamingCode": {
+                    "description": "4 character network function type, aligned with nf naming standards",
+                    "type": "string"
+                },
+                "nfVendorName": {
+                    "description": "network function vendor name",
+                    "type": "string"
+                },
+                "priority": {
+                    "description": "processing priority",
+                    "type": "string",
+                    "enum": [
+                        "High",
+                        "Medium",
+                        "Normal",
+                        "Low"
+                    ]
+                },
+                "reportingEntityId": {
+                    "description": "UUID identifying the entity reporting the event, for example an OAM VM; must be populated by the ATT enrichment process",
+                    "type": "string"
+                },
+                "reportingEntityName": {
+                    "description": "name of the entity reporting the event, for example, an EMS name; may be the same as sourceName",
+                    "type": "string"
+                },
+                "sequence": {
+                    "description": "ordering of events communicated by an event source instance or 0 if not needed",
+                    "type": "integer"
+                },
+                "sourceId": {
+                    "description": "UUID identifying the entity experiencing the event issue; must be populated by the ATT enrichment process",
+                    "type": "string"
+                },
+                "sourceName": {
+                    "description": "name of the entity experiencing the event issue",
+                    "type": "string"
+                },
+                "startEpochMicrosec": {
+                    "description": "the earliest unix time aka epoch time associated with the event from any component--as microseconds elapsed since 1 Jan 1970 not including leap seconds",
+                    "type": "number"
+                },
+                "timeZoneOffset": {
+                    "description": "UTC offset for the local time zone of the device as UTC+/-hh.mm",
+                    "type": "string"
+                },
+                "version": {
+                    "description": "version of the event header",
+                    "type": "string",
+                    "enum": [ "4.0.1" ]
+                },
+                "vesEventListenerVersion": {
+                    "description": "version of the VES Event Listener API",
+                    "type": "string",
+                    "enum": [ "7.0.1" ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "domain", "eventId", "eventName", "lastEpochMicrosec", 
+                          "priority", "reportingEntityName", "sequence", "sourceName",
+                          "startEpochMicrosec", "version", "vesEventListenerVersion" ]
+        },
+        "counter": {
+            "description": "performance counter",
+            "type": "object",
+            "properties": {
+                "criticality": { "type": "string", "enum": [ "CRIT", "MAJ" ] },
+                "hashMap": { "$ref": "#/definitions/hashMap" },
+                "thresholdCrossed": { "type": "string" }
+            },
+            "additionalProperties": false,
+            "required": [ "criticality", "hashMap", "thresholdCrossed" ]
+        },
+        "cpuUsage": {
+            "description": "usage of an identified CPU",
+            "type": "object",
+            "properties": {
+                "cpuCapacityContention": { 
+                    "description": "the amount of time the CPU cannot run due to contention, in milliseconds over the measurementInterval",
+                    "type": "number" 
+                },
+                "cpuDemandAvg": { 
+                    "description": "the total CPU time that the NF/NFC/VM could use if there was no contention, in milliseconds over the measurementInterval",
+                    "type": "number" 
+                },
+                "cpuDemandMhz": { 
+                    "description": "CPU demand in megahertz",
+                    "type": "number" 
+                },
+                "cpuDemandPct": { 
+                    "description": "CPU demand as a percentage of the provisioned capacity",
+                    "type": "number" 
+                },
+                "cpuIdentifier": { 
+                    "description": "cpu identifer",
+                    "type": "string" 
+                },
+                "cpuIdle": { 
+                    "description": "percentage of CPU time spent in the idle task",
+                    "type": "number" 
+                },
+                "cpuLatencyAvg": { 
+                    "description": "percentage of time the VM is unable to run because it is contending for access to the physical CPUs",
+                    "type": "number" 
+                },
+                "cpuOverheadAvg": { 
+                    "description": "the overhead demand above available allocations and reservations, in milliseconds over the measurementInterval",
+                    "type": "number" 
+                },
+                "cpuSwapWaitTime": { 
+                    "description": "swap wait time. in milliseconds over the measurementInterval",
+                    "type": "number" 
+                },
+                "cpuUsageInterrupt": { 
+                    "description": "percentage of time spent servicing interrupts",
+                    "type": "number" 
+                },
+                "cpuUsageNice": { 
+                    "description": "percentage of time spent running user space processes that have been niced",
+                    "type": "number" 
+                },
+                "cpuUsageSoftIrq": { 
+                    "description": "percentage of time spent handling soft irq interrupts",
+                    "type": "number" 
+                },
+                "cpuUsageSteal": { 
+                    "description": "percentage of time spent in involuntary wait which is neither user, system or idle time and is effectively time that went missing",
+                    "type": "number" 
+                },
+                "cpuUsageSystem": { 
+                    "description": "percentage of time spent on system tasks running the kernel",
+                    "type": "number" 
+                },
+                "cpuUsageUser": { 
+                    "description": "percentage of time spent running un-niced user space processes",
+                    "type": "number" 
+                },
+                "cpuWait": { 
+                    "description": "percentage of CPU time spent waiting for I/O operations to complete",
+                    "type": "number" 
+                },
+                "percentUsage": { 
+                    "description": "aggregate cpu usage of the virtual machine on which the xNFC reporting the event is running",
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "cpuIdentifier", "percentUsage" ]
+        },
+        "diskUsage": {
+            "description": "usage of an identified disk",
+            "type": "object",
+            "properties": {
+                "diskBusResets": {
+                    "description": "number of bus resets over the measurementInterval",
+                    "type": "number"
+                },
+                "diskCommandsAborted": {
+                    "description": "number of disk commands aborted over the measurementInterval",
+                    "type": "number"
+                },
+                "diskCommandsAvg": {
+                    "description": "average number of commands per second over the measurementInterval",
+                    "type": "number"
+                },
+                "diskFlushRequests": {
+                    "description": "total flush requests of the disk cache over the measurementInterval",
+                    "type": "number"
+                },
+                "diskFlushTime": {
+                    "description": "milliseconds spent on disk cache flushing over the measurementInterval",
+                    "type": "number"
+                },
+                "diskIdentifier": { 
+                    "description": "disk identifier", 
+                    "type": "string" 
+                },
+                "diskIoTimeAvg": {
+                    "description": "milliseconds spent doing input/output operations over 1 sec; treat this metric as a device load percentage where 1000ms  matches 100% load; provide the average over the measurement interval",
+                    "type": "number"
+                },
+                "diskIoTimeLast": {
+                    "description": "milliseconds spent doing input/output operations over 1 sec; treat this metric as a device load percentage where 1000ms  matches 100% load; provide the last value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskIoTimeMax": {
+                    "description": "milliseconds spent doing input/output operations over 1 sec; treat this metric as a device load percentage where 1000ms  matches 100% load; provide the maximum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskIoTimeMin": {
+                    "description": "milliseconds spent doing input/output operations over 1 sec; treat this metric as a device load percentage where 1000ms  matches 100% load; provide the minimum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedReadAvg": {
+                    "description": "number of logical read operations that were merged into physical read operations, e.g., two logical reads were served by one physical disk access; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedReadLast": {
+                    "description": "number of logical read operations that were merged into physical read operations, e.g., two logical reads were served by one physical disk access; provide the last value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedReadMax": {
+                    "description": "number of logical read operations that were merged into physical read operations, e.g., two logical reads were served by one physical disk access; provide the maximum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedReadMin": {
+                    "description": "number of logical read operations that were merged into physical read operations, e.g., two logical reads were served by one physical disk access; provide the minimum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedWriteAvg": {
+                    "description": "number of logical write operations that were merged into physical write operations, e.g., two logical writes were served by one physical disk access; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedWriteLast": {
+                    "description": "number of logical write operations that were merged into physical write operations, e.g., two logical writes were served by one physical disk access; provide the last value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedWriteMax": {
+                    "description": "number of logical write operations that were merged into physical write operations, e.g., two logical writes were served by one physical disk access; provide the maximum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskMergedWriteMin": {
+                    "description": "number of logical write operations that were merged into physical write operations, e.g., two logical writes were served by one physical disk access; provide the minimum value measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsReadAvg": {
+                    "description": "number of octets per second read from a disk or partition; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsReadLast": {
+                    "description": "number of octets per second read from a disk or partition; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsReadMax": {
+                    "description": "number of octets per second read from a disk or partition; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsReadMin": {
+                    "description": "number of octets per second read from a disk or partition; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsWriteAvg": {
+                    "description": "number of octets per second written to a disk or partition; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsWriteLast": {
+                    "description": "number of octets per second written to a disk or partition; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsWriteMax": {
+                    "description": "number of octets per second written to a disk or partition; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOctetsWriteMin": {
+                    "description": "number of octets per second written to a disk or partition; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsReadAvg": {
+                    "description": "number of read operations per second issued to the disk; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsReadLast": {
+                    "description": "number of read operations per second issued to the disk; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsReadMax": {
+                    "description": "number of read operations per second issued to the disk; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsReadMin": {
+                    "description": "number of read operations per second issued to the disk; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsWriteAvg": {
+                    "description": "number of write operations per second issued to the disk; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsWriteLast": {
+                    "description": "number of write operations per second issued to the disk; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsWriteMax": {
+                    "description": "number of write operations per second issued to the disk; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskOpsWriteMin": {
+                    "description": "number of write operations per second issued to the disk; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskPendingOperationsAvg": {
+                    "description": "queue size of pending I/O operations per second; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskPendingOperationsLast": {
+                    "description": "queue size of pending I/O operations per second; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskPendingOperationsMax": {
+                    "description": "queue size of pending I/O operations per second; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskPendingOperationsMin": {
+                    "description": "queue size of pending I/O operations per second; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskReadCommandsAvg": {
+                    "description": "average number of read commands issued per second to the disk over the measurementInterval",
+                    "type": "number"
+                },
+                "diskTime": {
+                    "description": "nanoseconds spent on disk cache reads/writes within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeReadAvg": {
+                    "description": "milliseconds a read operation took to complete; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeReadLast": {
+                    "description": "milliseconds a read operation took to complete; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeReadMax": {
+                    "description": "milliseconds a read operation took to complete; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeReadMin": {
+                    "description": "milliseconds a read operation took to complete; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeWriteAvg": {
+                    "description": "milliseconds a write operation took to complete; provide the average measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeWriteLast": {
+                    "description": "milliseconds a write operation took to complete; provide the last measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeWriteMax": {
+                    "description": "milliseconds a write operation took to complete; provide the maximum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTimeWriteMin": {
+                    "description": "milliseconds a write operation took to complete; provide the minimum measurement within the measurement interval",
+                    "type": "number"
+                },
+                "diskTotalReadLatencyAvg": {
+                    "description": "average read time from the perspective of a Guest OS: sum of the Kernel Read Latency and Physical Device Read Latency in milliseconds over the measurement interval",
+                    "type": "number"
+                },
+                "diskTotalWriteLatencyAvg": {
+                    "description": "average write time from the perspective of a Guest OS: sum of the Kernel Write Latency and Physical Device Write Latency in milliseconds over the measurement interval",
+                    "type": "number"
+                },
+                "diskWeightedIoTimeAvg": {
+                    "description": "measure in ms over 1 sec of both I/O completion time and the backlog that may be accumulating; value is the average within the collection interval",
+                    "type": "number"
+                },
+                "diskWeightedIoTimeLast": {
+                    "description": "measure in ms over 1 sec of both I/O completion time and the backlog that may be accumulating; value is the last within the collection interval",
+                    "type": "number"
+                },
+                "diskWeightedIoTimeMax": {
+                    "description": "measure in ms over 1 sec of both I/O completion time and the backlog that may be accumulating; value is the maximum within the collection interval",
+                    "type": "number"
+                },
+                "diskWeightedIoTimeMin": {
+                    "description": "measure in ms over 1 sec of both I/O completion time and the backlog that may be accumulating; value is the minimum within the collection interval",
+                    "type": "number"
+                },
+                "diskWriteCommandsAvg": {
+                    "description": "average number of write commands issued per second to the disk over the measurementInterval",
+                    "type": "number"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "diskIdentifier" ]
+        },
+        "endOfCallVqmSummaries": {
+            "description": "provides end of call voice quality metrics",
+            "type": "object",
+            "properties": {
+                "adjacencyName": {
+                    "description": " adjacency name",
+                    "type": "string"
+                },
+                "endpointAverageJitter": {
+                    "description": "endpoint average jitter",
+                    "type": "number"
+                },
+                "endpointDescription": {
+                    "description": "either Caller or Callee",
+                    "type": "string",
+                    "enum": ["Caller", "Callee"]
+                },
+                "endpointMaxJitter": {
+                    "description": "endpoint maximum jitter",
+                    "type": "number"
+                },
+                "endpointRtpOctetsDiscarded": {
+                    "description": "",
+                    "type": "number"
+                },
+                "endpointRtpOctetsLost": {
+                    "description": "endpoint RTP octets lost",
+                    "type": "number"
+                },
+                "endpointRtpOctetsReceived": {
+                    "description": "",
+                    "type": "number"
+                },
+                "endpointRtpOctetsSent": {
+                    "description": "",
+                    "type": "number"
+                },
+                "endpointRtpPacketsDiscarded": {
+                    "description": "",
+                    "type": "number"
+                },
+                "endpointRtpPacketsLost": {
+                    "description": "endpoint RTP packets lost",
+                    "type": "number"
+                },
+                "endpointRtpPacketsReceived": {
+                    "description": "",
+                    "type": "number"
+                },
+                "endpointRtpPacketsSent": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localAverageJitter": {
+                    "description": "Local average jitter",
+                    "type": "number"
+                },
+                "localAverageJitterBufferDelay": {
+                    "description": "Local average jitter delay",
+                    "type": "number"
+                },
+                "localMaxJitter": {
+                    "description": "Local maximum jitter",
+                    "type": "number"
+                },
+                "localMaxJitterBufferDelay": {
+                    "description": "Local maximum jitter delay",
+                    "type": "number"
+                },
+                "localRtpOctetsDiscarded": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localRtpOctetsLost": {
+                    "description": "Local RTP octets lost",
+                    "type": "number"
+                },
+                "localRtpOctetsReceived": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localRtpOctetsSent": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localRtpPacketsDiscarded": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localRtpPacketsLost": {
+                    "description": "Local RTP packets lost",
+                    "type": "number"
+                },
+                "localRtpPacketsReceived": {
+                    "description": "",
+                    "type": "number"
+                },
+                "localRtpPacketsSent": {
+                    "description": "",
+                    "type": "number"
+                },
+                "mosCqe": {
+                    "description": "1-5 1dp",
+                    "type": "number"
+                },
+                "oneWayDelay": {
+                    "description": "one-way path delay in milliseconds",
+                    "type": "number"
+                },
+                "packetLossPercent": {
+                    "description" : "Calculated percentage packet loss based on Endpoint RTP packets lost (as reported in RTCP) and Local RTP packets sent. Direction is based on Endpoint description (Caller, Callee). Decimal (2 dp)",
+                    "type": "number"
+                },
+                "rFactor": {
+                    "description": "0-100",
+                    "type": "number"
+                },
+                "roundTripDelay": {
+                    "description": "millisecs",
+                    "type": "number"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "adjacencyName", "endpointDescription" ]
+        },
+        "event": {
+            "description": "the root level of the common event format",
+            "type": "object",
+            "properties": {
+                "commonEventHeader": { "$ref": "#/definitions/commonEventHeader" },
+                "faultFields": { "$ref": "#/definitions/faultFields" },
+                "heartbeatFields": { "$ref": "#/definitions/heartbeatFields" },
+                "measurementFields": { "$ref": "#/definitions/measurementFields" },
+                "mobileFlowFields": { "$ref": "#/definitions/mobileFlowFields" },
+                "notificationFields": { "$ref": "#/definitions/notificationFields" },
+                "otherFields": { "$ref": "#/definitions/otherFields" },
+                "pnfRegistrationFields": { "$ref": "#/definitions/pnfRegistrationFields" },
+                "sipSignalingFields": { "$ref": "#/definitions/sipSignalingFields" },
+                "stateChangeFields": { "$ref": "#/definitions/stateChangeFields" },
+                "syslogFields": { "$ref": "#/definitions/syslogFields" },
+                "thresholdCrossingAlertFields": { "$ref": "#/definitions/thresholdCrossingAlertFields" },
+                "voiceQualityFields": { "$ref": "#/definitions/voiceQualityFields" }
+            },
+            "additionalProperties": false,
+            "required": [ "commonEventHeader" ]
+        },
+        "eventList": {
+            "description": "array of events",
+            "type": "array",
+            "items": {
+                "$ref": "#/definitions/event"
+            }
+        },
+        "faultFields": {
+            "description": "fields specific to fault events",
+            "type": "object",
+            "properties": {
+                "alarmAdditionalInformation": { "$ref": "#/definitions/hashMap" },
+                "alarmCondition": {
+                    "description": "alarm condition reported by the device",
+                    "type": "string"
+                },
+                "alarmInterfaceA": {
+                    "description": "card, port, channel or interface name of the device generating the alarm",
+                    "type": "string"
+                },
+                "eventCategory": {
+                    "description": "Event category, for example: license, link, routing, security, signaling",
+                    "type": "string"
+                },
+                "eventSeverity": {
+                    "description": "event severity",
+                    "type": "string",
+                    "enum": [
+                        "CRITICAL",
+                        "MAJOR",
+                        "MINOR",
+                        "WARNING",
+                        "NORMAL"
+                    ]
+                },
+                "eventSourceType": {
+                    "description": "type of event source; examples: card, host, other, port, portThreshold, router, slotThreshold, switch, virtualMachine, virtualNetworkFunction",
+                    "type": "string"
+                },
+                "faultFieldsVersion": {
+                    "description": "version of the faultFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                },
+                "specificProblem": {
+                    "description": "short description of the alarm or problem",
+                    "type": "string"
+                },
+                "vfStatus": {
+                    "description": "virtual function status enumeration",
+                    "type": "string",
+                    "enum": [
+                        "Active",
+                        "Idle",
+                        "Preparing to terminate",
+                        "Ready to terminate",
+                        "Requesting termination"
+                    ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "alarmCondition", "eventSeverity", "eventSourceType",
+                          "faultFieldsVersion", "specificProblem", "vfStatus" ]
+        },
+        "filesystemUsage": {
+            "description": "disk usage of an identified virtual machine in gigabytes and/or gigabytes per second",
+            "type": "object",
+            "properties": {
+                "blockConfigured": { "type": "number" },
+                "blockIops": { "type": "number" },
+                "blockUsed": { "type": "number" },
+                "ephemeralConfigured": { "type": "number" },
+                "ephemeralIops": { "type": "number" },
+                "ephemeralUsed": { "type": "number" },
+                "filesystemName": { "type": "string" }
+            },
+            "additionalProperties": false,
+            "required": [ "blockConfigured", "blockIops", "blockUsed", "ephemeralConfigured",
+                          "ephemeralIops", "ephemeralUsed", "filesystemName" ]
+        },
+        "gtpPerFlowMetrics": {
+            "description": "Mobility GTP Protocol per flow metrics",
+            "type": "object",
+            "properties": {
+                "avgBitErrorRate": {
+                    "description": "average bit error rate",
+                    "type": "number"
+                },
+                "avgPacketDelayVariation": {
+                    "description": "Average packet delay variation or jitter in milliseconds for received packets: Average difference between the packet timestamp and time received for all pairs of consecutive packets",
+                    "type": "number"
+                },
+                "avgPacketLatency": {
+                    "description": "average delivery latency",
+                    "type": "number"
+                },
+                "avgReceiveThroughput": {
+                    "description": "average receive throughput",
+                    "type": "number"
+                },
+                "avgTransmitThroughput": {
+                    "description": "average transmit throughput",
+                    "type": "number"
+                },
+                "durConnectionFailedStatus": {
+                    "description": "duration of failed state in milliseconds, computed as the cumulative time between a failed echo request and the next following successful error request, over this reporting interval",
+                    "type": "number"
+                },
+                "durTunnelFailedStatus": {
+                    "description": "Duration of errored state, computed as the cumulative time between a tunnel error indicator and the next following non-errored indicator, over this reporting interval",
+                    "type": "number"
+                },
+                "flowActivatedBy": {
+                    "description": "Endpoint activating the flow",
+                    "type": "string"
+                },
+                "flowActivationEpoch": {
+                    "description": "Time the connection is activated in the flow (connection) being reported on, or transmission time of the first packet if activation time is not available",
+                    "type": "number"
+                },
+                "flowActivationMicrosec": {
+                    "description": "Integer microseconds for the start of the flow connection",
+                    "type": "number"
+                },
+                "flowActivationTime": {
+                    "description": "time the connection is activated in the flow being reported on, or transmission time of the first packet if activation time is not available; with RFC 2822 compliant format: Sat, 13 Mar 2010 11:29:05 -0800",
+                    "type": "string"
+                },
+                "flowDeactivatedBy": {
+                    "description": "Endpoint deactivating the flow",
+                    "type": "string"
+                },
+                "flowDeactivationEpoch": {
+                    "description": "Time for the start of the flow connection, in integer UTC epoch time aka UNIX time",
+                    "type": "number"
+                },
+                "flowDeactivationMicrosec": {
+                    "description": "Integer microseconds for the start of the flow connection",
+                    "type": "number"
+                },
+                "flowDeactivationTime": {
+                    "description": "Transmission time of the first packet in the flow connection being reported on; with RFC 2822 compliant format: Sat, 13 Mar 2010 11:29:05 -0800",
+                    "type": "string"
+                },
+                "flowStatus": {
+                    "description": "connection status at reporting time as a working / inactive / failed indicator value",
+                    "type": "string"
+                },
+                "gtpConnectionStatus": {
+                    "description": "Current connection state at reporting time",
+                    "type": "string"
+                },
+                "gtpTunnelStatus": {
+                    "description": "Current tunnel state  at reporting time",
+                    "type": "string"
+                },
+                "ipTosCountList": { "$ref": "#/definitions/hashMap" },
+                "ipTosList": {
+                    "description": "Array of unique IP Type-of-Service values observed in the flow where values range from '0' to '255'",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "largePacketRtt": {
+                    "description": "large packet round trip time",
+                    "type": "number"
+                },
+                "largePacketThreshold": {
+                    "description": "large packet threshold being applied",
+                    "type": "number"
+                },
+                "maxPacketDelayVariation": {
+                    "description": "Maximum packet delay variation or jitter in milliseconds for received packets: Maximum of the difference between the packet timestamp and time received for all pairs of consecutive packets",
+                    "type": "number"
+                },
+                "maxReceiveBitRate": {
+                    "description": "maximum receive bit rate",
+                    "type": "number"
+                },
+                "maxTransmitBitRate": {
+                    "description": "maximum transmit bit rate",
+                    "type": "number"
+                },
+                "mobileQciCosCountList": { "$ref": "#/definitions/hashMap" },
+                "mobileQciCosList": {
+                    "description": "Array of unique LTE QCI or UMTS class-of-service values observed in the flow",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "numActivationFailures": {
+                    "description": "Number of failed activation requests, as observed by the reporting node",
+                    "type": "number"
+                },
+                "numBitErrors": {
+                    "description": "number of errored bits",
+                    "type": "number"
+                },
+                "numBytesReceived": {
+                    "description": "number of bytes received, including retransmissions",
+                    "type": "number"
+                },
+                "numBytesTransmitted": {
+                    "description": "number of bytes transmitted, including retransmissions",
+                    "type": "number"
+                },
+                "numDroppedPackets": {
+                    "description": "number of received packets dropped due to errors per virtual interface",
+                    "type": "number"
+                },
+                "numGtpEchoFailures": {
+                    "description": "Number of Echo request path failures where failed paths are defined in 3GPP TS 29.281 sec 7.2.1 and 3GPP TS 29.060 sec. 11.2",
+                    "type": "number"
+                },
+                "numGtpTunnelErrors": {
+                    "description": "Number of tunnel error indications where errors are defined in 3GPP TS 29.281 sec 7.3.1 and 3GPP TS 29.060 sec. 11.1",
+                    "type": "number"
+                },
+                "numHttpErrors": {
+                    "description": "Http error count",
+                    "type": "number"
+                },
+                "numL7BytesReceived": {
+                    "description": "number of tunneled layer 7 bytes received, including retransmissions",
+                    "type": "number"
+                },
+                "numL7BytesTransmitted": {
+                    "description": "number of tunneled layer 7 bytes transmitted, excluding retransmissions",
+                    "type": "number"
+                },
+                "numLostPackets": {
+                    "description": "number of lost packets",
+                    "type": "number"
+                },
+                "numOutOfOrderPackets": {
+                    "description": "number of out-of-order packets",
+                    "type": "number"
+                },
+                "numPacketErrors": {
+                    "description": "number of errored packets",
+                    "type": "number"
+                },
+                "numPacketsReceivedExclRetrans": {
+                    "description": "number of packets received, excluding retransmission",
+                    "type": "number"
+                },
+                "numPacketsReceivedInclRetrans": {
+                    "description": "number of packets received, including retransmission",
+                    "type": "number"
+                },
+                "numPacketsTransmittedInclRetrans": {
+                    "description": "number of packets transmitted, including retransmissions",
+                    "type": "number"
+                },
+                "numRetries": {
+                    "description": "number of packet retries",
+                    "type": "number"
+                },
+                "numTimeouts": {
+                    "description": "number of packet timeouts",
+                    "type": "number"
+                },
+                "numTunneledL7BytesReceived": {
+                    "description": "number of tunneled layer 7 bytes received, excluding retransmissions",
+                    "type": "number"
+                },
+                "roundTripTime": {
+                    "description": "round trip time",
+                    "type": "number"
+                },
+                "tcpFlagCountList": { "$ref": "#/definitions/hashMap" },
+                "tcpFlagList": {
+                    "description": "Array of unique TCP Flags observed in the flow",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "timeToFirstByte": {
+                    "description": "Time in milliseconds between the connection activation and first byte received",
+                    "type": "number"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "avgBitErrorRate", "avgPacketDelayVariation", "avgPacketLatency",
+                          "avgReceiveThroughput", "avgTransmitThroughput",
+                          "flowActivationEpoch", "flowActivationMicrosec",
+                          "flowDeactivationEpoch", "flowDeactivationMicrosec",
+                          "flowDeactivationTime", "flowStatus",
+                          "maxPacketDelayVariation", "numActivationFailures",
+                          "numBitErrors", "numBytesReceived", "numBytesTransmitted",
+                          "numDroppedPackets", "numL7BytesReceived",
+                          "numL7BytesTransmitted", "numLostPackets",
+                          "numOutOfOrderPackets", "numPacketErrors",
+                          "numPacketsReceivedExclRetrans",
+                          "numPacketsReceivedInclRetrans",
+                          "numPacketsTransmittedInclRetrans",
+                          "numRetries", "numTimeouts", "numTunneledL7BytesReceived",
+                          "roundTripTime", "timeToFirstByte"
+            ]
+        },
+        "hashMap": {
+            "description": "an associative array which is an array of key:value pairs",
+            "type": "object",
+            "additionalProperties": { "type": "string" },
+            "default": {}
+        },
+        "heartbeatFields": {
+            "description": "optional field block for fields specific to heartbeat events",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "heartbeatFieldsVersion": {
+                    "description": "version of the heartbeatFields block",
+                    "type": "string",
+                    "enum": [ "3.0" ]
+                },
+                "heartbeatInterval": {
+                    "description": "current heartbeat interval in seconds",
+                    "type": "integer"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "heartbeatFieldsVersion", "heartbeatInterval" ]
+        },
+        "hugePages": {
+            "description": "metrics on system hugepages",
+            "type": "object",
+            "properties": {
+                "bytesFree": { 
+                    "description": "number of free hugepages in bytes", 
+                    "type": "number" 
+                },
+                "bytesUsed": { 
+                    "description": "number of used hugepages in bytes", 
+                    "type": "number" 
+                },
+                "hugePagesIdentifier": { 
+                    "description": "hugePages identifier", 
+                    "type": "number" 
+                },
+                "percentFree": { 
+                    "description": "number of free hugepages in percent", 
+                    "type": "number" 
+                },
+                "percentUsed": { 
+                    "description": "number of free hugepages in percent", 
+                    "type": "number" 
+                },
+                "vmPageNumberFree": { 
+                    "description": "number of free vmPages in numbers", 
+                    "type": "number" 
+                },
+                "vmPageNumberUsed": { 
+                    "description": "number of used vmPages in numbers", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "hugePagesIdentifier" ]
+        },
+        "internalHeaderFields": {
+            "description": "enrichment fields for internal VES Event Listener service use only, not supplied by event sources",
+            "type": "object"
+        },
+        "ipmi": {
+            "description": "intelligent platform management interface metrics",
+            "type": "object",
+            "properties": {
+                "exitAirTemperature": { 
+                    "description": "system fan exit air flow temperature in celsius", 
+                    "type": "number" 
+                },
+                "frontPanelTemperature": { 
+                    "description": "front panel temperature in celsius", 
+                    "type": "number" 
+                },
+                "ioModuleTemperature": { 
+                    "description": "io module temperature in celsius", 
+                    "type": "number" 
+                },
+                "ipmiBaseboardTemperatureArray": { 
+                    "description": "array of ipmiBaseboardTemperature objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiBaseboardTemperature"  
+                    }                   
+                },
+                "ipmiBaseboardVoltageRegulatorArray": { 
+                    "description": "array of ipmiBaseboardVoltageRegulator objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiBaseboardVoltageRegulator"  
+                    }                   
+                },
+                "ipmiBatteryArray": { 
+                    "description": "array of ipmiBattery objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiBattery"  
+                    }                   
+                },
+                "ipmiFanArray": { 
+                    "description": "array of ipmiFan objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiFan"  
+                    }                   
+                },
+                "ipmiHsbpArray": { 
+                    "description": "array of ipmiHsbp objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiHsbp"  
+                    }                   
+                },
+                "ipmiGlobalAggregateTemperatureMarginArray": { 
+                    "description": "array of ipmiGlobalAggregateTemperatureMargin objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiGlobalAggregateTemperatureMargin"  
+                    }                   
+                },
+                "ipmiNicArray": { 
+                    "description": "array of ipmiNic objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiNic"  
+                    }                   
+                },
+                "ipmiPowerSupplyArray": { 
+                    "description": "array of ipmiPowerSupply objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiPowerSupply"  
+                    }                   
+                },
+                "ipmiProcessorArray": { 
+                    "description": "array of ipmiProcessor objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/ipmiProcessor"  
+                    }                   
+                },
+                "systemAirflow": { 
+                    "description": "airfflow in cubic feet per minute (cfm)", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false
+        },
+        "ipmiBaseboardTemperature": {
+            "description": "intelligent platform management interface (ipmi) baseboard temperature metrics",
+            "type": "object",
+            "properties": {
+                "baseboardTemperatureIdentifier": { 
+                    "description": "identifier for the location where the temperature is taken", 
+                    "type": "string" 
+                },
+                "baseboardTemperature": { 
+                    "description": "baseboard temperature in celsius", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "baseboardTemperatureIdentifier" ]
+        },
+        "ipmiBaseboardVoltageRegulator": {
+            "description": "intelligent platform management interface (ipmi) baseboard voltage regulator metrics",
+            "type": "object",
+            "properties": {
+                "baseboardVoltageRegulatorIdentifier": { 
+                    "description": "identifier for the baseboard voltage regulator", 
+                    "type": "string" 
+                },
+                "voltageRegulatorTemperature": { 
+                    "description": "voltage regulator temperature in celsius", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "baseboardVoltageRegulatorIdentifier" ]
+        },
+        "ipmiBattery": {
+            "description": "intelligent platform management interface (ipmi) battery metrics",
+            "type": "object",
+            "properties": {
+                "batteryIdentifier": { 
+                    "description": "identifier for the battery", 
+                    "type": "string" 
+                },
+                "batteryType": { 
+                    "description": "type of battery", 
+                    "type": "string" 
+                },
+                "batteryVoltageLevel": { 
+                    "description": "battery voltage level", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "batteryIdentifier" ]
+        },
+        "ipmiFan": {
+            "description": "intelligent platform management interface (ipmi) fan metrics",
+            "type": "object",
+            "properties": {
+                "fanIdentifier": { 
+                    "description": "identifier for the fan", 
+                    "type": "string" 
+                },
+                "fanSpeed": { 
+                    "description": "fan speed in revolutions per minute (rpm)", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "fanIdentifier" ]
+        },
+        "ipmiGlobalAggregateTemperatureMargin": {
+            "description": "intelligent platform management interface (ipmi) global aggregate temperature margin",
+            "type": "object",
+            "properties": {
+                "ipmiGlobalAggregateTemperatureMarginIdentifier": { 
+                    "description": "identifier for the ipmi global aggregate temperature margin metrics", 
+                    "type": "string" 
+                },
+                "globalAggregateTemperatureMargin": { 
+                    "description": "the difference between the current global aggregate temperature, in celsius, and the global aggregate throttling thermal trip point", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "ipmiGlobalAggregateTemperatureMarginIdentifier", "globalAggregateTemperatureMargin" ]
+        },
+        "ipmiHsbp": {
+            "description": "intelligent platform management interface (ipmi) hot swap backplane power metrics",
+            "type": "object",
+            "properties": {
+                "hsbpIdentifier": { 
+                    "description": "identifier for the hot swap backplane power unit", 
+                    "type": "string" 
+                },
+                "hsbpTemperature": { 
+                    "description": "hot swap backplane power temperature in celsius", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "hsbpIdentifier" ]
+        },
+        "ipmiNic": {
+            "description": "intelligent platform management interface (ipmi) network interface control card (nic) metrics",
+            "type": "object",
+            "properties": {
+                "nicIdentifier": { 
+                    "description": "identifier for the network interface control card", 
+                    "type": "string" 
+                },
+                "nicTemperature": { 
+                    "description": "nic temperature in celsius", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "nicIdentifier" ]
+        },
+        "ipmiPowerSupply": {
+            "description": "intelligent platform management interface (ipmi) power supply metrics",
+            "type": "object",
+            "properties": {
+                "powerSupplyIdentifier": { 
+                    "description": "identifier for the power supply", 
+                    "type": "string" 
+                },
+                "powerSupplyInputPower": { 
+                    "description": "input power in watts", 
+                    "type": "number" 
+                },
+                "powerSupplyCurrentOutputPercent": { 
+                    "description": "current output voltage as a percentage of the design specified level", 
+                    "type": "number" 
+                },
+                "powerSupplyTemperature": { 
+                    "description": "power supply temperature in celsius", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "powerSupplyIdentifier" ]
+        },
+        "ipmiProcessor": {
+            "description": "intelligent platform management interface processor metrics",
+            "type": "object",
+            "properties": {
+                "processorIdentifier": { 
+                    "description": "identifier for an ipmi processor", 
+                    "type": "string" 
+                },
+                "processorThermalControlPercent": { 
+                    "description": "io module temperature in celsius", 
+                    "type": "number" 
+                },
+                "processorDtsThermalMargin": { 
+                    "description": "front panel temperature in celsius", 
+                    "type": "number" 
+                },
+                "processorDimmAggregateThermalMarginArray": { 
+                    "description": "array of processorDimmAggregateThermalMargin objects", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/processorDimmAggregateThermalMargin"  
+                    }                   
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "processorIdentifier" ]
+        },
+        "jsonObject": {
+            "description": "json object schema, name and other meta-information along with one or more object instances",
+            "type": "object",
+            "properties": {
+                "objectInstances":  {
+                    "description": "one or more instances of the jsonObject", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/jsonObjectInstance"  
+                    }                   
+                },
+                "objectName":  {
+                    "description": "name of the JSON Object", 
+                    "type": "string" 
+                },
+                "objectSchema":  {
+                    "description": "json schema for the object", 
+                    "type": "string" 
+                },
+                "objectSchemaUrl":  {
+                    "description": "Url to the json schema for the object", 
+                    "type": "string" 
+                },
+                "nfSubscribedObjectName":  {
+                    "description": "name of the object associated with the nfSubscriptonId", 
+                    "type": "string" 
+                },
+                "nfSubscriptionId":  {
+                    "description": "identifies an openConfig telemetry subscription on a network function, which configures the network function to send complex object data associated with the jsonObject", 
+                    "type": "string" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "objectInstances", "objectName" ]
+        },
+        "jsonObjectInstance": {
+            "description": "meta-information about an instance of a jsonObject along with the actual object instance",
+            "type": "object",
+            "properties": {
+                "jsonObject": { "$ref": "#/definitions/jsonObject" },
+                "objectInstance":  {
+                    "description": "an instance conforming to the jsonObject objectSchema", 
+                    "type": "object" 
+                },
+                "objectInstanceEpochMicrosec":  {
+                    "description": "the unix time aka epoch time associated with this objectInstance--as microseconds elapsed since 1 Jan 1970 not including leap seconds", 
+                    "type": "number" 
+                },
+                "objectKeys":  {
+                    "description": "an ordered set of keys that identifies this particular instance of jsonObject", 
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/key"
+                    }                   
+                }
+            },
+            "additionalProperties": false
+        },
+        "key": {
+            "description": "tuple which provides the name of a key along with its value and relative order",
+            "type": "object",
+            "properties": {
+                "keyName": { 
+                    "description": "name of the key", 
+                    "type": "string" 
+                },
+                "keyOrder": { 
+                    "description": "relative sequence or order of the key with respect to other keys", 
+                    "type": "integer" 
+                },
+                "keyValue": { 
+                    "description": "value of the key", 
+                    "type": "string" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "keyName" ]
+        },
+        "latencyBucketMeasure": {
+            "description": "number of counts falling within a defined latency bucket",
+            "type": "object",
+            "properties": {
+                "countsInTheBucket": { "type": "number" },
+                "highEndOfLatencyBucket": { "type": "number" },
+                "lowEndOfLatencyBucket":  { "type": "number" }
+            },
+            "additionalProperties": false,
+            "required": [ "countsInTheBucket" ]
+        },
+        "load": {
+            "description": "/proc/loadavg cpu utilization and io utilization metrics",
+            "type": "object",
+            "properties": {
+                "longTerm": { 
+                    "description": "number of jobs in the run queue (state R, cpu utilization) or waiting for disk I/O (state D, io utilization) averaged over 15 minutes using /proc/loadavg", 
+                    "type": "number" 
+                },
+                "midTerm": { 
+                    "description": "number of jobs in the run queue (state R, cpu utilization) or waiting for disk I/O (state D, io utilization) averaged over 5 minutes using /proc/loadavg", 
+                    "type": "number" 
+                },
+                "shortTerm": { 
+                    "description": "number of jobs in the run queue (state R, cpu utilization) or waiting for disk I/O (state D, io utilization) averaged over 1 minute using /proc/loadavg", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false
+        },
+        "machineCheckException": {
+            "description": "metrics on vm machine check exceptions",
+            "type": "object",
+            "properties": {
+                "correctedMemoryErrors": {
+                    "description": "total hardware errors that were corrected by the hardware (e.g. data corruption corrected via Â ECC) over the measurementInterval",
+                    "type": "number"
+                },
+                "correctedMemoryErrorsIn1Hr": {
+                    "description": "total hardware errors that were corrected by the hardware over the last one hour",
+                    "type": "number"
+                },
+                "uncorrectedMemoryErrors": {
+                    "description": "total uncorrected hardware errors that were detected by the hardware (e.g., causing data corruption) over the measurementInterval",
+                    "type": "number"
+                },
+                "uncorrectedMemoryErrorsIn1Hr": {
+                    "description": "total uncorrected hardware errors that were detected by the hardware over the last one hour",
+                    "type": "number"
+                },
+                "vmIdentifier": { 
+                    "description": "virtual machine identifier associated with the machine check exception", 
+                    "type": "string" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "vmIdentifier" ]
+        },
+        "measurementFields": {
+            "description": "measurement fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "additionalMeasurements": {"$ref": "#/definitions/arrayOfNamedHashMap"},
+                "additionalObjects": {"$ref": "#/definitions/arrayOfJsonObject"},
+                "codecUsageArray": {
+                    "description": "array of codecs in use",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/codecsInUse"
+                    }
+                },
+                "concurrentSessions": {
+                    "description": "peak concurrent sessions for the VM or xNF over the measurementInterval",
+                    "type": "integer"
+                },
+                "configuredEntities": {
+                    "description": "over the measurementInterval, peak total number of: users, subscribers, devices, adjacencies, etc., for the VM, or subscribers, devices, etc., for the xNF",
+                    "type": "integer"
+                },
+                "cpuUsageArray": {
+                    "description": "usage of an array of CPUs",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/cpuUsage"
+                    }
+                },
+                "diskUsageArray": {
+                    "description": "usage of an array of disks",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/diskUsage"
+                    }
+                },
+                "featureUsageArray": { "$ref": "#/definitions/hashMap" },
+                "filesystemUsageArray": {
+                    "description": "filesystem usage of the VM on which the xNFC reporting the event is running",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/filesystemUsage"
+                    }
+                },
+                "hugePagesArray": {
+                    "description": "array of metrics on hugepPages",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/hugePages"
+                    }
+                },
+                "ipmi": { "$ref": "#/definitions/ipmi" },
+                "latencyDistribution": {
+                    "description": "array of integers representing counts of requests whose latency in milliseconds falls within per-xNF configured ranges",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/latencyBucketMeasure"
+                    }
+                },
+                "loadArray": {
+                    "description": "array of system load metrics",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/load"
+                    }
+                },
+                "machineCheckExceptionArray": {
+                    "description": "array of machine check exceptions",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/machineCheckException"
+                    }
+                },
+                "meanRequestLatency": {
+                    "description": "mean seconds required to respond to each request for the VM on which the xNFC reporting the event is running",
+                    "type": "number"
+                },
+                "measurementInterval": {
+                    "description": "interval over which measurements are being reported in seconds",
+                    "type": "number"
+                },
+                "measurementFieldsVersion": {
+                    "description": "version of the measurementFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                },
+                "memoryUsageArray": {
+                    "description": "memory usage of an array of VMs",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/memoryUsage"
+                    }
+                },
+                "numberOfMediaPortsInUse": {
+                    "description": "number of media ports in use",
+                    "type": "integer"
+                },
+                "requestRate": {
+                    "description": "peak rate of service requests per second to the xNF over the measurementInterval",
+                    "type": "number"
+                },
+                "nfcScalingMetric": {
+                    "description": "represents busy-ness of the network function from 0 to 100 as reported by the xNFC",
+                    "type": "integer"
+                },
+                "nicPerformanceArray": {
+                    "description": "usage of an array of network interface cards",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/nicPerformance"
+                    }
+                },
+                "processStatsArray": {
+                    "description": "array of metrics on system processes",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/processStats"
+                    }
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "measurementInterval", "measurementFieldsVersion" ]
+        },
+        "memoryUsage": {
+            "description": "memory usage of an identified virtual machine",
+            "type": "object",
+            "properties": {
+                "memoryBuffered": { 
+                    "description": "kibibytes of temporary storage for raw disk blocks", 
+                    "type": "number" 
+                },
+                "memoryCached": { 
+                    "description": "kibibytes of memory used for cache", 
+                    "type": "number" 
+                },
+                "memoryConfigured": { 
+                    "description": "kibibytes of memory configured in the virtual machine on which the xNFC reporting the event is running", 
+                    "type": "number" 
+                },
+                "memoryDemand": { 
+                    "description": "host demand in kibibytes", 
+                    "type": "number" 
+                },
+                "memoryFree": { 
+                    "description": "kibibytes of physical RAM left unused by the system", 
+                    "type": "number" 
+                },
+                "memoryLatencyAvg": { 
+                    "description": "Percentage of time the VM is waiting to access swapped or compressed memory", 
+                    "type": "number" 
+                },
+                "memorySharedAvg": { 
+                    "description": "shared memory in kilobytes", 
+                    "type": "number" 
+                },
+                "memorySlabRecl": { 
+                    "description": "the part of the slab that can be reclaimed such as caches measured in kibibytes", 
+                    "type": "number" 
+                },
+                "memorySlabUnrecl": { 
+                    "description": "the part of the slab that cannot be reclaimed even when lacking memory measured in kibibytes", 
+                    "type": "number" 
+                },
+                "memorySwapInAvg": { 
+                    "description": "Amount of memory swapped-in from host cache in kibibytes", 
+                    "type": "number" 
+                },
+                "memorySwapInRateAvg": { 
+                    "description": "rate at which memory is swapped from disk into active memory during the interval in kilobytes per second", 
+                    "type": "number" 
+                },
+                "memorySwapOutAvg": { 
+                    "description": "Amount of memory swapped-out to host cache in kibibytes", 
+                    "type": "number" 
+                },
+                "memorySwapOutRateAvg": { 
+                    "description": "rate at which memory is being swapped from active memory to disk during the current interval in kilobytes per second", 
+                    "type": "number" 
+                },
+                "memorySwapUsedAvg": { 
+                    "description": "space used for caching swapped pages in the host cache in kibibytes", 
+                    "type": "number" 
+                },
+                "memoryUsed": { 
+                    "description": "total memory minus the sum of free, buffered, cached and slab memory measured in kibibytes", 
+                    "type": "number" 
+                },
+                "percentMemoryUsage": { 
+                    "description": "Percentage of memory usage; value = (memoryUsed / (memoryUsed + memoryFree) x 100 if denomintor is nonzero, or 0, if otherwise", 
+                    "type": "number" 
+                },
+                "vmIdentifier": { 
+                    "description": "virtual machine identifier associated with the memory metrics", 
+                    "type": "string" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "memoryFree", "memoryUsed", "vmIdentifier" ]
+        },
+        "mobileFlowFields": {
+            "description": "mobileFlow fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "applicationType": {
+                    "description": "Application type inferred",
+                    "type": "string"
+                },
+                "appProtocolType": {
+                    "description": "application protocol",
+                    "type": "string"
+                },
+                "appProtocolVersion": {
+                    "description": "application protocol version",
+                    "type": "string"
+                },
+                "cid": {
+                    "description": "cell id",
+                    "type": "string"
+                },
+                "connectionType": {
+                    "description": "Abbreviation referencing a 3GPP reference point e.g., S1-U, S11, etc",
+                    "type": "string"
+                },
+                "ecgi": {
+                    "description": "Evolved Cell Global Id",
+                    "type": "string"
+                },
+                "flowDirection": {
+                    "description": "Flow direction, indicating if the reporting node is the source of the flow or destination for the flow",
+                    "type": "string"
+                },
+                "gtpPerFlowMetrics": { "$ref": "#/definitions/gtpPerFlowMetrics" },
+                "gtpProtocolType": {
+                    "description": "GTP protocol",
+                    "type": "string"
+                },
+                "gtpVersion": {
+                    "description": "GTP protocol version",
+                    "type": "string"
+                },
+                "httpHeader": {
+                    "description": "HTTP request header, if the flow connects to a node referenced by HTTP",
+                    "type": "string"
+                },
+                "imei": {
+                    "description": "IMEI for the subscriber UE used in this flow, if the flow connects to a mobile device",
+                    "type": "string"
+                },
+                "imsi": {
+                    "description": "IMSI for the subscriber UE used in this flow, if the flow connects to a mobile device",
+                    "type": "string"
+                },
+                "ipProtocolType": {
+                    "description": "IP protocol type e.g., TCP, UDP, RTP...",
+                    "type": "string"
+                },
+                "ipVersion": {
+                    "description": "IP protocol version e.g., IPv4, IPv6",
+                    "type": "string"
+                },
+                "lac": {
+                    "description": "location area code",
+                    "type": "string"
+                },
+                "mcc": {
+                    "description": "mobile country code",
+                    "type": "string"
+                },
+                "mnc": {
+                    "description": "mobile network code",
+                    "type": "string"
+                },
+                "mobileFlowFieldsVersion": {
+                    "description": "version of the mobileFlowFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                },
+                "msisdn": {
+                    "description": "MSISDN for the subscriber UE used in this flow, as an integer, if the flow connects to a mobile device",
+                    "type": "string"
+                },
+                "otherEndpointIpAddress": {
+                    "description": "IP address for the other endpoint, as used for the flow being reported on",
+                    "type": "string"
+                },
+                "otherEndpointPort": {
+                    "description": "IP Port for the reporting entity, as used for the flow being reported on",
+                    "type": "integer"
+                },
+                "otherFunctionalRole": {
+                    "description": "Functional role of the other endpoint for the flow being reported on e.g., MME, S-GW, P-GW, PCRF...",
+                    "type": "string"
+                },
+                "rac": {
+                    "description": "routing area code",
+                    "type": "string"
+                },
+                "radioAccessTechnology": {
+                    "description": "Radio Access Technology e.g., 2G, 3G, LTE",
+                    "type": "string"
+                },
+                "reportingEndpointIpAddr": {
+                    "description": "IP address for the reporting entity, as used for the flow being reported on",
+                    "type": "string"
+                },
+                "reportingEndpointPort": {
+                    "description": "IP port for the reporting entity, as used for the flow being reported on",
+                    "type": "integer"
+                },
+                "sac": {
+                    "description": "service area code",
+                    "type": "string"
+                },
+                "samplingAlgorithm": {
+                    "description": "Integer identifier for the sampling algorithm or rule being applied in calculating the flow metrics if metrics are calculated based on a sample of packets, or 0 if no sampling is applied",
+                    "type": "integer"
+                },
+                "tac": {
+                    "description": "transport area code",
+                    "type": "string"
+                },
+                "tunnelId": {
+                    "description": "tunnel identifier",
+                    "type": "string"
+                },
+                "vlanId": {
+                    "description": "VLAN identifier used by this flow",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "flowDirection", "gtpPerFlowMetrics", "ipProtocolType", "ipVersion",
+                          "mobileFlowFieldsVersion", "otherEndpointIpAddress", "otherEndpointPort",
+                          "reportingEndpointIpAddr", "reportingEndpointPort" ]
+        },
+        "namedHashMap": {
+            "description": "a hashMap which is associated with and described by a name",
+            "type": "object",
+            "properties": {
+                "name":  { "type": "string" },
+                "hashMap": { "$ref": "#/definitions/hashMap" }
+            },
+            "additionalProperties": false,
+            "required": [ "name", "hashMap" ]
+        },
+        "nicPerformance": {
+            "description": "describes the performance and errors of an identified network interface card",
+            "type": "object",
+            "properties": {
+                "administrativeState": {
+                    "description": "administrative state",
+                    "type": "string",
+                    "enum": [ "inService", "outOfService" ]
+                },
+                "nicIdentifier": {
+                    "description": "nic identification",
+                    "type": "string"
+                },
+                "operationalState": {
+                    "description": "operational state",
+                    "type": "string",
+                    "enum": [ "inService", "outOfService" ]
+                },
+                "receivedBroadcastPacketsAccumulated": {
+                    "description": "Cumulative count of broadcast packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedBroadcastPacketsDelta": {
+                    "description": "Count of broadcast packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedDiscardedPacketsAccumulated": {
+                    "description": "Cumulative count of discarded packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedDiscardedPacketsDelta": {
+                    "description": "Count of discarded packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedErrorPacketsAccumulated": {
+                    "description": "Cumulative count of error packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedErrorPacketsDelta": {
+                    "description": "Count of error packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedMulticastPacketsAccumulated": {
+                    "description": "Cumulative count of multicast packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedMulticastPacketsDelta": {
+                    "description": "Count of multicast packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedOctetsAccumulated": {
+                    "description": "Cumulative count of octets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedOctetsDelta": {
+                    "description": "Count of octets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedTotalPacketsAccumulated": {
+                    "description": "Cumulative count of all packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedPercentDiscard": {
+                    "description": "Percentage of discarded packets received; value = (receivedDiscardedPacketsDelta / receivedTotalPacketsDelta) x 100, if denominator is nonzero, or 0, if otherwise",
+                    "type": "number"
+                },
+                "receivedPercentError": {
+                    "description": "Percentage of error packets received; value = (receivedErrorPacketsDelta / receivedTotalPacketsDelta) x 100, if denominator is nonzero, or 0, if otherwise.",
+                    "type": "number"
+                },
+                "receivedTotalPacketsDelta": {
+                    "description": "Count of all packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedUnicastPacketsAccumulated": {
+                    "description": "Cumulative count of unicast packets received as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "receivedUnicastPacketsDelta": {
+                    "description": "Count of unicast packets received within the measurement interval",
+                    "type": "number"
+                },
+                "receivedUtilization": {
+                    "description": "Percentage of utilization received; value = (receivedOctetsDelta / (speed x (lastEpochMicrosec - startEpochMicrosec))) x 100, if denominator is nonzero, or 0, if otherwise",
+                    "type": "number"
+                },
+                "speed": {
+                    "description": "Speed configured in mbps",
+                    "type": "number"
+                },
+                "transmittedBroadcastPacketsAccumulated": {
+                    "description": "Cumulative count of broadcast packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedBroadcastPacketsDelta": {
+                    "description": "Count of broadcast packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedDiscardedPacketsAccumulated": {
+                    "description": "Cumulative count of discarded packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedDiscardedPacketsDelta": {
+                    "description": "Count of discarded packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedErrorPacketsAccumulated": {
+                    "description": "Cumulative count of error packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedErrorPacketsDelta": {
+                    "description": "Count of error packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedMulticastPacketsAccumulated": {
+                    "description": "Cumulative count of multicast packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedMulticastPacketsDelta": {
+                    "description": "Count of multicast packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedOctetsAccumulated": {
+                    "description": "Cumulative count of octets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedOctetsDelta": {
+                    "description": "Count of octets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedTotalPacketsAccumulated": {
+                    "description": "Cumulative count of all packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedTotalPacketsDelta": {
+                    "description": "Count of all packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedUnicastPacketsAccumulated": {
+                    "description": "Cumulative count of unicast packets transmitted as read at the end of the measurement interval",
+                    "type": "number"
+                },
+                "transmittedUnicastPacketsDelta": {
+                    "description": "Count of unicast packets transmitted within the measurement interval",
+                    "type": "number"
+                },
+                "transmittedPercentDiscard": {
+                    "description": "Percentage of discarded packets transmitted; value = (transmittedDiscardedPacketsDelta / transmittedTotalPacketsDelta) x 100, if denominator is nonzero, or 0, if otherwise",
+                    "type": "number"
+                },
+                "transmittedPercentError": {
+                    "description": "Percentage of error packets received; value = (transmittedErrorPacketsDelta / transmittedTotalPacketsDelta) x 100, if denominator is nonzero, or 0, if otherwise",
+                    "type": "number"
+                },
+                "transmittedUtilization": {
+                    "description": "Percentage of utilization transmitted; value = (transmittedOctetsDelta / (speed x (lastEpochMicrosec - startEpochMicrosec))) x 100, if denominator is nonzero, or 0, if otherwise.",
+                    "type": "number"
+                },
+                "valuesAreSuspect": {
+                    "description": "Indicates whether vNicPerformance values are likely inaccurate due to counter overflow or other condtions",
+                    "type": "string",
+                    "enum": [ "true", "false" ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "nicIdentifier", "valuesAreSuspect" ]
+        },
+        "notificationFields": {
+            "description": "notification fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "arrayOfNamedHashMap": {"$ref": "#/definitions/arrayOfNamedHashMap"},
+                "changeContact": {
+                    "description": "identifier for a contact related to the change",
+                    "type": "string"
+                },
+                "changeIdentifier": {
+                    "description": "system or session identifier associated with the change",
+                    "type": "string"
+                },
+                "changeType": {
+                    "description": "describes what has changed for the entity",
+                    "type": "string"
+                },
+                "newState": {
+                    "description": "new state of the entity",
+                    "type": "string"
+                },
+                "oldState": {
+                    "description": "previous state of the entity",
+                    "type": "string"
+                },
+                "notificationFieldsVersion": {
+                    "description": "version of the notificationFields block",
+                    "type": "string",
+                    "enum": [ "2.0" ]
+                },
+                "stateInterface": {
+                    "description": "card or port name of the entity that changed state",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "changeIdentifier", "changeType", "notificationFieldsVersion" ]
+        },
+        "otherFields": {
+            "description": "fields for events belonging to the 'other' domain of the commonEventHeader domain enumeration",
+            "type": "object",
+            "properties": {
+                "arrayOfNamedHashMap": {"$ref": "#/definitions/arrayOfNamedHashMap"},
+                "hashMap": {"$ref": "#/definitions/hashMap"},               
+                "jsonObjects": {"$ref": "#/definitions/arrayOfJsonObject"},
+                "otherFieldsVersion": {
+                    "description": "version of the otherFields block",
+                    "type": "string",
+                    "enum": [ "3.0" ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "otherFieldsVersion" ]
+        },
+        "pnfRegistrationFields": {
+            "description": "hardware device registration fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "lastServiceDate": {
+                    "description": "TS 32.692 dateOfLastService = date of last service; e.g. 15022017",
+                    "type": "string"
+                },
+                "macAddress": {
+                    "description": "MAC address of OAM interface of the unit",
+                    "type": "string"
+                },
+                "manufactureDate": {
+                    "description": "TS 32.692 dateOfManufacture = manufacture date of the unit; 24032016",
+                    "type": "string"
+                },
+                "modelNumber": {
+                    "description": "TS 32.692 versionNumber = version of the unit from vendor; e.g. AJ02.  Maps to AAI equip-model",
+                    "type": "string"
+                },
+                "oamV4IpAddress": {
+                    "description": "IPv4 m-plane IP address to be used by the manager to contact the PNF",
+                    "type": "string"
+                },
+                "oamV6IpAddress": {
+                    "description": "IPv6 m-plane IP address to be used by the manager to contact the PNF",
+                    "type": "string"
+                },
+                "pnfRegistrationFieldsVersion": {
+                    "description": "version of the pnfRegistrationFields block",
+                    "type": "string",
+                    "enum": [ "2.0" ]
+                },
+                "serialNumber": {
+                    "description": "TS 32.692 serialNumber = serial number of the unit; e.g. 6061ZW3",
+                    "type": "string"
+                },
+                "softwareVersion": {
+                    "description": "TS 32.692 swName = active SW running on the unit; e.g. 5gDUv18.05.201",
+                    "type": "string"
+                },
+                "unitFamily": {
+                    "description": "TS 32.692 vendorUnitFamilyType = general type of HW unit; e.g. BBU",
+                    "type": "string"
+                },
+                "unitType": {
+                    "description": "TS 32.692 vendorUnitTypeNumber = vendor name for the unit; e.g. Airscale",
+                    "type": "string"
+                },
+                "vendorName": {
+                    "description": "TS 32.692 vendorName = name of manufacturer; e.g. Nokia. Maps to AAI equip-vendor",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "pnfRegistrationFieldsVersion" ]
+        },
+        "processorDimmAggregateThermalMargin": {
+            "description": "intelligent platform management interface (ipmi) processor dual inline memory module aggregate thermal margin metrics",
+            "type": "object",
+            "properties": {
+                "processorDimmAggregateThermalMarginIdentifier": { 
+                    "description": "identifier for the aggregate thermal margin metrics from the processor dual inline memory module", 
+                    "type": "string" 
+                },
+                "thermalMargin": { 
+                    "description": "the difference between the DIMM's current temperature, in celsius, and the DIMM's throttling thermal trip point", 
+                    "type": "number" 
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "processorDimmAggregateThermalMarginIdentifier", "thermalMargin" ]
+        },
+        "processStats": {
+            "description": "metrics on system processes",
+            "type": "object",
+            "properties": {
+                "forkRate": {
+                    "description": "the number of threads created since the last reboot",
+                    "type": "number"
+                },
+                "processIdentifier": {
+                    "description": "processIdentifier",
+                    "type": "string"
+                },
+                "psStateBlocked": {
+                    "description": "the number of processes in a blocked state",
+                    "type": "number"
+                },
+                "psStatePaging": {
+                    "description": "the number of processes in a paging state",
+                    "type": "number"
+                },
+                "psStateRunning": {
+                    "description": "the number of processes in a running state",
+                    "type": "number"
+                },
+                "psStateSleeping": {
+                    "description": "the number of processes in a sleeping state",
+                    "type": "number"
+                },
+                "psStateStopped": {
+                    "description": "the number of processes in a stopped state",
+                    "type": "number"
+                },
+                "psStateZombie": {
+                    "description": "the number of processes in a zombie state",
+                    "type": "number"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "processIdentifier" ]
+        },
+        "requestError": {
+            "description": "standard request error data structure",
+            "type": "object",
+            "properties": {
+                "messageId": {
+                    "description": "Unique message identifier of the format ABCnnnn where ABC is either SVC for Service Exceptions or POL for Policy Exception",
+                    "type": "string"
+                },
+                "text": {
+                    "description": "Message text, with replacement variables marked with %n, where n is an index into the list of <variables> elements, starting at 1",
+                    "type": "string"
+                },
+                "url": {
+                    "description": "Hyperlink to a detailed error resource e.g., an HTML page for browser user agents",
+                    "type": "string"
+                },
+                "variables": {
+                    "description": "List of zero or more strings that represent the contents of the variables used by the message text",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "messageId", "text" ]
+        },
+        "sipSignalingFields": {
+            "description": "sip signaling fields",
+            "type": "object",
+            "properties": {
+                "additionalInformation": { "$ref": "#/definitions/hashMap"},
+                "compressedSip": {
+                    "description": "the full SIP request/response including headers and bodies",
+                    "type": "string"
+                },
+                "correlator": {
+                    "description": "this is the same for all events on this call",
+                    "type": "string"
+                },
+                "localIpAddress": {
+                    "description": "IP address on xNF",
+                    "type": "string"
+                },
+                "localPort": {
+                    "description": "port on xNF",
+                    "type": "string"
+                },
+                "remoteIpAddress": {
+                    "description": "IP address of peer endpoint",
+                    "type": "string"
+                },
+                "remotePort": {
+                    "description": "port of peer endpoint",
+                    "type": "string"
+                },
+                "sipSignalingFieldsVersion": {
+                    "description": "version of the sipSignalingFields block",
+                    "type": "string",
+                    "enum": [ "3.0" ]
+                },
+                "summarySip": {
+                    "description": "the SIP Method or Response ('INVITE', '200 OK', 'BYE', etc)",
+                    "type": "string"
+                },
+                "vendorNfNameFields": {
+                    "$ref": "#/definitions/vendorNfNameFields"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "correlator", "localIpAddress", "localPort", "remoteIpAddress", 
+                          "remotePort", "sipSignalingFieldsVersion", "vendorNfNameFields" ]
+        },
+        "stateChangeFields": {
+            "description": "stateChange fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "newState": {
+                    "description": "new state of the entity",
+                    "type": "string",
+                    "enum": [
+                        "inService",
+                        "maintenance",
+                        "outOfService"
+                    ]
+                },
+                "oldState": {
+                    "description": "previous state of the entity",
+                    "type": "string",
+                    "enum": [
+                        "inService",
+                        "maintenance",
+                        "outOfService"
+                    ]
+                },
+                "stateChangeFieldsVersion": {
+                    "description": "version of the stateChangeFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                },
+                "stateInterface": {
+                    "description": "card or port name of the entity that changed state",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "newState", "oldState", "stateChangeFieldsVersion", "stateInterface" ]
+        },
+        "syslogFields": {
+            "description": "sysLog fields",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap" },
+                "eventSourceHost": {
+                    "description": "hostname of the device",
+                    "type": "string"
+                },
+                "eventSourceType": {
+                    "description": "type of event source; examples: other, router, switch, host, card, port, slotThreshold, portThreshold, virtualMachine, virtualNetworkFunction",
+                    "type": "string"
+                },
+                "syslogFacility": {
+                    "description": "numeric code from 0 to 23 for facility--see table in documentation",
+                    "type": "integer"
+                },
+                "syslogFieldsVersion": {
+                    "description": "version of the syslogFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                },
+                "syslogMsg": {
+                    "description": "syslog message",
+                    "type": "string"
+                },
+                "syslogMsgHost": {
+                    "description": "hostname parsed from non-VES syslog message",
+                    "type": "string"
+                },
+                "syslogPri": {
+                    "description": "0-192 combined severity and facility",
+                    "type": "integer"
+                },
+                "syslogProc": {
+                    "description": "identifies the application that originated the message",
+                    "type": "string"
+                },
+                "syslogProcId": {
+                    "description": "a change in the value of this field indicates a discontinuity in syslog reporting",
+                    "type": "number"
+                },
+                "syslogSData": {
+                    "description": "syslog structured data consisting of a structured data Id followed by a set of key value pairs",
+                    "type": "string"
+                },
+                "syslogSdId": {
+                    "description": "0-32 char in format name@number for example ourSDID@32473",
+                    "type": "string"
+                },
+                "syslogSev": {
+                    "description": "numerical Code for  severity derived from syslogPri as remaider of syslogPri / 8",
+                    "type": "string",
+                    "enum": [
+                        "Alert",
+                        "Critical",
+                        "Debug",
+                        "Emergency",
+                        "Error",
+                        "Info",
+                        "Notice",
+                        "Warning"
+                    ]
+                },
+                "syslogTag": {
+                    "description": "msgId indicating the type of message such as TCPOUT or TCPIN; NILVALUE should be used when no other value can be provided",
+                    "type": "string"
+                },
+                "syslogTs": {
+                    "description": "timestamp parsed from non-VES syslog message",
+                    "type": "string"
+                },
+                "syslogVer": {
+                    "description": "IANA assigned version of the syslog protocol specification - typically 1",
+                    "type": "number"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "eventSourceType", "syslogFieldsVersion", "syslogMsg", "syslogTag" ]
+        },
+        "thresholdCrossingAlertFields": {
+            "description": "fields specific to threshold crossing alert events",
+            "type": "object",
+            "properties": {
+                "additionalFields": { "$ref": "#/definitions/hashMap"},
+                "additionalParameters": {
+                    "description": "performance counters",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/counter"
+                    }
+                },
+                "alertAction": {
+                    "description": "Event action",
+                    "type": "string",
+                    "enum": [
+                        "CLEAR",
+                        "CONT",
+                        "SET"
+                    ]
+                },
+                "alertDescription": {
+                    "description": "Unique short alert description such as IF-SHUB-ERRDROP",
+                    "type": "string"
+                },
+                "alertType": {
+                    "description": "Event type",
+                    "type": "string",
+                    "enum": [
+                        "CARD-ANOMALY",
+                        "ELEMENT-ANOMALY",
+                        "INTERFACE-ANOMALY",
+                        "SERVICE-ANOMALY"
+                    ]
+                },
+                "alertValue": {
+                    "description": "Calculated API value (if applicable)",
+                    "type": "string"
+                },
+                "associatedAlertIdList": {
+                    "description": "List of eventIds associated with the event being reported",
+                    "type": "array",
+                    "items": { "type": "string" }
+                },
+                "collectionTimestamp": {
+                    "description": "Time when the performance collector picked up the data; with RFC 2822 compliant format: Sat, 13 Mar 2010 11:29:05 -0800",
+                    "type": "string"
+                },
+                "dataCollector": {
+                    "description": "Specific performance collector instance used",
+                    "type": "string"
+                },
+                "elementType": {
+                    "description": "type of network element - internal ATT field",
+                    "type": "string"
+                },
+                "eventSeverity": {
+                    "description": "event severity or priority",
+                    "type": "string",
+                    "enum": [
+                        "CRITICAL",
+                        "MAJOR",
+                        "MINOR",
+                        "WARNING",
+                        "NORMAL"
+                    ]
+                },
+                "eventStartTimestamp": {
+                    "description": "Time closest to when the measurement was made; with RFC 2822 compliant format: Sat, 13 Mar 2010 11:29:05 -0800",
+                    "type": "string"
+                },
+                "interfaceName": {
+                    "description": "Physical or logical port or card (if applicable)",
+                    "type": "string"
+                },
+                "networkService": {
+                    "description": "network name - internal ATT field",
+                    "type": "string"
+                },
+                "possibleRootCause": {
+                    "description": "Reserved for future use",
+                    "type": "string"
+                },
+                "thresholdCrossingFieldsVersion": {
+                    "description": "version of the thresholdCrossingAlertFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [
+                "additionalParameters",
+                "alertAction",
+                "alertDescription",
+                "alertType",
+                "collectionTimestamp",
+                "eventSeverity",
+                "eventStartTimestamp",
+                "thresholdCrossingFieldsVersion"
+            ]
+        },
+        "vendorNfNameFields": {
+            "description": "provides vendor, nf and nfModule identifying information",
+            "type": "object",
+            "properties": {
+                "vendorName": {
+                    "description": "network function vendor name",
+                    "type": "string"
+                },
+                "nfModuleName": {
+                    "description": "name of the nfModule generating the event",
+                    "type": "string"
+                },
+                "nfName": {
+                    "description": "name of the network function generating the event",
+                    "type": "string"
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "vendorName" ]
+        },
+        "voiceQualityFields": {
+            "description": "provides statistics related to customer facing voice products",
+            "type": "object",
+            "properties": {
+                "additionalInformation": { "$ref": "#/definitions/hashMap"},
+                "calleeSideCodec": {
+                    "description": "callee codec for the call",
+                    "type": "string"
+                },
+                "callerSideCodec": {
+                    "description": "caller codec for the call",
+                    "type": "string"
+                },
+                "correlator": {
+                    "description": "this is the same for all events on this call",
+                    "type": "string"
+                },
+                "endOfCallVqmSummaries": {
+                    "$ref": "#/definitions/endOfCallVqmSummaries"
+                },
+                "phoneNumber": {
+                    "description": "phone number associated with the correlator",
+                    "type": "string"
+                },
+                "midCallRtcp": {
+                    "description": "Base64 encoding of the binary RTCP data excluding Eth/IP/UDP headers",
+                    "type": "string"
+                },
+                "vendorNfNameFields": {
+                    "$ref": "#/definitions/vendorNfNameFields"
+                },
+                "voiceQualityFieldsVersion": {
+                    "description": "version of the voiceQualityFields block",
+                    "type": "string",
+                    "enum": [ "4.0" ]
+                }
+            },
+            "additionalProperties": false,
+            "required": [ "calleeSideCodec", "callerSideCodec", "correlator", "midCallRtcp",
+                          "vendorNfNameFields", "voiceQualityFieldsVersion" ]
+        }
+    }
+}
\ No newline at end of file
index 83f80c4..9d648bb 100644 (file)
@@ -1,4 +1,4 @@
 <config xmlns="http://nokia.com/pnf-simulator">
-       <testDuration>10</testDuration>
-       <messageInterval>1</messageInterval>
+  <itemValue1>42</itemValue1>
+  <itemValue2>35</itemValue2>
 </config>
index dda6554..d7fc2f2 100644 (file)
@@ -3,7 +3,7 @@ module pnf-simulator {
   prefix config;
   container config {
     config true;
-    leaf testDuration {type uint32;}
-    leaf messageInterval {type uint32;}
+    leaf itemValue1 {type uint32;}
+    leaf itemValue2 {type uint32;}
   }
 }
index 0af1f6f..563ee27 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         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>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+  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>
 
-    <groupId>org.onap.pnfsimulator</groupId>
-    <artifactId>pnf-simulator</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-    <name>pnf-simulator</name>
+  <parent>
+    <groupId>org.onap.oparent</groupId>
+    <artifactId>oparent</artifactId>
+    <version>1.1.0</version>
+  </parent>
 
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
-        <simulator.main.class>org.onap.pnfsimulator.Main</simulator.main.class>
-        <docker.image.tag>latest</docker.image.tag>
-        <dependency.directory.name>libs</dependency.directory.name>
-        <dependency.directory.location>
-            ${project.build.directory}/${dependency.directory.name}
-        </dependency.directory.location>
-        <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>
-    </properties>
+  <groupId>org.onap.pnfsimulator</groupId>
+  <artifactId>pnf-simulator</artifactId>
+  <version>2.0.0-SNAPSHOT</version>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
-            <version>2.0.2.RELEASE</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <version>2.0.2.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-log4j2</artifactId>
-            <version>2.0.2.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-api</artifactId>
-            <version>2.11.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-core</artifactId>
-            <version>2.11.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
-            <version>2.11.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-jul</artifactId>
-            <version>2.11.0</version>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>2.6</version>
-        </dependency>
-        <dependency>
-            <groupId>org.json</groupId>
-            <artifactId>json</artifactId>
-            <version>20180130</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.5.5</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>21.0</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-cli</groupId>
-            <artifactId>commons-cli</artifactId>
-            <version>1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <version>5.1.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <version>3.9.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.7</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>jnc</artifactId>
-            <version>1.0</version>
-        </dependency>
-    </dependencies>
+  <name>pnf-simulator</name>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>${maven.compiler.source}</source>
-                    <target>${maven.compiler.target}</target>
-                    <showWarnings>true</showWarnings>
-                    <showDeprecation>true</showDeprecation>
-                </configuration>
-            </plugin>
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.19</version>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.junit.platform</groupId>
-                        <artifactId>junit-platform-surefire-provider</artifactId>
-                        <version>1.1.1</version>
-                    </dependency>
-                </dependencies>
-                <configuration>
-                    <detail>true</detail>
-                    <printSummary>true</printSummary>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <configuration>
-                    <outputDirectory>${dependency.directory.location}</outputDirectory>
-                    <includeScope>runtime</includeScope>
-                    <silent>true</silent>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>copy-external-dependencies</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>1.0.0</version>
-                <configuration>
-                    <imageName>${onap.nexus.dockerregistry.daily}/onap/${project.artifactId}</imageName>
-                    <imageTags>latest</imageTags>
-                    <imageTags>${project.version}-latest</imageTags>
-                    <serverId>${onap.nexus.dockerregistry.daily}</serverId>
-                    <baseImage>openjdk:8-jdk-alpine</baseImage>
-                    <cmd>java -cp  ${dependency.directory.name}/*:${project.build.finalName}.jar ${simulator.main.class}</cmd>
-                    <resources>
-                        <resource>
-                            <targetPath>${dependency.directory.name}</targetPath>
-                            <directory>${dependency.directory.location}</directory>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>${project.build.finalName}.jar</include>
-                        </resource>
-                    </resources>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>build-image</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>build</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.8</maven.compiler.source>
+    <maven.compiler.target>1.8</maven.compiler.target>
+    <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+
+    <simulator.main.class>org.onap.pnfsimulator.Main</simulator.main.class>
+    <docker.image.tag>latest</docker.image.tag>
+    <junit.jupiter.version>5.1.0</junit.jupiter.version>
+    <junit.vintage.version>5.1.0</junit.vintage.version>
+    <docker.image.name>onap/${project.artifactId}</docker.image.name>
+
+    <dependency.directory.name>libs</dependency.directory.name>
+    <dependency.directory.location>${project.build.directory}/${dependency.directory.name}
+    </dependency.directory.location>
+
+    <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>2.0.2.RELEASE</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-starter-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+      <version>2.0.2.RELEASE</version>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>1.2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+      <version>1.2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.json</groupId>
+      <artifactId>json</artifactId>
+      <version>20180130</version>
+    </dependency>
+    <dependency>
+      <groupId>org.everit.json</groupId>
+      <artifactId>org.everit.json.schema</artifactId>
+      <version>1.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.github.fge</groupId>
+      <artifactId>json-schema-validator</artifactId>
+      <version>2.2.6</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.8.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>4.5.5</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>21.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.onosproject</groupId>
+      <artifactId>jnc</artifactId>
+      <version>1.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.1.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-migrationsupport</artifactId>
+      <version>${junit.jupiter.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>3.9.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sshd</groupId>
+      <artifactId>sshd-core</artifactId>
+      <version>0.9.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.18.3</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <version>5.0.4.RELEASE</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <version>2.0.1.RELEASE</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.7.0</version>
+        <configuration>
+          <source>${maven.compiler.source}</source>
+          <target>${maven.compiler.target}</target>
+          <showWarnings>true</showWarnings>
+          <showDeprecation>true</showDeprecation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>3.0.2</version>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <Main-Class>${simulator.main.class}</Main-Class>
+              <Build-Time>${maven.build.timestamp}</Build-Time>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>pl.project13.maven</groupId>
+        <artifactId>git-commit-id-plugin</artifactId>
+        <version>2.2.4</version>
+        <executions>
+          <execution>
+            <id>get-commit-info</id>
+            <goals>
+              <goal>revision</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
+          <generateGitPropertiesFile>true</generateGitPropertiesFile>
+          <includeOnlyProperties>git.commit.id.abbrev</includeOnlyProperties>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.19</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-surefire-provider</artifactId>
+            <version>1.1.1</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <detail>true</detail>
+          <printSummary>true</printSummary>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <outputDirectory>${dependency.directory.location}</outputDirectory>
+          <includeScope>runtime</includeScope>
+          <silent>true</silent>
+        </configuration>
+        <executions>
+          <execution>
+            <id>copy-external-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>com.spotify</groupId>
+        <artifactId>docker-maven-plugin</artifactId>
+        <version>1.0.0</version>
+        <configuration>
+          <registryUrl>${onap.nexus.dockerregistry.daily}</registryUrl>
+          <imageName>${onap.nexus.dockerregistry.daily}/${docker.image.name}</imageName>
+          <forceTags>true</forceTags>
+          <imageTags>
+            <tag>latest</tag>
+            <tag>${project.version}</tag>
+            <tag>${project.version}-${maven.build.timestamp}</tag>
+          </imageTags>
+          <baseImage>openjdk:8-jre-alpine</baseImage>
+          <cmd>java -cp ${dependency.directory.name}/*:${project.build.finalName}.jar ${simulator.main.class}</cmd>
+          <resources>
+            <resource>
+              <targetPath>${dependency.directory.name}</targetPath>
+              <directory>${dependency.directory.location}</directory>
+            </resource>
+            <resource>
+              <targetPath>/</targetPath>
+              <directory>${project.build.directory}</directory>
+              <include>${project.build.finalName}.jar</include>
+            </resource>
+          </resources>
+          <forceTags>true</forceTags>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <version>0.8.1</version>
+        <configuration>
+          <excludes>
+            <exclude>org/onap/pnfsimulator/Main.class</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>default-prepare-agent</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>report</id>
+            <phase>prepare-package</phase>
+            <goals>
+              <goal>report</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>check</id>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <rule>
+                  <element>CLASS</element>
+                  <limits>
+                    <limit>
+                      <value>COVEREDRATIO</value>
+                      <minimum>0.70</minimum>
+                    </limit>
+                    <limit>
+                      <counter>BRANCH</counter>
+                      <value>COVEREDRATIO</value>
+                      <minimum>0.75</minimum>
+                    </limit>
+                  </limits>
+                </rule>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/sftp/sftp-file.txt b/test/mocks/pnfsimulator/sftp/sftp-file.txt
new file mode 100644 (file)
index 0000000..43f6712
--- /dev/null
@@ -0,0 +1,2 @@
+We are SFTP specialists.
+Do you prefer chocolate or vanilia?
\ No newline at end of file
index cf16e24..23facce 100755 (executable)
@@ -3,7 +3,6 @@
 set -euo pipefail
 
 COMPOSE_FILE_NAME=docker-compose.yml
-DEV_COMPOSE_FILE_NAME=docker-compose.dev.yml
 NETOPEER_CONTAINER_NAME=netopeer
 SIMULATOR_CONTAINER_NAME=pnf-simulator
 SIMULATOR_PORT=5000
@@ -22,9 +21,7 @@ function main(){
         "start")
             start $COMPOSE_FILE_NAME;;
         "start-dev")
-            start $DEV_COMPOSE_FILE_NAME;;
-        "start-debug")
-            start_netconf_server $DEV_COMPOSE_FILE_NAME;;
+            start_netconf_server $COMPOSE_FILE_NAME;;
         "stop")
             stop;;
         "run-simulator")
@@ -42,7 +39,7 @@ function main(){
 
 function build_image(){
     if [ -f pom.xml ]; then
-        mvn clean package 
+        mvn clean package docker:build
     else
         echo "pom.xml file not found"
         exit 1
@@ -74,7 +71,7 @@ function start(){
 }
 
 function running_containers(){
-   docker-compose -f $COMPOSE_FILE_NAME ps -q && docker-compose -f $DEV_COMPOSE_FILE_NAME ps -q
+   docker-compose -f $COMPOSE_FILE_NAME ps -q
 }
 
 function stop(){
@@ -89,14 +86,14 @@ function stop(){
 function run_simulator(){
 cat << EndOfMessage
 Simulator response:
-$(curl -s -X POST -H "Content-Type: application/json" -d @config/config.json $SIMULATOR_START_URL | json_pp)
+$(curl -s -X POST -H "Content-Type: application/json" -H "X-ONAP-RequestID: 123" -H "X-InvocationID: 456" -d @config/config.json $SIMULATOR_START_URL)
 EndOfMessage
 }
 
 function stop_simulator(){
 cat << EndOfMessage
 Simulator response:
-$(curl -s -X POST $SIMULATOR_STOP_URL | json_pp)
+$(curl -s -X POST $SIMULATOR_STOP_URL)
 EndOfMessage
 }
 
@@ -114,7 +111,7 @@ cat << EndOfMessage
 $(docker-compose -f $RUNNING_COMPOSE_CONFIG ps)
 
 Simulator response:
-$(curl -s -X GET $SIMULATOR_STATUS_URL | json_pp)
+$(curl -s -X GET $SIMULATOR_STATUS_URL)
 EndOfMessage
 }
 
@@ -123,8 +120,7 @@ cat << EndOfMessage
 Available options:
 build - locally builds simulator image from existing code
 start - starts simulator and netopeer2 containers using remote simulator image and specified model name
-start-dev - starts simulator and netopeer2 containers using remote simulator image
-start-debug - starts only  netopeer2 container
+start-dev - starts only  netopeer2 container
 run-simulator - starts sending PNF registration messages with parameters specified in config.json
 stop-simulator - stop sending PNF registration messages
 stop - stops both containers
@@ -142,7 +138,7 @@ Logs are written to logs/pnf-simulator.log. After each "start/start-dev" old log
 
 FOR DEVELOPERS
 1. Build local simulator image using "./simulator.sh build"
-2. Run containers with "./simulator.sh start-dev"
+2. Run containers with "./simulator.sh start-debug"
 
 If you change the source code you have to rebuild image with "./simulator.sh build" and run "./simulator.sh start/start-dev" again
 EndOfMessage
index 0e9fe4d..244eef6 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator;
 
+import org.onap.pnfsimulator.message.MessageProvider;
+import org.onap.pnfsimulator.simulator.validation.JSONValidator;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 @SpringBootApplication
 @EnableAsync
 public class Main {
+
     public static void main(String[] args) {
         SpringApplication.run(Main.class, args);
     }
+
+    @Bean
+    public MessageProvider messageProvider() {
+        return new MessageProvider();
+    }
+
+    @Bean
+    public JSONValidator jsonValidator() {
+        return new JSONValidator();
+    }
 }
+
+
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/logging/MDCVariables.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/logging/MDCVariables.java
new file mode 100644 (file)
index 0000000..8f6fe3b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.logging;
+
+public final class MDCVariables {
+
+    public static final String X_ONAP_REQUEST_ID = "X-ONAP-RequestID";
+    public static final String X_INVOCATION_ID = "X-InvocationID";
+    public static final String REQUEST_ID = "RequestID";
+    public static final String INVOCATION_ID = "InvocationID";
+    public static final String INSTANCE_UUID = "InstanceUUID";
+    public static final String RESPONSE_CODE = "ResponseCode";
+    public static final String SERVICE_NAME = "ServiceName";
+
+    private MDCVariables() {
+    }
+}
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
new file mode 100644 (file)
index 0000000..fd2b95a
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.message;
+
+import static org.onap.pnfsimulator.message.MessageConstants.*;
+
+import org.json.JSONObject;
+
+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);
+        commonEventHeader.put(START_EPOCH_MICROSEC, timestamp);
+        commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
+        commonEventHeader.put(VERSION, VERSION_NUMBER);
+        commonEventHeader.put(VES_EVENT_LISTENER_VERSION, VES_EVENT_LISTENER_VERSION_NUMBER);
+        return commonEventHeader;
+    }
+
+    static JSONObject generatePnfRegistrationFields() {
+        JSONObject pnfRegistrationFields = new JSONObject();
+        pnfRegistrationFields.put(PNF_REGISTRATION_FIELDS_VERSION, PNF_REGISTRATION_FIELDS_VERSION_VALUE);
+        pnfRegistrationFields.put(PNF_LAST_SERVICE_DATE, String.valueOf(System.currentTimeMillis()));
+        pnfRegistrationFields.put(PNF_MANUFACTURE_DATE, String.valueOf(System.currentTimeMillis()));
+        return pnfRegistrationFields;
+    }
+
+    static String generateEventId() {
+        String timeAsString = String.valueOf(System.currentTimeMillis());
+        return String.format("registration_%s",
+            timeAsString.substring(timeAsString.length() - 11, timeAsString.length() - 3));
+    }
+
+    private JSONObjectFactory(){
+
+    }
+
+}
index 8e7c6fc..7861d5f 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -22,34 +22,44 @@ package org.onap.pnfsimulator.message;
 
 public final class MessageConstants {
 
-    public static final String EVENT = "event";
-    public static final String DOMAIN = "domain";
-    public static final String EVENT_ID = "eventId";
-    public static final String EVENT_TYPE = "eventType";
-    public static final String LAST_EPOCH_MICROSEC = "lastEpochMicrosec";
-    public static final String PRIORITY = "priority";
-    public static final String SEQUENCE = "sequence";
-    public static final String START_EPOCH_MICROSEC = "startEpochMicrosec";
-    public static final String INTERNAL_HEADER_FIELDS = "internalHeaderFields";
-    public static final String VERSION = "version";
-    public static final String OTHER_FIELDS_VERSION = "otherFieldsVersion";
-    public static final String PNF_LAST_SERVICE_DATE = "pnfLastServiceDate";
-    public static final String PNF_MANUFACTURE_DATE = "pnfManufactureDate";
-
     public static final String SIMULATOR_PARAMS_CONTAINER = "simulatorParams";
     public static final String MESSAGE_PARAMS_CONTAINER = "messageParams";
+    static final String EVENT = "event";
+    static final String DOMAIN = "domain";
+    static final String EVENT_ID = "eventId";
+    static final String EVENT_TYPE = "eventType";
+    static final String LAST_EPOCH_MICROSEC = "lastEpochMicrosec";
+    static final String PRIORITY = "priority";
+    static final String SEQUENCE = "sequence";
+    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
-    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";
+    // 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 PNF_PREFIX = "pnf";
-    public static final String COMMON_EVENT_HEADER = "commonEventHeader";
-    public static final String OTHER_FIELDS = "otherFields";
     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 String VERSION_NUMBER = "4.0.1";
+    static final String VES_EVENT_LISTENER_VERSION_NUMBER = "7.0.1";
+    static final String PNF_REGISTRATION_FIELDS_VERSION_VALUE = "2.0";
+    static final int SEQUENCE_NUMBER = 0;
 
     private MessageConstants() {
     }
index 44ca966..7c3bf9e 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 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_ID;
-import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE;
-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.OTHER_FIELDS;
-import static org.onap.pnfsimulator.message.MessageConstants.OTHER_FIELDS_VERSION;
-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_PREFIX;
-import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY;
-import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE;
-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.EVENT;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_PREFIX;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
 
 import java.util.Map;
-import java.util.UUID;
 import org.json.JSONObject;
 
 public class MessageProvider {
 
     public JSONObject createMessage(JSONObject params) {
 
-        if(params == null){
+        if (params == null) {
             throw new IllegalArgumentException("Params object cannot be null");
         }
 
-         Map<String, Object> paramsMap = params.toMap();
+        Map<String, Object> paramsMap = params.toMap();
         JSONObject root = new JSONObject();
-        JSONObject commonEventHeader = generateConstantCommonEventHeader();
-        JSONObject otherFields = generateConstantOtherFields();
+        JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
+        JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
 
         paramsMap.forEach((key, value) -> {
 
             if (key.startsWith(PNF_PREFIX)) {
-                otherFields.put(key, value);
+                pnfRegistrationFields.put(key.substring(PNF_PREFIX.length()), value);
             } else {
                 commonEventHeader.put(key, value);
             }
@@ -65,37 +52,9 @@ public class MessageProvider {
 
         JSONObject event = new JSONObject();
         event.put(COMMON_EVENT_HEADER, commonEventHeader);
-        event.put(OTHER_FIELDS, otherFields);
+        event.put(PNF_REGISTRATION_FIELDS, pnfRegistrationFields);
         root.put(EVENT, event);
         return root;
     }
 
-    private JSONObject generateConstantCommonEventHeader() {
-
-        JSONObject commonEventHeader = new JSONObject();
-        long timestamp = System.currentTimeMillis();
-
-        commonEventHeader.put(DOMAIN, "other");
-        commonEventHeader.put(EVENT_ID, UUID.randomUUID() + "-reg");
-        commonEventHeader.put(EVENT_TYPE, "pnfRegistration");
-        commonEventHeader.put(LAST_EPOCH_MICROSEC, timestamp);
-        commonEventHeader.put(PRIORITY, "Normal");
-        commonEventHeader.put(SEQUENCE, 0);
-        commonEventHeader.put(START_EPOCH_MICROSEC, timestamp);
-        commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
-        commonEventHeader.put(VERSION, 3);
-
-        return commonEventHeader;
-    }
-
-    private JSONObject generateConstantOtherFields() {
-
-        JSONObject otherFields = new JSONObject();
-
-        otherFields.put(OTHER_FIELDS_VERSION, 1);
-        otherFields.put(PNF_LAST_SERVICE_DATE, System.currentTimeMillis());
-        otherFields.put(PNF_MANUFACTURE_DATE, System.currentTimeMillis());
-
-        return otherFields;
-    }
 }
index b4eda0a..2300d64 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 package org.onap.pnfsimulator.netconfmonitor;
 
 import com.tailf.jnc.JNCException;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import java.io.IOException;
+import java.util.TimerTask;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationCache;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationReader;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationWriter;
-
-import java.io.IOException;
-import java.util.TimerTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NetconfConfigurationCheckingTask extends TimerTask {
-    private static final Logger LOGGER = LogManager.getLogger(NetconfConfigurationCheckingTask.class);
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NetconfConfigurationCheckingTask.class);
 
     private final NetconfConfigurationReader reader;
     private final NetconfConfigurationWriter writer;
@@ -47,16 +47,15 @@ public class NetconfConfigurationCheckingTask extends TimerTask {
 
     @Override
     public void run() {
-        String currentConfiguration = "";
         try {
-            currentConfiguration = reader.read();
-        } catch (IOException|JNCException e) {
-            LOGGER.info("Error during configuration reading: {}", e.getMessage());
-        }
-        if (!currentConfiguration.equals(cache.getConfiguration())) {
-            LOGGER.info("Configuration has changed, new configuration:\n\n{}", currentConfiguration);
-            writer.writeToFile(currentConfiguration);
-            cache.update(currentConfiguration);
+            String currentConfiguration = reader.read();
+            if (!currentConfiguration.equals(cache.getConfiguration())) {
+                LOGGER.info("Configuration has changed, new configuration:\n\n{}", currentConfiguration);
+                writer.writeToFile(currentConfiguration);
+                cache.update(currentConfiguration);
+            }
+        } catch (IOException | JNCException e) {
+            LOGGER.warn("Error during configuration reading: {}", e.getMessage());
         }
     }
 }
index c4d6198..0e7ab25 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 package org.onap.pnfsimulator.netconfmonitor;
 
 import com.tailf.jnc.JNCException;
+import java.io.IOException;
+import java.util.Timer;
+import javax.annotation.PostConstruct;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationCache;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationReader;
 import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.PostConstruct;
-import java.io.IOException;
-import java.util.Timer;
-
 @Service
 public class NetconfMonitorService {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NetconfMonitorService.class);
     private static final long timePeriod = 1000L;
     private static final long startDelay = 0;
 
@@ -53,15 +55,19 @@ public class NetconfMonitorService {
     }
 
     @PostConstruct
-    public void start() throws IOException, JNCException {
+    public void start() {
         setStartConfiguration();
-        NetconfConfigurationCheckingTask task =  new NetconfConfigurationCheckingTask(reader, writer, cache);
+        NetconfConfigurationCheckingTask task = new NetconfConfigurationCheckingTask(reader, writer, cache);
         timer.scheduleAtFixedRate(task, startDelay, timePeriod);
     }
 
-    private void setStartConfiguration() throws IOException, JNCException {
-        String configuration = reader.read();
-        writer.writeToFile(configuration);
-        cache.update(configuration);
+    private void setStartConfiguration() {
+        try {
+            String configuration = reader.read();
+            writer.writeToFile(configuration);
+            cache.update(configuration);
+        } catch (IOException | JNCException e) {
+            LOGGER.warn("Error during configuration reading: {}", e.getMessage());
+        }
     }
 }
index 82ea85a..b0965d4 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -22,19 +22,24 @@ package org.onap.pnfsimulator.netconfmonitor;
 
 import com.tailf.jnc.JNCException;
 import com.tailf.jnc.NetconfSession;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.onap.pnfsimulator.netconfmonitor.netconf.*;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
+import com.tailf.jnc.SSHConnection;
+import com.tailf.jnc.SSHSession;
 import java.io.IOException;
 import java.util.Map;
 import java.util.Timer;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationCache;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationReader;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationWriter;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConnectionParams;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 
 @Configuration
 public class NetconfMonitorServiceConfiguration {
-    private static final Logger LOGGER = LogManager.getLogger(NetconfMonitorServiceConfiguration.class);
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NetconfMonitorServiceConfiguration.class);
     private static final Map<String, String> enviroment = System.getenv();
 
     private static final String LOG_PATH = "/var/log";
@@ -44,7 +49,7 @@ public class NetconfMonitorServiceConfiguration {
     private static final String NETCONF_MODEL = "NETCONF_MODEL";
     private static final String NETCONF_MAIN_CONTAINER = "NETCONF_MAIN_CONTAINER";
 
-    private static final String DEFAULT_NETCONF_ADDRESS = "netopeer";
+    private static final String DEFAULT_NETCONF_ADDRESS = "localhost";
     private static final int DEFAULT_NETCONF_PORT = 830;
     private static final String DEFAULT_NETCONF_MODEL = "pnf-simulator";
     private static final String DEFAULT_NETCONF_MAIN_CONTAINER = "config";
@@ -64,12 +69,18 @@ public class NetconfMonitorServiceConfiguration {
 
     @Bean
     public NetconfConfigurationReader configurationReader() throws IOException, JNCException {
-        NetconfConnectionParams params = createConnectionParams();
+        NetconfConnectionParams params = resolveConnectionParams();
         LOGGER.info("Configuration params are : {}", params);
-        NetconfSession session = NetconfSessionFactory.create(params);
+        NetconfSession session = createNetconfSession(params);
         return new NetconfConfigurationReader(session, buildModelPath());
     }
 
+    NetconfSession createNetconfSession(NetconfConnectionParams params) throws IOException, JNCException {
+        SSHConnection sshConnection = new SSHConnection(params.address, params.port);
+        sshConnection.authenticateWithPassword(params.user, params.password);
+        return new NetconfSession( new SSHSession(sshConnection));
+    }
+
     @Bean
     public NetconfConfigurationWriter netconfConfigurationWriter() {
         return new NetconfConfigurationWriter(LOG_PATH);
@@ -77,22 +88,24 @@ public class NetconfMonitorServiceConfiguration {
 
     private String buildModelPath() {
         return String.format("/%s:%s",
-                enviroment.getOrDefault(NETCONF_MODEL, DEFAULT_NETCONF_MODEL),
-                enviroment.getOrDefault(NETCONF_MAIN_CONTAINER, DEFAULT_NETCONF_MAIN_CONTAINER));
+            enviroment.getOrDefault(NETCONF_MODEL, DEFAULT_NETCONF_MODEL),
+            enviroment.getOrDefault(NETCONF_MAIN_CONTAINER, DEFAULT_NETCONF_MAIN_CONTAINER));
     }
 
-    private NetconfConnectionParams createConnectionParams() {
+    NetconfConnectionParams resolveConnectionParams() {
         return new NetconfConnectionParams(
-                enviroment.getOrDefault(NETCONF_ADDRESS, DEFAULT_NETCONF_ADDRESS),
-                resolveNetconfPort(),
-                DEFAULT_NETCONF_USER,
-                DEFAULT_NETCONF_PASSWORD);
+            enviroment.getOrDefault(NETCONF_ADDRESS, DEFAULT_NETCONF_ADDRESS),
+            resolveNetconfPort(),
+            DEFAULT_NETCONF_USER,
+            DEFAULT_NETCONF_PASSWORD);
     }
 
     private int resolveNetconfPort() {
         try {
             return Integer.parseInt(enviroment.get(NETCONF_PORT));
         } catch (NumberFormatException e) {
+            LOGGER.warn("Invalid netconf port: {}. Default netconf port {} is set.", e.getMessage(),
+                DEFAULT_NETCONF_PORT);
             return DEFAULT_NETCONF_PORT;
         }
     }
index 8202346..3972184 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -21,6 +21,7 @@
 package org.onap.pnfsimulator.netconfmonitor.netconf;
 
 public class NetconfConfigurationCache {
+
     private String configuration = "";
 
     public String getConfiguration() {
index e897925..593598e 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -22,10 +22,10 @@ package org.onap.pnfsimulator.netconfmonitor.netconf;
 
 import com.tailf.jnc.JNCException;
 import com.tailf.jnc.NetconfSession;
-
 import java.io.IOException;
 
 public class NetconfConfigurationReader {
+
     private final NetconfSession session;
     private final String netconfModelPath;
 
index 4c3d53e..4003079 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.netconfmonitor.netconf;
 
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
 import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import org.onap.pnfsimulator.rest.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NetconfConfigurationWriter {
-    private static final Logger LOGGER = LogManager.getLogger(NetconfConfigurationWriter.class);
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NetconfConfigurationWriter.class);
     private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
     private String pathToLog;
 
@@ -45,7 +45,7 @@ public class NetconfConfigurationWriter {
             writer.write(configuration);
             LOGGER.info("Configuration wrote to file {}/{} ", pathToLog, fileName);
         } catch (IOException e) {
-            LOGGER.info("Failed to write configuration to file: {}", e.getMessage());
+            LOGGER.warn("Failed to write configuration to file: {}", e.getMessage());
         }
     }
 }
index 3130d2b..1d6eb89 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -21,6 +21,7 @@
 package org.onap.pnfsimulator.netconfmonitor.netconf;
 
 public class NetconfConnectionParams {
+
     public final String address;
     public final int port;
     public final String user;
@@ -36,9 +37,9 @@ public class NetconfConnectionParams {
     @Override
     public String toString() {
         return String.format("NetconfConnectionParams{address=%s, port=%d, user=%s, password=%s}",
-                address,
-                port,
-                user,
-                password);
+            address,
+            port,
+            user,
+            password);
     }
 }
\ No newline at end of file
index 46a63a2..3b275a6 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.rest;
 
+import static org.onap.pnfsimulator.logging.MDCVariables.INSTANCE_UUID;
+import static org.onap.pnfsimulator.logging.MDCVariables.INVOCATION_ID;
+import static org.onap.pnfsimulator.logging.MDCVariables.REQUEST_ID;
+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.rest.util.ResponseBuilder.MESSAGE;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.REMAINING_TIME;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.SIMULATOR_STATUS;
 import static org.onap.pnfsimulator.rest.util.ResponseBuilder.TIMESTAMP;
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
+import static org.springframework.http.HttpStatus.OK;
 
+import java.io.IOException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.util.UUID;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.onap.pnfsimulator.message.MessageConstants;
-import org.onap.pnfsimulator.message.MessageProvider;
 import org.onap.pnfsimulator.rest.util.DateUtil;
 import org.onap.pnfsimulator.rest.util.ResponseBuilder;
 import org.onap.pnfsimulator.simulator.Simulator;
 import org.onap.pnfsimulator.simulator.SimulatorFactory;
+import org.onap.pnfsimulator.simulator.validation.JSONValidator;
 import org.onap.pnfsimulator.simulator.validation.ValidationException;
-import org.springframework.http.HttpStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -52,87 +70,104 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/simulator")
 public class SimulatorController {
 
-    private static final Logger LOGGER = LogManager.getLogger(Simulator.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(Simulator.class);
     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;
 
-    @PostMapping("start")
-    public ResponseEntity start(@RequestBody String message) {
+    @Autowired
+    public SimulatorController(JSONValidator validator, SimulatorFactory factory) {
+        this.validator = validator;
+        this.factory = factory;
+    }
 
-        if (simulator != null && simulator.isAlive()) {
+    @PostMapping("start")
+    public ResponseEntity start(@RequestHeader HttpHeaders headers, @RequestBody String message) {
+        MDC.put(REQUEST_ID, headers.getFirst(X_ONAP_REQUEST_ID));
+        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");
+
+        if (isSimulatorRunning()) {
+            MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
             return ResponseBuilder
-                .status(HttpStatus.BAD_REQUEST.value())
+                .status(BAD_REQUEST)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Cannot start simulator since it's already running")
                 .build();
         }
 
         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 = SimulatorFactory
-                .usingMessageProvider(new MessageProvider())
-                .create(simulatorParams, messageParams);
-
+            simulator = factory.create(simulatorParams, messageParams);
             simulator.start();
 
-        } catch (JSONException e) {
+            MDC.put(RESPONSE_CODE, OK.toString());
+            return ResponseBuilder
+                .status(OK)
+                .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                .put(MESSAGE, "Simulator started")
+                .build();
 
-            LOGGER.error("Cannot start simulator, invalid json format: " + e.getMessage());
-            LOGGER.debug("Received json has invalid format:\n" + message);
+        } catch (JSONException e) {
+            MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
+            LOGGER.warn("Cannot start simulator, invalid json format: {}", e.getMessage());
+            LOGGER.debug("Received json has invalid format", e);
             return ResponseBuilder
-                .status(HttpStatus.BAD_REQUEST.value())
+                .status(BAD_REQUEST)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Cannot start simulator, invalid json format")
                 .build();
 
-        } catch (ValidationException e) {
-
-            LOGGER.error("Cannot start simulator - missing mandatory parameters");
+        } catch (ProcessingException | ValidationException | IOException e) {
+            MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
+            LOGGER.warn("Json validation failed: {}", e.getMessage());
             return ResponseBuilder
-                .status(HttpStatus.BAD_REQUEST.value())
+                .status(BAD_REQUEST)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
-                .put(MESSAGE, e.getMessage())
+                .put(MESSAGE, "Cannot start simulator - Json format is not compatible with schema definitions")
                 .build();
 
-        } catch (RuntimeException e) {
-
+        } catch (Exception e) {
+            MDC.put(RESPONSE_CODE, INTERNAL_SERVER_ERROR.toString());
             LOGGER.error("Cannot start simulator - unexpected exception", e);
             return ResponseBuilder
-                .status(HttpStatus.INTERNAL_SERVER_ERROR.value())
+                .status(INTERNAL_SERVER_ERROR)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Unexpected exception: " + e.getMessage())
                 .build();
         }
-
-        return ResponseBuilder
-            .status(HttpStatus.OK.value())
-            .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
-            .put(MESSAGE, "Simulator started")
-            .build();
+        finally {
+            MDC.clear();
+        }
     }
 
     @GetMapping("status")
     public ResponseEntity status() {
-
-        if (simulator != null && simulator.isAlive()) {
-
+        if (isSimulatorRunning()) {
             ResponseBuilder responseBuilder = ResponseBuilder
-                .status(HttpStatus.OK.value())
+                .status(OK)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(SIMULATOR_STATUS, "RUNNING");
 
-            if (!simulator.isEndless()) {
-                responseBuilder.put(REMAINING_TIME, simulator.getRemainingTime());
-            }
-            return responseBuilder.build();
+            return !simulator.isEndless() ?
+                responseBuilder
+                    .put(REMAINING_TIME, simulator.getRemainingTime())
+                    .build() :
+                responseBuilder
+                    .build();
         } else {
             return ResponseBuilder
-                .status(HttpStatus.OK.value())
+                .status(OK)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(SIMULATOR_STATUS, "NOT RUNNING")
                 .build();
@@ -141,22 +176,25 @@ public class SimulatorController {
 
     @PostMapping("stop")
     public ResponseEntity stop() {
-
-        if (simulator != null && simulator.isAlive()) {
+        if (isSimulatorRunning()) {
             simulator.interrupt();
 
             return ResponseBuilder
-                .status(HttpStatus.OK.value())
+                .status(OK)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Simulator successfully stopped")
                 .build();
         } else {
             return ResponseBuilder
-                .status(HttpStatus.BAD_REQUEST.value())
+                .status(BAD_REQUEST)
                 .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
                 .put(MESSAGE, "Cannot stop simulator, because it's not running")
                 .build();
         }
     }
+
+    private boolean isSimulatorRunning() {
+        return simulator != null && simulator.isAlive();
+    }
 }
 
index 73443d0..284d589 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
index 31d22a7..98f4588 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -22,6 +22,7 @@ package org.onap.pnfsimulator.rest.util;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 
 public class ResponseBuilder {
@@ -31,16 +32,16 @@ public class ResponseBuilder {
     public static final String SIMULATOR_STATUS = "simulatorStatus";
     public static final String REMAINING_TIME = "remainingTime";
 
-    private int statusCode;
+    private HttpStatus httpStatus;
     private Map<String, Object> body = new LinkedHashMap<>();
 
-    private ResponseBuilder(int statusCode) {
-        this.statusCode = statusCode;
+    private ResponseBuilder(HttpStatus httpStatus) {
+        this.httpStatus = httpStatus;
     }
 
-    public static ResponseBuilder status(int statusCode) {
+    public static ResponseBuilder status(HttpStatus httpStatus) {
 
-        return new ResponseBuilder(statusCode);
+        return new ResponseBuilder(httpStatus);
     }
 
     public ResponseBuilder put(String key, Object value) {
@@ -52,10 +53,10 @@ public class ResponseBuilder {
     public ResponseEntity build() {
 
         if (body.isEmpty()) {
-            return ResponseEntity.status(statusCode).build();
+            return ResponseEntity.status(httpStatus).build();
         }
 
-        return ResponseEntity.status(statusCode).body(body);
+        return ResponseEntity.status(httpStatus).body(body);
     }
 
 }
index 0c713e1..8543117 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -22,49 +22,61 @@ package org.onap.pnfsimulator.simulator;
 
 import java.time.Duration;
 import java.time.Instant;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import java.util.Map;
 import org.json.JSONObject;
 import org.onap.pnfsimulator.simulator.client.HttpClientAdapter;
+import org.onap.pnfsimulator.simulator.client.HttpClientAdapterImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
 
 public class Simulator extends Thread {
 
-    private static final Logger LOGGER = LogManager.getLogger(Simulator.class);
-    private HttpClientAdapter clientProvider;
+    private static final Logger LOGGER = LoggerFactory.getLogger(Simulator.class);
+    private final Marker EXIT = MarkerFactory.getMarker("EXIT");
+    private Map<String,String> contextMap = MDC.getCopyOfContextMap();
+    private boolean isEndless;
+    private String vesUrl;
+    private HttpClientAdapter httpClient;
     private JSONObject messageBody;
-    private Instant endTime;
     private Duration duration;
     private Duration interval;
-    private final boolean isEndless;
-
-    public Simulator(String vesServerUrl, JSONObject messageBody, Duration duration, Duration interval) {
-        this.messageBody = messageBody;
-        this.duration = duration;
-        this.interval = interval;
-        this.clientProvider = new HttpClientAdapter(vesServerUrl);
-        this.isEndless = duration.getSeconds() == 0;
+    private Instant endTime;
+
+    private Simulator() {
     }
 
-    public void run() {
-        LOGGER.info("Simulation started - duration: " + getDuration() + ", interval: {}s", interval.getSeconds());
+    public static Builder builder() {
+        return new Builder();
+    }
 
+    public void run() {
+        setMdcContextMap(contextMap);
+        LOGGER.info("Simulation started - duration: {}, interval: {}s", getDuration(), interval.getSeconds());
         endTime = Instant.now().plus(duration);
-        boolean isEndless = isEndless();
         while (isEndless || runningTimeNotExceeded()) {
             try {
-                LOGGER.debug("Message to be sent:\n" + messageBody.toString(4));
-                clientProvider.sendMsg(messageBody.toString());
+                LOGGER.debug("Message to be sent:\n" + getMessage());
+                httpClient.send(messageBody.toString(), vesUrl);
                 Thread.sleep(interval.toMillis());
             } catch (InterruptedException e) {
                 LOGGER.info("Simulation interrupted");
                 return;
             }
         }
-        LOGGER.info("Simulation finished");
+        LOGGER.info(EXIT, "Simulation finished");
+        MDC.clear();
     }
 
-    public boolean isEndless() {
-        return isEndless;
+    private void setMdcContextMap(Map<String,String> mdcContextMap) {
+        if(mdcContextMap != null)
+            MDC.setContextMap(mdcContextMap);
+    }
+
+    private String getMessage() {
+        return messageBody.toString(4);
     }
 
     private String getDuration() {
@@ -75,10 +87,65 @@ public class Simulator extends Thread {
         return Instant.now().isBefore(endTime);
     }
 
-    public long getRemainingTime(){
+    public boolean isEndless() {
+        return isEndless;
+    }
+
+    public long getRemainingTime() {
         return Duration.between(Instant.now(), endTime).getSeconds();
     }
-    public String getMessage(){
-        return messageBody.toString(4);
+
+    public static class Builder {
+
+        private String vesUrl;
+        private HttpClientAdapter httpClient;
+        private JSONObject messageBody;
+        private Duration duration;
+        private Duration interval;
+
+        private Builder() {
+            this.vesUrl = "";
+            this.httpClient = new HttpClientAdapterImpl();
+            this.messageBody = new JSONObject();
+            this.duration = Duration.ZERO;
+            this.interval = Duration.ZERO;
+        }
+
+        public Builder withVesUrl(String vesUrl) {
+            this.vesUrl = vesUrl;
+            return this;
+        }
+
+        public Builder withCustomHttpClientAdapter(HttpClientAdapter httpClient) {
+            this.httpClient = httpClient;
+            return this;
+        }
+
+        public Builder withMessageBody(JSONObject messageBody) {
+            this.messageBody = messageBody;
+            return this;
+        }
+
+        public Builder withDuration(Duration duration) {
+            this.duration = duration;
+            return this;
+        }
+
+
+        public Builder withInterval(Duration interval) {
+            this.interval = interval;
+            return this;
+        }
+
+        public Simulator build() {
+            Simulator simulator = new Simulator();
+            simulator.vesUrl = this.vesUrl;
+            simulator.httpClient = this.httpClient;
+            simulator.messageBody = this.messageBody;
+            simulator.duration = this.duration;
+            simulator.interval = this.interval;
+            simulator.isEndless = duration.equals(Duration.ZERO);
+            return simulator;
+        }
     }
 }
\ No newline at end of file
index 7f1b0a8..3948644 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.simulator;
 
-import static java.lang.Integer.*;
+import static java.lang.Integer.parseInt;
 import static org.onap.pnfsimulator.message.MessageConstants.MESSAGE_INTERVAL;
 import static org.onap.pnfsimulator.message.MessageConstants.TEST_DURATION;
 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 org.json.JSONObject;
 import org.onap.pnfsimulator.message.MessageProvider;
-import org.onap.pnfsimulator.simulator.validation.ParamsValidator;
+import org.onap.pnfsimulator.simulator.validation.JSONValidator;
 import org.onap.pnfsimulator.simulator.validation.ValidationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
+@Service
 public class SimulatorFactory {
 
-    private MessageProvider messageProvider;
+    private static final String DEFAULT_OUTPUT_SCHEMA_PATH = "json_schema/output_validator_ves_schema_30.0.1.json";
 
-    public static SimulatorFactory usingMessageProvider(MessageProvider messageProvider) {
-        return new SimulatorFactory(messageProvider);
-    }
+    private MessageProvider messageProvider;
+    private JSONValidator validator;
 
-    private SimulatorFactory(MessageProvider messageProvider) {
+    @Autowired
+    public SimulatorFactory(MessageProvider messageProvider, JSONValidator validator) {
         this.messageProvider = messageProvider;
+        this.validator = validator;
     }
 
-    public Simulator create(JSONObject simulatorParams, JSONObject messageParams) throws ValidationException {
-
-        ParamsValidator.forParams(simulatorParams, messageParams).validate();
-
+    public Simulator create(JSONObject simulatorParams, JSONObject messageParams)
+        throws ProcessingException, IOException, ValidationException {
         Duration duration = Duration.ofSeconds(parseInt(simulatorParams.getString(TEST_DURATION)));
         Duration interval = Duration.ofSeconds(parseInt(simulatorParams.getString(MESSAGE_INTERVAL)));
-        String vesServerUrl = simulatorParams.getString(VES_SERVER_URL);
+        String vesUrl = simulatorParams.getString(VES_SERVER_URL);
 
         JSONObject messageBody = messageProvider.createMessage(messageParams);
-        return new Simulator(vesServerUrl, messageBody, duration, interval);
+        validator.validate(messageBody.toString(), DEFAULT_OUTPUT_SCHEMA_PATH);
+
+        return Simulator.builder()
+            .withVesUrl(vesUrl)
+            .withDuration(duration)
+            .withInterval(interval)
+            .withMessageBody(messageBody)
+            .build();
     }
 }
\ No newline at end of file
index 35f0b68..47f2e31 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.simulator.client;
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+public interface HttpClientAdapter {
 
-public class HttpClientAdapter {
-
-    private static final Logger LOGGER = LogManager.getLogger(HttpClientAdapter.class);
-    private static final String CONTENT_TYPE = "Content-Type";
-    private static final String APPLICATION_JSON = "application/json";
-
-    private HttpClient client;
-    private String url;
-
-    public HttpClientAdapter(String url) {
-
-        RequestConfig config = RequestConfig.custom()
-            .setConnectTimeout(1000)
-            .setConnectionRequestTimeout(1000)
-            .setSocketTimeout(1000)
-            .build();
-
-        this.client = HttpClientBuilder
-            .create()
-            .setDefaultRequestConfig(config)
-            .build();
-
-        this.url = url;
-    }
-
-    public void sendMsg(String content) {
-        try {
-            HttpPost request = createRequest(content);
-            HttpResponse response = client.execute(request);
-            LOGGER.info("MESSAGE SENT, VES RESPONSE CODE: {}", response.getStatusLine());
-        } catch (IOException e) {
-            LOGGER.info("ERROR SENDING MESSAGE TO VES: {}", e.getMessage());
-        }
-    }
-
-    private HttpPost createRequest(String content) throws UnsupportedEncodingException {
-        StringEntity stringEntity = new StringEntity(content);
-        HttpPost request = new HttpPost(url);
-        request.addHeader(CONTENT_TYPE, APPLICATION_JSON);
-        request.setEntity(stringEntity);
-        return request;
-    }
+    void send(String content, String url);
 }
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java
new file mode 100644 (file)
index 0000000..db1ea15
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator.client;
+
+import static org.onap.pnfsimulator.logging.MDCVariables.REQUEST_ID;
+import static org.onap.pnfsimulator.logging.MDCVariables.X_INVOCATION_ID;
+import static org.onap.pnfsimulator.logging.MDCVariables.X_ONAP_REQUEST_ID;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.UUID;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+public class HttpClientAdapterImpl implements HttpClientAdapter {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientAdapterImpl.class);
+    private static final String CONTENT_TYPE = "Content-Type";
+    private static final String APPLICATION_JSON = "application/json";
+    private final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
+    private static final RequestConfig CONFIG = RequestConfig.custom()
+        .setConnectTimeout(1000)
+        .setConnectionRequestTimeout(1000)
+        .setSocketTimeout(1000)
+        .build();
+
+    private HttpClient client;
+
+    public HttpClientAdapterImpl() {
+        this.client = HttpClientBuilder
+            .create()
+            .setDefaultRequestConfig(CONFIG)
+            .build();
+    }
+
+    @Override
+    public void send(String content, String url) {
+        try {
+            HttpPost request = createRequest(content, url);
+            HttpResponse response = client.execute(request);
+            LOGGER.info(INVOKE, "Message sent, ves response code: {}", response.getStatusLine());
+        } catch (IOException e) {
+            LOGGER.warn("Error sending message to ves: {}", e.getMessage());
+        }
+    }
+
+    HttpClientAdapterImpl(HttpClient client) {
+        this.client = client;
+    }
+
+    private HttpPost createRequest(String content, String url) throws UnsupportedEncodingException {
+        HttpPost request = new HttpPost(url);
+        StringEntity stringEntity = new StringEntity(content);
+        request.addHeader(CONTENT_TYPE, APPLICATION_JSON);
+        request.addHeader(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID));
+        request.addHeader(X_INVOCATION_ID, UUID.randomUUID().toString());
+        request.setEntity(stringEntity);
+        return request;
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/JSONValidator.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/JSONValidator.java
new file mode 100644 (file)
index 0000000..89135f9
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator.validation;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.fge.jackson.JsonLoader;
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import com.github.fge.jsonschema.core.report.LogLevel;
+import com.github.fge.jsonschema.core.report.ProcessingMessage;
+import com.github.fge.jsonschema.core.report.ProcessingReport;
+import com.github.fge.jsonschema.main.JsonSchema;
+import com.github.fge.jsonschema.main.JsonSchemaFactory;
+import com.google.gson.JsonParser;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+public class JSONValidator {
+
+    public void validate(String data, String jsonSchemaPath)
+        throws ValidationException, ProcessingException, IOException {
+        String jsonSchema = readJsonSchemaAsString(jsonSchemaPath);
+        JsonNode jsonData = JsonLoader.fromString(data);
+        ProcessingReport report = createJsonSchema(jsonSchema).validate(jsonData);
+
+        if (!report.isSuccess()) {
+            throw new ValidationException(constructValidationErrors(report));
+        }
+    }
+
+    private String readJsonSchemaAsString(String schemaPath) throws IOException {
+        try (FileReader reader = new FileReader(schemaPath)) {
+            return new JsonParser().parse(reader).toString();
+        }
+    }
+
+    private JsonSchema createJsonSchema(String schema) throws ProcessingException, IOException {
+        return JsonSchemaFactory.byDefault().getJsonSchema(JsonLoader.fromString(schema));
+    }
+
+    private String constructValidationErrors(ProcessingReport report) {
+        return StreamSupport.stream(report.spliterator(), false)
+            .filter(entry -> entry.getLogLevel() == LogLevel.ERROR)
+            .map(ProcessingMessage::getMessage)
+            .collect(Collectors.joining("\n"));
+    }
+}
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/ParamsValidator.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/validation/ParamsValidator.java
deleted file mode 100644 (file)
index 3c84594..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.integration
- * ================================================================================
- * Copyright (C) 2018 NOKIA 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.simulator.validation;
-
-import static org.onap.pnfsimulator.message.MessageConstants.MESSAGE_INTERVAL;
-import static org.onap.pnfsimulator.message.MessageConstants.PNF_OAM_IPV4_ADDRESS;
-import static org.onap.pnfsimulator.message.MessageConstants.PNF_OAM_IPV6_ADDRESS;
-import static org.onap.pnfsimulator.message.MessageConstants.PNF_SERIAL_NUMBER;
-import static org.onap.pnfsimulator.message.MessageConstants.PNF_VENDOR_NAME;
-import static org.onap.pnfsimulator.message.MessageConstants.TEST_DURATION;
-import static org.onap.pnfsimulator.message.MessageConstants.VES_SERVER_URL;
-
-import com.google.common.collect.ImmutableMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.function.BiPredicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.commons.lang3.StringUtils;
-import org.json.JSONObject;
-
-
-public class ParamsValidator {
-
-    private final static String MISSING_PARAMS_MESSAGE = "Following mandatory params are missing:\n";
-
-    private final Map<String, BiPredicate<String, JSONObject>> simulatorParamsValidators = ImmutableMap
-        .<String, BiPredicate<String, JSONObject>>builder()
-        .put(VES_SERVER_URL, this::isDefined)
-        .put(TEST_DURATION, this::isNumeric)
-        .put(MESSAGE_INTERVAL, this::isNumeric)
-        .build();
-
-    private final Map<String, BiPredicate<String, JSONObject>> messageParamsValidators = ImmutableMap
-        .<String, BiPredicate<String, JSONObject>>builder()
-        .put(PNF_SERIAL_NUMBER, this::isDefined)
-        .put(PNF_VENDOR_NAME, this::isDefined)
-        .put(PNF_OAM_IPV4_ADDRESS, this::isDefined)
-        .put(PNF_OAM_IPV6_ADDRESS, this::isDefined)
-        .build();
-
-    private JSONObject simulatorParams;
-    private JSONObject messageParams;
-
-    private ParamsValidator(JSONObject simulatorParams, JSONObject messageParams) {
-        this.simulatorParams = simulatorParams;
-        this.messageParams = messageParams;
-    }
-
-    public static ParamsValidator forParams(JSONObject simulatorParams, JSONObject messageParams) {
-        return new ParamsValidator(simulatorParams, messageParams);
-    }
-
-    public void validate() throws ValidationException {
-
-        Stream<String> missingSimulatorParams = simulatorParamsValidators
-            .entrySet()
-            .stream()
-            .filter(entry -> !entry.getValue().test(entry.getKey(), simulatorParams))
-            .map(Entry::getKey);
-
-        Stream<String> missingMessageParams = messageParamsValidators
-            .entrySet()
-            .stream()
-            .filter(entry -> !entry.getValue().test(entry.getKey(), messageParams))
-            .map(Entry::getKey);
-
-        List<String> missingParams = Stream
-            .concat(missingMessageParams, missingSimulatorParams)
-            .collect(Collectors.toList());
-
-        resolveMissingIP(missingParams);
-
-        if (!missingParams.isEmpty()) {
-            throw new ValidationException(constructMessage(missingParams));
-        }
-    }
-
-    private String constructMessage(List<String> missingParams) {
-
-        return MISSING_PARAMS_MESSAGE + missingParams
-            .stream()
-            .collect(Collectors.joining("\n"));
-    }
-
-    private boolean isNumeric(String param, JSONObject container) {
-        return isDefined(param, container) && StringUtils.isNumeric(container.getString(param));
-    }
-
-    private boolean isDefined(String param, JSONObject container) {
-
-        return container.has(param) && !container.getString(param).isEmpty();
-    }
-
-    private void resolveMissingIP(List<String> missingParams) {
-        // if only one IP is missing clear the error
-        if (!(missingParams.contains(PNF_OAM_IPV4_ADDRESS) && missingParams.contains(PNF_OAM_IPV6_ADDRESS))) {
-            missingParams.remove(PNF_OAM_IPV4_ADDRESS);
-            missingParams.remove(PNF_OAM_IPV6_ADDRESS);
-        }
-    }
-}
index 086997f..a934917 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
diff --git a/test/mocks/pnfsimulator/src/main/resources/log4j2.xml b/test/mocks/pnfsimulator/src/main/resources/log4j2.xml
deleted file mode 100644 (file)
index d3941d3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN">
-    <Properties>
-        <Property name="log4j.logLevel" value="info"/>
-   </Properties>
-    <Appenders>
-        <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout pattern="%d{ISO8601} +%r [%t] %-5p %c %x - %m%n"/>
-        </Console>
-        <Console name="ColorConsole" target="SYSTEM_OUT">
-            <PatternLayout
-                    pattern="%style{%d{ISO8601} +%r}{yellow} %highlight{%-5level}{STYLE=Logback} %style{[%t]}{yellow} %style{%c{1.}}{BRIGHT} %message%n"/>
-        </Console>
-        <File name="File" fileName="/var/log/pnfsimulator.log">
-            <PatternLayout pattern="%d{ISO8601} +%r [%t] %-5p %c %x - %m%n"/>
-        </File>
-    </Appenders>
-    <Loggers>
-        <Root level="${sys:log4j.logLevel}">
-            <AppenderRef ref="File"/>
-            <AppenderRef ref="ColorConsole"/>
-        </Root>
-    </Loggers>
-</Configuration>
diff --git a/test/mocks/pnfsimulator/src/main/resources/logback.xml b/test/mocks/pnfsimulator/src/main/resources/logback.xml
new file mode 100644 (file)
index 0000000..de34b9a
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration complete="true" compact="true">
+
+  <Property name="outputFilename" value="pnfsimulator_output"/>
+  <Property name="log-path" value="/var/log/ONAP/pnfsimulator"/>
+  <Property name="archive" value="/var/log/ONAP/pnfsimulator/archive"/>
+  <property name="maxFileSize" value="50MB"/>
+  <property name="maxHistory" value="30"/>
+  <property name="totalSizeCap" value="10GB"/>
+
+  <appender name="Console" target="SYSTEM_OUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <Pattern>%nopexception%logger
+        |%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+        |%level
+        |%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+        |%thread
+        |%n</Pattern>
+    </encoder>
+  </appender>
+
+  <appender name="ROLLING-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <encoder>
+      <pattern>%nopexception%logger
+        |%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+        |%level
+        |%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+        |%thread
+        |%n</pattern>
+    </encoder>
+    <File>${log-path}/${outputFilename}.log</File>
+    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+      <FileNamePattern>${archive}/${outputFilename}.%d{yyyy-MM-dd}.%i.log.zip</FileNamePattern>
+      <MaxFileSize>${maxFileSize}</MaxFileSize>
+      <MaxHistory>${maxHistory}</MaxHistory>
+      <TotalSizeCap>${totalSizeCap}</TotalSizeCap>
+    </rollingPolicy>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="Console" />
+    <appender-ref ref="ROLLING-FILE" />
+  </root>
+</Configuration>
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java
new file mode 100644 (file)
index 0000000..bc3d17f
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.message;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.onap.pnfsimulator.message.MessageConstants.*;
+
+import org.json.JSONObject;
+import org.junit.jupiter.api.Test;
+
+public class JSONObjectFactoryTest {
+
+    @Test
+    public void generateConstantCommonEventHeader_shouldCreateProperly(){
+        JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
+        assertEquals(10,commonEventHeader.toMap().size());
+        assertTrue(commonEventHeader.has(DOMAIN));
+        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);
+        assertEquals(commonEventHeader.get(VES_EVENT_LISTENER_VERSION),VES_EVENT_LISTENER_VERSION_NUMBER);
+    }
+
+    @Test
+    public void generateConstantPnfRegistrationFields_shouldCreateProperly(){
+        JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        assertEquals(3,pnfRegistrationFields.toMap().size());
+        assertTrue(pnfRegistrationFields.has(PNF_REGISTRATION_FIELDS_VERSION));
+        assertEquals(pnfRegistrationFields.get(PNF_REGISTRATION_FIELDS_VERSION), PNF_REGISTRATION_FIELDS_VERSION_VALUE);
+        assertTrue(pnfRegistrationFields.has(PNF_LAST_SERVICE_DATE));
+        assertTrue(pnfRegistrationFields.has(PNF_MANUFACTURE_DATE));
+    }
+
+    @Test
+    public void generateEventId_shouldCreateProperly(){
+        String eventId = JSONObjectFactory.generateEventId();
+        assertTrue(eventId.startsWith("registration_"));
+    }
+
+}
index 41df397..3d1f253 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
@@ -24,22 +24,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 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.DOMAIN;
-import static org.onap.pnfsimulator.message.MessageConstants.EVENT_ID;
-import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE;
-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.OTHER_FIELDS;
-import static org.onap.pnfsimulator.message.MessageConstants.OTHER_FIELDS_VERSION;
-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.PRIORITY;
-import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE;
-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.EVENT;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
 
-import java.util.UUID;
 import org.json.JSONObject;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -47,7 +34,7 @@ import org.junit.jupiter.api.Test;
 public class MessageProviderTest {
 
     private static final String testParamsJson =
-        "{\"key1\": \"val1\",\"key2\": \"val2\",\"pnfKey3\": \"pnfVal3\",\"key4\": \"val4\"}";
+        "{\"key1\": \"val1\",\"key2\": \"val2\",\"pnf_key3\": \"pnfVal3\",\"key4\": \"val4\"}";
 
     private static MessageProvider messageProvider;
 
@@ -69,19 +56,19 @@ public class MessageProviderTest {
         JSONObject event = message.getJSONObject(EVENT);
 
         JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
-        JSONObject otherFields = event.getJSONObject(OTHER_FIELDS);
+        JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
 
-        JSONObject expectedCommonEventHeader = generateConstantCommonEventHeader();
-        JSONObject expectedOtherFields = generateConstantOtherFields();
+        JSONObject expectedCommonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
+        JSONObject expectedPnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
 
         expectedCommonEventHeader
             .toMap()
             .forEach((key, val) -> assertTrue(commonEventHeader.has(key),
                 () -> String.format("Key %s is not present", key)));
 
-        expectedOtherFields
+        expectedPnfRegistrationFields
             .toMap()
-            .forEach((key, val) -> assertTrue(otherFields.has(key),
+            .forEach((key, val) -> assertTrue(pnfRegistrationFields.has(key),
                 () -> String.format("Key %s is not present", key)));
     }
 
@@ -93,41 +80,12 @@ public class MessageProviderTest {
         JSONObject event = message.getJSONObject(EVENT);
 
         JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
-        JSONObject otherFields = event.getJSONObject(OTHER_FIELDS);
+        JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
 
-        assertEquals("pnfVal3", otherFields.getString("pnfKey3"));
+        assertEquals("pnfVal3", pnfRegistrationFields.getString("key3"));
         assertEquals("val1", commonEventHeader.getString("key1"));
         assertEquals("val2", commonEventHeader.getString("key2"));
         assertEquals("val4", commonEventHeader.getString("key4"));
     }
 
-
-    private JSONObject generateConstantCommonEventHeader() {
-
-        JSONObject commonEventHeader = new JSONObject();
-        long timestamp = System.currentTimeMillis();
-
-        commonEventHeader.put(DOMAIN, "other");
-        commonEventHeader.put(EVENT_ID, UUID.randomUUID() + "-reg");
-        commonEventHeader.put(EVENT_TYPE, "pnfRegistration");
-        commonEventHeader.put(LAST_EPOCH_MICROSEC, timestamp);
-        commonEventHeader.put(PRIORITY, "Normal");
-        commonEventHeader.put(SEQUENCE, 0);
-        commonEventHeader.put(START_EPOCH_MICROSEC, timestamp);
-        commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
-        commonEventHeader.put(VERSION, 3);
-
-        return commonEventHeader;
-    }
-
-    private JSONObject generateConstantOtherFields() {
-        JSONObject otherFields = new JSONObject();
-
-        otherFields.put(OTHER_FIELDS_VERSION, 1);
-        otherFields.put(PNF_LAST_SERVICE_DATE, 1517206400);
-        otherFields.put(PNF_MANUFACTURE_DATE, 1516406400);
-
-        return otherFields;
-    }
-
 }
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java
new file mode 100644 (file)
index 0000000..99cae00
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.netconfmonitor;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.tailf.jnc.JNCException;
+import java.io.IOException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationCache;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationReader;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationWriter;
+
+class NetconfConfigurationCheckingTaskTest {
+
+    private NetconfConfigurationCheckingTask checkingTask;
+
+    @Mock
+    private NetconfConfigurationReader reader;
+    @Mock
+    private NetconfConfigurationWriter writer;
+    @Mock
+    private NetconfConfigurationCache cache;
+
+    @BeforeEach
+    void setup() {
+        MockitoAnnotations.initMocks(this);
+        checkingTask = new NetconfConfigurationCheckingTask(reader, writer, cache);
+    }
+
+    @Test
+    void run_should_update_configuration_when_changed() throws IOException, JNCException {
+        String configuration = "newConfiguration";
+        when(reader.read()).thenReturn(configuration);
+        when(cache.getConfiguration()).thenReturn("oldConfiguration");
+
+        checkingTask.run();
+
+        verify(reader).read();
+        verify(cache).getConfiguration();
+        verify(writer).writeToFile(configuration);
+        verify(cache).update(configuration);
+    }
+
+    @Test
+    void run_should_not_update_configuration_when_same() throws IOException, JNCException {
+        String configuration = "configuration";
+        when(reader.read()).thenReturn(configuration);
+        when(cache.getConfiguration()).thenReturn("configuration");
+
+        checkingTask.run();
+
+        verify(reader).read();
+        verify(cache).getConfiguration();
+        verify(writer, never()).writeToFile(configuration);
+        verify(cache, never()).update(configuration);
+    }
+
+    @Test
+    void run_should_not_take_any_action_when_failed_to_read_configuration() throws IOException, JNCException {
+        when(reader.read()).thenThrow(new IOException());
+
+        checkingTask.run();
+
+        verify(reader).read();
+        verify(cache, never()).getConfiguration();
+        verify(writer, never()).writeToFile(any());
+        verify(cache, never()).update(any());
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java
new file mode 100644 (file)
index 0000000..02b8423
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.netconfmonitor;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import com.tailf.jnc.JNCException;
+import com.tailf.jnc.NetconfSession;
+import java.io.IOException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+
+class NetconfMonitorServiceConfigurationTest {
+
+    private NetconfMonitorServiceConfiguration configuration;
+
+    @Mock
+    private NetconfSession netconfSession;
+
+    @BeforeEach
+    void setup() {
+        netconfSession = mock(NetconfSession.class);
+        configuration = spy(new NetconfMonitorServiceConfiguration());
+    }
+
+    @Test
+    void readNetconfConfiguration() throws IOException, JNCException {
+        doReturn(netconfSession).when(configuration).createNetconfSession(any());
+
+        assertNotNull(configuration.configurationReader());
+        verify(configuration).createNetconfSession(any());
+    }
+
+    @Test
+    void configurationCacheIsNotNull() {
+        assertNotNull(configuration.configurationCache());
+    }
+
+    @Test
+    void netconfConfigurationWriterIsNotNull() {
+        assertNotNull(configuration.netconfConfigurationWriter());
+    }
+
+    @Test
+    void timerIsNotNull() {
+        assertNotNull(configuration.timer());
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java
new file mode 100644 (file)
index 0000000..4f5da33
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.netconfmonitor;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.tailf.jnc.JNCException;
+import java.io.IOException;
+import java.util.Timer;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationCache;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationReader;
+import org.onap.pnfsimulator.netconfmonitor.netconf.NetconfConfigurationWriter;
+
+class NetconfMonitorServiceTest {
+
+    private NetconfMonitorService service;
+
+    @Mock
+    private Timer timer;
+    @Mock
+    private NetconfConfigurationReader reader;
+    @Mock
+    private NetconfConfigurationWriter writer;
+    @Mock
+    private NetconfConfigurationCache cache;
+
+    @BeforeEach
+    void setup() {
+        MockitoAnnotations.initMocks(this);
+        service = new NetconfMonitorService(timer, reader, writer, cache);
+    }
+
+    @Test
+    void startNetconfService() throws IOException, JNCException {
+        when(reader.read()).thenReturn("message");
+        doNothing().when(writer).writeToFile(anyString());
+        doNothing().when(cache).update(anyString());
+
+        service.start();
+
+        verify(cache, times(1)).update(anyString());
+        verify(writer, times(1)).writeToFile(anyString());
+        verify(timer, times(1)).scheduleAtFixedRate(any(), anyLong(), anyLong());
+    }
+}
\ No newline at end of file
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.netconfmonitor.netconf;
 
-import com.tailf.jnc.JNCException;
-import com.tailf.jnc.NetconfSession;
-import com.tailf.jnc.SSHConnection;
-import com.tailf.jnc.SSHSession;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import java.io.IOException;
+import org.junit.jupiter.api.Test;
 
-public final class NetconfSessionFactory {
-    private NetconfSessionFactory() {}
+public class NetconfConfigurationCacheTest {
 
-    public static NetconfSession create(NetconfConnectionParams params) throws IOException, JNCException {
-        SSHConnection sshConnection = new SSHConnection(params.address, params.port);
-        sshConnection.authenticateWithPassword(params.user, params.password);
-        SSHSession sshSession = new SSHSession(sshConnection);
-        return new NetconfSession(sshSession);
+    private static final String CONFIGURATION = "sampleConfiguration";
+
+    @Test
+    void changeConfigurationAfterUpdate() {
+        NetconfConfigurationCache configurationCache = new NetconfConfigurationCache();
+        configurationCache.update(CONFIGURATION);
+
+        assertEquals(CONFIGURATION, configurationCache.getConfiguration());
     }
-}
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReaderTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReaderTest.java
new file mode 100644 (file)
index 0000000..65b2bc3
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.netconfmonitor.netconf;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.tailf.jnc.Element;
+import com.tailf.jnc.JNCException;
+import com.tailf.jnc.NetconfSession;
+import com.tailf.jnc.NodeSet;
+import java.io.IOException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+class NetconfConfigurationReaderTest {
+
+    private static final String NETCONF_MODEL_PATH = "";
+    private static final String EXPECTED_STRING_XML = "<?xml version=\"1.0\"?>";
+    private NetconfConfigurationReader reader;
+
+    @Mock
+    private NetconfSession netconfSession;
+    @Mock
+    private NodeSet nodeSet;
+    @Mock
+    private Element element;
+
+    @BeforeEach
+    void setup() {
+        MockitoAnnotations.initMocks(this);
+        reader = new NetconfConfigurationReader(netconfSession, NETCONF_MODEL_PATH);
+    }
+
+    @Test
+    void properlyReadXML() throws IOException, JNCException {
+        when(netconfSession.getConfig(anyString())).thenReturn(nodeSet);
+        when(nodeSet.first()).thenReturn(element);
+        when(element.toXMLString()).thenReturn(EXPECTED_STRING_XML);
+
+        String result = reader.read();
+
+        verify(netconfSession).getConfig(anyString());
+        verify(nodeSet).first();
+        verify(element).toXMLString();
+        assertEquals(EXPECTED_STRING_XML, result);
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriterTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriterTest.java
new file mode 100644 (file)
index 0000000..2baee21
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.netconfmonitor.netconf;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.apache.commons.io.FileUtils;
+import org.junit.Rule;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport;
+import org.junit.rules.TemporaryFolder;
+
+@EnableRuleMigrationSupport
+class NetconfConfigurationWriterTest {
+
+    private static final String TEST_CONFIGURATION = "test-configuration";
+
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+    @Test
+    void writeToFile_should_write_sample_config_when_directory_exists() throws IOException {
+        File file = temporaryFolder.newFolder("temp");
+        NetconfConfigurationWriter configurationWriter = new NetconfConfigurationWriter(file.getPath());
+
+        configurationWriter.writeToFile(TEST_CONFIGURATION);
+
+        File[] files = file.listFiles();
+        assertEquals(1, files.length);
+
+        String content = FileUtils.readFileToString(files[0], "UTF-8");
+        assertEquals(TEST_CONFIGURATION, content);
+    }
+
+    @Test
+    void writeToFile_should_not_write_config_when_directory_doesnt_exist() {
+        String logFolderPath = "/not/existing/logs";
+        NetconfConfigurationWriter configurationWriter = new NetconfConfigurationWriter(logFolderPath);
+
+        configurationWriter.writeToFile(TEST_CONFIGURATION);
+
+        assertFalse(Files.exists(Paths.get(logFolderPath)));
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java
new file mode 100644 (file)
index 0000000..8cb1906
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.rest;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import java.time.Duration;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.pnfsimulator.simulator.Simulator;
+import org.onap.pnfsimulator.simulator.SimulatorFactory;
+import org.onap.pnfsimulator.simulator.client.HttpClientAdapter;
+import org.onap.pnfsimulator.simulator.validation.JSONValidator;
+import org.onap.pnfsimulator.simulator.validation.ValidationException;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+class SimulatorControllerTest {
+
+    private static final String START_URL = "/simulator/start";
+    private static final String STOP_URL = "/simulator/stop";
+    private static final String STATUS_URL = "/simulator/status";
+    private static final String JSON_MSG_EXPRESSION = "$.message";
+    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" +
+        "    \"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" +
+        "  }\n" +
+        "}";
+    private static final String WRONG_JSON = "{\n" +
+        "  \"mes\": {\n" +
+        "    \"vesServerUrl\": \"http://10.154.187.70:8080/eventListener/v5\",\n" +
+        "    \"testDuration\": \"10\",\n" +
+        "    \"messageInterval\": \"1\"\n" +
+        "  },\n" +
+        "  \"messageParams\": {\n" +
+        "    \"sourceName\": \"val12\",\n" +
+        "    \"sourceId\": \"val13\",\n" +
+        "    \"reportingEntityName\": \"val14\"\n" +
+        "  }\n" +
+        "}\n";
+
+    private MockMvc mockMvc;
+
+    @InjectMocks
+    private SimulatorController controller;
+
+    @Mock
+    private SimulatorFactory factory;
+    @Mock
+    private JSONValidator validator;
+
+    private Simulator simulator;
+
+    @BeforeEach
+    void setup() {
+        MockitoAnnotations.initMocks(this);
+        simulator = createEndlessSimulator();
+        mockMvc = MockMvcBuilders
+            .standaloneSetup(controller)
+            .build();
+    }
+
+    private Simulator createEndlessSimulator() {
+        return spy(Simulator.builder()
+            .withCustomHttpClientAdapter(mock(HttpClientAdapter.class))
+            .withInterval(Duration.ofMinutes(1))
+            .build());
+    }
+
+    @Test
+    void wrongJSONFormatOnStart() throws Exception {
+        when(factory.create(any(), any())).thenReturn(simulator);
+        doThrow(new ValidationException("")).when(validator).validate(anyString(), anyString());
+
+        mockMvc.perform(post("/simulator/start").content(WRONG_JSON))
+            .andExpect(status().isBadRequest())
+            .andExpect(jsonPath("$.message").value("Cannot start simulator - Json format " +
+                "is not compatible with schema definitions"));
+        verify(validator).validate(anyString(), anyString());
+    }
+
+    @Test
+    void startSimulatorProperly() throws Exception {
+        startSimulator();
+
+        verify(validator).validate(anyString(), anyString());
+        verify(factory).create(any(), any());
+        verify(simulator).start();
+    }
+
+    @Test
+    void notStartWhenAlreadyRunning() throws Exception {
+        startSimulator();
+
+        mockMvc
+            .perform(post(START_URL).content(PROPER_JSON))
+            .andExpect(status().isBadRequest())
+            .andExpect(jsonPath(JSON_MSG_EXPRESSION).value("Cannot start simulator since it's already running"));
+    }
+
+    @Test
+    void stopSimulatorWhenRunning() throws Exception {
+        startSimulator();
+
+        mockMvc
+            .perform(post(STOP_URL))
+            .andExpect(status().isOk())
+            .andExpect(jsonPath(JSON_MSG_EXPRESSION).value("Simulator successfully stopped"));
+    }
+
+    @Test
+    void getNotRunningMessageWhenOff() throws Exception {
+        mockMvc
+            .perform(post(STOP_URL))
+            .andExpect(status().isBadRequest())
+            .andExpect(jsonPath(JSON_MSG_EXPRESSION).value("Cannot stop simulator, because it's not running"));
+    }
+
+    @Test
+    void getRunningStatusWhenOn() throws Exception {
+        startSimulator();
+
+        mockMvc
+            .perform(get(STATUS_URL))
+            .andExpect(status().isOk())
+            .andExpect(jsonPath(JSON_STATUS_EXPRESSION).value("RUNNING"));
+    }
+
+    @Test
+    void getNotRunningStatusWhenOff() throws Exception {
+        mockMvc
+            .perform(get(STATUS_URL))
+            .andExpect(status().isOk())
+            .andExpect(jsonPath(JSON_STATUS_EXPRESSION).value("NOT RUNNING"));
+    }
+
+    private void startSimulator() throws Exception {
+        when(factory.create(any(), any())).thenReturn(simulator);
+
+        mockMvc
+            .perform(post(START_URL).content(PROPER_JSON))
+            .andExpect(status().isOk())
+            .andExpect(jsonPath(JSON_MSG_EXPRESSION).value("Simulator started"));
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/util/DateUtilTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/rest/util/DateUtilTest.java
new file mode 100644 (file)
index 0000000..99b9af7
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.rest.util;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import org.junit.jupiter.api.Test;
+
+class DateUtilTest {
+
+    @Test
+    void getFormattedDate() {
+        Calendar currentCalendar = Calendar.getInstance();
+        String expectedResult = String.valueOf(currentCalendar.get(Calendar.YEAR));
+
+        assertEquals(expectedResult, DateUtil.getTimestamp(new SimpleDateFormat("yyyy")));
+    }
+}
\ No newline at end of file
index a814734..59e1e3b 100644 (file)
@@ -1,6 +1,6 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
- * org.onap.integration
+ * PNF-REGISTRATION-HANDLER
  * ================================================================================
  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
  * ================================================================================
 
 package org.onap.pnfsimulator.rest.util;
 
-import org.junit.jupiter.api.BeforeEach;
+import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.util.Map;
 import org.junit.jupiter.api.Test;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import java.util.Map;
-import static org.junit.jupiter.api.Assertions.*;
 
 public class ResponseBuilderTest {
 
-    private static final int SAMPLE_STATUS_CODE = 200;
-    private ResponseBuilder builder;
 
-    @BeforeEach
-    void setup() {
-        builder = ResponseBuilder.status(SAMPLE_STATUS_CODE);
-    }
+    private static final HttpStatus SAMPLE_STATUS = HttpStatus.OK;
 
     @Test
-    void checkResponseBodySize() {
-        builder.put("sample", "sample");
-        ResponseEntity responseEntity = builder.build();
-        Map<String, Object> body = (Map<String, Object>) responseEntity.getBody();
+    void response_should_have_empty_body_when_built_immediately() {
+        ResponseEntity responseEntity = ResponseBuilder.status(SAMPLE_STATUS).build();
 
-        assertEquals(body.size(), 1);
+        assertAll(
+            () -> assertEquals(responseEntity.getStatusCode(), SAMPLE_STATUS),
+            () -> assertNull(responseEntity.getBody())
+        );
     }
 
     @Test
-    void buildProperResponseEntity() {
-        ResponseEntity responseEntity = builder.build();
+    void builder_should_set_response_status_and_body() {
+        String key = "key";
+        String value = "value";
+        ResponseEntity response = ResponseBuilder
+            .status(SAMPLE_STATUS)
+            .put(key, value)
+            .build();
+
+        Map<String, Object> body = (Map<String, Object>) response.getBody();
 
         assertAll(
-            () -> assertEquals(responseEntity.getStatusCode(), HttpStatus.OK),
-            () -> assertNull(responseEntity.getBody())
+            () -> assertEquals(SAMPLE_STATUS, response.getStatusCode()),
+            () -> assertEquals(value, body.get(key))
         );
     }
 
+
 }
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java
new file mode 100644 (file)
index 0000000..970f8cf
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+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_SIMULATOR_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.VALID_MESSAGE_PARAMS;
+import static org.onap.pnfsimulator.simulator.TestMessages.VALID_SIMULATOR_PARAMS;
+
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.io.IOException;
+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;
+import org.onap.pnfsimulator.simulator.validation.ValidationException;
+
+class SimulatorFactoryTest {
+
+
+    private SimulatorFactory simulatorFactory;
+
+    @BeforeEach
+    void setUp() {
+        simulatorFactory = new SimulatorFactory(new MessageProvider(), new JSONValidator());
+    }
+
+    @Test
+    void should_successfully_create_simulator_given_valid_params_and_valid_output_message()
+        throws ValidationException, IOException, ProcessingException {
+        assertNotNull(simulatorFactory.create(VALID_SIMULATOR_PARAMS, VALID_MESSAGE_PARAMS));
+    }
+
+    @Test
+    void should_throw_given_invalid_params() {
+        assertThrows(
+            JSONException.class,
+            () -> simulatorFactory.create(INVALID_SIMULATOR_PARAMS, VALID_MESSAGE_PARAMS));
+    }
+
+    @Test
+    void should_throw_given_valid_params_and_invalid_output_message() {
+
+        assertThrows(
+            ValidationException.class,
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_1));
+
+        assertThrows(
+            ValidationException.class,
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_2));
+
+        assertThrows(
+            ValidationException.class,
+            () -> simulatorFactory.create(VALID_SIMULATOR_PARAMS, INVALID_MESSAGE_PARAMS_3));
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java
new file mode 100644 (file)
index 0000000..db9dbd7
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTimeout;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.verify;
+
+import java.time.Duration;
+import org.json.JSONObject;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
+import org.mockito.Mockito;
+import org.onap.pnfsimulator.simulator.client.HttpClientAdapter;
+
+class SimulatorTest {
+
+    private static final String TEST_VES_URL = "http://test-ves-url";
+
+    @Test
+    void builder_should_create_endless_simulator_when_duration_not_specified() {
+        Simulator simulator = Simulator
+            .builder()
+            .withDuration(Duration.ofSeconds(1))
+            .withVesUrl(TEST_VES_URL).build();
+
+        assertFalse(simulator.isEndless());
+
+        simulator = Simulator
+            .builder()
+            .withVesUrl(TEST_VES_URL).build();
+
+        assertTrue(simulator.isEndless());
+    }
+
+    @Test
+    void simulator_should_send_given_message() {
+
+        JSONObject messageBody = new JSONObject("{\"key\":\"val\"}");
+        HttpClientAdapter httpClientMock = Mockito.mock(HttpClientAdapter.class);
+
+        Simulator simulator = Simulator.builder()
+            .withDuration(Duration.ofMillis(100))
+            .withInterval(Duration.ofMillis(10))
+            .withMessageBody(messageBody)
+            .withCustomHttpClientAdapter(httpClientMock)
+            .withVesUrl(TEST_VES_URL).build();
+
+        simulator.start();
+
+        assertTimeout(Duration.ofMillis(150), (Executable) simulator::join);
+        verify(httpClientMock, atLeast(2)).send(messageBody.toString(), TEST_VES_URL);
+    }
+
+    @Test
+    void simulator_should_stop_when_interrupted() {
+
+        JSONObject messageBody = new JSONObject("{\"key\":\"val\"}");
+        HttpClientAdapter httpClientMock = Mockito.mock(HttpClientAdapter.class);
+
+        Simulator simulator = Simulator.builder()
+            .withInterval(Duration.ofSeconds(1))
+            .withMessageBody(messageBody)
+            .withCustomHttpClientAdapter(httpClientMock)
+            .withVesUrl(TEST_VES_URL).build();
+
+        simulator.start();
+        simulator.interrupt();
+
+        assertTimeout(Duration.ofSeconds(1), (Executable) simulator::join);
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
new file mode 100644 (file)
index 0000000..2f166b2
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator;
+
+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 INVALID_SIMULATOR_PARAMS = new JSONObject(
+        "{\n" +
+            "    \"vesServerUrl\": \"http://10.42.111.42:8080/eventListener/v5\",\n" +
+            "    \"messageInterval\": \"1\"\n" +
+            "}");
+
+
+    static final JSONObject INVALID_MESSAGE_PARAMS_1 = new JSONObject(
+        "{\n" +
+            "    \"pnfSerialNumber\": \"val1\",\n" +
+            "    \"pnfVendorName\": \"val2\",\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" +
+            "}");
+
+    static final JSONObject INVALID_MESSAGE_PARAMS_2 = new JSONObject(
+        "{\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" +
+            "}");
+
+    static final JSONObject INVALID_MESSAGE_PARAMS_3 = new JSONObject(
+        "{\n" +
+            "    \"pnfSerialNumber\": \"val1\",\n" +
+            "    \"pnfOamIpv4Address\": \"val3\",\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" +
+            "}");
+
+    private TestMessages() {
+    }
+}
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImplTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImplTest.java
new file mode 100644 (file)
index 0000000..a4fb9eb
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator.client;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.IOException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+
+class HttpClientAdapterImplTest {
+
+    private HttpClientAdapter adapter;
+
+    @Mock
+    private HttpClient httpClient;
+    @Mock
+    private HttpResponse httpResponse;
+
+    @BeforeEach
+    void setup() {
+        initMocks(this);
+        adapter = new HttpClientAdapterImpl(httpClient);
+    }
+
+    @Test
+    void send_should_successfully_send_request_given_valid_url() throws IOException {
+        doReturn(httpResponse).when(httpClient).execute(any());
+
+        adapter.send("test-msg", "http://valid-url");
+
+        verify(httpClient).execute(any());
+        verify(httpResponse).getStatusLine();
+    }
+
+    @Test
+    void send_should_not_send_request_given_invalid_url() throws IOException {
+        doThrow(new IOException("test")).when(httpClient).execute(any());
+
+        adapter.send("test-msg", "http://invalid-url");
+
+        verify(httpClient).execute(any());
+        verify(httpResponse, never()).getStatusLine();
+    }
+}
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/validation/JSONValidatorTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/validation/JSONValidatorTest.java
new file mode 100644 (file)
index 0000000..30dfe06
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.pnfsimulator.simulator.validation;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import com.github.fge.jsonschema.core.exceptions.InvalidSchemaException;
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.io.IOException;
+import java.net.URL;
+import org.json.JSONObject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class JSONValidatorTest {
+
+    private final static String VALID_SCHEMA_NAME = "valid-test-schema.json";
+    private final static String INVALID_SCHEMA_NAME = "invalid-test-schema.json";
+
+    private JSONValidator validator;
+
+    @BeforeEach
+    void setUp() {
+        validator = new JSONValidator();
+    }
+
+    @Test
+    void validate_should_not_throw_given_valid_json() throws ProcessingException, IOException, ValidationException {
+        validator.validate(getValidJsonString(), getResourcePath(VALID_SCHEMA_NAME));
+    }
+
+    @Test
+    void validate_should_not_throw_when_optional_parameter_missing()
+        throws ProcessingException, IOException, ValidationException {
+
+        String invalidJsonString = new JSONObject()
+            .put("key1", "value1")
+            .put("key2", "value2")
+            .toString();
+
+        validator.validate(invalidJsonString, getResourcePath(VALID_SCHEMA_NAME));
+    }
+
+    @Test
+    void validate_should_throw_when_mandatory_parameter_missing() {
+
+        String invalidJsonString = new JSONObject()
+            .put("key1", "value1")
+            .put("key3", "value3")
+            .toString();
+
+        assertThrows(
+            ValidationException.class,
+            () -> validator.validate(invalidJsonString, getResourcePath(VALID_SCHEMA_NAME)));
+    }
+
+    @Test
+    void validate_should_throw_when_invalid_json_format() {
+        String invalidJsonString = "{" +
+            "\"key1\": \"value1\"" +
+            "\"key2\": \"value2" +
+            "}";
+
+        assertThrows(
+            IOException.class,
+            () -> validator.validate(invalidJsonString, getResourcePath(VALID_SCHEMA_NAME)));
+    }
+
+    @Test
+    void validate_should_throw_when_invalid_schema_format() {
+        assertThrows(
+            InvalidSchemaException.class,
+            () -> validator.validate(getValidJsonString(), getResourcePath(INVALID_SCHEMA_NAME)));
+    }
+
+    @Test
+    void validate_should_throw_when_invalid_schema_path() {
+
+        assertThrows(
+            IOException.class,
+            () -> validator.validate(getValidJsonString(), "/not/existing/path/schema.json"));
+    }
+
+    private String getResourcePath(String schemaFileName) {
+        URL result = getClass()
+            .getClassLoader()
+            .getResource(schemaFileName);
+
+        if (result == null) {
+            throw new IllegalArgumentException("Given file doesn't exist");
+        } else {
+            return result
+                .toString()
+                .replace("file:", "");
+        }
+    }
+
+    private String getValidJsonString() {
+        return new JSONObject()
+            .put("key1", "value1")
+            .put("key2", "value2")
+            .put("key3", "value3")
+            .toString();
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/pnfsimulator/src/test/resources/invalid-test-schema.json b/test/mocks/pnfsimulator/src/test/resources/invalid-test-schema.json
new file mode 100644 (file)
index 0000000..8c37c82
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  "type": "object",
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "properties": {
+    "key1": {
+      "type": "string"
+    },
+    "key2": {
+      "type": "string"
+    },
+    "key3": {
+      "type": "string"
+    },
+    "required": [
+      "key1",
+      "key2"
+    ]
+  }
+}
diff --git a/test/mocks/pnfsimulator/src/test/resources/logback-test.xml b/test/mocks/pnfsimulator/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..d7966fe
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration complete="true" compact="true">
+
+  <Property name="outputFilename" value="pnfsimulator_output"/>
+  <Property name="log-path" value="${java.io.tmpdir}"/>
+  <property name="maxFileSize" value="50MB"/>
+  <property name="maxHistory" value="30"/>
+  <property name="totalSizeCap" value="10GB"/>
+
+  <appender name="Console" target="SYSTEM_OUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <Pattern>%nopexception%logger
+        |%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+        |%level
+        |%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+        |%thread
+        |%n</Pattern>
+    </encoder>
+  </appender>
+
+  <appender name="ROLLING-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <encoder>
+      <pattern>%nopexception%logger
+        |%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+        |%level
+        |%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+        |%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+        |%thread
+        |%n</pattern>
+    </encoder>
+    <File>${log-path}/${outputFilename}.log</File>
+    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+      <FileNamePattern>${log-path}/${outputFilename}.%d{yyyy-MM-dd}.%i.log.zip</FileNamePattern>
+      <MaxFileSize>${maxFileSize}</MaxFileSize>
+      <MaxHistory>${maxHistory}</MaxHistory>
+      <TotalSizeCap>${totalSizeCap}</TotalSizeCap>
+    </rollingPolicy>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="Console" />
+    <appender-ref ref="ROLLING-FILE" />
+  </root>
+</Configuration>
diff --git a/test/mocks/pnfsimulator/src/test/resources/valid-test-schema.json b/test/mocks/pnfsimulator/src/test/resources/valid-test-schema.json
new file mode 100644 (file)
index 0000000..26e48a5
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  "type": "object",
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "properties": {
+    "key1": {
+      "type": "string"
+    },
+    "key2": {
+      "type": "string"
+    },
+    "key3": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "key1",
+    "key2"
+  ]
+}
diff --git a/test/mocks/pnfsimulator/ssh/ssh_host_rsa_key b/test/mocks/pnfsimulator/ssh/ssh_host_rsa_key
new file mode 100644 (file)
index 0000000..1a3c49e
--- /dev/null
@@ -0,0 +1,54 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,242034B2C46EE5D70C6017C29024CFAE
+
+33cZKnNILWwb7Xlw4sQLEWp5w72vS8znQr/T4Hd7mCxoxrTJM0Cm3oNM6zK92kMp
+tXtJiT/Mpz6zmlUrKwhcESk+4ovNHGkzVCyYQfofkb5jyYHT92HXA8H1Qd1oyKBA
+8DUDFdFqlW2EZS7joDrU/ImpWkAI4gysbhg40QUeWbjlO/gyzii7/gu6AgZ3RF8l
+hKu4600kk7m3xa28GqMm53k2TVlgAI7JBiFH/aTxeHhntjpO2NRwtQ+YQlx8DveH
+CXw1+RhfWa2CtBPosstuAza+8NPRreIclUjMBKz7FDWIucnMbBhLCoyZyCRctYy5
+exzIkjQ3Uacz0aV9GTNvmJ4HiratKPPsMzCVggk6bxQy+DfvcYdoP/Z8vsLvhCkg
+usOWh5EUDI918rPwwA6O9fZce8QJHp/SY29m5JboafWN9raUMd0Szdc3DcNYK0oR
+04dF7FZuRhrBY8c0xPJV99K9091Hnr9gJU+0dst6naw6z/X5ZXra+pBIPEAFkRdy
+eZLAr9sKsjEhEb+jY1T/PI2sfR1B9dygCZW/nqrpqHKqjxZ034R9AmrpSRiwb8BJ
+1omLjh49J6ys7ibmYk3pC+c4ry1vLlpg9Gr7pD0TJo3F8k826D4pPEzA70X7rVoD
+vZRg+TUKQ9cbECF8+/AuwA+vi12qU4vUPvgdQYl9EgrSpNdNN9St/C6RsNKK8I4D
+vPD2MN8gfxSJrQn/FyZlcujDX0MoX6NbsKKLkUdH/3FnAnjH9wZUCrE+SZFOZkT5
+uki7fa/+6Lc5M5s4v4Qi438lTJD9/PQUJ//WtNMQjZLM3rwgg68syJBZ/WoqqqLw
+585rAORYgXcHH62Vp71yUCwnwVvnPMOkjes01gGluZaCGVZptNRwE38GqED8nGGt
+dOpY7A59BlZAryeXN0UwI5ki6KIG/BeRrNULdkniTYp7zbod+Ac9cDBv1Aczzv04
+rAKlzJ5Ac/ROrqcHb3dJwdNMZA3hLWBRAHw4EtYRyyrn1WHNIKUJJivn3to7h+I5
+7dMQpWSWJ8MFCDBNN0RPmXECZVzwAKjHcGcq4YOZAKOzcHE5u+1GmtjiOhcvsisy
+5xelkqKKwcu+uY6CmlItaxNvyt4tLkS8BsbFDovx44CwDb6YzUkuw8KKPFjGp+H1
+qkqw/Iqqw9f5d8pcK8f5kZWnQOTYEadQvpSz0o8Qod4Kk98HyWl45/83YxK/SV1A
+yaQftzYw8WTpbBC164hKIQamyuZ6CIv8inAIaHs/zFIYNlDtriNDqt+uh/0WPe1b
+Y/7aA6I0cU1DggoXgU8irxHKVfll2Mk9r0wB1lvqvBU/LA6XPh6Crcc6iN+nQAtE
+YXWEdPV0n9mnOug1h+LiU4P5LmShkkm4+Bo3TBOjS3gGz7bzu7d8rWp8S+VUBcKM
+fa0sivE6CC24WMJXGxqs4YhC+3OIGjA2z7vfaLANBCWBycIM6TwtF3MgpX9hSIbL
+mFX7SFTHd/QCOAK930nXp/fpe78RBebyabyJ5tiOoXBQWyVGvqmXroGj6ajWojZT
+QMn8FuQQ+QpbKgFZCxgsQmkLelslcVUpvcqK26FC5t5+FoAfAzmzbVLdTVycAa77
+QDxkcaCgfIJAV/JbHfAZHJaoK2ZM8/xaygpDhRqjgIraCELMcyQR0V3pn3dgTahd
+ynZHxLMzeyyX700kyJEaG1DvA4s4io+C3naRg5te5sH6rgy/Zvq1ldA95husA3rf
+1LGEWnrudsm8mxJo3EfstiBJXltHxrG+kM99PDk3+c+eRAn0iSpFUeMn+2sWZRSZ
+6o7sRoBVAY6wRxi1qBftAnw9FLyhZhpz6Jp33DT3j8L8vD4il9zdv5gU4FZsdT8T
+B+d3/c2wIEuFYQCIrW/A+QVqEastChUexfNMenuj28QySifAXWjiVV8CifseG/OI
+hSn6+EfMVyK00DJEqjUeXH5Om3jxkfY+oldpx+HafITxqcvUsFVDSsP+CZPzhEz5
+HNidv0mH6eDmRwB+Nb1HoYFNdvnotrLotvdLr53POu/q3IM6Co8VAxkHU4cY68a9
+hCrhrTY2HH5kasjvoanf/DbLrj+vwTRvH4MDSOu4a5Wdm3LRjyHgP3RuhbGq61eq
+7MZT1UASPJVFGUe9KlxZDKhJQ8ccvzGkGU5yJdxao27hRDnBaR2l72PCawT5ntgf
+hEmMLmw17g848MET/2jMvbNyyOx9pKlfMv/AJBBU4knGSBDBYnETdocvbwkbVJSe
+4EDu/K+mOCF5dllEgGTCPTazvYBlbgWi+lZtq6eAYLiN4arJ+ScALFSMh+zSwwvM
+xt5RnpSxw1yV2pHlGsQjg9yw9XQX7wEjKeMGjTwiLFAMbwWYJvF6Z6ZmI2LWaS5O
+AmXm/JkHdE8JQzAZwnqZOOpcEB3y8D/vACEBHUMafbkBGHRvFOIcHfB/ozfEyIym
+E5Mo6OWtRTbnpPo0seH4Kx9UY+BvG1Run3fYxcPQqaA7H4jLO1eOZSOfiiOzM8Jf
+l+QrKomqizmyUTUiikC/9memJDz/nqdm7w0r4Zq9UqY0E74OkpYLyspoWVM8Cj4k
+61wPtYXRrJ70UbvVnhX2pMnxRMH6BkU6+SCSzhbo9sNHgP0VtVhXrijTPJJY8Kap
+3hUkQvVlb1Gdl7DeeeJmYGOLxYGjfmj6UcflqXZzorm43E0djw/sCtBc76FFOpsB
+8R8F/ArtsSGsw+KJqK5Uyf+2LzL9BNdv80EiRKkubJ8+ODdRrBMNCT/hPRY7iACX
+UEudm5DA0Ai5NOyUDV7kVyW9C7SFaXoMtG0NO7TL5cBZ63uFpsoBrk+Y4tepgVIx
++8beinOJSBAu7HlTyj4eS2L+TQbPIf7j+UwPh2FKNvloVeXku3IUtyRjfcRlWpct
+5sjAXvtc+elSAVVoX9J1fAltepsRG9sd9iFTNTpiOC6nrvWuVz8jrbCitFuvKYnm
+tD5bqRmGLkqYrwz+MSkA7cFCE50F5WPXVkRxp/bZ1ds+fh/Ymx9UwlsUqgRpHsGb
+ZhpJZALukr2YDGw4mSyTtRE9uhGW7+YFSHp1TL6wEUHAT5GwqrY2MioZ2Da6vVYD
+SZv+uusSWHjaiJpkuoqOOnPfdFDse8Khc4xBsOMLgAc86wfjZtD3gWBcDkRdD81C
+-----END RSA PRIVATE KEY-----
diff --git a/test/mocks/pnfsimulator/ssh/ssh_host_rsa_key.pub b/test/mocks/pnfsimulator/ssh/ssh_host_rsa_key.pub
new file mode 100644 (file)
index 0000000..6193335
--- /dev/null
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCiZJaJfjmjnaJqHTcYG8DkrU1Mr7WAmGR70QVd4mDxmM5vPm26nOv3uDO0sSwjP/sDGyVzlaxwlnfBfVZwJbMMf6sEPMNCLvBSwT4E6vf9rKwXqUIzj8hZuvOd7RPp241Z29CkL6aep6QNSk3NOlu4mxGMv+WJwyoDq8ya+ePEXQgl5QipabAmXFOKk1x15z9tcs9Dw5JvKkCpjpJ7zAd9tkmuiramS9OlETy8BJ0QkMj3ucNuqDsUkUzvKnnWHVcykmacJY3v3D9S4BoqLc1XZTVB4oRg0GlOCqOMQeVLP/jxtzVYiK5EsHbC55qhC9i8IaaSyeN66hgWwIh6FHhPMHr40vRKyliZGK0aBP+paS0V1PvNUW9+sb3ZDB/7mu/0yp06yGpqJAAFRQCZzNqiWbbQy1s/+HQbtUwVr7gnY2jhhAv8bcBPwTtIctg/rO/WDWJJsLzuFnb7fGkFL+EqAt0qozDSL5bDzJgylg00Y6GM1ebvBluNE+71n1TigInlIvKWHKtrAtiHQwXLOS/v3aEoepgJKiwABvYXiB2QNXqxkbrnFoT4+byhmakG3SVmDCDUlbQoDJpKLekwt5dezSuDNdFeC1TxUahfsBcOOG1TOxrsCKJU+ZoMXVXsouAAshpWiSZGZR2imXFLcRfDV5FI2bRZPv+WADzuzsfkJw==
\ No newline at end of file
index 1a1fbf7..0b338ab 100644 (file)
@@ -1,11 +1,11 @@
 image,tag
-onap/aaf/aaf_cm,2.1.1
-onap/aaf/aaf_fs,2.1.1
-onap/aaf/aaf_gui,2.1.1
-onap/aaf/aaf_hello,2.1.1
-onap/aaf/aaf_locate,2.1.1
-onap/aaf/aaf_oauth,2.1.1
-onap/aaf/aaf_service,2.1.1
+onap/aaf/aaf_cm,2.1.2-SNAPSHOT
+onap/aaf/aaf_fs,2.1.2-SNAPSHOT
+onap/aaf/aaf_gui,2.1.2-SNAPSHOT
+onap/aaf/aaf_hello,2.1.2-SNAPSHOT
+onap/aaf/aaf_locate,2.1.2-SNAPSHOT
+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
@@ -13,26 +13,27 @@ onap/aai-traversal,1.2.2
 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.3.0
+onap/appc-cdt-image,1.4.0-SNAPSHOT-latest
 onap/appc-image,1.4.0-SNAPSHOT-latest
 onap/babel,1.2.0
 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/clamp,2.0.2
+onap/clamp,3.0-STAGING-latest
 onap/cli,2.0.2
 onap/data-router,1.2.2
 onap/dmaap/buscontroller,1.0.12
-onap/dmaap/dmaap-mr,1.1.4
-onap/externalapi/nbi,2.0.0
+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/holmes/engine-management,1.1.0
-onap/holmes/rule-management,1.1.0
+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/msb/msb_apigateway,1.2.0-STAGING-latest
 onap/msb/msb_discovery,1.2.0-STAGING-latest
-onap/multicloud/framework,1.1.2
+onap/multicloud/framework,1.2.0-STAGING
 onap/multicloud/openstack-newton,1.2.0-STAGING
 onap/multicloud/openstack-ocata,1.2.0-STAGING
 onap/multicloud/openstack-windriver,1.2.0-STAGING
@@ -40,6 +41,7 @@ onap/multicloud/vio,1.1.2
 onap/multicloud/vio-vesagent,1.0.0
 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
@@ -57,6 +59,7 @@ 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/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
@@ -81,13 +84,22 @@ 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.1
+onap/search-data-service,1.2.2
 onap/sniroemulator,1.0.0
+onap/so/api-handler-infra,1.3.0-STAGING-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
+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/testsuite,1.3.0-STAGING-latest
+onap/testsuite,1.3.1-STAGING-latest
 onap/usecase-ui,1.1.1
 onap/usecase-ui/usecase-ui-server,1.1.1
 onap/vfc/catalog,1.1.0
+onap/vfc/db,1.1.0-STAGING-latest
 onap/vfc/emsdriver,1.1.0
 onap/vfc/gvnfmdriver,1.1.0
 onap/vfc/jujudriver,1.1.0
@@ -104,9 +116,8 @@ onap/vfc/wfengine-activiti,1.1.0
 onap/vfc/wfengine-mgrservice,1.1.0
 onap/vfc/ztesdncdriver,1.1.0
 onap/vfc/ztevnfmdriver,1.1.0
-onap/vid,2.0.0
+onap/vid,3.0-STAGING-latest
 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
-openecomp/mso,1.2.2
index da87af4..9e11233 100644 (file)
@@ -25,7 +25,7 @@ onap/cli,2.0.2
 onap/data-router,1.2.2
 onap/dmaap/buscontroller,1.0.12
 onap/dmaap/dmaap-mr,1.1.4
-onap/externalapi/nbi,2.0.0
+onap/externalapi/nbi,2.1.1
 onap/gizmo,1.2.1
 onap/holmes/engine-management,1.1.0
 onap/holmes/rule-management,1.1.0
@@ -84,7 +84,7 @@ onap/sdnc-ueb-listener-image,1.3.4
 onap/search-data-service,1.2.1
 onap/sniroemulator,1.0.0
 onap/sparky-be,1.2.1
-onap/testsuite,1.2.1
+onap/testsuite,1.3.0
 onap/usecase-ui,1.1.1
 onap/usecase-ui/usecase-ui-server,1.1.1
 onap/vfc/catalog,1.1.0
index 5393b80..64d78a6 100644 (file)
@@ -1,28 +1,28 @@
 groupId,artifactId,version
-org.onap.aaf.authz,aaf-auth-batch,2.1.1
-org.onap.aaf.authz,aaf-auth-cass,2.1.1
-org.onap.aaf.authz,aaf-auth-certman,2.1.1
-org.onap.aaf.authz,aaf-auth-client,2.1.1
-org.onap.aaf.authz,aaf-auth-cmd,2.1.1
-org.onap.aaf.authz,aaf-auth-core,2.1.1
-org.onap.aaf.authz,aaf-auth-deforg,2.1.1
-org.onap.aaf.authz,aaf-auth-fs,2.1.1
-org.onap.aaf.authz,aaf-auth-gui,2.1.1
-org.onap.aaf.authz,aaf-auth-hello,2.1.1
-org.onap.aaf.authz,aaf-auth-locate,2.1.1
-org.onap.aaf.authz,aaf-auth-oauth,2.1.1
-org.onap.aaf.authz,aaf-auth-service,2.1.1
-org.onap.aaf.authz,aaf-cadi-aaf,2.1.1
-org.onap.aaf.authz,aaf-cadi-cass,2.1.1
-org.onap.aaf.authz,aaf-cadi-client,2.1.1
-org.onap.aaf.authz,aaf-cadi-core,2.1.1
-org.onap.aaf.authz,aaf-cadi-oauth-enduser,2.1.1
-org.onap.aaf.authz,aaf-cadi-shiro,2.1.1
-org.onap.aaf.authz,aaf-misc-env,2.1.1
-org.onap.aaf.authz,aaf-misc-log4j,2.1.1
-org.onap.aaf.authz,aaf-misc-rosetta,2.1.1
-org.onap.aaf.authz,aaf-misc-xgen,2.1.1
-org.onap.aaf.authz,aaf-shiro-aafrealm-osgi-bundle,2.1.1
+org.onap.aaf.authz,aaf-auth-batch,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-cass,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-certman,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-client,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-cmd,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-core,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-deforg,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-fs,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-gui,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-hello,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-locate,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-oauth,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-auth-service,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-aaf,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-cass,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-client,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-core,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-oauth-enduser,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-cadi-shiro,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-misc-env,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-misc-log4j,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-misc-rosetta,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-misc-xgen,2.1.2-SNAPSHOT
+org.onap.aaf.authz,aaf-shiro-aafrealm-osgi-bundle,2.1.2-SNAPSHOT
 org.onap.aai,rest-client,1.2.1
 org.onap.aai,search-data-service,1.2.0
 org.onap.aai.aai-common,aai-annotations,1.2.4
@@ -185,10 +185,10 @@ org.onap.dmaap.messagerouter.dmaapclient,dmaapClient,1.0.0
 org.onap.dmaap.messagerouter.messageservice,dmaapMR1,1.0.1
 org.onap.dmaap.messagerouter.mirroragent,dmaapMMAgent,1.0.0
 org.onap.dmaap.messagerouter.msgrtr,msgrtr,1.0.0
-org.onap.holmes.common,holmes-actions,1.0.0
-org.onap.holmes.dsa,dmaap-dsa,1.0.0
-org.onap.holmes.engine-management,holmes-engine-d,1.1.0
-org.onap.holmes.rule-management,holmes-rulemgt,1.1.0
+org.onap.holmes.common,holmes-actions,1.2.0-SNAPSHOT
+org.onap.holmes.dsa,dmaap-dsa,1.2.0-SNAPSHOT
+org.onap.holmes.engine-management,holmes-engine-d,1.2.0-SNAPSHOT
+org.onap.holmes.rule-management,holmes-rulemgt,1.2.0-SNAPSHOT
 org.onap.modeling.toscaparsers,Checker,1.0.0
 org.onap.modeling.toscaparsers,Service,1.0.0
 org.onap.modeling.toscaparsers,kwalify,1.0.0
diff --git a/version-manifest/src/main/scripts/upgrade-oparent.sh b/version-manifest/src/main/scripts/upgrade-oparent.sh
new file mode 100755 (executable)
index 0000000..aec665e
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# Copyright 2017 Huawei Technologies Co., Ltd.
+#
+# 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
+#
+cat projects.txt | grep -v oparent | grep -v doc | grep -v ci-management | while read p; do
+    pushd $p
+
+    #git fetch origin
+    #git reset --hard origin
+    for pom in $(find -name pom.xml); do
+        git checkout origin/master -- $pom
+        dos2unix < $pom | cmp -s - $pom
+        IS_DOS=$?
+        if grep -q "oparent" $pom; then
+            xmlstarlet ed -L -P -N ns="http://maven.apache.org/POM/4.0.0"  -u '/_:project/_:parent[_:groupId="org.onap.oparent" and _:artifactId="oparent"]/_:version' -v '1.2.0' $pom
+            sed -i 's/^[ \t]*$//' $pom
+        fi
+        if grep -q "guava" $pom; then
+            xmlstarlet ed -L -P -N ns="http://maven.apache.org/POM/4.0.0"  -d '//_:dependency[_:groupId="com.google.guava" and _:artifactId="guava"]/_:version' $pom
+            sed -i 's/^[ \t]*$//' $pom
+        fi
+        if [ $IS_DOS -ne 0 ]; then
+            unix2dos $pom
+        fi
+    done
+    git --no-pager diff
+
+
+    if [ $(git rev-parse HEAD) == $(git rev-parse @{u}) ]; then
+
+        git commit -a -s -m 'Use managed guava version
+
+Use centrally managed guava version specified in
+oparent.  Includes upgrade to oparent 1.2.0.
+
+This change was submitted by script and may include
+additional whitespace or formatting changes.
+
+Issue-ID: INT-619
+'
+    else
+        git commit -a -s --amend --no-edit
+    fi
+    git review -r origin -D
+    popd
+done