Merge "switch drools pdp image to new one"
authorYang Xu <yang.xu3@huawei.com>
Sun, 31 Mar 2019 15:37:24 +0000 (15:37 +0000)
committerGerrit Code Review <gerrit@onap.org>
Sun, 31 Mar 2019 15:37:24 +0000 (15:37 +0000)
139 files changed:
.gitignore
deployment/heat/onap-oom/env/windriver/onap-oom.env
deployment/heat/onap-oom/onap-oom.yaml
deployment/heat/onap-oom/parts/onap-oom-1.yaml
deployment/heat/onap-oom/rancher_vm_entrypoint.sh
deployment/heat/onap-oom/scripts/Crypto.java [new file with mode: 0644]
deployment/heat/onap-oom/scripts/deploy.sh
deployment/heat/onap-rke/env/windriver/Integration-HEAT-Daily-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-HEAT-Staging-Daily-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-HEAT-Verify-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-OOM-Daily-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-OOM-Staging-Daily-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-OOM-Verify-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-00-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-01-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-02-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-03-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-04-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-05-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-06-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/Integration-SB-07-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/OOF-openrc [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/onap-oom-light.env [new file with mode: 0644]
deployment/heat/onap-rke/env/windriver/onap-oom.env [new file with mode: 0644]
deployment/heat/onap-rke/k8s_vm_init.sh [new file with mode: 0644]
deployment/heat/onap-rke/k8s_vm_init_serv.sh [new file with mode: 0644]
deployment/heat/onap-rke/k8s_vm_install.sh [new file with mode: 0644]
deployment/heat/onap-rke/onap-oom.yaml [new file with mode: 0644]
deployment/heat/onap-rke/parts/onap-oom-1.yaml [new file with mode: 0644]
deployment/heat/onap-rke/parts/onap-oom-2.yaml [new file with mode: 0644]
deployment/heat/onap-rke/parts/onap-oom-3.yaml [new file with mode: 0644]
deployment/heat/onap-rke/rancher_vm_entrypoint.sh [new file with mode: 0644]
deployment/heat/onap-rke/scripts/Crypto.java [new file with mode: 0644]
deployment/heat/onap-rke/scripts/cleanup.sh [new file with mode: 0755]
deployment/heat/onap-rke/scripts/deploy.sh [new file with mode: 0755]
deployment/heat/onap-rke/scripts/gen-onap-oom-yaml.sh [new file with mode: 0755]
deployment/heat/onap-rke/scripts/prepull-docker.sh [new file with mode: 0755]
deployment/heat/onap-rke/scripts/redeploy-module.sh [new file with mode: 0644]
deployment/heat/onap-rke/scripts/redeploy.sh [new file with mode: 0755]
docs/release-notes.rst
test/mocks/datafilecollector-testharness/dr-sim/Dockerfile [new file with mode: 0644]
test/mocks/datafilecollector-testharness/dr-sim/README.md
test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js [new file with mode: 0644]
test/mocks/datafilecollector-testharness/dr-sim/dmaapDR.js
test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml [new file with mode: 0644]
test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml
test/mocks/datafilecollector-testharness/mr-sim/Dockerfile [new file with mode: 0755]
test/mocks/datafilecollector-testharness/mr-sim/README.md
test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml [new file with mode: 0644]
test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
test/mocks/datafilecollector-testharness/simulator-group/README.md [new file with mode: 0644]
test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh [new file with mode: 0755]
test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml [new file with mode: 0644]
test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh [new file with mode: 0755]
test/mocks/datafilecollector-testharness/simulator-group/simulators-kill.sh [new file with mode: 0755]
test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh [new file with mode: 0755]
test/mocks/mass-pnf-sim/README.md
test/mocks/mass-pnf-sim/ROP_file_creator.sh [deleted file]
test/mocks/mass-pnf-sim/clean.sh [new file with mode: 0755]
test/mocks/mass-pnf-sim/diagnostic.sh [new file with mode: 0755]
test/mocks/mass-pnf-sim/mass-pnf-sim.py
test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh [new file with mode: 0755]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.json
test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/netconf.env
test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-ftps-template.json [deleted file]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-sftp-template.json [deleted file]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh [deleted file]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/json_schema/input_validator.json
test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.data.xml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.yang [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/pom.xml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/assembly/resources.xml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/FileProvider.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/Main.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/logback.xml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/logging/MDCVariables.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTask.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorService.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfiguration.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCache.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReader.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriter.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConnectionParams.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/Simulator.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapter.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/validation/JSONValidator.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/validation/ValidationException.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/resources/application.properties [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCacheTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReaderTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriterTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/util/DateUtilTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/util/ResponseBuilderTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImplTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/validation/JSONValidatorTest.java [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/invalid-test-schema.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/logback-test.xml [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/valid-test-schema.json [new file with mode: 0644]
test/mocks/mass-pnf-sim/pnf-sim-lightweight/templates/file_template_new.xml.gz [moved from test/mocks/mass-pnf-sim/templates/file_template.xml.gz with 100% similarity]
test/mocks/pnf-onboarding/unsecureAcmePnf.csar [new file with mode: 0644]
test/mocks/pnfsimulator/config/config.json
test/mocks/pnfsimulator/json_schema/input_validator.json
test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh
test/mocks/pnfsimulator/src/assembly/resources.xml
test/mocks/sniroemulator/pom.xml
test/security/check_for_http_endpoints.sh [new file with mode: 0755]
test/security/check_for_jdwp.sh [new file with mode: 0755]
version-manifest/src/main/resources/docker-manifest-staging.csv
version-manifest/src/main/resources/docker-manifest.csv
version-manifest/src/main/resources/java-manifest.csv

index e6ef23d..6c1ca2a 100644 (file)
@@ -26,3 +26,6 @@ csit/
 *.iml
 /.pydevproject
 /bin/
+*.class
+*.csar
+benchmark/
index 5a0cfbe..5ad7bc0 100644 (file)
@@ -5,8 +5,8 @@ parameters:
   apt_proxy: 10.12.5.2:8000
   docker_proxy: 10.12.5.2:5000
 
-  rancher_vm_flavor: m1.large
-  k8s_vm_flavor: m1.xlarge
+  rancher_vm_flavor: m1.xlarge
+  k8s_vm_flavor: m2.xlarge
   etcd_vm_flavor: m1.medium
   orch_vm_flavor: m1.medium
 
@@ -85,27 +85,27 @@ parameters:
           initialDelaySeconds: 120
     portal:
       enabled: true
-      global:
-        portalHostName: "__portal_hostname__"
-      portal-mariadb:
-        config:
-          sdcFeHostName: "__portal_hostname__"
-          papHostName: "__portal_hostname__"
-          vidHostName: "__portal_hostname__"
-          aaiSparkyHostName: "__portal_hostname__"
-          cliHostName: "__portal_hostname__"
-          portalSdkHostName: "__portal_hostname__"
-          dmaapBcHostName: "__portal_hostname__"
-          msbHostName: "__portal_hostname__"
+    #  global:
+    #    portalHostName: "__portal_hostname__"
+    #  portal-mariadb:
+    #    config:
+    #      sdcFeHostName: "__portal_hostname__"
+    #      papHostName: "__portal_hostname__"
+    #      vidHostName: "__portal_hostname__"
+    #      aaiSparkyHostName: "__portal_hostname__"
+    #      cliHostName: "__portal_hostname__"
+    #      portalSdkHostName: "__portal_hostname__"
+    #      dmaapBcHostName: "__portal_hostname__"
+    #      msbHostName: "__portal_hostname__"
     vid:
       enabled: true
-      config:
-        portalhost: "__portal_hostname__"
+    #  config:
+    #    portalhost: "__portal_hostname__"
 
     aaf:
       enabled: true
     cassandra:
-      enabled: true
+      enabled: false
     clamp:
       enabled: true
     cli:
@@ -121,7 +121,7 @@ parameters:
     esr:
       enabled: true
     log:
-      enabled: true
+      enabled: false
     sniro-emulator:
       enabled: true
     oof:
@@ -135,7 +135,7 @@ parameters:
     policy:
       enabled: true
     pomba:
-      enabled: true
+      enabled: false
     sdc:
       enabled: true
     uui:
@@ -143,4 +143,4 @@ parameters:
     vfc:
       enabled: true
     vnfsdk:
-      enabled: true
\ No newline at end of file
+      enabled: true
index c2c08f6..66c98ee 100644 (file)
@@ -73,7 +73,7 @@ parameters:
 
   rancher_version:
     type: string
-    default: "1.6.25"
+    default: "1.6.26"
 
   rancher_agent_version:
     type: string
@@ -81,7 +81,7 @@ parameters:
 
   kubectl_version:
     type: string
-    default: "1.11.5"
+    default: "1.11.8"
 
   helm_version:
     type: string
@@ -241,12 +241,6 @@ resources:
               get_attr: [k8s_04_floating_ip, floating_ip_address],
               get_attr: [k8s_05_floating_ip, floating_ip_address],
               get_attr: [k8s_06_floating_ip, floating_ip_address],
-              get_attr: [k8s_07_floating_ip, floating_ip_address],
-              get_attr: [k8s_08_floating_ip, floating_ip_address],
-              get_attr: [k8s_09_floating_ip, floating_ip_address],
-              get_attr: [k8s_10_floating_ip, floating_ip_address],
-              get_attr: [k8s_11_floating_ip, floating_ip_address],
-              get_attr: [k8s_12_floating_ip, floating_ip_address],
             ]
             __k8s_private_ips__: [
               get_attr: [k8s_01_floating_ip, fixed_ip_address],
@@ -255,12 +249,6 @@ resources:
               get_attr: [k8s_04_floating_ip, fixed_ip_address],
               get_attr: [k8s_05_floating_ip, fixed_ip_address],
               get_attr: [k8s_06_floating_ip, fixed_ip_address],
-              get_attr: [k8s_07_floating_ip, fixed_ip_address],
-              get_attr: [k8s_08_floating_ip, fixed_ip_address],
-              get_attr: [k8s_09_floating_ip, fixed_ip_address],
-              get_attr: [k8s_10_floating_ip, fixed_ip_address],
-              get_attr: [k8s_11_floating_ip, fixed_ip_address],
-              get_attr: [k8s_12_floating_ip, fixed_ip_address],
             ]
   k8s_01_private_port:
     type: OS::Neutron::Port
@@ -682,426 +670,6 @@ resources:
       user_data_format: SOFTWARE_CONFIG
       user_data: { get_resource: k8s_06_vm_config }
 
-  k8s_07_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_07_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_07_private_port }
-
-  k8s_07_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_07_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_07_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_07_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_07_vm_scripts }
-
-  k8s_07_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '07' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_07_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_07_vm_config }
-
-  k8s_08_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_08_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_08_private_port }
-
-  k8s_08_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_08_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_08_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_08_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_08_vm_scripts }
-
-  k8s_08_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '08' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_08_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_08_vm_config }
-
-  k8s_09_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_09_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_09_private_port }
-
-  k8s_09_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_09_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_09_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_09_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_09_vm_scripts }
-
-  k8s_09_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '09' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_09_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_09_vm_config }
-
-  k8s_10_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_10_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_10_private_port }
-
-  k8s_10_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_10_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_10_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_10_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_10_vm_scripts }
-
-  k8s_10_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '10' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_10_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_10_vm_config }
-
-  k8s_11_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_11_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_11_private_port }
-
-  k8s_11_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_11_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_11_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_11_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_11_vm_scripts }
-
-  k8s_11_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '11' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_11_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_11_vm_config }
-
-  k8s_12_private_port:
-    type: OS::Neutron::Port
-    properties:
-      network: { get_resource: oam_network }
-      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
-      security_groups:
-      - { get_resource: onap_sg }
-
-  k8s_12_floating_ip:
-    type: OS::Neutron::FloatingIP
-    properties:
-      floating_network_id: { get_param: public_net_id }
-      port_id: { get_resource: k8s_12_private_port }
-
-  k8s_12_vm_scripts:
-    type: OS::Heat::CloudConfig
-    properties:
-      cloud_config:
-        power_state:
-          mode: reboot
-        runcmd:
-        - [ /opt/k8s_vm_install.sh ]
-        write_files:
-        - path: /opt/k8s_vm_install.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __docker_proxy__: { get_param: docker_proxy }
-                __apt_proxy__: { get_param: apt_proxy }
-                __docker_version__: { get_param: docker_version }
-                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
-                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
-                __host_private_ip_addr__: { get_attr: [k8s_12_floating_ip, fixed_ip_address] }
-                __mtu__: { get_param: mtu }
-              template:
-                get_file: k8s_vm_install.sh
-        - path: /opt/k8s_vm_init.sh
-          permissions: '0755'
-          content:
-            str_replace:
-              params:
-                __host_private_ip_addr__: { get_attr: [k8s_12_floating_ip, fixed_ip_address] }
-                __host_label__: 'compute'
-              template:
-                get_file: k8s_vm_init.sh
-        - path: /etc/init.d/k8s_vm_init_serv
-          permissions: '0755'
-          content:
-            get_file: k8s_vm_init_serv.sh
-
-  k8s_12_vm_config:
-    type: OS::Heat::MultipartMime
-    properties:
-      parts:
-      - config: { get_resource: k8s_12_vm_scripts }
-
-  k8s_12_vm:
-    type: OS::Nova::Server
-    properties:
-      name:
-        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '12' ] ]
-      image: { get_param: ubuntu_1604_image }
-      flavor: { get_param: k8s_vm_flavor }
-      key_name: { get_param: key_name }
-      networks:
-      - port: { get_resource: k8s_12_private_port }
-      user_data_format: SOFTWARE_CONFIG
-      user_data: { get_resource: k8s_12_vm_config }
-
   etcd_1_private_port:
     type: OS::Neutron::Port
     properties:
@@ -1481,27 +1049,3 @@ outputs:
     description: The IP address of the k8s_06 instance
     value: { get_attr: [k8s_06_floating_ip, floating_ip_address] }
 
-  k8s_07_vm_ip:
-    description: The IP address of the k8s_07 instance
-    value: { get_attr: [k8s_07_floating_ip, floating_ip_address] }
-
-  k8s_08_vm_ip:
-    description: The IP address of the k8s_08 instance
-    value: { get_attr: [k8s_08_floating_ip, floating_ip_address] }
-
-  k8s_09_vm_ip:
-    description: The IP address of the k8s_09 instance
-    value: { get_attr: [k8s_09_floating_ip, floating_ip_address] }
-
-  k8s_10_vm_ip:
-    description: The IP address of the k8s_10 instance
-    value: { get_attr: [k8s_10_floating_ip, floating_ip_address] }
-
-  k8s_11_vm_ip:
-    description: The IP address of the k8s_11 instance
-    value: { get_attr: [k8s_11_floating_ip, floating_ip_address] }
-
-  k8s_12_vm_ip:
-    description: The IP address of the k8s_12 instance
-    value: { get_attr: [k8s_12_floating_ip, floating_ip_address] }
-
index bff17c0..a8ed24a 100644 (file)
@@ -70,7 +70,7 @@ parameters:
 
   rancher_version:
     type: string
-    default: "1.6.25"
+    default: "1.6.26"
 
   rancher_agent_version:
     type: string
@@ -78,7 +78,7 @@ parameters:
 
   kubectl_version:
     type: string
-    default: "1.11.5"
+    default: "1.11.8"
 
   helm_version:
     type: string
index f13e639..0ea9b62 100644 (file)
@@ -166,7 +166,7 @@ curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
 -X PUT \
 -H 'Accept: application/json' \
 -H 'Content-Type: application/json' \
--d '{"stacks":[{"type":"catalogTemplate", "answers":{"CONSTRAINT_TYPE":"required"}, "name":"kubernetes", "templateVersionId":"library:infra*k8s:53"}, {"type":"catalogTemplate", "name":"network-services", "templateId":"library:infra*network-services"}, {"type":"catalogTemplate", "name":"ipsec", "templateId":"library:infra*ipsec", "answers":{"MTU":"__mtu__"}}, {"type":"catalogTemplate", "name":"healthcheck", "templateId":"library:infra*healthcheck"}]}' \
+-d '{"stacks":[{"type":"catalogTemplate", "answers":{"CONSTRAINT_TYPE":"required"}, "name":"kubernetes", "templateVersionId":"library:infra*k8s:58"}, {"type":"catalogTemplate", "name":"network-services", "templateId":"library:infra*network-services"}, {"type":"catalogTemplate", "name":"ipsec", "templateId":"library:infra*ipsec", "answers":{"MTU":"__mtu__"}}, {"type":"catalogTemplate", "name":"healthcheck", "templateId":"library:infra*healthcheck"}]}' \
 "http://$RANCHER_IP:8080/v2-beta/projecttemplates/$TEMPLATE_ID"
 
 curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" > project.json
@@ -300,10 +300,10 @@ git commit -a -m "apply manifest versions"
 
 cd ~/oom
 # workaround to change onap portal cookie domain
-sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-app/resources/config/deliveries/properties/ONAPPORTAL/system.properties
-sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-sdk/resources/config/deliveries/properties/ONAPPORTALSDK/system.properties
-git diff
-git commit -a -m "set portal cookie domain"
+#sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-app/resources/config/deliveries/properties/ONAPPORTAL/system.properties
+#sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-sdk/resources/config/deliveries/properties/ONAPPORTALSDK/system.properties
+#git diff
+#git commit -a -m "set portal cookie domain"
 
 git tag -a "deploy0" -m "initial deployment"
 
diff --git a/deployment/heat/onap-oom/scripts/Crypto.java b/deployment/heat/onap-oom/scripts/Crypto.java
new file mode 100644 (file)
index 0000000..a9bad50
--- /dev/null
@@ -0,0 +1,82 @@
+import javax.crypto.Cipher;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.GeneralSecurityException;
+import java.security.SecureRandom;
+import java.util.Arrays;
+
+public class Crypto {
+
+    private static final String AES = "AES";
+    private static final int GCM_TAG_LENGTH = 16;
+    private static final int GCM_IV_LENGTH = 12;
+    private static final String AES_GCM_NO_PADDING = "AES/GCM/NoPadding";
+
+    public static void main(String[] args) {
+       if(args.length != 2) {
+               System.out.println("Usage: java Crypto value_to_encrypt key");
+               System.out.println("exit(1)");
+               System.exit(1);
+       }
+
+       String value = args[0];
+       String key = args[1];
+       String encrypted = encryptCloudConfigPassword(value, key);
+       System.out.println(encrypted);
+    }
+
+    /**
+     * encrypt a value and generate a keyfile
+     * if the keyfile is not found then a new one is created
+     * 
+     * @throws GeneralSecurityException
+     */
+    public static String encrypt (String value, String keyString) throws GeneralSecurityException {
+        SecretKeySpec sks = getSecretKeySpec (keyString);
+        Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+        byte[] initVector = new byte[GCM_IV_LENGTH];
+        (new SecureRandom()).nextBytes(initVector);
+        GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+        cipher.init(Cipher.ENCRYPT_MODE, sks, spec);
+        byte[] encoded = value.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+        byte[] cipherText = new byte[initVector.length + cipher.getOutputSize(encoded.length)];
+        System.arraycopy(initVector, 0, cipherText, 0, initVector.length);
+        cipher.doFinal(encoded, 0, encoded.length, cipherText, initVector.length);
+        return byteArrayToHexString(cipherText);
+    }
+
+    public static String encryptCloudConfigPassword(String message, String key) {
+       try {
+               return Crypto.encrypt(message, key);
+           } catch (GeneralSecurityException e) {
+          return null;
+      }
+    }
+
+    private static SecretKeySpec getSecretKeySpec (String keyString) {
+        byte[] key = hexStringToByteArray (keyString);
+        return new SecretKeySpec (key, AES);
+    }
+
+    public static String byteArrayToHexString (byte[] b) {
+        StringBuilder sb = new StringBuilder(b.length * 2);
+        for (byte aB : b) {
+            int v = aB & 0xff;
+            if (v < 16) {
+                sb.append('0');
+            }
+            sb.append(Integer.toHexString(v));
+        }
+        return sb.toString ().toUpperCase ();
+    }
+
+    private static byte[] hexStringToByteArray (String s) {
+        byte[] b = new byte[s.length () / 2];
+        for (int i = 0; i < b.length; i++) {
+            int index = i * 2;
+            int v = Integer.parseInt (s.substring (index, index + 2), 16);
+            b[i] = (byte) v;
+        }
+        return b;
+    }
+}
\ No newline at end of file
index 7977c6a..264152f 100755 (executable)
@@ -111,8 +111,15 @@ SSH_KEY=~/.ssh/onap_key
 
 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
 
+#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)
+
+#Use new encryption method
+pushd $WORKSPACE/deployment/heat/onap-oom/scripts
+javac Crypto.java
 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)
+export OS_PASSWORD_ENCRYPTED=$(java Crypto "$OS_PASSWORD" "$SO_ENCRYPTION_KEY")
+popd
 
 for n in $(seq 1 5); do
     if [ $full_deletion = true ] ; then
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Daily-openrc b/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Daily-openrc
new file mode 100644 (file)
index 0000000..3a3bb32
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=56d245b3c668419380d3b0f912497e29
+export OS_PROJECT_NAME=Integration-HEAT-Daily
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Staging-Daily-openrc b/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Staging-Daily-openrc
new file mode 100644 (file)
index 0000000..fa3825c
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=3583253e932845a09cd4c8ca2f31d095
+export OS_PROJECT_NAME=Integration-HEAT-Staging-Daily
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Verify-openrc b/deployment/heat/onap-rke/env/windriver/Integration-HEAT-Verify-openrc
new file mode 100644 (file)
index 0000000..624db1c
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=28481f6939614cfd83e6767a0e039bcc
+export OS_PROJECT_NAME=Integration-HEAT-Verify
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-OOM-Daily-openrc b/deployment/heat/onap-rke/env/windriver/Integration-OOM-Daily-openrc
new file mode 100644 (file)
index 0000000..b0eddb6
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=712b6016580e410b9abfec9ca34953ce
+export OS_PROJECT_NAME=Integration-OOM-Daily
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-OOM-Staging-Daily-openrc b/deployment/heat/onap-rke/env/windriver/Integration-OOM-Staging-Daily-openrc
new file mode 100644 (file)
index 0000000..062f3d1
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=09d8566ea45e43aa974cf447ed591d77
+export OS_PROJECT_NAME=Integration-OOM-Staging-Daily
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-OOM-Verify-openrc b/deployment/heat/onap-rke/env/windriver/Integration-OOM-Verify-openrc
new file mode 100644 (file)
index 0000000..1b48e4a
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=c27d16b88a4141ec8abcc07e731c0f24
+export OS_PROJECT_NAME=Integration-OOM-Verify
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-00-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-00-openrc
new file mode 100644 (file)
index 0000000..8b55dbd
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=41d6d38489bd40b09ea8a6b6b852dcbd
+export OS_PROJECT_NAME=Integration-SB-00
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-01-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-01-openrc
new file mode 100644 (file)
index 0000000..78469b2
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=087050388b204c73a3e418dd2c1fe30b
+export OS_PROJECT_NAME=Integration-SB-01
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-02-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-02-openrc
new file mode 100644 (file)
index 0000000..3531c11
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=ebb0ea7144004bacac1e39ff23105fa7
+export OS_PROJECT_NAME=Integration-SB-02
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-03-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-03-openrc
new file mode 100644 (file)
index 0000000..f6dbb7a
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=bc43d50ffcb84750bac0c1707a9a765b
+export OS_PROJECT_NAME=Integration-SB-03
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-04-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-04-openrc
new file mode 100644 (file)
index 0000000..0a27051
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=d570c718cbc545029f40e50b75eb13df
+export OS_PROJECT_NAME=Integration-SB-04
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-05-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-05-openrc
new file mode 100644 (file)
index 0000000..9bc0846
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=b8ad3842ab3642f7bf3fbe4e4d3b9f86
+export OS_PROJECT_NAME=Integration-SB-05
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-06-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-06-openrc
new file mode 100644 (file)
index 0000000..c7b650e
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=7fad299815104c0a8f90a8df80343f03
+export OS_PROJECT_NAME=Integration-SB-06
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/Integration-SB-07-openrc b/deployment/heat/onap-rke/env/windriver/Integration-SB-07-openrc
new file mode 100644 (file)
index 0000000..faf6b4b
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=1e097c6713e74fd7ac8e4295e605ee1e
+export OS_PROJECT_NAME=Integration-SB-07
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/OOF-openrc b/deployment/heat/onap-rke/env/windriver/OOF-openrc
new file mode 100644 (file)
index 0000000..dec995f
--- /dev/null
@@ -0,0 +1,9 @@
+export OS_PROJECT_ID=6bbd2981b210461dbc8fe846df1a7808
+export OS_PROJECT_NAME=OOF
+export OS_USER_DOMAIN_NAME=Default
+export OS_USERNAME=demo
+export OS_PASSWORD=onapdemo
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME=RegionOne
+export OS_INTERFACE=public
diff --git a/deployment/heat/onap-rke/env/windriver/onap-oom-light.env b/deployment/heat/onap-rke/env/windriver/onap-oom-light.env
new file mode 100644 (file)
index 0000000..c3f6159
--- /dev/null
@@ -0,0 +1,87 @@
+parameters:
+
+  ubuntu_1604_image: ubuntu-16-04-cloud-amd64
+
+  apt_proxy: 10.12.5.2:8000
+  docker_proxy: 10.12.5.2:5000
+
+  rancher_vm_flavor: m1.large
+  # use a smaller image for k8 hosts
+  k8s_vm_flavor: m1.xlarge
+
+  public_net_id: 971040b2-7059-49dc-b220-4fab50cb2ad4
+
+  oam_network_cidr: 10.0.0.0/16
+
+  integration_override_yaml: >
+    global:
+      repository: __docker_proxy__
+      pullPolicy: IfNotPresent
+    robot:
+      enabled: true
+      openStackKeyStoneUrl: "http://10.12.25.2:5000"
+      openStackPublicNetId: "__public_net_id__"
+      openStackTenantId: "${OS_PROJECT_ID}"
+      openStackUserName: "${OS_USERNAME}"
+      ubuntu14Image: "ubuntu-14-04-cloud-amd64"
+      ubuntu16Image: "ubuntu-16-04-cloud-amd64"
+      openStackPrivateNetId: "__oam_network_id__"
+      openStackPrivateSubnetId: "__oam_subnet_id__"
+      openStackPrivateNetCidr: "__oam_network_cidr__"
+      openStackOamNetworkCidrPrefix: "10.0"
+      dcaeCollectorIp: "__k8s_01_vm_ip__"
+      vnfPubKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh"
+      demoArtifactsVersion: "1.2.2"
+      scriptVersion: "1.2.1"
+      rancherIpAddress: "__rancher_ip_addr__"
+      config:
+        openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+    so:
+      enabled: true
+      so-catalog-db-adapter:
+        config:
+          openStackUserName: "${OS_USERNAME}"
+          openStackKeyStoneUrl: "http://10.12.25.2:5000/v2.0"
+          openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+    appc:
+      enabled: true
+      replicaCount: 1
+      config:
+        enableClustering: false
+    sdnc:
+      enabled: true
+      replicaCount: 1
+      config:
+        enableClustering: false
+    clamp:
+      enabled: false
+    pomba:
+      enabled: false
+    cli:
+      enabled: false
+    consul:
+      enabled: false
+    dcaegen2:
+      enabled: false
+    esr:
+      enabled: false
+    log:
+      enabled: false
+    mock:
+      enabled: false
+    msb:
+      enabled: false
+    multicloud:
+      enabled: false
+    nbi:
+      enabled: false
+    oof:
+      enabled: false
+    policy:
+      enabled: false
+    uui:
+      enabled: false
+    vfc:
+      enabled: false
+    vnfsdk:
+      enabled: false
diff --git a/deployment/heat/onap-rke/env/windriver/onap-oom.env b/deployment/heat/onap-rke/env/windriver/onap-oom.env
new file mode 100644 (file)
index 0000000..bf98171
--- /dev/null
@@ -0,0 +1,146 @@
+parameters:
+
+  ubuntu_1804_image: ubuntu-18.04
+
+  apt_proxy: 10.12.5.2:8000
+  docker_proxy: 10.12.5.2:5000
+
+  rancher_vm_flavor: m1.large
+  k8s_vm_flavor: m2.xlarge
+  etcd_vm_flavor: m1.medium
+  orch_vm_flavor: m1.large
+
+  public_net_id: 971040b2-7059-49dc-b220-4fab50cb2ad4
+
+  oam_network_cidr: 10.0.0.0/16
+
+  integration_gerrit_branch: master
+
+  helm_deploy_delay: 2.5m
+
+  integration_override_yaml: >
+    global:
+      repository: __docker_proxy__
+      pullPolicy: IfNotPresent
+    robot:
+      enabled: true
+      flavor: large
+      appcUsername: "appc@appc.onap.org"
+      appcPassword: "demo123456!"
+      openStackKeyStoneUrl: "http://10.12.25.2:5000"
+      openStackPublicNetId: "__public_net_id__"
+      openStackTenantId: "${OS_PROJECT_ID}"
+      openStackUserName: "${OS_USERNAME}"
+      ubuntu14Image: "ubuntu-14-04-cloud-amd64"
+      ubuntu16Image: "ubuntu-16-04-cloud-amd64"
+      openStackPrivateNetId: "__oam_network_id__"
+      openStackPrivateSubnetId: "__oam_subnet_id__"
+      openStackPrivateNetCidr: "__oam_network_cidr__"
+      openStackSecurityGroup: "__sec_group__"
+      openStackOamNetworkCidrPrefix: "10.0"
+      dcaeCollectorIp: "__k8s_01_vm_ip__"
+      vnfPubKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh"
+      demoArtifactsVersion: "1.3.0"
+      demoArtifactsRepoUrl: "https://nexus.onap.org/content/repositories/releases"
+      scriptVersion: "1.3.0"
+      rancherIpAddress: "__rancher_ip_addr__"
+      config:
+        openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+    so:
+      enabled: true
+      so-catalog-db-adapter:
+        config:
+          openStackUserName: "${OS_USERNAME}"
+          openStackKeyStoneUrl: "http://10.12.25.2:5000/v2.0"
+          openStackEncryptedPasswordHere: "${OS_PASSWORD_ENCRYPTED}"
+    appc:
+      enabled: true
+      replicaCount: 3
+      config:
+        enableClustering: true
+        openStackType: "OpenStackProvider"
+        openStackName: "OpenStack"
+        openStackKeyStoneUrl: "http://10.12.25.2:5000/v2.0"
+        openStackServiceTenantName: "${OS_PROJECT_NAME}"
+        openStackDomain: "${OS_USER_DOMAIN_NAME}"
+        openStackUserName: "${OS_USERNAME}"
+        openStackEncryptedPassword: "${OS_PASSWORD}"
+    sdnc:
+      enabled: true
+      replicaCount: 3
+      config:
+        enableClustering: true
+    aai:
+      enabled: true
+      liveness:
+        initialDelaySeconds: 120
+      aai-data-router:
+        liveness:
+          initialDelaySeconds: 120
+      aai-sparky-be:
+        liveness:
+          initialDelaySeconds: 120
+      aai-spike:
+        liveness:
+          initialDelaySeconds: 120
+    portal:
+      enabled: true
+      global:
+        portalHostName: "__portal_hostname__"
+      portal-mariadb:
+        config:
+          sdcFeHostName: "__portal_hostname__"
+          papHostName: "__portal_hostname__"
+          vidHostName: "__portal_hostname__"
+          aaiSparkyHostName: "__portal_hostname__"
+          cliHostName: "__portal_hostname__"
+          portalSdkHostName: "__portal_hostname__"
+          dmaapBcHostName: "__portal_hostname__"
+          msbHostName: "__portal_hostname__"
+    vid:
+      enabled: true
+      config:
+        portalhost: "__portal_hostname__"
+
+    aaf:
+      enabled: true
+    cassandra:
+      enabled: true
+    clamp:
+      enabled: true
+    cli:
+      enabled: true
+    consul:
+      enabled: true
+    contrib:
+      enabled: true
+    dcaegen2:
+      enabled: true
+    dmaap:
+      enabled: true
+    esr:
+      enabled: true
+    log:
+      enabled: true
+    sniro-emulator:
+      enabled: true
+    oof:
+      enabled: true
+    msb:
+      enabled: true
+    multicloud:
+      enabled: true
+    nbi:
+      enabled: true
+    policy:
+      enabled: true
+    pomba:
+      enabled: true
+    sdc:
+      enabled: true
+    uui:
+      enabled: true
+    vfc:
+      enabled: true
+    vnfsdk:
+      enabled: true
diff --git a/deployment/heat/onap-rke/k8s_vm_init.sh b/deployment/heat/onap-rke/k8s_vm_init.sh
new file mode 100644 (file)
index 0000000..aceb6a9
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -x
+# Copyright 2018 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
+#
+while [ ! -e /dockerdata-nfs/.git ]; do
+    mount /dockerdata-nfs
+    sleep 10
+done
diff --git a/deployment/heat/onap-rke/k8s_vm_init_serv.sh b/deployment/heat/onap-rke/k8s_vm_init_serv.sh
new file mode 100644 (file)
index 0000000..1536077
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          k8s_vm_init.sh
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start daemon at boot time
+# Description:       Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./k8s_vm_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+    cat "$pid_file"
+}
+
+is_running() {
+    [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+    start)
+    if is_running; then
+        echo "Already started"
+    else
+        echo "Starting $name"
+        cd "$dir"
+        if [ -z "$user" ]; then
+            sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        else
+            sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        fi
+        echo $! > "$pid_file"
+        if ! is_running; then
+            echo "Unable to start, see $stdout_log and $stderr_log"
+            exit 1
+        fi
+    fi
+    ;;
+    stop)
+    if is_running; then
+        echo -n "Stopping $name.."
+        kill `get_pid`
+        for i in {1..10}
+        do
+            if ! is_running; then
+                break
+            fi
+
+            echo -n "."
+            sleep 1
+        done
+        echo
+
+        if is_running; then
+            echo "Not stopped; may still be shutting down or shutdown may have failed"
+            exit 1
+        else
+            echo "Stopped"
+            if [ -f "$pid_file" ]; then
+                rm "$pid_file"
+            fi
+        fi
+    else
+        echo "Not running"
+    fi
+    ;;
+    restart)
+    $0 stop
+    if is_running; then
+        echo "Unable to stop, will not attempt to start"
+        exit 1
+    fi
+    $0 start
+    ;;
+    status)
+    if is_running; then
+        echo "Running"
+    else
+        echo "Stopped"
+        exit 1
+    fi
+    ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/deployment/heat/onap-rke/k8s_vm_install.sh b/deployment/heat/onap-rke/k8s_vm_install.sh
new file mode 100644 (file)
index 0000000..ebd4563
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash -x
+# Copyright 2018 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
+#
+export DEBIAN_FRONTEND=noninteractive
+echo "__host_private_ip_addr__ $(hostname)" >> /etc/hosts
+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
+echo "__host_private_ip_addr__" > /opt/config/host_private_ip_addr.txt
+echo "__mtu__" > /opt/config/mtu.txt
+
+mkdir -p /etc/docker
+if [ ! -z "__docker_proxy__" ]; then
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__,
+  "insecure-registries" : ["__docker_proxy__"]
+}
+EOF
+else
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__
+}
+EOF
+fi
+if [ ! -z "__apt_proxy__" ]; then
+    cat > /etc/apt/apt.conf.d/30proxy <<EOF
+Acquire::http { Proxy "http://__apt_proxy__"; };
+Acquire::https::Proxy "DIRECT";
+EOF
+fi
+
+
+mkdir -p /dockerdata-nfs
+echo "__rancher_private_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs noauto,noatime,fg,retry=1,x-systemd.automount,_netdev,soft,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab
+
+# workaround for OpenStack intermittent failure to change default apt mirrors
+sed -i 's|http://archive.ubuntu.com|http://nova.clouds.archive.ubuntu.com|g' /etc/apt/sources.list
+
+while ! hash jq &> /dev/null; do
+    apt-get -y update
+    # apt-get -y dist-upgrade
+    apt-get -y install curl jq nfs-common docker.io
+    systemctl enable docker
+    usermod -aG docker ubuntu
+    sleep 10
+done
+
+# Enable autorestart when VM reboots
+update-rc.d k8s_vm_init_serv defaults
diff --git a/deployment/heat/onap-rke/onap-oom.yaml b/deployment/heat/onap-rke/onap-oom.yaml
new file mode 100644 (file)
index 0000000..6e1f72a
--- /dev/null
@@ -0,0 +1,962 @@
+#
+# Generated by scripts/gen-onap-oom-yaml.sh; MANUAL CHANGES WILL BE LOST
+#
+heat_template_version: 2015-10-15
+description: ONAP on RKE Kubernetes using OOM
+
+parameters:
+  docker_proxy:
+    type: string
+
+  apt_proxy:
+    type: string
+
+  public_net_id:
+    type: string
+    description: The ID of the Public network for floating IP address allocation
+
+  oam_network_cidr:
+    type: string
+    description: CIDR of the OAM ONAP network
+
+  ubuntu_1804_image:
+    type: string
+    description: Name of the Ubuntu 18.04 image
+
+  rancher_vm_flavor:
+    type: string
+    description: VM flavor for Rancher
+
+  k8s_vm_flavor:
+    type: string
+    description: VM flavor for k8s hosts
+
+  etcd_vm_flavor:
+    type: string
+    description: VM flavor for etcd hosts
+
+  orch_vm_flavor:
+    type: string
+    description: VM flavor for orch hosts
+
+  integration_override_yaml:
+    type: string
+    description: Content for integration_override.yaml
+
+  integration_gerrit_branch:
+    type: string
+    default: "master"
+
+  integration_gerrit_refspec:
+    type: string
+    default: ""
+
+  oom_gerrit_branch:
+    type: string
+    default: "master"
+
+  oom_gerrit_refspec:
+    type: string
+    default: ""
+
+  docker_manifest:
+    type: string
+    default: ""
+
+  key_name:
+    type: string
+    default: "onap_key"
+
+  docker_version:
+    type: string
+    default: "17.03.2"
+
+  rancher_version:
+    type: string
+    default: "1.6.26"
+
+  rancher_agent_version:
+    type: string
+    default: "1.2.11"
+
+  kubectl_version:
+    type: string
+    default: "1.13.4"
+
+  helm_version:
+    type: string
+    default: "2.9.1"
+
+  helm_deploy_delay:
+    type: string
+    default: "3m"
+
+  use_ramdisk:
+    type: string
+    description: Set to "true" if you want to use a RAM disk for /dockerdata-nfs/.
+    default: "false"
+
+  mtu:
+    type: number
+    default: 1500
+
+  portal_hostname:
+    type: string
+    description: The FQDN of the k8s host that will be used for the Portal UI component URLs; this needs to be resolveable at the client
+    default: "portal.api.simpledemo.onap.org"
+
+resources:
+  random-str:
+    type: OS::Heat::RandomString
+    properties:
+      length: 4
+
+  # ONAP security group
+  onap_sg:
+    type: OS::Neutron::SecurityGroup
+    properties:
+      name:
+        str_replace:
+          template: base_rand
+          params:
+            base: onap_sg
+            rand: { get_resource: random-str }
+      description: security group used by ONAP
+      rules:
+        # All egress traffic
+        - direction: egress
+          ethertype: IPv4
+        - direction: egress
+          ethertype: IPv6
+        # ingress traffic
+        # ICMP
+        - protocol: icmp
+        - protocol: udp
+          port_range_min: 1
+          port_range_max: 65535
+        - protocol: tcp
+          port_range_min: 1
+          port_range_max: 65535
+        # Protocols used for vLB/vDNS use case
+        - protocol: 47
+        - protocol: 53
+        - protocol: 132
+
+
+  # ONAP management private network
+  oam_network:
+    type: OS::Neutron::Net
+    properties:
+      name:
+        str_replace:
+          template: oam_network_rand
+          params:
+            rand: { get_resource: random-str }
+
+  oam_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name:
+        str_replace:
+          template: oam_network_rand
+          params:
+            rand: { get_resource: random-str }
+      network_id: { get_resource: oam_network }
+      cidr: { get_param: oam_network_cidr }
+      dns_nameservers: [ "8.8.8.8" ]
+
+  router:
+    type: OS::Neutron::Router
+    properties:
+      name:
+        list_join: ['-', [{ get_param: 'OS::stack_name' }, 'router']]
+      external_gateway_info:
+        network: { get_param: public_net_id }
+
+  router_interface:
+    type: OS::Neutron::RouterInterface
+    properties:
+      router_id: { get_resource: router }
+      subnet_id: { get_resource: oam_subnet }
+
+  rancher_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  rancher_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: rancher_private_port }
+
+  rancher_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [{ get_param: 'OS::stack_name' }, 'rancher']]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: rancher_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: rancher_private_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          template:
+            get_file: rancher_vm_entrypoint.sh
+          params:
+            __docker_proxy__: { get_param: docker_proxy }
+            __apt_proxy__: { get_param: apt_proxy }
+            __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 }
+            __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 }
+            __helm_deploy_delay__: { get_param: helm_deploy_delay }
+            __use_ramdisk__: { get_param: use_ramdisk }
+            __mtu__: { get_param: mtu }
+            __portal_hostname__: { get_param: portal_hostname }
+            __public_net_id__: { get_param: public_net_id }
+            __oam_network_cidr__: { get_param: oam_network_cidr }
+            __oam_network_id__: { get_resource: oam_network }
+            __oam_subnet_id__: { get_resource: oam_subnet }
+            __sec_group__: { get_resource: onap_sg }
+            __k8s_01_vm_ip__: { get_attr: [k8s_01_floating_ip, floating_ip_address] }
+            __k8s_vm_ips__: [
+              get_attr: [k8s_01_floating_ip, floating_ip_address],
+              get_attr: [k8s_02_floating_ip, floating_ip_address],
+              get_attr: [k8s_03_floating_ip, floating_ip_address],
+              get_attr: [k8s_04_floating_ip, floating_ip_address],
+              get_attr: [k8s_05_floating_ip, floating_ip_address],
+              get_attr: [k8s_06_floating_ip, floating_ip_address],
+            ]
+            __k8s_private_ips__: [
+              get_attr: [k8s_01_floating_ip, fixed_ip_address],
+              get_attr: [k8s_02_floating_ip, fixed_ip_address],
+              get_attr: [k8s_03_floating_ip, fixed_ip_address],
+              get_attr: [k8s_04_floating_ip, fixed_ip_address],
+              get_attr: [k8s_05_floating_ip, fixed_ip_address],
+              get_attr: [k8s_06_floating_ip, fixed_ip_address],
+            ]
+  k8s_01_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_01_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_01_private_port }
+
+  k8s_01_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_01_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_01_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_01_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_01_vm_scripts }
+
+  k8s_01_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '01' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_01_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_01_vm_config }
+
+  k8s_02_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_02_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_02_private_port }
+
+  k8s_02_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_02_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_02_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_02_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_02_vm_scripts }
+
+  k8s_02_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '02' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_02_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_02_vm_config }
+
+  k8s_03_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_03_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_03_private_port }
+
+  k8s_03_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_03_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_03_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_03_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_03_vm_scripts }
+
+  k8s_03_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '03' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_03_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_03_vm_config }
+
+  k8s_04_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_04_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_04_private_port }
+
+  k8s_04_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_04_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_04_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_04_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_04_vm_scripts }
+
+  k8s_04_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '04' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_04_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_04_vm_config }
+
+  k8s_05_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_05_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_05_private_port }
+
+  k8s_05_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_05_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_05_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_05_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_05_vm_scripts }
+
+  k8s_05_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '05' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_05_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_05_vm_config }
+
+  k8s_06_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_06_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_06_private_port }
+
+  k8s_06_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [k8s_06_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [k8s_06_floating_ip, fixed_ip_address] }
+                __host_label__: 'compute'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  k8s_06_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: k8s_06_vm_scripts }
+
+  k8s_06_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s', '06' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_06_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: k8s_06_vm_config }
+
+  orch_1_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  orch_1_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: orch_1_private_port }
+
+  orch_1_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [orch_1_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [orch_1_floating_ip, fixed_ip_address] }
+                __host_label__: 'orchestration'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  orch_1_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: orch_1_vm_scripts }
+
+  orch_1_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'orch', '1' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: orch_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: orch_1_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: orch_1_vm_config }
+
+  orch_2_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  orch_2_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: orch_2_private_port }
+
+  orch_2_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [orch_2_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [orch_2_floating_ip, fixed_ip_address] }
+                __host_label__: 'orchestration'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  orch_2_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: orch_2_vm_scripts }
+
+  orch_2_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'orch', '2' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: orch_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: orch_2_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: orch_2_vm_config }
+
+  orch_3_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  orch_3_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: orch_3_private_port }
+
+  orch_3_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [orch_3_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [orch_3_floating_ip, fixed_ip_address] }
+                __host_label__: 'orchestration'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  orch_3_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: orch_3_vm_scripts }
+
+  orch_3_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'orch', '3' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: orch_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: orch_3_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: orch_3_vm_config }
+
+outputs:
+  docker_proxy:
+    value: { get_param: docker_proxy }
+
+  rancher_vm_ip:
+    description: The IP address of the rancher instance
+    value: { get_attr: [rancher_floating_ip, floating_ip_address] }
+
+  k8s_01_vm_ip:
+    description: The IP address of the k8s_01 instance
+    value: { get_attr: [k8s_01_floating_ip, floating_ip_address] }
+
+  k8s_01_vm_private_ip:
+    description: The private IP address of the k8s_01 instance
+    value: { get_attr: [k8s_01_floating_ip, fixed_ip_address] }
+
+  k8s_02_vm_ip:
+    description: The IP address of the k8s_02 instance
+    value: { get_attr: [k8s_02_floating_ip, floating_ip_address] }
+
+  k8s_02_vm_private_ip:
+    description: The private IP address of the k8s_02 instance
+    value: { get_attr: [k8s_02_floating_ip, fixed_ip_address] }
+
+  k8s_03_vm_ip:
+    description: The IP address of the k8s_03 instance
+    value: { get_attr: [k8s_03_floating_ip, floating_ip_address] }
+
+  k8s_03_vm_private_ip:
+    description: The private IP address of the k8s_03 instance
+    value: { get_attr: [k8s_03_floating_ip, fixed_ip_address] }
+
+  k8s_04_vm_ip:
+    description: The IP address of the k8s_04 instance
+    value: { get_attr: [k8s_04_floating_ip, floating_ip_address] }
+
+  k8s_04_vm_private_ip:
+    description: The private IP address of the k8s_04 instance
+    value: { get_attr: [k8s_04_floating_ip, fixed_ip_address] }
+
+  k8s_05_vm_ip:
+    description: The IP address of the k8s_05 instance
+    value: { get_attr: [k8s_05_floating_ip, floating_ip_address] }
+
+  k8s_05_vm_private_ip:
+    description: The private IP address of the k8s_05 instance
+    value: { get_attr: [k8s_05_floating_ip, fixed_ip_address] }
+
+  k8s_06_vm_ip:
+    description: The IP address of the k8s_06 instance
+    value: { get_attr: [k8s_06_floating_ip, floating_ip_address] }
+
+  k8s_06_vm_private_ip:
+    description: The private IP address of the k8s_06 instance
+    value: { get_attr: [k8s_06_floating_ip, fixed_ip_address] }
+
+  orch_1_vm_ip:
+    description: The IP address of the orch_1 instance
+    value: { get_attr: [orch_1_floating_ip, floating_ip_address] }
+
+  orch_1_vm_private_ip:
+    description: The private IP address of the orch_1 instance
+    value: { get_attr: [orch_1_floating_ip, fixed_ip_address] }
+
+  orch_2_vm_ip:
+    description: The IP address of the orch_2 instance
+    value: { get_attr: [orch_2_floating_ip, floating_ip_address] }
+
+  orch_2_vm_private_ip:
+    description: The private IP address of the orch_2 instance
+    value: { get_attr: [orch_2_floating_ip, fixed_ip_address] }
+
+  orch_3_vm_ip:
+    description: The IP address of the orch_3 instance
+    value: { get_attr: [orch_3_floating_ip, floating_ip_address] }
+
+  orch_3_vm_private_ip:
+    description: The private IP address of the orch_3 instance
+    value: { get_attr: [orch_3_floating_ip, fixed_ip_address] }
+
diff --git a/deployment/heat/onap-rke/parts/onap-oom-1.yaml b/deployment/heat/onap-rke/parts/onap-oom-1.yaml
new file mode 100644 (file)
index 0000000..b1676b2
--- /dev/null
@@ -0,0 +1,192 @@
+heat_template_version: 2015-10-15
+description: ONAP on RKE Kubernetes using OOM
+
+parameters:
+  docker_proxy:
+    type: string
+
+  apt_proxy:
+    type: string
+
+  public_net_id:
+    type: string
+    description: The ID of the Public network for floating IP address allocation
+
+  oam_network_cidr:
+    type: string
+    description: CIDR of the OAM ONAP network
+
+  ubuntu_1804_image:
+    type: string
+    description: Name of the Ubuntu 18.04 image
+
+  rancher_vm_flavor:
+    type: string
+    description: VM flavor for Rancher
+
+  k8s_vm_flavor:
+    type: string
+    description: VM flavor for k8s hosts
+
+  etcd_vm_flavor:
+    type: string
+    description: VM flavor for etcd hosts
+
+  orch_vm_flavor:
+    type: string
+    description: VM flavor for orch hosts
+
+  integration_override_yaml:
+    type: string
+    description: Content for integration_override.yaml
+
+  integration_gerrit_branch:
+    type: string
+    default: "master"
+
+  integration_gerrit_refspec:
+    type: string
+    default: ""
+
+  oom_gerrit_branch:
+    type: string
+    default: "master"
+
+  oom_gerrit_refspec:
+    type: string
+    default: ""
+
+  docker_manifest:
+    type: string
+    default: ""
+
+  key_name:
+    type: string
+    default: "onap_key"
+
+  docker_version:
+    type: string
+    default: "17.03.2"
+
+  rancher_version:
+    type: string
+    default: "1.6.26"
+
+  rancher_agent_version:
+    type: string
+    default: "1.2.11"
+
+  kubectl_version:
+    type: string
+    default: "1.13.4"
+
+  helm_version:
+    type: string
+    default: "2.9.1"
+
+  helm_deploy_delay:
+    type: string
+    default: "3m"
+
+  use_ramdisk:
+    type: string
+    description: Set to "true" if you want to use a RAM disk for /dockerdata-nfs/.
+    default: "false"
+
+  mtu:
+    type: number
+    default: 1500
+
+  portal_hostname:
+    type: string
+    description: The FQDN of the k8s host that will be used for the Portal UI component URLs; this needs to be resolveable at the client
+    default: "portal.api.simpledemo.onap.org"
+
+resources:
+  random-str:
+    type: OS::Heat::RandomString
+    properties:
+      length: 4
+
+  # ONAP security group
+  onap_sg:
+    type: OS::Neutron::SecurityGroup
+    properties:
+      name:
+        str_replace:
+          template: base_rand
+          params:
+            base: onap_sg
+            rand: { get_resource: random-str }
+      description: security group used by ONAP
+      rules:
+        # All egress traffic
+        - direction: egress
+          ethertype: IPv4
+        - direction: egress
+          ethertype: IPv6
+        # ingress traffic
+        # ICMP
+        - protocol: icmp
+        - protocol: udp
+          port_range_min: 1
+          port_range_max: 65535
+        - protocol: tcp
+          port_range_min: 1
+          port_range_max: 65535
+        # Protocols used for vLB/vDNS use case
+        - protocol: 47
+        - protocol: 53
+        - protocol: 132
+
+
+  # ONAP management private network
+  oam_network:
+    type: OS::Neutron::Net
+    properties:
+      name:
+        str_replace:
+          template: oam_network_rand
+          params:
+            rand: { get_resource: random-str }
+
+  oam_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name:
+        str_replace:
+          template: oam_network_rand
+          params:
+            rand: { get_resource: random-str }
+      network_id: { get_resource: oam_network }
+      cidr: { get_param: oam_network_cidr }
+      dns_nameservers: [ "8.8.8.8" ]
+
+  router:
+    type: OS::Neutron::Router
+    properties:
+      name:
+        list_join: ['-', [{ get_param: 'OS::stack_name' }, 'router']]
+      external_gateway_info:
+        network: { get_param: public_net_id }
+
+  router_interface:
+    type: OS::Neutron::RouterInterface
+    properties:
+      router_id: { get_resource: router }
+      subnet_id: { get_resource: oam_subnet }
+
+  rancher_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  rancher_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: rancher_private_port }
+
diff --git a/deployment/heat/onap-rke/parts/onap-oom-2.yaml b/deployment/heat/onap-rke/parts/onap-oom-2.yaml
new file mode 100644 (file)
index 0000000..bd4ba1f
--- /dev/null
@@ -0,0 +1,70 @@
+  ${VM_TYPE}_${VM_NUM}_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  ${VM_TYPE}_${VM_NUM}_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port }
+
+  ${VM_TYPE}_${VM_NUM}_vm_scripts:
+    type: OS::Heat::CloudConfig
+    properties:
+      cloud_config:
+        power_state:
+          mode: reboot
+        runcmd:
+        - [ /opt/k8s_vm_install.sh ]
+        write_files:
+        - path: /opt/k8s_vm_install.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __docker_proxy__: { get_param: docker_proxy }
+                __apt_proxy__: { get_param: apt_proxy }
+                __docker_version__: { get_param: docker_version }
+                __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+                __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+                __host_private_ip_addr__: { get_attr: [${VM_TYPE}_${VM_NUM}_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
+              template:
+                get_file: k8s_vm_install.sh
+        - path: /opt/k8s_vm_init.sh
+          permissions: '0755'
+          content:
+            str_replace:
+              params:
+                __host_private_ip_addr__: { get_attr: [${VM_TYPE}_${VM_NUM}_floating_ip, fixed_ip_address] }
+                __host_label__: '$HOST_LABEL'
+              template:
+                get_file: k8s_vm_init.sh
+        - path: /etc/init.d/k8s_vm_init_serv
+          permissions: '0755'
+          content:
+            get_file: k8s_vm_init_serv.sh
+
+  ${VM_TYPE}_${VM_NUM}_vm_config:
+    type: OS::Heat::MultipartMime
+    properties:
+      parts:
+      - config: { get_resource: ${VM_TYPE}_${VM_NUM}_vm_scripts }
+
+  ${VM_TYPE}_${VM_NUM}_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, '${VM_TYPE}', '${VM_NUM}' ] ]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: ${VM_TYPE}_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: ${VM_TYPE}_${VM_NUM}_private_port }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource: ${VM_TYPE}_${VM_NUM}_vm_config }
+
diff --git a/deployment/heat/onap-rke/parts/onap-oom-3.yaml b/deployment/heat/onap-rke/parts/onap-oom-3.yaml
new file mode 100644 (file)
index 0000000..3b3cf70
--- /dev/null
@@ -0,0 +1,8 @@
+outputs:
+  docker_proxy:
+    value: { get_param: docker_proxy }
+
+  rancher_vm_ip:
+    description: The IP address of the rancher instance
+    value: { get_attr: [rancher_floating_ip, floating_ip_address] }
+
diff --git a/deployment/heat/onap-rke/rancher_vm_entrypoint.sh b/deployment/heat/onap-rke/rancher_vm_entrypoint.sh
new file mode 100644 (file)
index 0000000..51a3fab
--- /dev/null
@@ -0,0 +1,241 @@
+#!/bin/bash -x
+#
+# Copyright 2018 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
+#
+
+# allow root login
+export HOME=/root
+mkdir -p ~/.ssh
+cp ~ubuntu/.ssh/authorized_keys ~/.ssh
+
+export DEBIAN_FRONTEND=noninteractive
+HOST_IP=$(hostname -I)
+echo $HOST_IP `hostname` >> /etc/hosts
+printenv
+
+mkdir -p /opt/config
+echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
+echo "__k8s_vm_ips__" > /opt/config/k8s_vm_ips.txt
+echo "__k8s_private_ips__" > /opt/config/k8s_private_ips.txt
+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 "__sec_group__" > /opt/config/sec_group.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
+echo "__helm_deploy_delay__" > /opt/config/helm_deploy_delay.txt
+echo "__mtu__" > /opt/config/mtu.txt
+echo "__portal_hostname__" > /opt/config/portal_hostname.txt
+
+cat <<EOF > /opt/config/integration-override.yaml
+__integration_override_yaml__
+EOF
+sed -i 's/\_\_portal_hostname__/__portal_hostname__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_public_net_id__/__public_net_id__/g' /opt/config/integration-override.yaml
+sed -i 's|\_\_oam_network_cidr__|__oam_network_cidr__|g' /opt/config/integration-override.yaml
+sed -i 's/\_\_oam_network_id__/__oam_network_id__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_oam_subnet_id__/__oam_subnet_id__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_sec_group__/__sec_group__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_rancher_ip_addr__/__rancher_ip_addr__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_k8s_01_vm_ip__/__k8s_01_vm_ip__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_docker_proxy__/__docker_proxy__/g' /opt/config/integration-override.yaml
+cp /opt/config/integration-override.yaml /root
+cat /root/integration-override.yaml
+
+mkdir -p /etc/docker
+if [ ! -z "__docker_proxy__" ]; then
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__,
+  "insecure-registries" : ["__docker_proxy__"]
+}
+EOF
+else
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__
+}
+EOF
+fi
+if [ ! -z "__apt_proxy__" ]; then
+    cat > /etc/apt/apt.conf.d/30proxy<<EOF
+Acquire::http { Proxy "http://__apt_proxy__"; };
+Acquire::https::Proxy "DIRECT";
+EOF
+fi
+
+# workaround for OpenStack intermittent failure to change default apt mirrors
+sed -i 's|http://archive.ubuntu.com|http://nova.clouds.archive.ubuntu.com|g' /etc/apt/sources.list
+
+while ! hash jq &> /dev/null; do
+    apt-get -y update
+    apt-get -y install curl jq make nfs-kernel-server moreutils
+    sleep 10
+done
+
+mkdir -p /dockerdata-nfs
+
+# use RAM disk for /dockerdata-nfs for testing
+if [ "__use_ramdisk__" = "true" ]; then
+    echo "tmpfs /dockerdata-nfs tmpfs noatime,size=75% 1 2" >> /etc/fstab
+    mount /dockerdata-nfs
+fi
+
+# update and initialize git
+git config --global user.email root@rancher
+git config --global user.name root@rancher
+git config --global log.decorate auto
+
+# version control the persistence volume to see what's happening
+chmod 777 /dockerdata-nfs/
+chown nobody:nogroup /dockerdata-nfs/
+cd /dockerdata-nfs/
+git init
+git add -A
+git commit -m "initial commit"
+
+# export NFS mount
+echo "/dockerdata-nfs *(rw,fsid=1,async,no_root_squash,no_subtree_check)" | tee /etc/exports
+exportfs -a
+systemctl restart nfs-kernel-server
+
+
+
+cd ~
+
+# 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 -p ~/.kube
+
+# install helm __helm_version__
+mkdir -p helm
+pushd helm
+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 cp linux-amd64/helm /usr/local/bin/helm
+popd
+
+
+
+
+# Clone OOM repo
+cd ~
+git clone -b __oom_gerrit_branch__ https://gerrit.onap.org/r/oom
+cd oom
+if [ ! -z "__oom_gerrit_refspec__" ]; then
+    git fetch https://gerrit.onap.org/r/oom __oom_gerrit_refspec__
+    git checkout FETCH_HEAD
+fi
+git checkout -b workarounds
+git log -1
+
+# Clone integration repo
+cd ~
+git clone -b __integration_gerrit_branch__ https://gerrit.onap.org/r/integration
+cd integration
+if [ ! -z "__integration_gerrit_refspec__" ]; then
+    git fetch https://gerrit.onap.org/r/integration __integration_gerrit_refspec__
+    git checkout FETCH_HEAD
+fi
+
+
+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"
+
+cd ~/oom
+# workaround to change onap portal cookie domain
+sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-app/resources/config/deliveries/properties/ONAPPORTAL/system.properties
+sed -i "s/^cookie_domain.*=.*/cookie_domain = __portal_hostname__/g" ./kubernetes/portal/charts/portal-sdk/resources/config/deliveries/properties/ONAPPORTALSDK/system.properties
+git diff
+git commit -a -m "set portal cookie domain"
+
+git tag -a "deploy0" -m "initial deployment"
+
+
+
+
+
+
+
+# wait for /root/.kube/config to show up; will be placed by deploy script after RKE completes
+while [ ! -e /root/.kube/config ]; do
+    sleep 1m
+done
+
+
+NAMESPACE=onap
+export KUBECONFIG=/root/.kube/config
+kubectl config set-context $(kubectl config current-context) --namespace=$NAMESPACE
+kubectl config view
+
+
+# Enable auto-completion for kubectl
+echo "source <(kubectl completion bash)" >> ~/.bashrc
+
+
+until [ $(kubectl get cs | tail -n +2 | grep -c Healthy) -ge 5 ]; do
+    sleep 1m
+done
+
+
+# install tiller/helm
+kubectl -n kube-system create serviceaccount tiller
+kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
+helm init --service-account tiller
+kubectl -n kube-system rollout status deploy/tiller-deploy
+helm serve &
+sleep 10
+
+# Make ONAP helm charts
+cd ~/oom/kubernetes/
+helm repo add local http://127.0.0.1:8879
+helm repo list
+make all
+helm search -l | grep local
+
+# install helm deploy plugin
+rsync -avt ~/oom/kubernetes/helm/plugins ~/.helm/
+# temporary workaround to throttle the helm deploy to alleviate startup disk contention issues
+if [ ! -z "__helm_deploy_delay__" ]; then
+    sed -i "/\^enabled:/a\      echo sleep __helm_deploy_delay__\n      sleep __helm_deploy_delay__" ~/.helm/plugins/deploy/deploy.sh
+fi
+
+# Deploy ONAP
+helm deploy dev local/onap -f ~/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f ~/integration-override.yaml --namespace $NAMESPACE --verbose
+
+# re-install original helm deploy plugin
+rsync -avt ~/oom/kubernetes/helm/plugins ~/.helm/
+
+helm list
+
+
+
+# Check ONAP status:
+sleep 10
+kubectl get pods --all-namespaces
+kubectl get nodes
+kubectl top nodes
diff --git a/deployment/heat/onap-rke/scripts/Crypto.java b/deployment/heat/onap-rke/scripts/Crypto.java
new file mode 100644 (file)
index 0000000..a9bad50
--- /dev/null
@@ -0,0 +1,82 @@
+import javax.crypto.Cipher;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.GeneralSecurityException;
+import java.security.SecureRandom;
+import java.util.Arrays;
+
+public class Crypto {
+
+    private static final String AES = "AES";
+    private static final int GCM_TAG_LENGTH = 16;
+    private static final int GCM_IV_LENGTH = 12;
+    private static final String AES_GCM_NO_PADDING = "AES/GCM/NoPadding";
+
+    public static void main(String[] args) {
+       if(args.length != 2) {
+               System.out.println("Usage: java Crypto value_to_encrypt key");
+               System.out.println("exit(1)");
+               System.exit(1);
+       }
+
+       String value = args[0];
+       String key = args[1];
+       String encrypted = encryptCloudConfigPassword(value, key);
+       System.out.println(encrypted);
+    }
+
+    /**
+     * encrypt a value and generate a keyfile
+     * if the keyfile is not found then a new one is created
+     * 
+     * @throws GeneralSecurityException
+     */
+    public static String encrypt (String value, String keyString) throws GeneralSecurityException {
+        SecretKeySpec sks = getSecretKeySpec (keyString);
+        Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+        byte[] initVector = new byte[GCM_IV_LENGTH];
+        (new SecureRandom()).nextBytes(initVector);
+        GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+        cipher.init(Cipher.ENCRYPT_MODE, sks, spec);
+        byte[] encoded = value.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+        byte[] cipherText = new byte[initVector.length + cipher.getOutputSize(encoded.length)];
+        System.arraycopy(initVector, 0, cipherText, 0, initVector.length);
+        cipher.doFinal(encoded, 0, encoded.length, cipherText, initVector.length);
+        return byteArrayToHexString(cipherText);
+    }
+
+    public static String encryptCloudConfigPassword(String message, String key) {
+       try {
+               return Crypto.encrypt(message, key);
+           } catch (GeneralSecurityException e) {
+          return null;
+      }
+    }
+
+    private static SecretKeySpec getSecretKeySpec (String keyString) {
+        byte[] key = hexStringToByteArray (keyString);
+        return new SecretKeySpec (key, AES);
+    }
+
+    public static String byteArrayToHexString (byte[] b) {
+        StringBuilder sb = new StringBuilder(b.length * 2);
+        for (byte aB : b) {
+            int v = aB & 0xff;
+            if (v < 16) {
+                sb.append('0');
+            }
+            sb.append(Integer.toHexString(v));
+        }
+        return sb.toString ().toUpperCase ();
+    }
+
+    private static byte[] hexStringToByteArray (String s) {
+        byte[] b = new byte[s.length () / 2];
+        for (int i = 0; i < b.length; i++) {
+            int index = i * 2;
+            int v = Integer.parseInt (s.substring (index, index + 2), 16);
+            b[i] = (byte) v;
+        }
+        return b;
+    }
+}
\ No newline at end of file
diff --git a/deployment/heat/onap-rke/scripts/cleanup.sh b/deployment/heat/onap-rke/scripts/cleanup.sh
new file mode 100755 (executable)
index 0000000..7c2a1e2
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+IFS='
+'
+
+if [ -z $1 ]; then
+       echo "ONAP component name missing"
+       echo "Usage: ./cleanup.sh onap_component_name"
+       exit 1
+fi
+
+COMPONENT=$1
+
+if [ $COMPONENT == "dcae" ] || [ $COMPONENT == "DCAE" ]; then
+       kubectl delete service consul -n onap
+fi
+
+for op in secrets configmaps pvc pv services deployments statefulsets clusterrolebinding; do
+       ARRAY=(`kubectl get $op -n onap | grep dev-$COMPONENT | awk '{print $1}'`)
+       for i in ${ARRAY[*]}; do
+               kubectl delete $op -n onap $i
+       done
+done
diff --git a/deployment/heat/onap-rke/scripts/deploy.sh b/deployment/heat/onap-rke/scripts/deploy.sh
new file mode 100755 (executable)
index 0000000..17113c1
--- /dev/null
@@ -0,0 +1,269 @@
+#!/bin/bash
+#
+# Copyright 2018 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
+#
+
+stack_name="onap"
+portal_hostname="portal.api.simpledemo.onap.org"
+full_deletion=false
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+usage() {
+    echo "Usage: $0 [ -n <number of VMs {2-15}> ][ -s <stack name> ][ -m <manifest> ][ -d <domain> ][ -r ][ -q ] <env>" 1>&2;
+
+    echo "n:    Set the number of VM's that will be installed. This number must be between 2 and 15" 1>&2;
+    echo "s:    Set the name to be used for stack. This name will be used for naming of resources" 1>&2;
+    echo "d:    Set the base domain name to be used in portal UI URLs" 1>&2;
+    echo "m:    The docker manifest to apply; must be either \"docker-manifest-staging.csv\" or \"docker-manifest.csv\"." 1>&2;
+    echo "r:    Delete all resources relating to ONAP within enviroment." 1>&2;
+    echo "q:    Quiet Delete of all ONAP resources." 1>&2;
+
+    exit 1;
+}
+
+
+while getopts ":n:s:d:m:rq" o; do
+    case "${o}" in
+        n)
+            if [[ ${OPTARG} =~ ^[0-9]+$ ]];then
+                if [ ${OPTARG} -ge 2 -a ${OPTARG} -le 15 ]; then
+                    vm_num=${OPTARG}
+                else
+                    usage
+                fi
+            else
+                usage
+            fi
+            ;;
+        s)
+            if [[ ! ${OPTARG} =~ ^[0-9]+$ ]];then
+                stack_name=${OPTARG}
+            else
+                usage
+            fi
+            ;;
+        d)
+            if [[ ! ${OPTARG} =~ ^[0-9]+$ ]];then
+                portal_hostname=${OPTARG}
+            else
+                usage
+            fi
+            ;;
+        m)
+            if [ -f $WORKSPACE/version-manifest/src/main/resources/${OPTARG} ]; then
+                docker_manifest=${OPTARG}
+            else
+                usage
+            fi
+            ;;
+        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
+   usage
+fi
+
+ENV_FILE=$1
+
+if [ ! -f $ENV_FILE ];then
+    echo ENV file does not exist or was not given
+    exit 1
+fi
+
+set -x
+
+SSH_KEY=~/.ssh/onap_key
+
+source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
+
+#Use new encryption method
+pushd $WORKSPACE/deployment/heat/onap-rke/scripts
+javac Crypto.java
+SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
+export OS_PASSWORD_ENCRYPTED=$(java Crypto "$OS_PASSWORD" "$SO_ENCRYPTION_KEY")
+popd
+
+for n in $(seq 1 5); do
+    if [ $full_deletion = true ] ; then
+        $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $stack_name -q
+    else
+        $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $stack_name
+    fi
+
+    cd $WORKSPACE/deployment/heat/onap-rke
+    envsubst < $ENV_FILE > $ENV_FILE~
+    if [ -z "$vm_num" ]; then
+        cp onap-oom.yaml onap-oom.yaml~
+    else
+        ./scripts/gen-onap-oom-yaml.sh $vm_num > onap-oom.yaml~
+    fi
+
+    if ! openstack stack create -t ./onap-oom.yaml~ -e $ENV_FILE~ $stack_name --parameter docker_manifest=$docker_manifest --parameter portal_hostname=$portal_hostname; then
+        break
+    fi
+
+    while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $stack_name)" ]; do
+        sleep 20
+    done
+
+    STATUS=$(openstack stack show -c stack_status -f value $stack_name)
+    echo $STATUS
+    if [ "CREATE_COMPLETE" != "$STATUS" ]; then
+        break
+    fi
+
+    for i in $(seq 1 30); do
+       sleep 30
+       RANCHER_IP=$(openstack stack output show $stack_name rancher_vm_ip -c output_value -f value)
+        K8S_IP=$(openstack stack output show $stack_name k8s_01_vm_ip -c output_value -f value)
+       timeout 1 ping -c 1 "$RANCHER_IP" && break
+    done
+
+    timeout 1 ping -c 1 "$RANCHER_IP" && break
+
+    echo Error: OpenStack infrastructure issue: unable to reach rancher "$RANCHER_IP"
+    sleep 10
+done
+
+if ! timeout 1 ping -c 1 "$RANCHER_IP"; then
+    exit 2
+fi
+
+# wait until all k8s VMs have fully initialized
+for VM_NAME in $(grep _vm: ./onap-oom.yaml~ | cut -d: -f1); do
+    echo $VM_NAME
+    VM_IP=$(openstack stack output show $stack_name ${VM_NAME}_ip -c output_value -f value)
+    ssh-keygen -R $VM_IP
+    until ssh -o StrictHostKeychecking=no -i $SSH_KEY ubuntu@$VM_IP ls -ad /dockerdata-nfs/.git; do
+        sleep 1m
+    done
+done
+
+cat > ./cluster.yml~ <<EOF
+# GENERATED for $stack_name
+nodes:
+EOF
+
+for VM_NAME in $(grep -E 'k8s_.+_vm:' ./onap-oom.yaml~ | cut -d: -f1); do
+    echo $VM_NAME
+    VM_IP=$(openstack stack output show $stack_name ${VM_NAME}_ip -c output_value -f value)
+    VM_PRIVATE_IP=$(openstack stack output show $stack_name ${VM_NAME}_private_ip -c output_value -f value)
+    VM_HOSTNAME=$stack_name-$(echo $VM_NAME | tr '_' '-' | cut -d- -f1,2)
+    cat >> ./cluster.yml~ <<EOF
+- address: $VM_IP
+  port: "22"
+  internal_address: $VM_PRIVATE_IP
+  role:
+  - worker
+  hostname_override: "$VM_HOSTNAME"
+  user: ubuntu
+  ssh_key_path: "$SSH_KEY"
+EOF
+done
+
+for VM_NAME in $(grep -E 'orch_.+_vm:' ./onap-oom.yaml~ | cut -d: -f1); do
+    echo $VM_NAME
+    VM_IP=$(openstack stack output show $stack_name ${VM_NAME}_ip -c output_value -f value)
+    VM_PRIVATE_IP=$(openstack stack output show $stack_name ${VM_NAME}_private_ip -c output_value -f value)
+    VM_HOSTNAME=$stack_name-$(echo $VM_NAME | tr '_' '-' | cut -d- -f1,2)
+    cat >> ./cluster.yml~ <<EOF
+- address: $VM_IP
+  port: "22"
+  internal_address: $VM_PRIVATE_IP
+  role:
+  - controlplane
+  - etcd
+  hostname_override: "$VM_HOSTNAME"
+  user: ubuntu
+  ssh_key_path: "$SSH_KEY"
+EOF
+done
+
+DOCKER_PROXY=$(openstack stack output show $stack_name docker_proxy -c output_value -f value)
+
+cat >> ./cluster.yml~ <<EOF
+services:
+  kube-api:
+    service_cluster_ip_range: 10.43.0.0/16
+    pod_security_policy: false
+    always_pull_images: false
+  kube-controller:
+    cluster_cidr: 10.42.0.0/16
+    service_cluster_ip_range: 10.43.0.0/16
+  kubelet:
+    cluster_domain: cluster.local
+    cluster_dns_server: 10.43.0.10
+    fail_swap_on: false
+network:
+  plugin: canal
+authentication:
+  strategy: x509
+ssh_key_path: "$SSH_KEY"
+ssh_agent_auth: false
+authorization:
+  mode: rbac
+ignore_docker_version: false
+kubernetes_version: "v1.13.4-rancher1-2"
+private_registries:
+- url: $DOCKER_PROXY
+  is_default: true
+cluster_name: "$stack_name"
+restore:
+  restore: false
+  snapshot_name: ""
+EOF
+
+rm -rf ./target
+mkdir -p ./target
+cp ./cluster.yml~ ./target/cluster.yml
+pushd ./target
+
+# spin up k8s with RKE
+until rke up; do
+    sleep 1m
+    rke remove
+done
+
+scp ./kube_config_cluster.yml root@$RANCHER_IP:/root/.kube/config
+popd
+
+
+sleep 2m
+ssh -o StrictHostKeychecking=no -i $SSH_KEY ubuntu@$RANCHER_IP "sed -u '/Cloud-init.*finished/q' <(tail -n+0 -f /var/log/cloud-init-output.log)"
+
+exit 0
diff --git a/deployment/heat/onap-rke/scripts/gen-onap-oom-yaml.sh b/deployment/heat/onap-rke/scripts/gen-onap-oom-yaml.sh
new file mode 100755 (executable)
index 0000000..b700d89
--- /dev/null
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# Copyright 2018 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
+#
+
+if [ "$#" -ne 1 ]; then
+    echo This script generates the HEAT template for X number of k8s VMs
+    echo "$0 <num k8s vms>"
+    exit 1
+fi
+NUM_K8S_VMS=$1
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+PARTS_DIR=$WORKSPACE/deployment/heat/onap-rke/parts
+
+cat <<EOF
+#
+# Generated by scripts/gen-onap-oom-yaml.sh; MANUAL CHANGES WILL BE LOST
+#
+EOF
+
+cat $PARTS_DIR/onap-oom-1.yaml
+
+cat <<EOF
+  rancher_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [{ get_param: 'OS::stack_name' }, 'rancher']]
+      image: { get_param: ubuntu_1804_image }
+      flavor: { get_param: rancher_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: rancher_private_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          template:
+            get_file: rancher_vm_entrypoint.sh
+          params:
+            __docker_proxy__: { get_param: docker_proxy }
+            __apt_proxy__: { get_param: apt_proxy }
+            __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 }
+            __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 }
+            __helm_deploy_delay__: { get_param: helm_deploy_delay }
+            __use_ramdisk__: { get_param: use_ramdisk }
+            __mtu__: { get_param: mtu }
+            __portal_hostname__: { get_param: portal_hostname }
+            __public_net_id__: { get_param: public_net_id }
+            __oam_network_cidr__: { get_param: oam_network_cidr }
+            __oam_network_id__: { get_resource: oam_network }
+            __oam_subnet_id__: { get_resource: oam_subnet }
+            __sec_group__: { get_resource: onap_sg }
+            __k8s_01_vm_ip__: { get_attr: [k8s_01_floating_ip, floating_ip_address] }
+            __k8s_vm_ips__: [
+EOF
+
+for VM_NUM in $(seq -f %02g $NUM_K8S_VMS); do
+    K8S_VM_NAME=k8s_$VM_NUM
+    cat <<EOF
+              get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address],
+EOF
+done
+
+cat <<EOF
+            ]
+            __k8s_private_ips__: [
+EOF
+
+for VM_NUM in $(seq -f %02g $NUM_K8S_VMS); do
+    K8S_VM_NAME=k8s_$VM_NUM
+    cat <<EOF
+              get_attr: [${K8S_VM_NAME}_floating_ip, fixed_ip_address],
+EOF
+done
+
+cat <<EOF
+            ]
+EOF
+
+for VM_NUM in $(seq -f %02g $NUM_K8S_VMS); do
+    VM_TYPE=k8s HOST_LABEL=compute VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml
+done
+
+for VM_NUM in $(seq 3); do
+    VM_TYPE=orch HOST_LABEL=orchestration VM_NUM=$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml
+done
+
+
+cat $PARTS_DIR/onap-oom-3.yaml
+
+for VM_NUM in $(seq -f %02g $NUM_K8S_VMS); do
+    K8S_VM_NAME=k8s_$VM_NUM
+    cat <<EOF
+  ${K8S_VM_NAME}_vm_ip:
+    description: The IP address of the ${K8S_VM_NAME} instance
+    value: { get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address] }
+
+  ${K8S_VM_NAME}_vm_private_ip:
+    description: The private IP address of the ${K8S_VM_NAME} instance
+    value: { get_attr: [${K8S_VM_NAME}_floating_ip, fixed_ip_address] }
+
+EOF
+done
+
+for VM_NUM in $(seq 3); do
+    K8S_VM_NAME=orch_$VM_NUM
+    cat <<EOF
+  ${K8S_VM_NAME}_vm_ip:
+    description: The IP address of the ${K8S_VM_NAME} instance
+    value: { get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address] }
+
+  ${K8S_VM_NAME}_vm_private_ip:
+    description: The private IP address of the ${K8S_VM_NAME} instance
+    value: { get_attr: [${K8S_VM_NAME}_floating_ip, fixed_ip_address] }
+
+EOF
+done
diff --git a/deployment/heat/onap-rke/scripts/prepull-docker.sh b/deployment/heat/onap-rke/scripts/prepull-docker.sh
new file mode 100755 (executable)
index 0000000..37385dd
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash -x
+#
+# Copyright 2018 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
+#
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+if [ "$#" -ne 1 ]; then
+    echo "Usage: $0 <docker-proxy>"
+    exit 1
+fi
+DOCKER_PROXY=$1
+
+for MANIFEST in docker-manifest.csv docker-manifest-staging.csv; do
+    for DOCKER_IMAGE in $(tail -n +2 $WORKSPACE/version-manifest/src/main/resources/$MANIFEST | tr ',' ':'); do
+        docker pull $DOCKER_PROXY/$DOCKER_IMAGE
+    done
+done
diff --git a/deployment/heat/onap-rke/scripts/redeploy-module.sh b/deployment/heat/onap-rke/scripts/redeploy-module.sh
new file mode 100644 (file)
index 0000000..ab52831
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Copyright 2019 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
+#
+
+if [ "$#" -ne 1 ]; then
+   echo "Please specify module name, i.e. $0 robot"
+   exit 1
+fi
+
+module=$1
+deploy=dev-$1
+cd /root/oom/kubernetes
+helm delete $deploy --purge
+/root/integration/deployment/heat/onap-oom/scripts/cleanup.sh $module
+rm -rf /dockerdata-nfs/$deploy
+make $module
+make onap 
+helm deploy $deploy local/onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --namespace onap
diff --git a/deployment/heat/onap-rke/scripts/redeploy.sh b/deployment/heat/onap-rke/scripts/redeploy.sh
new file mode 100755 (executable)
index 0000000..1d46f02
--- /dev/null
@@ -0,0 +1,106 @@
+#!/bin/bash -x
+#
+# Copyright 2018 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
+#
+
+# This is meant to be run from within the Rancher VM to completely
+# redeploy ONAP while reusing the existing k8s stack.
+#
+# This assumes that /root/integration-override.yaml is up-to-date.
+#
+# This script can also be used after a VM reboot, and will restart
+# helm server accordingly.
+
+export DEBIAN_FRONTEND=noninteractive
+
+usage() {
+    echo "Usage: $0 <namespace>" 1>&2;
+    echo "This will completely re-deploy ONAP, and delete and re-clone oom/ and integration/ directories."
+    exit 1;
+}
+
+if [ "$#" -ne 1 ]; then
+   usage
+fi
+
+
+NS=$1
+OOM_GERRIT_BRANCH=master
+OOM_GERRIT_REFSPEC=refs/heads/master
+INTEGRATION_GERRIT_BRANCH=master
+INTEGRATION_GERRIT_REFSPEC=refs/heads/master
+DOCKER_MANIFEST=""
+
+# Verify that k8s works
+if [ $(kubectl get pods --namespace kube-system | tail -n +2 | grep -c Running) -lt 6 ]; then
+    echo "[ERROR] Kubernetes is not healthy; aborting"
+    exit 1
+fi
+
+if [ ! -f /dockerdata-nfs/rancher_agent_cmd.sh ]; then
+    cp /root/rancher_agent_cmd.sh /dockerdata-nfs
+fi
+
+
+kubectl delete namespace $NS
+for op in secrets configmaps pvc pv services deployments statefulsets clusterrolebinding; do
+    kubectl delete $op -n $NS --all
+done
+helm undeploy dev --purge
+rm -rf /dockerdata-nfs/dev-*/
+
+
+# Clone OOM:
+cd ~
+rm -rf oom/
+git clone -b $OOM_GERRIT_BRANCH https://gerrit.onap.org/r/oom
+cd oom
+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 ~
+rm -rf integration/
+git clone -b $INTEGRATION_GERRIT_BRANCH https://gerrit.onap.org/r/integration
+cd integration
+git fetch https://gerrit.onap.org/r/integration $INTEGRATION_GERRIT_REFSPEC
+git checkout FETCH_HEAD
+git checkout -b workarounds
+git log -1
+
+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:
+cd ~/oom/kubernetes/
+
+if [ $(curl -s -o /dev/null -w "%{http_code}" 127.0.0.1:8879) -ne 200 ]; then
+    helm init --client-only
+    helm init --upgrade
+    helm serve &
+    sleep 10
+    helm repo add local http://127.0.0.1:8879
+    helm repo list
+fi
+make all
+rsync -avt ~/oom/kubernetes/helm/plugins ~/.helm/
+helm search -l | grep local
+helm deploy dev local/onap -f ~/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f ~/integration-override.yaml --namespace onap | ts | tee -a ~/helm-deploy.log
+helm list
+
index b6e4d7b..62133a1 100644 (file)
@@ -58,6 +58,17 @@ The details can be found at :ref:`Verified Use Cases and Functional Requirements
 O-Parent
 ========
 
+Version: 1.2.3
+--------------
+
+:Release Date: 2019-02-11
+
+**Bug Fixes**
+
+* Updated various library dependency versions per SECCOM input
+* Fixed Checkstyle configuration issues
+
+
 Version: 1.2.2
 --------------
 
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/Dockerfile b/test/mocks/datafilecollector-testharness/dr-sim/Dockerfile
new file mode 100644 (file)
index 0000000..fc903d7
--- /dev/null
@@ -0,0 +1,18 @@
+#Common image for both dmmapDR and dmaapDR_redir
+
+FROM node:8
+
+WORKDIR /app
+
+COPY dmaapDR.js ./
+COPY dmaapDR_redir.js ./
+COPY package*.json ./
+COPY cert/ cert/
+
+RUN npm install express
+RUN npm install argparse
+
+EXPOSE 3906
+EXPOSE 3907
+EXPOSE 3908
+EXPOSE 3909
\ No newline at end of file
index 38ad1c5..f0cdf58 100644 (file)
@@ -1,3 +1,9 @@
+#Alternative to running python (as described below) on your machine, use the docker files.
+1. Build docker container with ```docker build -t drsim_common:latest .```
+2. Run the container ```docker-compose up```
+
+
+
 1. install nodejs
 2. install npm
 Make sure that you run these commands in the application directory "dr-sim"
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js b/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js
new file mode 100644 (file)
index 0000000..a1b2770
--- /dev/null
@@ -0,0 +1,115 @@
+var http = require('http');
+var https = require('https');
+var ArgumentParser = require('argparse').ArgumentParser;
+var express = require('express');
+const stream = require('stream');
+var app = express();
+var fs = require("fs");
+var path = require('path');
+var privateKey = fs.readFileSync('cert/private.key', 'utf8');
+var certificate = fs.readFileSync('cert/certificate.crt', 'utf8');
+var credentials = {
+       key: privateKey,
+       cert: certificate
+};
+
+
+var parser = new ArgumentParser({
+       version: '0.0.1',
+       addHelp: true,
+       description: 'Datarouter simulator'
+});
+
+parser.addArgument('--tc', {
+       help: 'TC $NoOfTc'
+});
+parser.addArgument('--printtc', {
+       help: 'Print complete usage help',
+       action: 'storeTrue'
+});
+
+var args = parser.parseArgs();
+
+if (args.tc == "100") {
+       console.log("TC: 100")
+}
+if (args.tc == "101") {
+       console.log("TC: 101")
+       //preparations
+}
+if (args.tc == "102") {
+       console.log("TC: 102")
+       //preparations
+}
+
+if (args.printtc) {
+       console.log("TC 100: receive all incoming files");
+       console.log("TC 101: drop/deny first 10 publishing attempt, then receive all");
+       console.log("TC 102: drop/deny/every second publisging attempt");
+       process.exit(0);
+}
+
+var bodyParser = require('body-parser')
+app.use(bodyParser.urlencoded({
+       extended: false
+}))
+
+// parse application/json
+app.use(bodyParser.json())
+
+// parse application/vnd.api+json as json
+app.use(bodyParser.json({
+       type: 'application/vnd.api+json'
+}))
+
+// parse some custom thing into a Buffer
+app.use(bodyParser.raw({
+       limit: 1024 * 1024 * 20,
+       type: 'application/octet-stream'
+}))
+// parse an HTML body into a string
+app.use(bodyParser.text({
+       type: 'text/html'
+}))
+app.get("/", function (req, res) {
+       res.send("ok");
+})
+app.post('/webapi/feeds/', function (req, res) {
+       res.setHeader('Content-Type', 'application/json');
+       var feedName = req.body.feedName;
+       console.log(feedName);
+       res.end(JSON.stringify({
+               "type": "feed",
+               "lastMod": "2019-03-21T16:00:40.489",
+               "status": "VALID",
+               "asprClassification": "unclassified",
+               "feedDescription": "generated for CSIT",
+               "feedId": "3",
+               "feedName": feedName,
+               "feedVersion": "csit",
+               "logURL": "https://dmaap-dr-prov/feedlog/3",
+               "owner": "dgl",
+               "publishURL": "https://dmaap-dr-prov/publish/3",
+               "pubs": [{
+                       "lastMod": "2019-01-24T16:00:40.484",
+                       "status": "VALID",
+                       "dcaeLocationName": "san-francisco",
+                       "feedId": "3",
+                       "pubId": "3.4gh53",
+                       "username": "tmp_i63w8psh6ycnoqu",
+                       "userpwd": "6jkc1uwywrc8q4w"
+               }],
+               "subs": [],
+               "subscribeURL": "https://dmaap-dr-prov/subscribe/3",
+               "suspended": false
+       }));
+})
+var httpServer = http.createServer(app);
+var httpsServer = https.createServer(credentials, app);
+
+var httpPort = 6665
+var httpsPort = 6666
+httpServer.listen(httpPort);
+console.log("DR-simulator listening (http) at " + httpPort)
+httpsServer.listen(httpsPort);
+console.log("DR-simulator listening (https) at " + httpsPort)
\ No newline at end of file
index 7e57b61..4e73174 100644 (file)
@@ -4,12 +4,13 @@ var ArgumentParser = require('argparse').ArgumentParser;
 var express = require('express');
 const stream = require('stream');
 var app = express();
-var fs = require("fs");
+var fs = require('fs');
 var path = require('path');
 var privateKey  = fs.readFileSync('cert/private.key', 'utf8');
 var certificate = fs.readFileSync('cert/certificate.crt', 'utf8');
 var credentials = {key: privateKey, cert: certificate};
-
+const allPublished = "allPublished";
+const nonePublished = "nonePublished";
 
 var parser = new ArgumentParser({
          version: '0.0.1',
@@ -27,22 +28,18 @@ parser.addArgument('--printtc' ,
 
 var args = parser.parseArgs();
 
-if (args.tc=="100") {
-       console.log("TC: 100")
-}
-if (args.tc=="101") {
-       console.log("TC: 101")
-       //preparations
+if (args.tc=="nonePublished") {
+       console.log("TC: nonePublished")
 }
-if (args.tc=="102") {
-       console.log("TC: 102")
+if (args.tc=="allPublished") {
+       console.log("TC: allPublished")
        //preparations
 }
 
 if (args.printtc) {
-       console.log("TC 100: receive all incoming files");
-       console.log("TC 101: drop/deny first 10 publishing attempt, then receive all");
-       console.log("TC 102: drop/deny/every second publisging attempt");
+       console.log("TC nonePublished: no file has already been published.");
+       console.log("TC allPublished: whatever is the request, this file is considered as published.");
+       console.log("No argument passed: normal behaviour, that is publish if not already published");
        process.exit(0);
 }
 
@@ -62,19 +59,55 @@ app.use(bodyParser.text({ type: 'text/html' }))
 app.get("/",function(req, res){
        res.send("ok");
 })
-app.put('/publish/1/:filename', function (req, res) {
-       console.log(req.files);
-       console.log(req.body);
-       console.log(req.headers);
-       var filename = path.basename(req.params.filename);
-        res.redirect(301, 'http://127.0.0.1:3908/publish/1/'+filename)
+
+
+var published = [];
+app.get('/feedlog/1/',function(req, res){
+       var filename = req.query.filename;
+       if(args.tc == allPublished){
+               res.send("[" + filename + "]");
+       } else if(args.tc == nonePublished){
+               res.send("[]");
+       } else {
+               if (published.includes(filename)) {
+                       res.send("[" + filename + "]");
+               } else {
+                       res.send("[]");
+               }
+       }
+})
+
+
+app.put('/publish/1/', function (req, res) {
+       var filename = req.query.filename;
+       var type = req.query.type;
+       if(typeof(filename) == 'undefined'){
+               res.status(400).send({error: 'No filename provided.'});
+       } else if(typeof(type) == 'undefined'){
+               res.status(400).send({error: 'No type provided.'});
+       } else {
+               if(args.tc == allPublished){
+                       res.send("[" + filename + "]");
+               } else if(args.tc == nonePublished){
+                       res.redirect(301, 'http://127.0.0.1:3908/publish/1/'+filename);
+               } else {
+                       if (!published.includes(filename)) {
+                               published.push(filename);
+                               res.redirect(301, 'http://127.0.0.1:3908/publish/1/'+filename);
+                       } else {
+                               res.send("ok");
+                       }
+               }
+       }
 })
+
+
 var httpServer = http.createServer(app);
 var httpsServer = https.createServer(credentials, app);
 
-var httpPort=3906
-var httpsPort=3907
+var httpPort=3906;
+var httpsPort=3907;
 httpServer.listen(httpPort);
-console.log("DR-simulator listening (http) at "+httpPort)
+console.log("DR-simulator listening (http) at "+httpPort);
 httpsServer.listen(httpsPort);
-console.log("DR-simulator listening (https) at "+httpsPort)
+console.log("DR-simulator listening (https) at "+httpsPort);
\ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml b/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml
new file mode 100644 (file)
index 0000000..1ad4788
--- /dev/null
@@ -0,0 +1,17 @@
+version: '2'
+services:
+  drsim:
+    image: drsim_common:latest
+    ports:
+     - "3906:3906"
+     - "3907:3907"
+    container_name: drsim
+    command: node dmaapDR.js
+
+  drsim_redir:
+    image: drsim_common:latest
+    ports:
+     - "3908:3908"
+     - "3909:3909"
+    container_name: drsim_redir
+    command: node dmaapDR_redir.js    
\ No newline at end of file
index 5a16601..3bd6740 100644 (file)
@@ -15,6 +15,12 @@ Source: https://docs.docker.com/install/linux/linux-postinstall/
 
 then logout-login to activate it.
 
+###Prepare files for the simulator
+Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB, 5MB and 50MB files) and a large number of 
+symbolic links to these files to simulate PM files. The files names maches the files in
+the events produced by the MR simulator. The dirs with the files will be mounted
+by the ftp containers, defined in the docker-compse file, when started
+
 ###Starting/stopping the FTPS/SFTP server(s)
 
 Start: `docker-compose up`
index f1146a6..086d43a 100755 (executable)
@@ -37,7 +37,7 @@ then
 
                # Create symlinks
                N_SYMLINKS=${nf_array[$n]}-1
-               for ((l=1;l<=$N_SYMLINKS;l++))
+               for ((l=0;l<=$N_SYMLINKS;l++))
                do
                        SYMLINK_NAME=$FILE_SIZE"MB_"$l".tar.gz"
                        ln -s ./$FILE_NAME $DIRECTORY/$SYMLINK_NAME
index 8dba114..61275df 100644 (file)
@@ -9,3 +9,8 @@ TC2:
   size_files: 0.5 1 5
   number_files: 2 3 1
   directory_files: ftps ftps sftp
+
+TC_10000:
+  size_files: 1 1 5 5 50 50
+  number_files: 10000 10000 10000 10000 1 1
+  directory_files: ftps sftp ftps sftp ftps sftp
\ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/Dockerfile b/test/mocks/datafilecollector-testharness/mr-sim/Dockerfile
new file mode 100755 (executable)
index 0000000..5341bb0
--- /dev/null
@@ -0,0 +1,10 @@
+FROM python:3.6-alpine
+
+COPY . /app
+
+WORKDIR /app
+
+RUN pip install -r requirements.txt
+
+EXPOSE 2222
+
index b04b9ec..5746345 100644 (file)
@@ -1,3 +1,52 @@
+
+#Alternative to running python (as described below) on your machine, use the docker files.
+1. Build docker container with ```docker build -t mrsim:latest .```
+2. Run the container ```docker-compose up```
+The behavior can be changed by argument to the python script in the docker-compose.yml
+
+The simulator can be queried for statistics
+localhost:2222/ctr_requests   - return an integer of the number of get request to the event poll path
+localhost:2222/ctr_responses  - return an integer of the number of get responses to the event poll path
+localhost:2222/ctr_unique_files - returns an integer or the number of unique files. A unique file is the combination of node+file_sequence_number 
+
+
+##Common TC info
+File names for 1MB, 5MB and 50MB files
+Files in the format: <size-in-mb>MB_<sequence-number>.tar.gz    Ex. for 5MB file with sequence number 12:  5MB_12.tar.gz
+The sequence numbers are stepped so that all files have unique names
+Missing files (files that are not expected to be found in the ftp server. Format: MissingFile_<sequence-number>.tar.gz
+
+Limited event streams
+When the number of events are exhausted, empty replies are returned '[]'
+
+TC100 - One ME, SFTP, 1 1MB file, 1 event
+TC101 - One ME, SFTP, 1 5MB file, 1 event
+TC102 - One ME, SFTP, 1 50MB file, 1 event
+
+TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
+TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.
+TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.
+TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.
+
+
+TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json
+TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files
+TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. 
+
+Endless event streams
+TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll
+TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll
+
+
+TC510 - 5 ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
+
+
+TC200-TC202 same as TC100-TC102 but with FTPS
+TC210-TC213 same as TC110-TC113 but with FTPS
+TC2000-TC2001 same as TC1000-TC1001 but with FTPS
+TC610 same as TC510 but with FTPS
+
+
 ## Developer workflow
 
 1. ```sudo apt install python3-venv```
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml b/test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml
new file mode 100644 (file)
index 0000000..7315e4b
--- /dev/null
@@ -0,0 +1,10 @@
+version: '2'
+
+services:
+  mrsim:
+    image: mrsim:latest
+    ports:
+     - "2222:2222"
+    container_name: mrsim
+    command: python mr-sim.py --tc100
+# Change -tc100 to other tc number for desired behavior.
\ No newline at end of file
index c37ae69..ef46535 100644 (file)
@@ -8,73 +8,432 @@ import json
 from flask import Flask
 app = Flask(__name__)
 
-DEFAULT_IP = "localhost"
+#Server info
+HOST_IP = "0.0.0.0"
+HOST_PORT = 2222
 
+#Test function to check server running
+@app.route('/',
+    methods=['GET'])
+def index():
+    return 'Hello world'
+
+#Returns number of polls
+@app.route('/ctr_requests',
+    methods=['GET'])
+def counter_requests():
+    global ctr_requests
+    return str(ctr_requests)
 
+#Returns number of replies
+@app.route('/ctr_responses',
+    methods=['GET'])
+def counter_responses():
+    global ctr_responses
+    return str(ctr_responses)
+
+#Returns number of unique files
+@app.route('/ctr_unique_files',
+    methods=['GET'])
+def counter_uniquefiles():
+    global fileMap
+    return str(len(fileMap))
+
+#Returns tc info
+@app.route('/tc_info',
+    methods=['GET'])
+def testcase_info():
+    global tc_num
+    return tc_num
+
+#Messages polling function
 @app.route(
     "/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12",
     methods=['GET'])
 def MR_reply():
-    global mr_counter
-    global mr_replies
-
-    mr_counter = mr_counter + 1
-    print("MR receiver counter: " + str(mr_counter))
-
-    if mr_replies[mr_counter].sleepMs != 0:
-        sleep(mr_replies[mr_counter].sleepMs / 1000.0)
-        print("Sleeping: " + str(mr_replies[mr_counter].sleepMs) + " ms")
-
-    if mr_replies[mr_counter].replytype == 0:
-        #print (str(mr_replies[mr_counter].jsonreply))
-        print("Regular reply")
-        response = app.response_class(
-            response=mr_replies[mr_counter].jsonreply,
-            status=200,
-            mimetype='application/json')
-
-        return response
-
-    if mr_replies[mr_counter].replytype == 2:
-
-        print("error: 404")
-        response = app.response_class(
-            response="",
-            status=404,
-            mimetype='application/json')
-
-        return response
-
-    if mr_replies[mr_counter].replytype == 1:
-        print("do nothing, sink request")
-        return
-
-
-class Reply:
-    """An instance of the reply event, which can be configured to behave in a certain way
-    (delay, error code, reply body"""
-
-    def to_json(self):
-        return self.jsonreply
-
-    def __init__(
-            self,
-            ip=DEFAULT_IP,
-            file="1MB.tar.gz",
-            sleepMs=0,
-            replyType=0,
-            port=1022,
-            type="ftps"):
-        self.sleepMs = sleepMs
-        self.ip = ip
-        self.file = file
-        self.port = port
-        self.replytype = replyType  # 0 for reply, 1 timeout, 2 deny
-        self.user = "onap"
-        self.passwd = "pano"
-        self.type = type
-        self.jsonreply = str.encode("""
-        [{
+    global ctr_requests
+    global args
+
+    ctr_requests = ctr_requests + 1
+    print("MR: poll request#: " + str(ctr_requests))
+
+    if args.tc100:
+      return tc100("sftp")
+    elif args.tc101:
+      return tc101("sftp")
+    elif args.tc102:
+      return tc102("sftp")
+
+    elif args.tc110:
+      return tc110("sftp")
+    elif args.tc111:
+      return tc111("sftp")
+    elif args.tc112:
+      return tc112("sftp")
+    elif args.tc113:
+      return tc113("sftp")
+
+    elif args.tc120:
+      return tc120("sftp")
+    elif args.tc121:
+      return tc121("sftp")
+    elif args.tc122:
+      return tc122("sftp")
+
+    elif args.tc1000:
+      return tc1000("sftp")
+    elif args.tc1001:
+      return tc1001("sftp")
+
+    elif args.tc510:
+      return tc510("sftp")      
+
+
+    elif args.tc200:
+      return tc200("ftps")
+    elif args.tc201:
+      return tc201("ftps")
+    elif args.tc202:
+      return tc202("ftps")
+
+    elif args.tc210:
+      return tc210("ftps")
+    elif args.tc211:
+      return tc211("ftps")
+    elif args.tc212:
+      return tc212("ftps")
+    elif args.tc213:
+      return tc213("ftps")
+
+    elif args.tc220:
+      return tc220("ftps")
+    elif args.tc221:
+      return tc221("ftps")
+    elif args.tc222:
+      return tc222("ftps")
+
+    elif args.tc2000:
+      return tc2000("ftps")
+    elif args.tc2001:
+      return tc2001("ftps")
+
+    elif args.tc610:
+      return tc510("ftps")     
+
+
+#### Test case functions
+
+
+def tc100(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 1):
+    return buildOkResponse("[]")
+
+  seqNr = (ctr_responses-1)
+  msg = getEventHead() + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+  fileMap[seqNr] = seqNr
+  return buildOkResponse("["+msg+"]")
+
+def tc101(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 1):
+    return buildOkResponse("[]")  
+  seqNr = (ctr_responses-1)
+  msg = getEventHead() + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+  fileMap[seqNr] = seqNr
+
+  return buildOkResponse("["+msg+"]")
+
+def tc102(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 1):
+    return buildOkResponse("[]")  
+
+  seqNr = (ctr_responses-1)
+  msg = getEventHead() + getEventName("50MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+  fileMap[seqNr] = seqNr
+
+  return buildOkResponse("["+msg+"]")
+
+def tc110(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+  
+  seqNr = (ctr_responses-1)
+  msg = getEventHead() + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+  fileMap[seqNr] = seqNr
+
+  return buildOkResponse("["+msg+"]")
+
+def tc111(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+  
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    fileMap[seqNr] = seqNr
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc112(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+  
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    fileMap[seqNr] = seqNr
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc113(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 1):
+    return buildOkResponse("[]")  
+  
+  msg = ""
+
+  for evts in range(100):  # build 100 evts
+    if (evts > 0):
+      msg = msg + ","
+    msg = msg + getEventHead()
+    for i in range(100):   # build 100 files
+      seqNr = i+evts+100*(ctr_responses-1)
+      if i != 0: msg = msg + ","
+      msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+      fileMap[seqNr] = seqNr
+
+    msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+
+def tc120(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+
+  if (ctr_responses % 10 == 2):
+    return  # Return nothing
+  
+  if (ctr_responses % 10 == 3):
+    return buildOkResponse("") # Return empty message
+
+  if (ctr_responses % 10 == 4):
+    return buildOkResponse(getEventHead()) # Return part of a json event
+
+  if (ctr_responses % 10 == 5):
+    return buildEmptyResponse(404) # Return empty message with status code
+
+  if (ctr_responses % 10 == 6):
+    sleep(60)
+
+  
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    fileMap[seqNr] = seqNr
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc121(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+  
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if (seqNr%10 == 0):     # Every 10th file is "missing"
+      fn = "MissingFile_" + str(seqNr) + ".tar.gz"
+    else:
+      fn = "1MB_" + str(seqNr) + ".tar.gz"
+      fileMap[seqNr] = seqNr
+
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName(fn,ftptype,"onap","pano","localhost",1022)
+    
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc122(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 100):
+    return buildOkResponse("[]")  
+  
+  msg = getEventHead()
+
+  for i in range(100):
+    fn = "1MB_0.tar.gz"  # All files identical names
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName(fn,ftptype,"onap","pano","localhost",1022)
+
+  fileMap[0] = 0
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+
+def tc1000(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    fileMap[seqNr] = seqNr
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc1001(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  msg = getEventHead()
+
+  for i in range(100):
+    seqNr = i+(ctr_responses-1)
+    if i != 0: msg = msg + ","
+    msg = msg + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    fileMap[seqNr] = seqNr
+
+  msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+def tc510(ftptype):
+  global ctr_responses
+  global ctr_unique_files
+
+  ctr_responses = ctr_responses + 1
+
+  if (ctr_responses > 5):
+    return buildOkResponse("[]")  
+
+  msg = ""
+
+  for evts in range(700):  # build events for 5 MEs
+    if (evts > 0):
+      msg = msg + ","
+    msg = msg + getEventHeadNodeName("PNF"+str(evts))
+    seqNr = (ctr_responses-1)
+    msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+    seqNr = seqNr + evts*1000000 #Create unique id for this node and file
+    fileMap[seqNr] = seqNr
+    msg = msg + getEventEnd()
+
+  return buildOkResponse("["+msg+"]")
+
+#Mapping FTPS TCs
+def tc200(ftptype):
+  return tc100(ftptype)
+def tc201(ftptype):
+  return tc101(ftptype)
+def tc202(ftptype):
+  return tc102(ftptype)
+
+def tc210(ftptype):
+  return tc110(ftptype)
+def tc211(ftptype):
+  return tc111(ftptype)
+def tc212(ftptype):
+  return tc112(ftptype)
+def tc213(ftptype):
+  return tc113(ftptype)
+
+def tc220(ftptype):
+  return tc120(ftptype)
+def tc221(ftptype):
+  return tc121(ftptype)
+def tc222(ftptype):
+  return tc122(ftptype)
+
+def tc2000(ftptype):
+  return tc1000(ftptype)
+def tc2001(ftptype):
+  return tc1001(ftptype)
+
+#### Functions to build json messages and respones ####
+
+# Function to build fixed beginning of an event
+def getEventHead():
+  return getEventHeadNodeName("oteNB5309")
+
+def getEventHeadNodeName(nodename):
+  headStr = """
+        {
           "event": {
             "commonEventHeader": {
               "startEpochMicrosec": 8745745764578,
@@ -85,205 +444,267 @@ class Reply:
               },
               "priority": "Normal",
               "version": "4.0.1",
-              "reportingEntityName": "otenb5309",
+              "reportingEntityName": \"""" + nodename + """",
               "sequence": 0,
               "domain": "notification",
               "lastEpochMicrosec": 8745745764578,
               "eventName": "Noti_RnNode-Ericsson_FileReady",
               "vesEventListenerVersion": "7.0.1",
-              "sourceName": "oteNB5309"
+              "sourceName": \"""" + nodename + """"
             },
             "notificationFields": {
               "notificationFieldsVersion": "2.0",
               "changeType": "FileReady",
               "changeIdentifier": "PM_MEAS_FILES",
               "arrayOfNamedHashMap": [
-                {
-                  "name": \"""" +
-                                    self.file +
-                                    """",
+          """ 
+  return headStr
+
+# Function to build the variable part of an event
+def getEventName(fn,type,user,passwd,ip,port):
+    nameStr =        """{
+                  "name": \"""" + fn + """",
                   "hashMap": {
                     "fileFormatType": "org.3GPP.32.435#measCollec",
-                    "location": \"""" +
-                                    self.type +
-                                    """://""" +
-                                    self.user +
-                                    """:""" +
-                                    self.passwd +
-                                    """@""" +
-                                    self.ip +
-                                    """:""" +
-                                    str(self.port) +
-                                    """/""" +
-                                    self.file +
-                                    """",
+                    "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """",
                     "fileFormatVersion": "V10",
                     "compression": "gzip"
                   }
-                }
+                } """
+    return nameStr
+
+# Function to build fixed end of an event
+def getEventEnd():
+    endStr =  """
               ]
             }
           }
-        }]
-        """)
-
-
-def replyFactory(
-        ip=DEFAULT_IP,
-        file="1MB.tar.gz",
-        factoryport=1022,
-        count=1,
-        factorytype="ftps"):
-    aggregatedReply = ""
-    # first item does not require .
-    aggregatedReply = Reply(ip, file, port=factoryport).to_json()
-    for i in range(count - 1):
-        aggregatedReply = aggregatedReply + b", " + \
-            Reply(ip, file, port=factoryport, type=factorytype).to_json()
-    #print(b"aggregated reply: " + aggregatedReply)
-    return b"[" + aggregatedReply + b"]"
+        }
+        """
+    return endStr
+
+# Function to build an OK reponse from a message string
+def buildOkResponse(msg):
+  response = app.response_class(
+      response=str.encode(msg),
+      status=200,
+      mimetype='application/json')
+  return response
+
+# Function to build an empty message with status
+def buildEmptyResponse(status_code):
+  response = app.response_class(
+      response=str.encode(""),
+      status=status_code,
+      mimetype='application/json')
+  return response
 
 
-def prepareMrRespArrSftp():
-    global mr_replies
-
-    for i in range(400):  # prepare 400 regular replies
-        mr_replies.append(
-            Reply(
-                port=1022,
-                ip="localhost",
-                type="sftp",
-                file="1MB.tar.gz"))
-    #mr_replies[0] is not used
-
-
-def prepareMrRespArrFtps():
-    global mr_replies
-
-    for i in range(400):
-        mr_replies.append(
-            Reply(
-                port=21,
-                ip="localhost",
-                type="ftps",
-                file="1MB.tar.gz"))
-
-
-def tc1():
-    prepareMrRespArrSftp()
-    # no mutation needed in this TC
-
-
-def tc2():
-    global mr_replies
-
-    for i in range(7):
-        mr_replies.append(
-            Reply(
-                port=1022,
-                ip="localhost",
-                type="sftp",
-                file="1MB.tar.gz"))
-
-    # inserting and empty reply message
-    mr_replies[1].jsonreply = b""
-    mr_replies[2].jsonreply = b""
-
-    # inserting a 404 error and delay
-    mr_replies[3].replytype = 2
-    mr_replies[3].sleepMs = 2000
-
-    # inserting and empty reply message
-    mr_replies[4].jsonreply = b""
-
-    # sink the message
-    mr_replies[5].replytype = 1
-
-    # reply with one proper file finally
-    mr_replies[6] = Reply(
-        port=1022,
-        ip="localhost",
-        type="sftp",
-        file="1MB.tar.gz")
+if __name__ == "__main__":
+  
+    #Counters
+    ctr_responses = 0
+    ctr_requests = 0
+    ctr_unique_files = 0
 
+    #Keeps all reponded file names
+    fileMap = {}
 
-def tc3():
-    prepareMrRespArrFtps()
+    tc_num = "Not set"
+    tc_help = "Not set"
 
+    parser = argparse.ArgumentParser()
 
-def tc4():
-    global mr_replies
+#SFTP TCs with single ME 
+    parser.add_argument(
+        '--tc100',
+        action='store_true',
+        help='TC100 - One ME, SFTP, 1 1MB file, 1 event')
+    parser.add_argument(
+        '--tc101',
+        action='store_true',
+        help='TC101 - One ME, SFTP, 1 5MB file, 1 event')
+    parser.add_argument(
+        '--tc102',
+        action='store_true',
+        help='TC102 - One ME, SFTP, 1 50MB file, 1 event')
 
-    for i in range(7):
-        mr_replies.append(
-            Reply(
-                port=21,
-                ip="localhost",
-                type="ftps",
-                file="1MB.tar.gz"))
+    parser.add_argument(
+        '--tc110',
+        action='store_true',
+        help='TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc111',
+        action='store_true',
+        help='TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc112',
+        action='store_true',
+        help='TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc113',
+        action='store_true',
+        help='TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.')
 
-    # inserting and empty reply message
-    mr_replies[1].jsonreply = b""
-    mr_replies[2].jsonreply = b""
+    parser.add_argument(
+        '--tc120',
+        action='store_true',
+        help='TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
+    parser.add_argument(
+        '--tc121',
+        action='store_true',
+        help='TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
+    parser.add_argument(
+        '--tc122',
+        action='store_true',
+        help='TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
 
-    # inserting a 404 error and delay
-    mr_replies[3].replytype = 2
-    mr_replies[3].sleepMs = 2000
+    parser.add_argument(
+        '--tc1000',
+        action='store_true',
+        help='TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll')
+    parser.add_argument(
+        '--tc1001',
+        action='store_true',
+        help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll')
 
-    # inserting and empty reply message
-    mr_replies[4].jsonreply = b""
+# SFTP TCs with multiple MEs
+    parser.add_argument(
+        '--tc510',
+        action='store_true',
+        help='TC510 - 5 MEs, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.')
 
-    # sink the message
-    mr_replies[5].replytype = 1
 
-    # reply with one proper file finally
-    mr_replies[6] = Reply(
-        port=21,
-        ip="localhost",
-        type="fftp",
-        file="1MB.tar.gz")
 
+# FTPS TCs with single ME
+    parser.add_argument(
+        '--tc200',
+        action='store_true',
+        help='TC200 - One ME, FTPS, 1 1MB file, 1 event')
+    parser.add_argument(
+        '--tc201',
+        action='store_true',
+        help='TC201 - One ME, FTPS, 1 5MB file, 1 event')
+    parser.add_argument(
+        '--tc202',
+        action='store_true',
+        help='TC202 - One ME, FTPS, 1 50MB file, 1 event')
 
-if __name__ == "__main__":
-    mr_replies = []
-    mr_counter = 0  # counting hits reaching MR instance
-    DR_block_single_req = 0
+    parser.add_argument(
+        '--tc210',
+        action='store_true',
+        help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc211',
+        action='store_true',
+        help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc212',
+        action='store_true',
+        help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.')
+    parser.add_argument(
+        '--tc213',
+        action='store_true',
+        help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.')
 
-    parser = argparse.ArgumentParser()
     parser.add_argument(
-        '--tc1',
+        '--tc220',
+        action='store_true',
+        help='TC220 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
+    parser.add_argument(
+        '--tc221',
         action='store_true',
-        help='TC1: reply all queries with 1-1 files using SFTP')
+        help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
     parser.add_argument(
-        '--tc2',
+        '--tc222',
         action='store_true',
-        help='TC2: Reply according to error scenarios, then return 1 file finally for SFTP ---NOTE: updated keys required')
+        help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
+
     parser.add_argument(
-        '--tc3',
+        '--tc2000',
         action='store_true',
-        help='TC3: reply all queries with 1-1 files using FTPS')
+        help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll')
     parser.add_argument(
-        '--tc4',
+        '--tc2001',
         action='store_true',
-        help='TC4: Reply according to error scenarios, then return 1 file finally for FTPS ---NOTE: updated keys required')
+        help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll')    
+
+    parser.add_argument(
+        '--tc610',
+        action='store_true',
+        help='TC510 - 5 MEs, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.')
 
     args = parser.parse_args()
 
-    if args.tc1:
-        print("TC: #1")
-        tc1()
-    elif args.tc2:
-        print("TC: #2")
-        tc2()
-    elif args.tc3:
-        print("TC: #3")
-        tc3()
-    elif args.tc4:
-        print("TC: #4")
-        tc4()
+    
+
+    if args.tc100:
+        tc_num = "TC# 100"
+    elif args.tc101:
+        tc_num = "TC# 101"
+    elif args.tc102:
+        tc_num = "TC# 102"
+
+    elif args.tc110:
+        tc_num = "TC# 110"
+    elif args.tc111:
+        tc_num = "TC# 111"
+    elif args.tc112:
+        tc_num = "TC# 112"
+    elif args.tc113:
+        tc_num = "TC# 113"
+
+    elif args.tc120:
+        tc_num = "TC# 120"
+    elif args.tc121:
+        tc_num = "TC# 121"
+    elif args.tc122:
+        tc_num = "TC# 122"
+
+    elif args.tc1000:
+        tc_num = "TC# 1000"
+    elif args.tc1001:
+        tc_num = "TC# 1001"
+
+    elif args.tc510:
+        tc_num = "TC# 510"
+
+    elif args.tc200:
+        tc_num = "TC# 200"
+    elif args.tc201:
+        tc_num = "TC# 201"
+    elif args.tc202:
+        tc_num = "TC# 202"
+
+    elif args.tc210:
+        tc_num = "TC# 210"
+    elif args.tc211:
+        tc_num = "TC# 211"
+    elif args.tc212:
+        tc_num = "TC# 212"
+    elif args.tc213:
+        tc_num = "TC# 213"
+
+    elif args.tc220:
+        tc_num = "TC# 220"
+    elif args.tc221:
+        tc_num = "TC# 221"
+    elif args.tc222:
+        tc_num = "TC# 222"
+
+    elif args.tc2000:
+        tc_num = "TC# 2000"
+    elif args.tc2001:
+        tc_num = "TC# 2001"
+
+    elif args.tc610:
+        tc_num = "TC# 610"
 
     else:
         print("No TC was defined")
         print("use --help for usage info")
         sys.exit()
-    app.run(port=2222)
+
+    print(tc_num)
+    app.run(port=HOST_PORT, host=HOST_IP)
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/README.md b/test/mocks/datafilecollector-testharness/simulator-group/README.md
new file mode 100644 (file)
index 0000000..4d448f8
--- /dev/null
@@ -0,0 +1,41 @@
+#Introduction
+The purpose of the "simulator-group" is to run all containers in one go with specified behavior.
+Mainly this is needed for CSIT tests but can be used also for local testing.
+
+
+###Preparation 
+Build the mr-sim image.
+
+cd ../mr-sim
+
+Run the docker build command to build the image for the MR simulator: 'docker build -t mrsim:latest .
+
+cd ../dr-sim
+
+Run the docker build command to build the image for the DR simulators: `docker build -t drsim_common:latest . 
+
+
+cd ../simulator-group
+
+Copy the 'configuration' and 'tls' catalogues from the ftps-sftp-server dir.
+
+Check the README.md in ftps-sftp-server dir in case the cert need to be updated.
+
+cp -r ./ftps-sftp-server/configuration .
+
+cp -r ../ftps-sftp-server/tls .
+
+
+###Execution
+
+Edit the `docker-compose-setup.sh` to setup the env variables to the desired test behavior for each simulators.
+See each simulator to find a description of the available settings.
+
+Run the script `docker-compose-setup.sh`to create a docker-compose with the desired settings. All simulators
+will be started with the generated docker-compose.yml file
+
+Kill all the containers with `simulators-kill.se`
+
+`simulators_start.sh` is for CSIT test and requires the env variables for test setting to be present in the shell.
+`setup-ftp-files.for-image.sh` is for CSIT and executed when the ftp servers are started from the docker-compose-setup.sh`.
+
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh
new file mode 100755 (executable)
index 0000000..d0171a5
--- /dev/null
@@ -0,0 +1,11 @@
+#/bin/bash
+
+#Script for manually starting all simulators with test setting below
+
+export DR_TC=""
+export DR_REDIR_TC=""
+export MR_TC="--tc100"
+export BC_TC=""
+export NUM_FTPFILES="250"
+
+source ./simulators-start.sh
\ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml
new file mode 100644 (file)
index 0000000..e7c7007
--- /dev/null
@@ -0,0 +1,59 @@
+version: '2'
+services:
+      
+  drsim:
+    network_mode: "host"
+    image: drsim_common:latest
+    ports:
+     - "3906:3906"
+     - "3907:3907"
+    container_name: dfc_dr-sim
+    command: node dmaapDR.js ${DR_TC}
+
+  drsim_redir:
+    image: drsim_common:latest
+    ports:
+     - "3908:3908"
+     - "3909:3909"
+    container_name: dfc_dr-redir-sim
+    command: node dmaapDR_redir.js ${DR_REDIR_TC}
+
+  mrsim:
+    image: mrsim:latest
+    ports:
+     - "2222:2222"
+    container_name: dfc_mr-sim
+    command: python mr-sim.py ${MR_TC}
+
+  sftp-server:
+    container_name: dfc_sftp-server
+    image: atmoz/sftp:alpine
+    ports:
+      - "1022:22"
+#    volumes:
+#      - ./files/onap/sftp/:/home/onap/
+    restart: on-failure
+    command: onap:pano:1001
+
+
+  ftpes-server-vsftpd:
+    container_name: dfc_ftpes-server-vsftpd
+    image: docker.io/panubo/vsftpd
+    ports:
+      - "21:21"
+      - "8001-8010:8001-8010"
+    environment:
+      FTP_USER: onap
+      FTP_PASSWORD: pano
+      PASV_ADDRESS: localhost
+      PASV_MIN_PORT: 8001
+      PASV_MAX_PORT: 8010
+    volumes:
+      - ./tls/ftp.crt:/etc/ssl/private/ftp.crt:ro
+      - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro
+      - ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro
+      - ./configuration/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro
+
+#      - ./files/onap/ftps/:/srv/
+    restart: on-failure
+  
\ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh b/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
new file mode 100755 (executable)
index 0000000..d8e57a3
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Script to create files for the FTP server to return upon request.
+# The file names matches the files names in the events polled from the MR simulator.
+# Intended for execution in the running ftp containers in the ftp-root dir.
+
+echo "Running ftp file creations"
+
+NUM=200 #Default number of files 
+
+if [ $# -eq 1 ]; then 
+    NUM=$1
+fi
+
+truncate -s 1MB 1MB.tar.gz
+truncate -s 5MB 5MB.tar.gz
+truncate -s 50MB 50MB.tar.gz
+
+
+i=0
+while [ $i -lt $NUM ]; do  #Problem with for loop and var substituion in curly bracket....so used good old style loop
+   ln -s 1MB.tar.gz 1MB_$i.tar.gz
+   ln -s 5MB.tar.gz 5MB_$i.tar.gz
+   let i=i+1
+done
+
+
+ln -s 50MB.tar.gz 50MB_0.tar.gz   #Large file, only for single file test
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/simulators-kill.sh b/test/mocks/datafilecollector-testharness/simulator-group/simulators-kill.sh
new file mode 100755 (executable)
index 0000000..b7cd6a3
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+#Stop all simulators 
+
+docker kill dfc_dr-sim
+docker kill dfc_dr-redir-sim
+docker kill dfc_mr-sim
+docker kill dfc_sftp-server
+docker kill dfc_ftpes-server-vsftpd
+
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh
new file mode 100755 (executable)
index 0000000..ef1b90a
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+
+# Starts all simulators with the test settings
+# Intended for CSIT test. For manual start, use the docker-compose-setup.sh
+
+docker-compose -f docker-compose-template.yml config > docker-compose.yml
+
+docker-compose up -d
+
+DR_SIM="$(docker ps -q --filter='name=dfc_dr-sim')"
+DR_RD_SIM="$(docker ps -q --filter='name=dfc_dr-redir-sim')"
+MR_SIM="$(docker ps -q --filter='name=dfc_mr-sim')"
+SFTP_SIM="$(docker ps -q --filter='name=dfc_sftp-server')"
+FTPS_SIM="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd')"
+
+#Wait for initialization of docker containers for all simulators
+for i in {1..10}; do
+if [ $(docker inspect --format '{{ .State.Running }}' $DR_SIM) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $DR_RD_SIM) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $MR_SIM) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $SFTP_SIM) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' $FTPS_SIM) ]
+ then
+   echo "All simulators Running"
+   break
+ else
+   echo sleep $i
+   sleep $i
+ fi 
+done
+
+#Populate the ftp server with files
+if [ -z "$NUM_FTPFILES" ]
+ then
+ NUM_FTPFILES=200
+fi
+
+
+docker cp setup-ftp-files-for-image.sh $SFTP_SIM:/tmp/
+docker exec -w /home/onap/ $SFTP_SIM /tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES >/dev/null 2>&1
+
+docker cp setup-ftp-files-for-image.sh $FTPS_SIM:/tmp/setup-ftp-files-for-image.sh
+docker exec -w /srv $FTPS_SIM /tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES >/dev/null 2>&1
+
index fa15292..7e98256 100644 (file)
@@ -12,17 +12,30 @@ The modification are focusing on the following areas:
 ###Pre-configuration
 The ipstart should align to a /28 Ip address range start (e.g. 10.11.0.16, 10.11.0.32)
 
+For debug purposes, you can use your own IP address as VES collector, use "ip" command to determine it.
+
 Example:
-python3 ./mass-pnf-sim.py  --bootstrap 2 --ipves 10.11.0.2 --ipstart 10.11.0.16
+./mass-pnf-sim.py  --bootstrap 2 --urlves http://10.148.95.??:10000/eventListener/v7 --ipfileserver 10.148.95.??? --ipstart 10.11.0.16
+
+Note that the file creator is started at a time of the bootstrapping.
+Stop/start will not re-launch it.
+
+###Replacing VES for test purposes
+`sudo nc -vv -l -k -p 10000`
 
 ###Start
 Define the amount of simulators to be launched
-python3 ./mass-pnf-sim.py  --start 2
+./mass-pnf-sim.py  --start 2
 
+###Trigger
+./mass-pnf-sim.py  --trigger 2
 
 ###Stop and clean
-python3 ./mass-pnf-sim.py  --stop 2
-python3 ./mass-pnf-sim.py  --clean
+./mass-pnf-sim.py  --stop 2
+./mass-pnf-sim.py  --clean
+
+###Verbose printout from Python
+python3 -m trace --trace --count -C . ./mass-pnf-sim.py .....
 
 ###Cleaning and recovery after incorrect configuration
 docker stop $(docker ps -aq); docker rm $(docker ps -aq)
diff --git a/test/mocks/mass-pnf-sim/ROP_file_creator.sh b/test/mocks/mass-pnf-sim/ROP_file_creator.sh
deleted file mode 100755 (executable)
index 1451658..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-MAIN_DIRECTORY=./files/onap
-FILE_TEMPLATE=./templates/file_template.xml.gz
-UPDATE_MINS=15
-NUM_NODES=20
-NUM_FILES=10
-
-rm -rf $MAIN_DIRECTORY/*
-for ((m=1;m<=$NUM_NODES;m++))
-do
-       DIRECTORY=$MAIN_DIRECTORY/"node"$m
-       mkdir -p "$DIRECTORY"
-done
-
-for ((n=0;n<$NUM_FILES;n++))
-do
-       if [[ "$OSTYPE" == "linux-gnu" ]]; then         # Linux OS
-               DATE=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%Y%m%d")
-               TIME_START=$(date -d $(($UPDATE_MINS*($n+1)-1))" minutes ago" +"%H%M")
-               TIME_END=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%H%M")  
-       elif [[ "$OSTYPE" == "darwin"* ]]; then         # Mac OS
-               DATE=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%Y%m%d")
-               TIME_START=$(date -v "-"$(($UPDATE_MINS*($n+1)-1))"M" +"%H%M")
-               TIME_END=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%H%M")
-       else
-               echo "ERROR: OS not supported"
-               exit 1
-       fi
-
-       FILE_NAME_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
-       TIMESTAMP_ARRAY[$n]=$FILE_NAME_TIMESTAMP
-
-       for ((m=1;m<=$NUM_NODES;m++))
-       do
-               DIRECTORY=$MAIN_DIRECTORY/"node"$m
-               FILE_NAME=$FILE_NAME_TIMESTAMP"_node"$m".xml.gz"
-               cp $FILE_TEMPLATE $DIRECTORY/$FILE_NAME
-       done
-done
-
-while true
-do
-       sleep $(($UPDATE_MINS*60))
-       OLD_TIMESTAMP=${TIMESTAMP_ARRAY[$NUM_FILES-1]}
-       unset TIMESTAMP_ARRAY[$NUM_FILES-1]
-
-       DATE=$(date +"%Y%m%d")
-       TIME_END=$(date +"%H%M")
-       if [[ "$OSTYPE" == "linux-gnu" ]]; then         # Linux OS
-               TIME_START=$(date -d $(($UPDATE_MINS-1))" minutes ago" +"%H%M")
-       elif [[ "$OSTYPE" == "darwin"* ]]; then         # Mac OS
-               TIME_START=$(date -v "-"$(($UPDATE_MINS-1))"M" +"%H%M")
-       else
-               echo "ERROR: OS not supported"
-               exit 1
-       fi
-
-       NEW_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
-       TIMESTAMP_ARRAY=("$NEW_TIMESTAMP" "${TIMESTAMP_ARRAY[@]}")
-
-       for ((m=1;m<=$NUM_NODES;m++))
-       do
-               DIRECTORY=$MAIN_DIRECTORY/"node"$m
-               OLD_FILE_NAME=$OLD_TIMESTAMP"_node"$m".xml.gz"
-               NEW_FILE_NAME=$NEW_TIMESTAMP"_node"$m".xml.gz"
-               mv $DIRECTORY/$OLD_FILE_NAME $DIRECTORY/$NEW_FILE_NAME
-               echo "Renamed OLD file: "$OLD_FILE_NAME" to NEW file: "$NEW_FILE_NAME
-       done
-done
diff --git a/test/mocks/mass-pnf-sim/clean.sh b/test/mocks/mass-pnf-sim/clean.sh
new file mode 100755 (executable)
index 0000000..28df0ef
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+killall ROP_file_creator.sh
+
+docker stop $(docker ps -aq); docker rm $(docker ps -aq)
+
+./mass-pnf-sim.py --clean
+
diff --git a/test/mocks/mass-pnf-sim/diagnostic.sh b/test/mocks/mass-pnf-sim/diagnostic.sh
new file mode 100755 (executable)
index 0000000..99e35cd
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+echo "======= docker ps"
+docker ps
+
+echo "======= Docker image cache"
+docker images nexus3.onap.org:10003/onap/masspnf-simulator
+
+export NUM_OF_SIMS=`find pnf-sim-lw* -maxdepth 0 | wc -l`
+echo $NUM_OF_SIMS
+
+if [ "$NUM_OF_SIMS" -gt 0 ];
+then
+       echo "======= docker-compose, first instance"
+       cat pnf-sim-lw-0/docker-compose.yml
+       
+       echo "======= Java config.yml, first instance"
+       cat pnf-sim-lw-0/config/config.yml
+fi
+
+if (("$NUM_OF_SIMS" > 2));
+then
+       echo "======= docker-compose, last instance"
+       cat pnf-sim-lw-$(($NUM_OF_SIMS-1))/docker-compose.yml
+       
+       echo "======= Java config.yml, last instance"
+       cat pnf-sim-lw-$(($NUM_OF_SIMS-1))/config/config.yml
+fi
+
+
index 9ec8c00..8a4f390 100755 (executable)
@@ -14,8 +14,18 @@ parser.add_argument(
 )
 
 parser.add_argument(
-    '--ipves',
-    help='IP of the VES collector',
+    '--trigger',
+    help='Trigger one single VES event from each simulator',
+)
+
+parser.add_argument(
+    '--urlves',
+    help='URL of the VES collector',
+)
+
+parser.add_argument(
+    '--ipfileserver',
+    help='Visible IP of the file server (SFTP/FTPS) to be included in the VES event',
 )
 
 parser.add_argument(
@@ -46,9 +56,11 @@ parser.add_argument(
 
 args = parser.parse_args()
 
-if args.bootstrap and args.ipstart and args.ipves:
+if args.bootstrap and args.ipstart and args.urlves:
     print("Bootstrap:")
 
+    start_port=2000
+
     for i in range(int(args.bootstrap)):
         print("PNF simulator instance: " + str(i) + ".")
 
@@ -63,11 +75,17 @@ if args.bootstrap and args.ipstart and args.ipves:
         IpPnfSim = ipaddress.ip_address(args.ipstart) + int(2 + (i * 16))
         print("\tIp Pnf SIM:" + str(IpPnfSim))
 
-        IpFtps = ipaddress.ip_address(args.ipstart) + int(3 + (i * 16))
-        print("\tIp Ftps: " + str(IpFtps))
+        IpFileServer = args.ipfileserver
 
-        IpSftp = ipaddress.ip_address(args.ipstart) + int(4 + (i * 16))
-        print("\tIp Sftp:" + str(IpSftp))
+        
+        PortSftp=start_port +1
+        PortFtps=start_port +2 
+        start_port +=2
+        UrlFtps = str(ipaddress.ip_address(args.ipstart) + int(3 + (i * 16)))
+        print("\tUrl Ftps: " + str(UrlFtps))
+        UrlSftp = str(ipaddress.ip_address(args.ipstart) + int(4 + (i * 16)))
+        print("\tUrl Sftp: " + str(UrlSftp))
 
         foldername = "pnf-sim-lw-" + str(i)
         completed = subprocess.run('mkdir ' + foldername, shell=True)
@@ -78,14 +96,17 @@ if args.bootstrap and args.ipstart and args.ipves:
             shell=True)
         print('\tCloning folder:', completed.stdout)
 
-        composercmd = "./simulator.sh compose " +\
-            str(ip_gw) + " " +\
-            str(ip_subnet) + " " +\
-            str(i) + " " +\
-            str(args.ipves) + " " +\
-            str(IpPnfSim) + " " +\
-            str(IpFtps) + " " +\
-            str(IpSftp)
+        composercmd = "./simulator.sh compose " + \
+            str(ip_gw) + " " + \
+            str(ip_subnet) + " " + \
+            str(i) + " " + \
+            str(args.urlves) + " " + \
+            str(IpPnfSim) + " " + \
+            str(IpFileServer) + " " + \
+            str(PortSftp) + " " + \
+            str(PortFtps) + " " + \
+            str(UrlFtps) + " " + \
+            str(UrlSftp)
 
         completed = subprocess.run(
             'set -x; cd ' +
@@ -95,6 +116,9 @@ if args.bootstrap and args.ipstart and args.ipves:
             shell=True)
         print('Cloning:', completed.stdout)
 
+    completed = subprocess.run('set -x; cd pnf-sim-lightweight; ./simulator.sh build ', shell=True)
+    print("Build docker image: ", completed.stdout)
+
     sys.exit()
 
 if args.clean:
@@ -135,10 +159,24 @@ if args.stop:
         completed = subprocess.run(
             'cd ' +
             foldername +
-            "; ./simulator.sh stop",
+            "; ./simulator.sh stop " + str(i),
             shell=True)
         print('Stopping:', completed.stdout)
 
+
+if args.trigger:
+    print("Triggering VES sending:")
+
+    for i in range(int(args.trigger)):
+        foldername = "pnf-sim-lw-" + str(i)
+
+        completed = subprocess.run(
+            'cd ' +
+            foldername +
+            "; ./simulator.sh trigger-simulator",
+            shell=True)
+        print('Status:', completed.stdout)
+
 else:
     print("No instruction was defined")
     sys.exit()
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
new file mode 100644 (file)
index 0000000..0e2b668
--- /dev/null
@@ -0,0 +1,39 @@
+##Local development shortcuts:
+####To start listening on port 10000 for test purposes
+`nc -l -k -p 10000`
+####Test the command above: 
+`echo "Hello World" | nc localhost  10000`
+
+####Trigger the pnf simulator locally:
+
+```
+~/dev/git/integration/test/mocks/mass-pnf-sim/pnf-sim-lightweight$ curl -s -X POST -H "Content-Type: application/json" -H "X-ONAP-RequestID: 123" -H "X-InvocationID: 456" -d @config/config.json 
+http://localhost:5000/simulator/start
+```
+#### VES event sending
+the default action is to send a VES Message every 15 minutes and the total duration of the VES FileReady Message sending is 1 day (these values can be changed in config/config.json)
+
+Message from the stdout of nc:
+
+```
+POST / HTTP/1.1
+Content-Type: application/json
+X-ONAP-RequestID: 123
+X-InvocationID: 3a256e95-2594-4b11-b25c-68c4baeb5c20
+Content-Length: 734
+Host: localhost:10000
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_162)
+Accept-Encoding: gzip,deflate
+```
+
+```javascript
+{"event":{"commonEventHeader":{"startEpochMicrosec":"1551865758690","sourceId":"val13","eventId":"registration_51865758",
+"nfcNamingCode":"oam","internalHeaderFields":{},"priority":"Normal","version":"4.0.1","reportingEntityName":"NOK6061ZW3",
+"sequence":"0","domain":"notification","lastEpochMicrosec":"1551865758690","eventName":"pnfRegistration_Nokia_5gDu",
+"vesEventListenerVersion":"7.0.1","sourceName":"NOK6061ZW3","nfNamingCode":"gNB"},
+"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES",
+"arrayOfNamedHashMap":[{"name":"10MB.tar.gz","hashMap":{
+"location":"ftpes://10.11.0.68/10MB.tar.gz","fileFormatType":"org.3GPP.32.435#measCollec",
+"fileFormatVersion":"V10","compression":"gzip"}}]}}}
+```
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh
new file mode 100755 (executable)
index 0000000..6ea6ffd
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+MAIN_DIRECTORY=${PWD##*/}
+FULL_DIRECTORY=${PWD}
+FILE_DIRECTORY=$FULL_DIRECTORY/files/onap
+FILE_TEMPLATE=$FULL_DIRECTORY/templates/file_template_new.xml.gz
+UPDATE_MINS=15
+NUM_FILES=96
+
+rm -rf $FILE_DIRECTORY
+mkdir -p "$FILE_DIRECTORY"
+
+for ((n=0;n<$NUM_FILES;n++))
+do
+       if [[ "$OSTYPE" == "linux-gnu" ]]; then         # Linux OS
+               DATE=$(date -d $(($UPDATE_MINS*($n+1)-1))" minutes ago" +"%Y%m%d")
+               TIME_START=$(date -d $(($UPDATE_MINS*($n+1)-1))" minutes ago" +"%H%M%z")
+               TIME_END=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%H%M%z")  
+       elif [[ "$OSTYPE" == "darwin"* ]]; then         # Mac OS
+               DATE=$(date -v "-"$(($UPDATE_MINS*($n+1)-1))"M" +"%Y%m%d")
+               TIME_START=$(date -v "-"$(($UPDATE_MINS*($n+1)-1))"M" +"%H%M%z")
+               TIME_END=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%H%M%z")
+       else
+               echo "ERROR: OS not supported"
+               exit 1
+       fi
+
+       FILE_NAME_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
+       FILE_NAME=$FILE_NAME_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+       cp $FILE_TEMPLATE $FILE_DIRECTORY/$FILE_NAME
+
+       TIMESTAMP_ARRAY[$n]=$FILE_NAME_TIMESTAMP
+done
+
+while true
+do
+       sleep $(($UPDATE_MINS*60))
+       OLD_TIMESTAMP=${TIMESTAMP_ARRAY[$NUM_FILES-1]}
+       unset TIMESTAMP_ARRAY[$NUM_FILES-1]
+
+       TIME_END=$(date +"%H%M%z")
+       if [[ "$OSTYPE" == "linux-gnu" ]]; then         # Linux OS
+               DATE=$(date -d $(($UPDATE_MINS-1))" minutes ago" +"%Y%m%d")
+               TIME_START=$(date -d $(($UPDATE_MINS-1))" minutes ago" +"%H%M%z")
+       elif [[ "$OSTYPE" == "darwin"* ]]; then         # Mac OS
+               DATE=$(date -v "-"$(($UPDATE_MINS-1))"M" +"%Y%m%d")
+               TIME_START=$(date -v "-"$(($UPDATE_MINS-1))"M" +"%H%M%z")
+       else
+               echo "ERROR: OS not supported"
+               exit 1
+       fi
+
+       NEW_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
+       OLD_FILE_NAME=$OLD_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+       NEW_FILE_NAME=$NEW_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+       mv $FILE_DIRECTORY/$OLD_FILE_NAME $FILE_DIRECTORY/$NEW_FILE_NAME
+       #echo "Renamed OLD file: "$OLD_FILE_NAME" to NEW file: "$NEW_FILE_NAME      # uncomment for debugging
+
+       TIMESTAMP_ARRAY=("$NEW_TIMESTAMP" "${TIMESTAMP_ARRAY[@]}")
+done
index f0ded4c..9d2ba7e 100644 (file)
@@ -1,35 +1,15 @@
 {
   "simulatorParams": {
-    "vesServerUrl": "http://localhost:10000/eventListener/v7",
-    "testDuration": "10",
-    "messageInterval": "1"
+    "testDuration": "86400",
+    "messageInterval": "900"
   },
   "commonEventHeaderParams": {
-    "eventName": "pnfRegistration_Nokia_5gDu",
+    "eventName": "Noti_RnNode-Ericsson_FileReady",
     "nfNamingCode": "gNB",
-    "nfcNamingCode": "oam",
-    "sourceName": "NOK6061ZW3",
-    "sourceId": "val13",
-    "reportingEntityName": "NOK6061ZW3"
+    "nfcNamingCode": "oam"
   },
   "notificationParams": {
     "changeIdentifier": "PM_MEAS_FILES",
-    "changeType": "FileReady",
-    "arrayOfNamedHashMap": [
-      {"name": "A20161221.1031-1041.bin.gz", "hashMap": {
-        "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      },
-      {"name": "A20161222.1042-1102.bin.gz", "hashMap": {
-        "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      }
-    ]
+    "changeType": "FileReady"
   }
 }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml
new file mode 100644 (file)
index 0000000..06c8320
--- /dev/null
@@ -0,0 +1,9 @@
+---
+urlves: http://localhost:10000/eventListener/v7
+urlftps: ftps://onap:pano@10.11.0.67
+urlsftp: sftp://onap:pano@10.11.0.68
+#when run in simulator, it does not have own IP
+ippnfsim: localhost
+defaultfileserver: sftp
+#defaultfileserver: ftps
+...
index 6cf310a..c4f7b4a 100644 (file)
@@ -1,4 +1,10 @@
-NETCONF_ADDRESS=netopeer
+
+//to run in simulator
+//NETCONF_ADDRESS=netopeer
+
+//to run in docker
+NETCONF_ADDRESS=localhost
+
 NETCONF_PORT=830
 NETCONF_MODEL=pnf-simulator
 NETCONF_MAIN_CONTAINER=config
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-ftps-template.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-ftps-template.json
deleted file mode 100644 (file)
index de1e957..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-{
-  "simulatorParams": {
-    "vesServerUrl": "http://______$IP_OF_VES_____:_____$PORT_OF_VES/eventListener/v7",
-    "testDuration": "10",
-    "messageInterval": "1"
-  },
-  "commonEventHeaderParams": {
-    "eventName": "pnfRegistration_Nokia_5gDu",
-    "nfNamingCode": "gNB",
-    "nfcNamingCode": "oam",
-    "sourceName": "NOK6061ZW3",
-    "sourceId": "val13",
-    "reportingEntityName": "NOK6061ZW3"
-  },
-  "notificationParams": {
-    "changeIdentifier": "PM_MEAS_FILES",
-    "changeType": "FileReady",
-    "arrayOfNamedHashMap": [
-      {"name": "1MB.tar.gz", "hashMap": {
-        "location": "sftp://$IPSFTP}/1MB.tar.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      }
-      }
-    ]
-  }
-}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-sftp-template.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/singlefile-config-sftp-template.json
deleted file mode 100644 (file)
index c8c38b0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-  "simulatorParams": {
-    "vesServerUrl": "http://______$IP_OF_VES_____:_____$PORT_OF_VES/eventListener/v7",
-    "testDuration": "10",
-    "messageInterval": "1"
-  },
-  "commonEventHeaderParams": {
-    "eventName": "pnfRegistration_Nokia_5gDu",
-    "nfNamingCode": "gNB",
-    "nfcNamingCode": "oam",
-    "sourceName": "NOK6061ZW3",
-    "sourceId": "val13",
-    "reportingEntityName": "NOK6061ZW3"
-  },
-  "notificationParams": {
-    "changeIdentifier": "PM_MEAS_FILES",
-    "changeType": "FileReady",
-    "arrayOfNamedHashMap": [
-      {"name": "1MB.tar.gz", "hashMap": {
-        "location": "ftps://$IP/1MB.tar.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      }
-    ]
-  }
-}
index f4ff7d8..aa0261c 100644 (file)
@@ -10,14 +10,15 @@ networks:
 services:
   pnf-simulator-${I}:
     container_name: pnf-simulator-${I}
-
-    image: nexus3.onap.org:10003/onap/pnf-simulator:4.0.0-SNAPSHOT
+    image: nexus3.onap.org:10003/onap/masspnf-simulator:1.0.0-SNAPSHOT
     networks:
       front-${I}:
         ipv4_address: "${IPPNFSIM}"
     volumes:
       - ./logs:/var/log
       - ./json_schema:/json_schema
+      - ./config/config.yml:/config/config.yml:rw
+      - ./files/:/files/:rw
     env_file:
       - ./config/netconf.env
     restart: on-failure
@@ -28,6 +29,8 @@ services:
     networks:
       front-${I}:
         ipv4_address: "${IPSFTP}"
+    ports:
+      - "${PORTSFTP}:22"
     volumes:
       - ./files/onap/:/home/onap/
     restart: on-failure
@@ -39,6 +42,8 @@ services:
     networks:
       front-${I}:
         ipv4_address: "${IPFTPS}"
+    ports:
+         - "${PORTFTPS}:21"
     environment:
       FTP_USER: onap
       FTP_PASSWORD: pano
@@ -50,10 +55,7 @@ services:
       - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro
       - ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro
       - ./config/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro
-      - ./files/onap/0.5MB.tar.gz:/srv/0.5MB.tar.gz:ro
-      - ./files/onap/1MB.tar.gz:/srv/1MB.tar.gz:ro
-      - ./files/onap/5MB.tar.gz:/srv/5MB.tar.gz:ro
-      - ./files/onap/10MB.tar.gz:/srv/10MB.tar.gz:ro
+      - ./files/onap/:/srv/
     restart: on-failure
     command: vsftpd /etc/vsftpd_ssl.conf
 
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh
deleted file mode 100755 (executable)
index 4c7c506..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-echo "Creating ROP files"
-set -x
-mkdir -p onap
-
-dd if=/dev/urandom of=./onap/0.5MB.tar.gz bs=1k count=512
-dd if=/dev/urandom of=./onap/1MB.tar.gz bs=1M count=1
-dd if=/dev/urandom of=./onap/5MB.tar.gz bs=1M count=5
-dd if=/dev/urandom of=./onap/10MB.tar.gz bs=1M count=10
\ No newline at end of file
index 4e75e0a..7b38e05 100644 (file)
@@ -5,9 +5,6 @@
     "simulatorParams": {
       "type": "object",
       "properties": {
-        "vesServerUrl": {
-          "type": "string"
-        },
         "testDuration": {
           "type": "string"
         },
@@ -16,7 +13,6 @@
         }
       },
       "required": [
-        "vesServerUrl",
         "testDuration",
         "messageInterval"
       ]
         },
         "nfcNamingCode": {
           "type": "string"
-        },
-        "sourceName": {
-          "type": "string"
-        },
-        "sourceId": {
-          "type": "string"
-        },
-        "reportingEntityName": {
-          "type": "string"
         }
       },
       "required": [
-        "eventName",
-        "sourceName",
-        "sourceId",
-        "reportingEntityName"
+        "eventName"
       ]
     },
 
         },
         "changeType": {
           "type": "string"
-        },
-        "arrayOfNamedHashMap": {
-          "type": "array",
-          "items": [
-            {
-              "type": "object",
-              "properties": {
-                "name": {
-                  "type": "string"
-                },
-                "hashMap": {
-                  "type": "object",
-                  "properties": {
-                    "location": {
-                      "type": "string"
-                    },
-                    "compression": {
-                      "type": "string"
-                    },
-                    "fileFormatType": {
-                      "type": "string"
-                    },
-                    "fileFormatVersion": {
-                      "type": "string"
-                    }
-                  },
-                  "required": [
-                    "location",
-                    "compression",
-                    "fileFormatType",
-                    "fileFormatVersion"
-                  ]
-                }
-              },
-              "required": [
-                "name",
-                "hashMap"
-              ]
-            },
-            {
-              "type": "object",
-              "properties": {
-                "name": {
-                  "type": "string"
-                },
-                "hashMap": {
-                  "type": "object",
-                  "properties": {
-                    "location": {
-                      "type": "string"
-                    },
-                    "compression": {
-                      "type": "string"
-                    },
-                    "fileFormatType": {
-                      "type": "string"
-                    },
-                    "fileFormatVersion": {
-                      "type": "string"
-                    }
-                  },
-                  "required": [
-                    "location",
-                    "compression",
-                    "fileFormatType",
-                    "fileFormatVersion"
-                  ]
-                }
-              },
-              "required": [
-                "name",
-                "hashMap"
-              ]
-            }
-          ]
         }
       },
       "required": [
         "changeIdentifier",
-        "changeType",
-        "arrayOfNamedHashMap"
+        "changeType"
       ]
     }
   },
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.data.xml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.data.xml
new file mode 100644 (file)
index 0000000..9d648bb
--- /dev/null
@@ -0,0 +1,4 @@
+<config xmlns="http://nokia.com/pnf-simulator">
+  <itemValue1>42</itemValue1>
+  <itemValue2>35</itemValue2>
+</config>
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.yang b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/netconf/pnf-simulator.yang
new file mode 100644 (file)
index 0000000..d7fc2f2
--- /dev/null
@@ -0,0 +1,9 @@
+module pnf-simulator {
+  namespace "http://nokia.com/pnf-simulator";
+  prefix config;
+  container config {
+    config true;
+    leaf itemValue1 {type uint32;}
+    leaf itemValue2 {type uint32;}
+  }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/pom.xml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/pom.xml
new file mode 100644 (file)
index 0000000..abfa615
--- /dev/null
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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>
+
+  <parent>
+    <groupId>org.onap.oparent</groupId>
+    <artifactId>oparent</artifactId>
+    <version>1.2.1</version>
+  </parent>
+
+  <groupId>org.onap.masspnfsimulator</groupId>
+  <artifactId>masspnf-simulator</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+
+  <name>pnf-simulator-sandbox</name>
+
+  <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>com.fasterxml.jackson.dataformat</groupId>
+    <artifactId>jackson-dataformat-yaml</artifactId>
+    <version>2.9.8</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-assembly-plugin</artifactId>
+        <configuration>
+          <descriptor>src/assembly/resources.xml</descriptor>
+          <finalName>${project.artifactId}-${project.version}</finalName>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <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>${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>
index 12b2047..4c5d9f0 100755 (executable)
@@ -6,9 +6,12 @@ COMPOSE_FILE_NAME=docker-compose.yml
 NETOPEER_CONTAINER_NAME=netopeer
 SIMULATOR_CONTAINER_NAME=pnf-simulator
 SIMULATOR_PORT=5000
-SIMULATOR_START_URL=http://localhost:$SIMULATOR_PORT/simulator/start
-SIMULATOR_STOP_URL=http://localhost:$SIMULATOR_PORT/simulator/stop
-SIMULATOR_STATUS_URL=http://localhost:$SIMULATOR_PORT/simulator/status
+
+SIMULATOR_BASE=http://localhost:$SIMULATOR_PORT/simulator/
+SIMULATOR_START_URL=$SIMULATOR_BASE/start
+SIMULATOR_STOP_URL=$SIMULATOR_BASE/stop
+SIMULATOR_STATUS_URL=$SIMULATOR_BASE/status
+
 RUNNING_COMPOSE_CONFIG=$COMPOSE_FILE_NAME
 
 function main(){
@@ -17,16 +20,23 @@ function main(){
 
     case $COMMAND in
        "compose")
-            compose $2 $3 $4 $5 $6 $7 $8;;
-             #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFTP, #IPSFTP,
+            compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" ;;
+             #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP
         "build")
             build_image;;
         "start")
             start $COMPOSE_FILE_NAME;;
         "stop")
-            stop;;
+            if [[ -z ${2+x} ]]
+            then
+               echo "Error: action 'stop' requires the instance identifier"
+               exit
+            fi
+            stop $2;;
         "run-simulator")
             run_simulator;;
+        "trigger-simulator")
+            trigger_simulator;;
         "stop-simulator")
             stop_simulator;;
         "status")
@@ -38,6 +48,18 @@ function main(){
     esac
 }
 
+
+function get_pnfsim_ip() {
+
+       export IPPNFSIM=$(cat ./config/config.yml | grep ippnfsim | awk -F'[ ]' '{print $2}')
+       echo "PNF-Sim IP: " $IPPNFSIM
+       
+       export SIMULATOR_BASE=http://$IPPNFSIM:$SIMULATOR_PORT/simulator/
+       export SIMULATOR_START_URL=$SIMULATOR_BASE/start
+       export SIMULATOR_STOP_URL=$SIMULATOR_BASE/stop
+       export SIMULATOR_STATUS_URL=$SIMULATOR_BASE/status
+}
+
 function compose(){
        #creating custom docker-compose based on IP arguments
        #creting config.json by injecting the same IP
@@ -47,8 +69,11 @@ function compose(){
        export I=$3
        export IPVES=$4
        export IPPNFSIM=$5
-       export IPFTPS=$6
-       export IPSFTP=$7
+       export IPFILESERVER=$6
+       export PORTSFTP=$7
+       export PORTFTPS=$8
+       export IPFTPS=$9
+       export IPSFTP=${10}
 
        #will insert $I to distinguish containers, networks properly
        #docker compose cannot substitute these, as they are keys, not values.
@@ -57,19 +82,17 @@ function compose(){
        docker-compose -f docker-compose-temporary.yml config > docker-compose.yml
        rm docker-compose-temporary.yml
 
-       cd files
-       ./prepare-ROP-files.sh
-       cd -
+       ./ROP_file_creator.sh $I &
 
        set_vsftpd_file_owner
 
-       write_config $IPVES $IPFTPS $IPSFTP
+       write_config $IPVES $IPFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
 
 }
 
 function build_image(){
     if [ -f pom.xml ]; then
-        mvn clean package docker:build
+        mvn clean package docker:build -Dcheckstyle.skip -DskipTests
     else
         echo "pom.xml file not found"
         exit 1
@@ -83,15 +106,16 @@ function set_vsftpd_file_owner() {
 
 function write_config(){
        #building a YML file for usage in Java
-       echo "---" > config/config.yml
-       echo "configuration:" >> config/config.yml
-       echo "  vesip: $1" >> config/config.yml
-       echo "  ipftps: $2" >> config/config.yml
-       echo "  ipsftp: $3" >> config/config.yml
+       echo "urlves: $1" > config/config.yml
+       echo "urlsftp: sftp://onap:pano@$2:$3" >> config/config.yml
+       echo "urlftps: ftps://onap:pano@$2:$4" >> config/config.yml
+       echo "ippnfsim: $5" >> config/config.yml
+       echo "defaultfileserver: sftp" >> config/config.yml
 }
 
 function start(){
 
+       get_pnfsim_ip
     if [[ $(running_containers) ]]; then
         echo "Simulator containers are already up"
     else
@@ -108,6 +132,8 @@ function running_containers(){
 }
 
 function stop(){
+       get_pnfsim_ip
+    kill $(ps -ef | grep "[.]/ROP_file_creator.sh $1" | head -n 1 | awk '{print $2}')
 
     if [[ $(running_containers) ]]; then
         docker-compose -f $RUNNING_COMPOSE_CONFIG down
@@ -117,8 +143,16 @@ function stop(){
     fi
 }
 
-function run_simulator(){
+function trigger_simulator(){
+get_pnfsim_ip
+cat << EndOfMessage
+Simulator response:
+$(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 run_simulator(){
+get_pnfsim_ip
 cat << EndOfMessage
 Simulator response:
 $(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)
@@ -126,6 +160,7 @@ EndOfMessage
 }
 
 function stop_simulator(){
+get_pnfsim_ip
 cat << EndOfMessage
 Simulator response:
 $(curl -s -X POST $SIMULATOR_STOP_URL)
@@ -133,7 +168,7 @@ EndOfMessage
 }
 
 function get_status(){
-
+       get_pnfsim_ip
     if [[ $(running_containers) ]]; then
         print_status
     else
@@ -142,6 +177,7 @@ function get_status(){
 }
 
 function print_status(){
+get_pnfsim_ip
 cat << EndOfMessage
 $(docker-compose -f $RUNNING_COMPOSE_CONFIG ps)
 
@@ -156,6 +192,7 @@ Available options:
 build - locally builds simulator image from existing code
 start - starts simulator and netopeer2 containers using remote simulator image and specified model name
 compose - customize the docker-compose and configuration based on arguments
+trigger-simulator - start monitoring the ROP files and report periodically
 run-simulator - starts sending PNF registration messages with parameters specified in config.json
 stop-simulator - stop sending PNF registration messages
 stop - stops both containers
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/assembly/resources.xml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/assembly/resources.xml
new file mode 100644 (file)
index 0000000..063c710
--- /dev/null
@@ -0,0 +1,75 @@
+<assembly>
+    <id>resources</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <includes>
+                <include>simulator.sh</include>
+            </includes>
+            <lineEnding>unix</lineEnding>
+            <fileMode>0755</fileMode>
+        </fileSet>
+        <fileSet>
+            <includes>
+                <include>docker-compose.yml</include>
+            </includes>
+            <lineEnding>unix</lineEnding>
+            <fileMode>0644</fileMode>
+        </fileSet>
+        <fileSet>
+            <directory>config</directory>
+            <outputDirectory>config</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>deployment</directory>
+            <outputDirectory>deployment</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>ftpes</directory>
+            <outputDirectory>ftpes</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+            <fileMode>0644</fileMode>
+
+        </fileSet>
+        <fileSet>
+            <directory>json_schema</directory>
+            <outputDirectory>json_schema</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>netconf</directory>
+            <outputDirectory>netconf</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>sftp</directory>
+            <outputDirectory>sftp</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>ssh</directory>
+            <outputDirectory>ssh</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java
new file mode 100644 (file)
index 0000000..15c687e
--- /dev/null
@@ -0,0 +1,28 @@
+package org.onap.pnfsimulator;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import java.io.File;
+
+public class ConfigurationProvider {
+    static PnfSimConfig conf = null;
+
+    public static PnfSimConfig getConfigInstance() {
+
+        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+        try {
+            File file = new File("./config/config.yml");
+
+            conf = mapper.readValue(file, PnfSimConfig.class);
+            System.out.println("Ves URL: " + conf.getUrlves());
+            System.out.println("SFTP URL: " + conf.getUrlsftp());
+            System.out.println("FTPS URL: " + conf.getUrlftps());
+            System.out.println("PNF sim IP: " + conf.getIppnfsim());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return conf;
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/FileProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/FileProvider.java
new file mode 100644 (file)
index 0000000..9eb7332
--- /dev/null
@@ -0,0 +1,44 @@
+package org.onap.pnfsimulator;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class FileProvider {
+
+    private FileProvider() {}
+
+    public static List<String> getFiles() {
+
+        List<String> files = queryFiles();
+
+        files.sort(Collections.reverseOrder());
+
+        List<String> fileListSorted = new ArrayList<>();
+        for (String f : files) {
+            fileListSorted.add(f);
+        }
+        return fileListSorted;
+    }
+
+    private static List<String> queryFiles() {
+
+        File folder = new File("./files/onap/");
+        File[] listOfFiles = folder.listFiles();
+        List<String> results = new ArrayList<>();
+
+        if (listOfFiles.length == 0) {
+            return results;
+            // TODO: this should be a thrown exception catched in the Simulator class
+        }
+
+        for (int i = 0; i < listOfFiles.length; i++) {
+            if (listOfFiles[i].isFile()) {
+                results.add(listOfFiles[i].getName());
+            }
+        }
+
+        return results;
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/Main.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/Main.java
new file mode 100644 (file)
index 0000000..a66bedb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============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;
+
+import java.util.concurrent.TimeUnit;
+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) throws InterruptedException {
+        SpringApplication.run(Main.class, args);
+
+        TimeUnit.SECONDS.sleep(5);
+        System.out.println("Start sending VES events");
+
+
+    }
+
+    @Bean
+    public MessageProvider messageProvider() {
+        return new MessageProvider();
+    }
+
+    @Bean
+    public JSONValidator jsonValidator() {
+        return new JSONValidator();
+    }
+
+}
+
+
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
new file mode 100644 (file)
index 0000000..89f59a3
--- /dev/null
@@ -0,0 +1,59 @@
+package org.onap.pnfsimulator;
+
+public class PnfSimConfig {
+    private String urlves;
+    private String urlftps;
+    private String urlsftp;
+    private String ippnfsim;
+    private String defaultfileserver;
+
+    public String getDefaultfileserver() {
+        return defaultfileserver;
+    }
+
+    public void setDefaultfileserver(String defaultfileserver) {
+        this.defaultfileserver = defaultfileserver;
+    }
+
+
+    public String getUrlves() {
+        return urlves;
+    }
+
+    public void setUrlves(String urlves) {
+        this.urlves = urlves;
+    }
+
+    public String getUrlftps() {
+        return urlftps;
+    }
+
+    public void setUrlftps(String urlftps) {
+        this.urlftps = urlftps;
+    }
+
+    public String getUrlsftp() {
+        return urlsftp;
+    }
+
+    public void setUrlsftp(String urlsftp) {
+        this.urlsftp = urlsftp;
+    }
+
+    public void setIppnfsim(String ippnfsim) {
+        this.ippnfsim = ippnfsim;
+    }
+
+    public String getIppnfsim() {
+        return ippnfsim;
+    }
+
+    @Override
+    public String toString() {
+        return "PnfSimConfig [vesip=" + urlves + ", urlftps=" + urlftps + ", ippnfsim=" + ippnfsim + ", urlsftp="
+                + urlsftp + "]";
+    }
+
+
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/logback.xml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/logback.xml
new file mode 100644 (file)
index 0000000..0f6d9de
--- /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="debug">
+    <appender-ref ref="Console" />
+    <appender-ref ref="ROLLING-FILE" />
+  </root>
+</Configuration>
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/logging/MDCVariables.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
new file mode 100644 (file)
index 0000000..545a568
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * ============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.COMPRESSION;
+import static org.onap.pnfsimulator.message.MessageConstants.COMPRESSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT_ID;
+import static org.onap.pnfsimulator.message.MessageConstants.FILE_FORMAT_TYPE;
+import static org.onap.pnfsimulator.message.MessageConstants.FILE_FORMAT_TYPE_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.FILE_FORMAT_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.FILE_FORMAT_VERSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.HASH_MAP;
+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.LOCATION;
+import static org.onap.pnfsimulator.message.MessageConstants.NAME;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS_VERSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_LAST_SERVICE_DATE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_MANUFACTURE_DATE;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS_VERSION_VALUE;
+import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY;
+import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY_NORMAL;
+import static org.onap.pnfsimulator.message.MessageConstants.REPORTING_ENTITY_NAME;
+import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE;
+import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE_NUMBER;
+import static org.onap.pnfsimulator.message.MessageConstants.SOURCE_NAME;
+import static org.onap.pnfsimulator.message.MessageConstants.START_EPOCH_MICROSEC;
+import static org.onap.pnfsimulator.message.MessageConstants.TIME_ZONE_OFFSET;
+import static org.onap.pnfsimulator.message.MessageConstants.VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.VERSION_NUMBER;
+import static org.onap.pnfsimulator.message.MessageConstants.VES_EVENT_LISTENER_VERSION;
+import static org.onap.pnfsimulator.message.MessageConstants.VES_EVENT_LISTENER_VERSION_NUMBER;
+import java.io.File;
+import java.util.List;
+import java.util.TimeZone;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+final class JSONObjectFactory {
+
+    static JSONObject generateConstantCommonEventHeader() {
+        JSONObject commonEventHeader = new JSONObject();
+        long timestamp = System.currentTimeMillis();
+        commonEventHeader.put(EVENT_ID, generateEventId());
+        commonEventHeader.put(TIME_ZONE_OFFSET, generateTimeZone(timestamp));
+        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);
+        String absPath = System.getProperty("user.dir");
+        String nodeName = absPath.substring(absPath.lastIndexOf(File.separator)+1);
+        commonEventHeader.put(SOURCE_NAME, nodeName);
+        commonEventHeader.put(REPORTING_ENTITY_NAME, nodeName);
+        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 JSONObject generateNotificationFields() {
+        JSONObject notificationFields = new JSONObject();
+        notificationFields.put(NOTIFICATION_FIELDS_VERSION, NOTIFICATION_FIELDS_VERSION_VALUE);
+        return notificationFields;
+    }
+
+    static JSONArray generateArrayOfNamedHashMap(List<String> fileList, String xnfUrl) {
+        JSONArray arrayOfNamedHashMap = new JSONArray();
+
+        for (String fileName : fileList) {
+            JSONObject namedHashMap = new JSONObject();
+            namedHashMap.put(NAME, fileName);
+
+            JSONObject hashMap = new JSONObject();
+            hashMap.put(FILE_FORMAT_TYPE, FILE_FORMAT_TYPE_VALUE);
+            hashMap.put(LOCATION, xnfUrl.concat(fileName));
+            hashMap.put(FILE_FORMAT_VERSION, FILE_FORMAT_VERSION_VALUE);
+            hashMap.put(COMPRESSION, COMPRESSION_VALUE);
+            namedHashMap.put(HASH_MAP, hashMap);
+
+            arrayOfNamedHashMap.put(namedHashMap);
+        }
+
+
+        return arrayOfNamedHashMap;
+    }
+
+
+    static String generateEventId() {
+        String timeAsString = String.valueOf(System.currentTimeMillis());
+        return String.format("FileReady_%s", timeAsString);
+    }
+
+    static String generateTimeZone(long timestamp) {
+        TimeZone timeZone = TimeZone.getDefault();
+        int offsetInMillis = timeZone.getOffset(timestamp);
+        String offsetHHMM = String.format("%02d:%02d", Math.abs(offsetInMillis / 3600000),
+                Math.abs((offsetInMillis / 60000) % 60));
+        return ("UTC" + (offsetInMillis >= 0 ? "+" : "-") + offsetHHMM);
+    }
+
+    private JSONObjectFactory() {
+
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java
new file mode 100644 (file)
index 0000000..6ff6e5d
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * ============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;
+
+public final class MessageConstants {
+
+    public static final String SIMULATOR_PARAMS = "simulatorParams";
+    public static final String COMMON_EVENT_HEADER_PARAMS = "commonEventHeaderParams";
+    public static final String PNF_REGISTRATION_PARAMS = "pnfRegistrationParams";
+    public static final String NOTIFICATION_PARAMS = "notificationParams";
+
+    static final String COMMON_EVENT_HEADER = "commonEventHeader";
+    static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields";
+    static final String NOTIFICATION_FIELDS = "notificationFields";
+    static final String EVENT = "event";
+
+    //=============================================================================================
+    //Simulation parameters
+    public static final String VES_SERVER_URL = "vesServerUrl";
+    public static final String TEST_DURATION = "testDuration";
+    public static final String MESSAGE_INTERVAL = "messageInterval";
+
+    //=============================================================================================
+    //commonEventHeader
+    //parameters
+    static final String DOMAIN = "domain";
+    static final String EVENT_ID = "eventId";
+    static final String TIME_ZONE_OFFSET = "timeZoneOffset";
+    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 VES_EVENT_LISTENER_VERSION = "vesEventListenerVersion";
+    static final String SOURCE_NAME = "sourceName";
+    static final String REPORTING_ENTITY_NAME = "reportingEntityName";
+    //constant values
+    static final int SEQUENCE_NUMBER = 0;
+    static final String VERSION_NUMBER = "4.0.1";
+    static final String VES_EVENT_LISTENER_VERSION_NUMBER = "7.0.1";
+    static final String PRIORITY_NORMAL = "Normal";
+
+    //=============================================================================================
+    //PNF registration
+    //parameters
+    static final String PNF_REGISTRATION_FIELDS_VERSION = "pnfRegistrationFieldsVersion";
+    static final String PNF_LAST_SERVICE_DATE = "lastServiceDate";
+    static final String PNF_MANUFACTURE_DATE = "manufactureDate";
+    //constant values
+    static final String PNF_REGISTRATION_FIELDS_VERSION_VALUE = "2.0";
+    static final String DOMAIN_PNF_REGISTRATION ="pnfRegistration";
+
+    //=============================================================================================
+    // Notifications
+    //parameters
+    static final String NOTIFICATION_FIELDS_VERSION = "notificationFieldsVersion";
+    static final String ARRAY_OF_NAMED_HASH_MAP = "arrayOfNamedHashMap";
+    static final String NAME = "name";
+    static final String HASH_MAP = "hashMap";
+    static final String FILE_FORMAT_TYPE = "fileFormatType";
+    static final String LOCATION = "location";
+    static final String FILE_FORMAT_VERSION = "fileFormatVersion";
+    static final String COMPRESSION = "compression";
+
+    //constant values
+    static final String NOTIFICATION_FIELDS_VERSION_VALUE = "2.0";
+    static final String DOMAIN_NOTIFICATION ="notification";
+    static final String FILE_FORMAT_TYPE_VALUE = "org.3GPP.32.435#measCollec";
+    static final String FILE_FORMAT_VERSION_VALUE = "V10";
+    static final String COMPRESSION_VALUE = "gzip";
+
+    private MessageConstants() {
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
new file mode 100644 (file)
index 0000000..c863625
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * ============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.ARRAY_OF_NAMED_HASH_MAP;
+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.DOMAIN_NOTIFICATION;
+import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN_PNF_REGISTRATION;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+public class MessageProvider {
+
+    public JSONObject createMessage(JSONObject commonEventHeaderParams, Optional<JSONObject> pnfRegistrationParams,
+            Optional<JSONObject> notificationParams) {
+        List<String> emptyList = new ArrayList<>();
+        String emptyString = "";
+        return createMessage(commonEventHeaderParams, pnfRegistrationParams, notificationParams, emptyList, emptyString);
+    }
+
+    public JSONObject createMessage(JSONObject commonEventHeaderParams, Optional<JSONObject> pnfRegistrationParams,
+            Optional<JSONObject> notificationParams, List<String> fileList, String xnfUrl) {
+
+        if (!pnfRegistrationParams.isPresent() && !notificationParams.isPresent()) {
+            throw new IllegalArgumentException(
+                    "Both PNF registration and notification parameters objects are not present");
+        }
+        JSONObject event = new JSONObject();
+
+        JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
+        Map<String, Object> commonEventHeaderFields = commonEventHeaderParams.toMap();
+        commonEventHeaderFields.forEach((key, value) -> {
+            commonEventHeader.put(key, value);
+        });
+
+        JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        pnfRegistrationParams.ifPresent(jsonObject -> {
+            copyParametersToFields(jsonObject.toMap(), pnfRegistrationFields);
+            commonEventHeader.put(DOMAIN, DOMAIN_PNF_REGISTRATION);
+            commonEventHeader.put(EVENT_TYPE, DOMAIN_PNF_REGISTRATION);
+            event.put(PNF_REGISTRATION_FIELDS, pnfRegistrationFields);
+        });
+
+        JSONObject notificationFields = JSONObjectFactory.generateNotificationFields();
+        notificationParams.ifPresent(jsonObject -> {
+            copyParametersToFields(jsonObject.toMap(), notificationFields);
+            JSONArray arrayOfNamedHashMap = JSONObjectFactory.generateArrayOfNamedHashMap(fileList, xnfUrl);
+            notificationFields.put(ARRAY_OF_NAMED_HASH_MAP, arrayOfNamedHashMap);
+            commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
+            event.put(NOTIFICATION_FIELDS, notificationFields);
+        });
+
+        event.put(COMMON_EVENT_HEADER, commonEventHeader);
+        JSONObject root = new JSONObject();
+        root.put(EVENT, event);
+        return root;
+    }
+
+    private void copyParametersToFields(Map<String, Object> paramersMap, JSONObject fieldsJsonObject) {
+        paramersMap.forEach((key, value) -> {
+            fieldsJsonObject.put(key, value);
+        });
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTask.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTask.java
new file mode 100644 (file)
index 0000000..bb173ae
--- /dev/null
@@ -0,0 +1,62 @@
+/// *
+// * ============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 com.tailf.jnc.JNCException;
+// 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 org.slf4j.Logger;
+// import org.slf4j.LoggerFactory;
+//
+// public class NetconfConfigurationCheckingTask extends TimerTask {
+//
+// private static final Logger LOGGER =
+/// LoggerFactory.getLogger(NetconfConfigurationCheckingTask.class);
+//
+// private final NetconfConfigurationReader reader;
+// private final NetconfConfigurationWriter writer;
+// private final NetconfConfigurationCache cache;
+//
+// public NetconfConfigurationCheckingTask(NetconfConfigurationReader reader,
+// NetconfConfigurationWriter writer,
+// NetconfConfigurationCache cache) {
+// this.reader = reader;
+// this.writer = writer;
+// this.cache = cache;
+// }
+//
+// @Override
+// public void run() {
+// try {
+// 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());
+// }
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorService.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorService.java
new file mode 100644 (file)
index 0000000..4e484b9
--- /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.netconfmonitor;
+//
+// import com.tailf.jnc.JNCException;
+// import java.io.IOException;
+// 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.slf4j.Logger;
+// import org.slf4j.LoggerFactory;
+// import org.springframework.beans.factory.annotation.Autowired;
+//
+//// @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;
+//
+// private Timer timer;
+// private NetconfConfigurationReader reader;
+// private NetconfConfigurationWriter writer;
+// private NetconfConfigurationCache cache;
+//
+// @Autowired
+// public NetconfMonitorService(Timer timer, NetconfConfigurationReader reader,
+/// NetconfConfigurationWriter writer,
+// NetconfConfigurationCache cache) {
+// this.timer = timer;
+// this.reader = reader;
+// this.writer = writer;
+// this.cache = cache;
+// }
+//
+// // @PostConstruct
+// public void start() {
+// setStartConfiguration();
+// NetconfConfigurationCheckingTask task = new NetconfConfigurationCheckingTask(reader, writer,
+/// cache);
+// timer.scheduleAtFixedRate(task, startDelay, timePeriod);
+// }
+//
+// 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());
+// }
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfiguration.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfiguration.java
new file mode 100644 (file)
index 0000000..d97315b
--- /dev/null
@@ -0,0 +1,114 @@
+/// *
+// * ============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 com.tailf.jnc.JNCException;
+// import com.tailf.jnc.NetconfSession;
+// 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 =
+/// LoggerFactory.getLogger(NetconfMonitorServiceConfiguration.class);
+// private static final Map<String, String> enviroment = System.getenv();
+//
+// private static final String LOG_PATH = "/var/log";
+//
+// private static final String NETCONF_ADDRESS = "NETCONF_ADDRESS";
+// private static final String NETCONF_PORT = "NETCONF_PORT";
+// 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 = "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";
+//
+// private static final String DEFAULT_NETCONF_USER = "netconf";
+// private static final String DEFAULT_NETCONF_PASSWORD = "netconf";
+//
+// @Bean
+// public Timer timer() {
+// return new Timer("NetconfMonitorServiceTimer");
+// }
+//
+// @Bean
+// public NetconfConfigurationCache configurationCache() {
+// return new NetconfConfigurationCache();
+// }
+//
+// @Bean
+// public NetconfConfigurationReader configurationReader() throws IOException, JNCException {
+// NetconfConnectionParams params = resolveConnectionParams();
+// LOGGER.info("Configuration params are : {}", 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);
+// }
+//
+// private String buildModelPath() {
+// return String.format("/%s:%s",
+// enviroment.getOrDefault(NETCONF_MODEL, DEFAULT_NETCONF_MODEL),
+// enviroment.getOrDefault(NETCONF_MAIN_CONTAINER, DEFAULT_NETCONF_MAIN_CONTAINER));
+// }
+//
+// NetconfConnectionParams resolveConnectionParams() {
+// return new NetconfConnectionParams(
+// 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;
+// }
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCache.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCache.java
new file mode 100644 (file)
index 0000000..3972184
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * ============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;
+
+public class NetconfConfigurationCache {
+
+    private String configuration = "";
+
+    public String getConfiguration() {
+        return configuration;
+    }
+
+    public void update(String configuration) {
+        this.configuration = configuration;
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReader.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReader.java
new file mode 100644 (file)
index 0000000..e41e58f
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * ============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 com.tailf.jnc.JNCException;
+import com.tailf.jnc.NetconfSession;
+import java.io.IOException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class NetconfConfigurationReader {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NetconfConfigurationReader.class);
+    private final NetconfSession session;
+    private final String netconfModelPath;
+
+    public NetconfConfigurationReader(NetconfSession session, String netconfModelPath) {
+        LOGGER.warn("netconfModelPath: {}", netconfModelPath);
+        this.session = session;
+        this.netconfModelPath = netconfModelPath;
+    }
+
+    public String read() throws IOException, JNCException {
+        return session.getConfig(netconfModelPath).first().toXMLString();
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriter.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriter.java
new file mode 100644 (file)
index 0000000..4003079
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * ============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 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 = LoggerFactory.getLogger(NetconfConfigurationWriter.class);
+    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
+    private String pathToLog;
+
+    public NetconfConfigurationWriter(String pathToLog) {
+        this.pathToLog = pathToLog;
+    }
+
+    public void writeToFile(String configuration) {
+        String fileName = String.format("%s/config[%s].xml", pathToLog, DateUtil.getTimestamp(dateFormat));
+        try (BufferedWriter writer = new BufferedWriter(new FileWriter(fileName))) {
+            writer.write(configuration);
+            LOGGER.info("Configuration wrote to file {}/{} ", pathToLog, fileName);
+        } catch (IOException e) {
+            LOGGER.warn("Failed to write configuration to file: {}", e.getMessage());
+        }
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConnectionParams.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConnectionParams.java
new file mode 100644 (file)
index 0000000..1d6eb89
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * ============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;
+
+public class NetconfConnectionParams {
+
+    public final String address;
+    public final int port;
+    public final String user;
+    public final String password;
+
+    public NetconfConnectionParams(String address, int port, String user, String password) {
+        this.address = address;
+        this.port = port;
+        this.user = user;
+        this.password = password;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("NetconfConnectionParams{address=%s, port=%d, user=%s, password=%s}",
+            address,
+            port,
+            user,
+            password);
+    }
+}
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java
new file mode 100644 (file)
index 0000000..2a685ea
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * ============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.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.COMMON_EVENT_HEADER_PARAMS;
+import static org.onap.pnfsimulator.message.MessageConstants.SIMULATOR_PARAMS;
+import static org.onap.pnfsimulator.rest.util.ResponseBuilder.MESSAGE;
+import static org.onap.pnfsimulator.rest.util.ResponseBuilder.REMAINING_TIME;
+import static org.onap.pnfsimulator.rest.util.ResponseBuilder.SIMULATOR_STATUS;
+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 com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Optional;
+import java.util.UUID;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.onap.pnfsimulator.message.MessageConstants;
+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.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;
+
+@RestController
+@RequestMapping("/simulator")
+public class SimulatorController {
+
+    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;
+
+    @Autowired
+    public SimulatorController(JSONValidator validator, SimulatorFactory factory) {
+        this.validator = validator;
+        this.factory = factory;
+    }
+
+    @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(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);
+            JSONObject commonEventHeaderParams = root.getJSONObject(COMMON_EVENT_HEADER_PARAMS);
+            Optional<JSONObject> pnfRegistrationFields = root.has(MessageConstants.PNF_REGISTRATION_PARAMS)
+                    ? Optional.of(root.getJSONObject(MessageConstants.PNF_REGISTRATION_PARAMS))
+                    : Optional.empty();
+            Optional<JSONObject> notificationFields = root.has(MessageConstants.NOTIFICATION_PARAMS)
+                    ? Optional.of(root.getJSONObject(MessageConstants.NOTIFICATION_PARAMS))
+                    : Optional.empty();
+            simulator =
+                    factory.create(simulatorParams, commonEventHeaderParams, pnfRegistrationFields, notificationFields);
+            simulator.start();
+
+            MDC.put(RESPONSE_CODE, OK.toString());
+            return ResponseBuilder.status(OK).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Simulator started").build();
+
+        } 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(BAD_REQUEST).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Cannot start simulator, invalid json format").build();
+
+        } catch (ProcessingException | ValidationException | IOException e) {
+            MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
+            LOGGER.warn("Json validation failed: {}", e.getMessage());
+            return ResponseBuilder.status(BAD_REQUEST).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Cannot start simulator - Json format is not compatible with schema definitions")
+                    .build();
+
+        } catch (Exception e) {
+            MDC.put(RESPONSE_CODE, INTERNAL_SERVER_ERROR.toString());
+            LOGGER.error("Cannot start simulator - unexpected exception", e);
+            return ResponseBuilder.status(INTERNAL_SERVER_ERROR)
+                    .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Unexpected exception: " + e.getMessage()).build();
+        } finally {
+            MDC.clear();
+        }
+    }
+
+    @PostMapping("startmassmode")
+    public ResponseEntity startmassmode(@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(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);
+            JSONObject commonEventHeaderParams = root.getJSONObject(COMMON_EVENT_HEADER_PARAMS);
+            Optional<JSONObject> pnfRegistrationFields = root.has(MessageConstants.PNF_REGISTRATION_PARAMS)
+                    ? Optional.of(root.getJSONObject(MessageConstants.PNF_REGISTRATION_PARAMS))
+                    : Optional.empty();
+            Optional<JSONObject> notificationFields = root.has(MessageConstants.NOTIFICATION_PARAMS)
+                    ? Optional.of(root.getJSONObject(MessageConstants.NOTIFICATION_PARAMS))
+                    : Optional.empty();
+            simulator =
+                    factory.create(simulatorParams, commonEventHeaderParams, pnfRegistrationFields, notificationFields);
+            simulator.start();
+
+            MDC.put(RESPONSE_CODE, OK.toString());
+            return ResponseBuilder.status(OK).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Simulator started").build();
+
+        } 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(BAD_REQUEST).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Cannot start simulator, invalid json format").build();
+
+        } catch (ProcessingException | ValidationException | IOException e) {
+            MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
+            LOGGER.warn("Json validation failed: {}", e.getMessage());
+            return ResponseBuilder.status(BAD_REQUEST).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Cannot start simulator - Json format is not compatible with schema definitions")
+                    .build();
+
+        } catch (Exception e) {
+            MDC.put(RESPONSE_CODE, INTERNAL_SERVER_ERROR.toString());
+            LOGGER.error("Cannot start simulator - unexpected exception", e);
+            return ResponseBuilder.status(INTERNAL_SERVER_ERROR)
+                    .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Unexpected exception: " + e.getMessage()).build();
+        } finally {
+            MDC.clear();
+        }
+    }
+
+
+
+    @GetMapping("status")
+    public ResponseEntity status() {
+        if (isSimulatorRunning()) {
+            ResponseBuilder responseBuilder = ResponseBuilder.status(OK)
+                    .put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT)).put(SIMULATOR_STATUS, "RUNNING");
+
+            return !simulator.isEndless() ? responseBuilder.put(REMAINING_TIME, simulator.getRemainingTime()).build()
+                    : responseBuilder.build();
+        } else {
+            return ResponseBuilder.status(OK).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(SIMULATOR_STATUS, "NOT RUNNING").build();
+        }
+    }
+
+    @PostMapping("stop")
+    public ResponseEntity stop() {
+        if (isSimulatorRunning()) {
+            simulator.interrupt();
+
+            return ResponseBuilder.status(OK).put(TIMESTAMP, DateUtil.getTimestamp(RESPONSE_DATE_FORMAT))
+                    .put(MESSAGE, "Simulator successfully stopped").build();
+        } else {
+            return ResponseBuilder.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();
+    }
+}
+
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java
new file mode 100644 (file)
index 0000000..284d589
--- /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.rest.util;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+public final class DateUtil {
+
+    private DateUtil() {
+    }
+
+    public static String getTimestamp(DateFormat dateFormat) {
+
+        return dateFormat.format(new Date());
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java
new file mode 100644 (file)
index 0000000..98f4588
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * ============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 java.util.LinkedHashMap;
+import java.util.Map;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+public class ResponseBuilder {
+
+    public static final String TIMESTAMP = "timestamp";
+    public static final String MESSAGE = "message";
+    public static final String SIMULATOR_STATUS = "simulatorStatus";
+    public static final String REMAINING_TIME = "remainingTime";
+
+    private HttpStatus httpStatus;
+    private Map<String, Object> body = new LinkedHashMap<>();
+
+    private ResponseBuilder(HttpStatus httpStatus) {
+        this.httpStatus = httpStatus;
+    }
+
+    public static ResponseBuilder status(HttpStatus httpStatus) {
+
+        return new ResponseBuilder(httpStatus);
+    }
+
+    public ResponseBuilder put(String key, Object value) {
+
+        body.put(key, value);
+        return this;
+    }
+
+    public ResponseEntity build() {
+
+        if (body.isEmpty()) {
+            return ResponseEntity.status(httpStatus).build();
+        }
+
+        return ResponseEntity.status(httpStatus).body(body);
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/Simulator.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/Simulator.java
new file mode 100644 (file)
index 0000000..5c64057
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * ============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 com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import java.io.IOException;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.json.JSONObject;
+import org.onap.pnfsimulator.FileProvider;
+import org.onap.pnfsimulator.message.MessageProvider;
+import org.onap.pnfsimulator.simulator.client.HttpClientAdapter;
+import org.onap.pnfsimulator.simulator.client.HttpClientAdapterImpl;
+import org.onap.pnfsimulator.simulator.validation.JSONValidator;
+import org.onap.pnfsimulator.simulator.validation.ValidationException;
+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 = 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 Duration duration;
+    private Duration interval;
+    private Instant endTime;
+    private JSONObject commonEventHeaderParams;
+    private Optional<JSONObject> pnfRegistrationParams;
+    private Optional<JSONObject> notificationParams;
+    private String xnfUrl;
+    private static final String DEFAULT_OUTPUT_SCHEMA_PATH = "json_schema/output_validator_ves_schema_30.0.1.json";
+
+    private Simulator() {}
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    @Override
+    public void run() {
+        setMdcContextMap(contextMap);
+        LOGGER.info("Simulation started - duration: {}, interval: {}s", getDuration(), interval.getSeconds());
+        endTime = Instant.now().plus(duration);
+        while (isEndless || runningTimeNotExceeded()) {
+            try {
+                List<String> fileList = FileProvider.getFiles();
+                MessageProvider messageProvider = new MessageProvider();
+                JSONValidator validator = new JSONValidator();
+
+                messageBody = messageProvider.createMessage(this.commonEventHeaderParams, this.pnfRegistrationParams,
+                        this.notificationParams, fileList, this.xnfUrl);
+                validator.validate(messageBody.toString(), DEFAULT_OUTPUT_SCHEMA_PATH);
+
+                LOGGER.info("Message to be sent:\n" + getMessage());
+                httpClient.send(messageBody.toString(), vesUrl);
+                Thread.sleep(interval.toMillis());
+            } catch (InterruptedException  | ValidationException | ProcessingException | IOException e) {
+                LOGGER.info("Simulation stopped due to an exception");
+                return;
+            }
+        }
+        LOGGER.info(EXIT, "Simulation finished");
+        MDC.clear();
+    }
+
+    private void setMdcContextMap(Map<String, String> mdcContextMap) {
+        if (mdcContextMap != null)
+            MDC.setContextMap(mdcContextMap);
+    }
+
+    private String getMessage() {
+        return messageBody.toString(4);
+    }
+
+    private String getDuration() {
+        return isEndless() ? "infinity" : duration.getSeconds() + "s";
+    }
+
+    private boolean runningTimeNotExceeded() {
+        return Instant.now().isBefore(endTime);
+    }
+
+    public boolean isEndless() {
+        return isEndless;
+    }
+
+    public long getRemainingTime() {
+        return Duration.between(Instant.now(), endTime).getSeconds();
+    }
+
+    public static class Builder {
+
+        private String vesUrl;
+        private HttpClientAdapter httpClient;
+        //private JSONObject messageBody;
+        private Duration duration;
+        private Duration interval;
+        private Optional<JSONObject> notificationParams;
+        private Optional<JSONObject> pnfRegistrationParams;
+        private JSONObject commonEventHeaderParams;
+        private String xnfUrl;
+
+        private Builder() {
+            this.vesUrl = "";
+            this.httpClient = new HttpClientAdapterImpl();
+            //this.messageBody = new JSONObject();
+            this.duration = Duration.ZERO;
+            this.interval = Duration.ZERO;
+            this.commonEventHeaderParams = new JSONObject();
+        }
+
+        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 Builder withCommonEventHeaderParams(JSONObject commonEventHeaderParams) {
+            this.commonEventHeaderParams = commonEventHeaderParams;
+            return this;
+        }
+
+        public Builder withNotificationParams(Optional<JSONObject> notificationParams) {
+            this.notificationParams = notificationParams;
+            return this;
+        }
+
+        public Builder withPnfRegistrationParams(Optional<JSONObject> pnfRegistrationParams) {
+            this.pnfRegistrationParams = pnfRegistrationParams;
+            return this;
+        }
+
+        public Builder withXnfUrl(String xnfUrl) {
+            this.xnfUrl = xnfUrl;
+            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.xnfUrl = this.xnfUrl;
+            simulator.commonEventHeaderParams = this.commonEventHeaderParams;
+            simulator.pnfRegistrationParams = this.pnfRegistrationParams;
+            simulator.notificationParams = this.notificationParams;
+            simulator.isEndless = duration.equals(Duration.ZERO);
+            return simulator;
+        }
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
new file mode 100644 (file)
index 0000000..a01c2e0
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============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 java.lang.Integer.parseInt;
+import static org.onap.pnfsimulator.message.MessageConstants.MESSAGE_INTERVAL;
+import static org.onap.pnfsimulator.message.MessageConstants.TEST_DURATION;
+import java.time.Duration;
+import java.util.Optional;
+import org.json.JSONObject;
+import org.onap.pnfsimulator.ConfigurationProvider;
+import org.onap.pnfsimulator.PnfSimConfig;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SimulatorFactory {
+
+    public Simulator create(JSONObject simulatorParams, JSONObject commonEventHeaderParams,
+            Optional<JSONObject> pnfRegistrationParams, Optional<JSONObject> notificationParams) {
+        PnfSimConfig configuration = ConfigurationProvider.getConfigInstance();
+
+        String xnfUrl = null;
+        if (configuration.getDefaultfileserver().equals("sftp")) {
+            xnfUrl = configuration.getUrlsftp() + "/";
+        } else if (configuration.getDefaultfileserver().equals("ftps")) {
+            xnfUrl = configuration.getUrlftps() + "/";
+        }
+
+        String urlVes = configuration.getUrlves();
+        Duration duration = Duration.ofSeconds(parseInt(simulatorParams.getString(TEST_DURATION)));
+        Duration interval = Duration.ofSeconds(parseInt(simulatorParams.getString(MESSAGE_INTERVAL)));
+
+        return Simulator.builder().withVesUrl(urlVes).withXnfUrl(xnfUrl).withDuration(duration)
+                .withCommonEventHeaderParams(commonEventHeaderParams).withNotificationParams(notificationParams)
+                .withPnfRegistrationParams(pnfRegistrationParams).withInterval(interval).build();
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapter.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapter.java
new file mode 100644 (file)
index 0000000..47f2e31
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * ============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;
+
+public interface HttpClientAdapter {
+
+    void send(String content, String url);
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java
new file mode 100644 (file)
index 0000000..f0c9917
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * ============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.apache.http.util.EntityUtils;
+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);
+            EntityUtils.consumeQuietly(response.getEntity());
+            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/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/validation/JSONValidator.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/validation/ValidationException.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/validation/ValidationException.java
new file mode 100644 (file)
index 0000000..a934917
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * ============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;
+
+public class ValidationException extends Exception {
+
+    public ValidationException(String message) {
+        super(message);
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/resources/application.properties b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/resources/application.properties
new file mode 100644 (file)
index 0000000..9740eff
--- /dev/null
@@ -0,0 +1,6 @@
+server.port=5000
+logging.level.root=ERROR
+logging.level.org.springframework=ERROR
+logging.level.org.springframework.data=ERROR
+logging.level.org.onap.pnfsimulator=TRACE
+logging.file=logs/log/application.log
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/JSONObjectFactoryTest.java
new file mode 100644 (file)
index 0000000..4331195
--- /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.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(8,commonEventHeader.toMap().size());
+        assertTrue(commonEventHeader.has(EVENT_ID));
+        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(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_"));
+    }
+
+    @Test
+    public void generateNotificationFields_shouldCreateProperly(){
+        JSONObject notificationFields = JSONObjectFactory.generateNotificationFields();
+        assertEquals(1,notificationFields.keySet().size());
+        assertEquals(NOTIFICATION_FIELDS_VERSION_VALUE,notificationFields.get(NOTIFICATION_FIELDS_VERSION));
+
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java
new file mode 100644 (file)
index 0000000..aadb54c
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * ============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.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.EVENT;
+import static org.onap.pnfsimulator.message.MessageConstants.NOTIFICATION_FIELDS;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
+
+import java.util.Optional;
+import org.json.JSONObject;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+public class MessageProviderTest {
+
+    private static final String testParamsPnfRegistration =
+        "{\"pnfKey1\": \"pnfVal1\",\"pnfKey2\": \"pnfVal2\",\"pnfKey3\": \"pnfVal3\",\"pnfKey4\": \"pnfVal4\"}";
+
+    private static final String testParamsNotification =
+        "{\"notKey1\": \"notVal1\",\"notKey2\": \"notVal2\",\"notKey3\": \"notVal3\",\"notKey4\": \"notVal4\"}";
+
+    private static MessageProvider messageProvider;
+
+    @BeforeAll
+    public static void setup() {
+        messageProvider = new MessageProvider();
+    }
+
+    @Test
+    public void createMessage_should_throw_when_given_empty_arguments() {
+        assertThrows(IllegalArgumentException.class,
+            () -> messageProvider.createMessage(new JSONObject(), Optional.empty(), Optional.empty()),
+            "Params object cannot be null");
+    }
+
+    @Test
+    public void createMessage_should_create_constant_message_when_no_params_specified() {
+        JSONObject message = messageProvider.createMessage(new JSONObject(), Optional.ofNullable(new JSONObject()),
+            Optional.ofNullable(new JSONObject()));
+        JSONObject event = message.getJSONObject(EVENT);
+
+        JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
+        JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
+        JSONObject notificationFields = event.getJSONObject(NOTIFICATION_FIELDS);
+
+        JSONObject expectedCommonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
+        JSONObject expectedPnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
+        JSONObject expectedNotificationFields = JSONObjectFactory.generateNotificationFields();
+
+        expectedCommonEventHeader
+            .toMap()
+            .forEach((key, val) -> assertTrue(commonEventHeader.has(key),
+                () -> String.format("Key %s is not present", key)));
+
+        expectedPnfRegistrationFields
+            .toMap()
+            .forEach((key, val) -> assertTrue(pnfRegistrationFields.has(key),
+                () -> String.format("Key %s is not present", key)));
+
+        expectedNotificationFields
+            .toMap()
+            .forEach((key, val) -> assertTrue(notificationFields.has(key),
+                () -> String.format("Key %s is not present", key)));
+    }
+
+    @Test
+    public void createMessage_should_throw_exception_when_params_specified_as_empty() {
+        assertThrows(IllegalArgumentException.class,
+            () -> messageProvider.createMessage(new JSONObject(), Optional.empty(),
+                Optional.empty()));
+    }
+
+    @Test
+    public void createMessage_should_add_specified_params_to_valid_subobjects() {
+        JSONObject message = messageProvider
+            .createMessage(new JSONObject(), Optional.of(new JSONObject(testParamsPnfRegistration)),
+                Optional.of(new JSONObject(testParamsNotification)));
+        JSONObject event = message.getJSONObject(EVENT);
+
+        JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER);
+        assertEquals(10, commonEventHeader.keySet().size());
+
+        JSONObject pnfRegistrationFields = event.getJSONObject(PNF_REGISTRATION_FIELDS);
+        assertEquals("pnfVal1", pnfRegistrationFields.getString("pnfKey1"));
+        assertEquals("pnfVal2", pnfRegistrationFields.getString("pnfKey2"));
+
+        JSONObject notificationFields = event.getJSONObject(NOTIFICATION_FIELDS);
+        assertEquals("notVal1", notificationFields.getString("notKey1"));
+        assertEquals("notVal2", notificationFields.getString("notKey2"));
+
+    }
+
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfConfigurationCheckingTaskTest.java
new file mode 100644 (file)
index 0000000..df5a13d
--- /dev/null
@@ -0,0 +1,95 @@
+/// *
+// * ============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());
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceConfigurationTest.java
new file mode 100644 (file)
index 0000000..3ff234b
--- /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());
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/NetconfMonitorServiceTest.java
new file mode 100644 (file)
index 0000000..f8690c5
--- /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());
+// }
+// }
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCacheTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationCacheTest.java
new file mode 100644 (file)
index 0000000..56f62ac
--- /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.netconfmonitor.netconf;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
+
+public class NetconfConfigurationCacheTest {
+
+    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/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationReaderTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/netconfmonitor/netconf/NetconfConfigurationWriterTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/SimulatorControllerTest.java
new file mode 100644 (file)
index 0000000..3603480
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * ============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/v7\",\n" +
+        "    \"testDuration\": \"10\",\n" +
+        "    \"messageInterval\": \"1\"\n" +
+        "  },\n" +
+        "  \"commonEventHeaderParams\": {\n" +
+        "    \"eventName\": \"val11\",\n" +
+        "    \"nfNamingCode\": \"val12\",\n" +
+        "    \"nfcNamingCode\": \"val13\",\n" +
+        "    \"sourceName\": \"val14\",\n" +
+        "    \"sourceId\": \"val15\",\n" +
+        "    \"reportingEntityName\": \"val16\",\n" +
+        "  },\n" +
+
+        "  \"pnfRegistrationParams\": {\n" +
+        "    \"SerialNumber\": \"val1\",\n" +
+        "    \"VendorName\": \"val2\",\n" +
+        "    \"OamIpv4Address\": \"val3\",\n" +
+        "    \"OamIpv6Address\": \"val4\",\n" +
+        "    \"Family\": \"val5\",\n" +
+        "    \"ModelNumber\": \"val6\",\n" +
+        "    \"SoftwareVersion\": \"val7\",\n" +
+        "  }\n" +
+        "}";
+    private static final String WRONG_JSON = "{\n" +
+        "  \"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(), 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(), 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(), 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/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/util/DateUtilTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/util/ResponseBuilderTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/rest/util/ResponseBuilderTest.java
new file mode 100644 (file)
index 0000000..59e1e3b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * ============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.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;
+
+public class ResponseBuilderTest {
+
+
+    private static final HttpStatus SAMPLE_STATUS = HttpStatus.OK;
+
+    @Test
+    void response_should_have_empty_body_when_built_immediately() {
+        ResponseEntity responseEntity = ResponseBuilder.status(SAMPLE_STATUS).build();
+
+        assertAll(
+            () -> assertEquals(responseEntity.getStatusCode(), SAMPLE_STATUS),
+            () -> assertNull(responseEntity.getBody())
+        );
+    }
+
+    @Test
+    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(SAMPLE_STATUS, response.getStatusCode()),
+            () -> assertEquals(value, body.get(key))
+        );
+    }
+
+
+}
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorFactoryTest.java
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/SimulatorTest.java
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
new file mode 100644 (file)
index 0000000..7511084
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * ============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 java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
+import org.json.JSONObject;
+
+final class TestMessages {
+
+    static final JSONObject VALID_SIMULATOR_PARAMS = new JSONObject(getContent("validSimulatorParams.json"));
+    static final JSONObject VALID_COMMON_EVENT_HEADER_PARAMS = new JSONObject(getContent("validCommonEventHeaderParams.json"));
+    static final Optional<JSONObject> VALID_PNF_REGISTRATION_PARAMS = Optional
+        .of(new JSONObject(getContent("validPnfRegistrationParams.json")));
+    static final Optional<JSONObject> VALID_NOTIFICATION_PARAMS = Optional
+        .of(new JSONObject(getContent("validNotificationParams.json")));
+
+    static final JSONObject INVALID_SIMULATOR_PARAMS = new JSONObject(
+        "{\n" +
+            "    \"vesServerUrl\": \"http://10.42.111.42:8080/eventListener/v5\",\n" +
+            "    \"messageInterval\": \"1\"\n" +
+            "}");
+
+
+    static final Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_1 = Optional.of(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 Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_2 = Optional.of(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 Optional<JSONObject> INVALID_PNF_REGISTRATION_PARAMS_3 = Optional.of(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" +
+            "}"));
+
+    static final Optional<JSONObject> INVALID_NOTIFICATION_PARAMS = Optional.of(new JSONObject(
+        "{\n" +
+            "    \"mother\": \"val1\",\n" +
+            "    \"father\": \"val3\",\n" +
+            "}"));
+
+
+    private TestMessages() {
+    }
+
+    private static String getContent(String fileName) {
+        try {
+            String pathAsString = TestMessages.class.getResource(fileName).getPath();
+            StringBuilder stringBuilder = new StringBuilder();
+            Files.readAllLines(Paths.get(pathAsString)).forEach(line -> {
+                stringBuilder.append(line);
+            });
+            return stringBuilder.toString();
+        } catch (IOException e) {
+            throw new RuntimeException(String.format("Cannot read JSON file %s", fileName));
+        }
+    }
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImplTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/java/org/onap/pnfsimulator/simulator/validation/JSONValidatorTest.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/invalid-test-schema.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/logback-test.xml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validCommonEventHeaderParams.json
new file mode 100644 (file)
index 0000000..e0f4550
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "eventName": "pnfRegistration_Nokia_5gDu",
+  "nfNamingCode": "gNB",
+  "nfcNamingCode": "oam",
+  "sourceName": "NOK6061ZW3",
+  "sourceId": "val13",
+  "reportingEntityName": "NOK6061ZW3"
+}
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validNotificationParams.json
new file mode 100644 (file)
index 0000000..f7f463d
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "changeIdentifier": "PM_MEAS_FILES",
+  "changeType": "FileReady",
+  "arrayOfNamedHashMap": [
+    {"name": "A20161221.1031-1041.bin.gz", "hashMap": {
+      "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+      "compression": "gzip",
+      "fileformatType": "org.3GPP.32.435#measCollec",
+      "fileFormatVersion": "V10"
+    }
+    },
+    {"name": "A20161222.1042-1102.bin.gz", "hashMap": {
+      "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
+      "compression": "gzip",
+      "fileFormatType": "org.3GPP.32.435#measCollec",
+      "fileFormatVersion": "V10"
+    }
+    }
+  ]
+}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validPnfRegistrationParams.json
new file mode 100644 (file)
index 0000000..b95f8e6
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "serialNumber": "6061ZW3",
+  "vendorName": "Nokia",
+  "oamV4IpAddress": "val3",
+  "oamV6IpAddress": "val4",
+  "unitFamily": "BBU",
+  "modelNumber": "val6",
+  "softwareVersion": "val7",
+  "unitType": "val8"
+}
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/org/onap/pnfsimulator/simulator/validSimulatorParams.json
new file mode 100644 (file)
index 0000000..6485ee4
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "vesServerUrl": "http://VES-HOST:VES-PORT/eventListener/v7",
+  "testDuration": "10",
+  "messageInterval": "1"
+}
\ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/test/resources/valid-test-schema.json b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/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/pnf-onboarding/unsecureAcmePnf.csar b/test/mocks/pnf-onboarding/unsecureAcmePnf.csar
new file mode 100644 (file)
index 0000000..37e4733
Binary files /dev/null and b/test/mocks/pnf-onboarding/unsecureAcmePnf.csar differ
index 3cda0c6..3b5cd8a 100644 (file)
     "unitFamily": "BBU",
     "modelNumber": "val6",
     "softwareVersion": "val7",
-    "unitType": "val8"
-  },
-  "notificationParams": {
-    "changeIdentifier": "PM_MEAS_FILES",
-    "changeType": "FileReady",
-    "arrayOfNamedHashMap": [
-      {"name": "A20161221.1031-1041.bin.gz", "hashMap": {
-        "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      },
-      {"name": "A20161222.1042-1102.bin.gz", "hashMap": {
-        "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
-        "compression": "gzip",
-        "fileFormatType": "org.3GPP.32.435#measCollec",
-        "fileFormatVersion": "V10"
-      }
-      }
-    ]
+    "unitType": "val8",
+    "additionalFields": {
+      "attachmentPoint": "bla-bla-30-3",
+      "svlan": "1005",
+      "cvlan": "678"
+    },
+    "notificationParams": {
+      "changeIdentifier": "PM_MEAS_FILES",
+      "changeType": "FileReady",
+      "arrayOfNamedHashMap": [
+        {
+          "name": "A20161221.1031-1041.bin.gz",
+          "hashMap": {
+            "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+            "compression": "gzip",
+            "fileFormatType": "org.3GPP.32.435#measCollec",
+            "fileFormatVersion": "V10"
+          }
+        },
+        {
+          "name": "A20161222.1042-1102.bin.gz",
+          "hashMap": {
+            "location": "ftpes://192.168.0.102:22/ftp/rop/A20161224.1045-1100.bin.gz",
+            "compression": "gzip",
+            "fileFormatType": "org.3GPP.32.435#measCollec",
+            "fileFormatVersion": "V10"
+          }
+        }
+      ]
+    }
   }
 }
index 13ce589..679e11a 100644 (file)
@@ -78,6 +78,9 @@
         },
         "unitType": {
           "type": "string"
+        },
+        "additionalFields": {
+          "type": "object"
         }
       }
     },
index 4091bea..e0e1ac6 100755 (executable)
@@ -9,7 +9,11 @@ SUBSCRIBE_APP_PATH='/opt/dev/sysrepo/build/examples/application_changes_example'
 upload_yang_data_model()
 {
   sysrepoctl -i -g $MOUNT_PATH/mynetconf.yang
+  sleep 5
+  echo ' subscribing to mynetconf model.'
   $SUBSCRIBE_APP_PATH mynetconf > /dev/null &
+  sleep 5
+  echo ' creating data for mynetconf model.'
   sysrepocfg --datastore=running --format=json mynetconf --import=$MOUNT_PATH/mynetconf.data
 }
 
index 063c710..470df7c 100644 (file)
                 <include>**/*</include>
             </includes>
         </fileSet>
+        <fileSet>
+            <directory>netopeer_tls_cfg</directory>
+            <outputDirectory>netopeer_tls_cfg</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
         <fileSet>
             <directory>sftp</directory>
             <outputDirectory>sftp</outputDirectory>
index 2a1402b..7ad3e7a 100644 (file)
@@ -21,7 +21,7 @@
     <java.version>1.8</java.version>
     <dockerLocation>${basedir}/target</dockerLocation>
     <docker.tag>latest</docker.tag>
-    <docker.maven.plugin.version>1.2.0</docker.maven.plugin.version>
+    <docker.maven.plugin.version>1.0.0</docker.maven.plugin.version>
     <versions.jackson>2.8.9</versions.jackson>
     <jetty.version>9.2.22.v20170606</jetty.version>
     <start-class>org.onap.integration.test.mocks.sniroemulator.MockApplication</start-class>
diff --git a/test/security/check_for_http_endpoints.sh b/test/security/check_for_http_endpoints.sh
new file mode 100755 (executable)
index 0000000..19be2ac
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+#   COPYRIGHT NOTICE STARTS HERE
+#
+#   Copyright 2019 Samsung Electronics 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
+#
+#   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.
+#
+#   COPYRIGHT NOTICE ENDS HERE
+
+# Check all ports exposed outside of kubernetes cluster looking for plain http
+# endpoints.
+#
+# Dependencies:
+#     nmap
+#     kubectl + config
+#
+# Return value: Number of discovered http ports
+# Output: List of pods exposing http endpoints
+#
+
+if [ "$#" -lt 1 ]; then
+    echo "Usage: $0 <k8s-namespace>"
+    exit 1
+fi
+
+K8S_NAMESPACE=$1
+
+# Get both values on single call as this may get slow
+PORTS_SVCS=`kubectl get svc --namespace=$K8S_NAMESPACE -o go-template='{{range $item := .items}}{{range $port := $item.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"\t"}}{{$item.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}' | column -t | sort -n`
+
+# Split port number and service name
+PORTS=`awk '{print $1}' <<<"$PORTS_SVCS"`
+SVCS=`awk '{print $2}' <<<"$PORTS_SVCS"`
+
+# Create a list in nmap-compatible format
+PORT_LIST=`tr "\\n" "," <<<"$PORTS" | sed 's/,$//'; echo ''`
+
+# Get IP addres of some cluster node
+K8S_NODE=`kubectl describe nodes \`kubectl get nodes | tail -n 1 | awk '{print $1}'\` | grep ExternalIP | awk '{print $2}'`
+
+# perform scan
+SCAN_RESULT=`nmap $K8S_NODE -sV -p $PORT_LIST 2>/dev/null | grep \tcp`
+
+# Concatenate scan result with service name
+RESULTS=`paste <(printf %s "$SVCS") <(printf %s "$SCAN_RESULT") | column -t`
+
+# Find all plain http ports
+HTTP_PORTS=`grep http <<< "$RESULTS" | grep -v ssl/http`
+
+# Count them
+N_HTTP=`wc -l <<<"$HTTP_PORTS"`
+
+if [ "$N_HTTP" -gt 0 ]; then
+       echo "$HTTP_PORTS"
+fi
+
+exit $N_HTTP
diff --git a/test/security/check_for_jdwp.sh b/test/security/check_for_jdwp.sh
new file mode 100755 (executable)
index 0000000..7bcbade
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+#   COPYRIGHT NOTICE STARTS HERE
+#
+#   Copyright 2019 Samsung Electronics 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
+#
+#   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.
+#
+#   COPYRIGHT NOTICE ENDS HERE
+
+# Check all ports exposed by pods to internal network and look for
+# open JDWP ports
+#
+# Dependencies:
+#     kubectl + config
+#     netcat
+#
+# Return value: Number of discovered JDWP ports
+# Output: List of pods and exposing JDWP interface
+#
+
+if [ "$#" -lt 1 ]; then
+    echo "Usage: $0 <k8s-namespace>"
+    exit 1
+fi
+
+K8S_NAMESPACE=$1
+LOCAL_PORT=12543
+
+list_pods() {
+       kubectl get po --namespace=$K8S_NAMESPACE | grep Running | awk '{print $1}' | grep -v NAME
+}
+
+do_jdwp_handshake() {
+       local ip="127.0.0.1"
+       local port=$1
+       local jdwp_challenge="JDWP-Handshake\n"
+       local jdwp_response="JDWP-Handshake"
+
+       local response=`nc $ip $port <<<$jdwp_challenge`
+       if [[ $response == *"$jdwp_response"* ]]; then
+               return 0
+       fi
+
+       return 1
+}
+# get open ports from procfs as netstat is not always available
+get_open_ports_on_pod() {
+       local pod=$1
+       local open_ports_hex=`kubectl exec --namespace=$K8S_NAMESPACE $pod cat /proc/net/tcp 2>/dev/null| grep -v "local_address" | awk '{ print $2" "$4 }' | grep '0A$' | tr ":" " " | awk '{ print $2 }' | sort | uniq`
+       for hex_port in $open_ports_hex; do
+               echo $((16#$hex_port))
+       done
+}
+
+N_PORTS=0
+
+# go through all pods
+for pod in `list_pods`; do
+       open_ports=`get_open_ports_on_pod $pod`
+       # if there is no open ports just go to next pod
+       if [ -z "$open_ports" ]; then
+               continue
+       fi
+
+       # let's setup a proxy and check every open port
+       for port in $open_ports; do
+               # run proxy
+               kubectl port-forward --namespace=$K8S_NAMESPACE $pod $LOCAL_PORT:$port &>/dev/null &
+               sleep 1
+               proxy_pid=$!
+
+               do_jdwp_handshake $LOCAL_PORT
+               if [ $? -eq 0 ]; then
+                       echo $pod $port
+                       ((++N_PORTS))
+               fi
+               kill $proxy_pid 2>/dev/null
+               wait $proxy_pid 2>/dev/null
+       done
+done
+
+exit $N_PORTS
index 61527ee..9d11eed 100644 (file)
@@ -18,20 +18,20 @@ onap/aai-graphadmin,1.1-STAGING-latest
 onap/aai-resources,1.4-STAGING-latest
 onap/aai-schema-service,1.0-STAGING-latest
 onap/aai-traversal,1.4-STAGING-latest
-onap/aai/esr-gui,1.2.2-STAGING-latest
-onap/aai/esr-server,1.2.2-STAGING-latest
-onap/admportal-sdnc-image,1.4-STAGING-latest
+onap/aai/esr-gui,1.4.0-STAGING-latest
+onap/aai/esr-server,1.4.0-STAGING-latest
+onap/admportal-sdnc-image,1.5.0-STAGING-latest
 onap/appc-cdt-image,1.4.3-SNAPSHOT-latest
 onap/appc-image,1.5.0-SNAPSHOT-latest
 onap/babel,1.4-STAGING-latest
 onap/ccsdk-ansible-server-image,0.4.1-STAGING-latest
-onap/ccsdk-apps-ms-neng,0.4-STAGING-latest
-onap/ccsdk-controllerblueprints,0.4-STAGING-latest
-onap/ccsdk-dgbuilder-image,0.4-STAGING-latest
-onap/ccsdk-odl-fluorine-alpine-image,0.4-STAGING-latest
-onap/ccsdk-odl-fluorine-ubuntu-image,0.4-STAGING-latest
-onap/ccsdk-odlsli-alpine-image,0.4-STAGING-latest
-onap/ccsdk-odlsli-image,0.4-STAGING-latest
+onap/ccsdk-apps-ms-neng,0.4.1-STAGING-latest
+onap/ccsdk-controllerblueprints,0.4.1-STAGING-latest
+onap/ccsdk-dgbuilder-image,0.4.1-STAGING-latest
+onap/ccsdk-odl-fluorine-alpine-image,0.4.1-STAGING-latest
+onap/ccsdk-odl-fluorine-ubuntu-image,0.4.1-STAGING-latest
+onap/ccsdk-odlsli-alpine-image,0.4.1-STAGING-latest
+onap/ccsdk-odlsli-image,0.4.1-STAGING-latest
 onap/champ,1.4-STAGING-latest
 onap/clamp,3.0-STAGING-latest
 onap/clamp-dashboard-kibana,3.0-STAGING-latest
@@ -44,8 +44,8 @@ onap/dcae-fe,1.3-STAGING-latest
 onap/dcae-tools,1.3-STAGING-latest
 onap/dcae-tosca-app,1.3-STAGING-latest
 onap/dmaap/buscontroller,1.0.23
-onap/dmaap/datarouter-node,2.0.1-SNAPSHOT
-onap/dmaap/datarouter-prov,2.0.1-SNAPSHOT
+onap/dmaap/datarouter-node,2.0.2-SNAPSHOT-latest
+onap/dmaap/datarouter-prov,2.0.2-SNAPSHOT-latest
 onap/dmaap/dmaap-mr,1.1.10
 onap/dmaap/kafka01101,0.0.1
 onap/dmaap/zookeeper,1.0.0
@@ -58,12 +58,11 @@ onap/model-loader,1.4-STAGING-latest
 onap/msb/msb_apigateway,1.2.2-STAGING-latest
 onap/msb/msb_discovery,1.2.2-STAGING-latest
 onap/multicloud/azure,1.2.1
-onap/multicloud/framework,1.2.3-STAGING
-onap/multicloud/openstack-newton,1.2.3
-onap/multicloud/openstack-ocata,1.2.3
-onap/multicloud/openstack-pike,1.2.3
-onap/multicloud/openstack-windriver,1.2.3
-onap/multicloud/vio,1.2.1
+onap/multicloud/framework,1.3.0-STAGING
+onap/multicloud/openstack-ocata,1.3.0-STAGING
+onap/multicloud/openstack-pike,1.3.0-STAGING
+onap/multicloud/openstack-windriver,1.3.0-STAGING
+onap/multicloud/vio,1.3.0-STAGING
 onap/multicloud/vio-vesagent,1.0.0
 onap/music/cassandra_3_11,3.0.24
 onap/music/cassandra_job,3.0.24
@@ -76,24 +75,28 @@ onap/optf-cmso-dbinit,1.0.1
 onap/optf-cmso-service,1.0.1
 onap/optf-has,1.2.5
 onap/optf-osdf,1.2.4
+onap/org.onap.dcaegen2.analytics.tca-gen2.dcae-analytics-tca-web,3.0.0-SNAPSHOT
 onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server,1.1.1-SNAPSHOT
 onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main,1.1.0-SNAPSHOT
-onap/org.onap.dcaegen2.collectors.snmptrap,1.4.0
-onap/org.onap.dcaegen2.collectors.ves.vescollector,1.3.1
+onap/org.onap.dcaegen2.collectors.restconfcollector,latest
+onap/org.onap.dcaegen2.collectors.snmptrap,1.4-STAGING-latest
+onap/org.onap.dcaegen2.collectors.ves.vescollector,1.4.3-SNAPSHOT
 onap/org.onap.dcaegen2.deployments.bootstrap,1.1.3
-onap/org.onap.dcaegen2.deployments.cm-container,1.5.1
-onap/org.onap.dcaegen2.deployments.healthcheck-container,1.2.4
-onap/org.onap.dcaegen2.deployments.k8s-bootstrap-container,1.4.9
-onap/org.onap.dcaegen2.deployments.redis-cluster-container,1.0.0
-onap/org.onap.dcaegen2.deployments.tca-cdap-container,1.1.0
-onap/org.onap.dcaegen2.deployments.tls-init-container,1.0.0
-onap/org.onap.dcaegen2.platform.cdapbroker,4.1.0
-onap/org.onap.dcaegen2.platform.configbinding.app-app,2.2.3
+onap/org.onap.dcaegen2.deployments.cm-container,1.5.2-STAGING-latest
+onap/org.onap.dcaegen2.deployments.consul-loader-container,1.0-STAGING-latest
+onap/org.onap.dcaegen2.deployments.healthcheck-container,1.2.4-STAGING-latest
+onap/org.onap.dcaegen2.deployments.k8s-bootstrap-container,1.4.10-STAGING-latest
+onap/org.onap.dcaegen2.deployments.redis-cluster-container,1.0-STAGING-latest
+onap/org.onap.dcaegen2.deployments.tca-cdap-container,1.1-STAGING-latest
+onap/org.onap.dcaegen2.deployments.tls-init-container,1.0-STAGING-latest
+onap/org.onap.dcaegen2.platform.configbinding.app-app,2.3-STAGING-latest
 onap/org.onap.dcaegen2.platform.deployment-handler,3.2.0
-onap/org.onap.dcaegen2.platform.inventory-api,3.0.4
-onap/org.onap.dcaegen2.platform.policy-handler,4.6.0-STAGING-latest
-onap/org.onap.dcaegen2.platform.servicechange-handler,1.1.5
-onap/org.onap.dcaegen2.services.prh.prh-app-server,1.2.1
+onap/org.onap.dcaegen2.platform.inventory-api,3.2.0
+onap/org.onap.dcaegen2.platform.policy-handler,4.6-STAGING-latest
+onap/org.onap.dcaegen2.platform.servicechange-handler,latest
+onap/org.onap.dcaegen2.services.heartbeat,latest
+onap/org.onap.dcaegen2.services.pm-mapper,latest
+onap/org.onap.dcaegen2.services.prh.prh-app-server,1.2.1-SNAPSHOT
 onap/policy-apex-pdp,2.1-SNAPSHOT-latest
 onap/policy-distribution,2.1.0-SNAPSHOT-latest
 onap/policy-pdpd-cl,1.4-SNAPSHOT-latest
@@ -117,10 +120,10 @@ onap/sdc-init-elasticsearch,1.4-STAGING-latest
 onap/sdc-kibana,1.4-STAGING-latest
 onap/sdc-onboard-backend,1.4-STAGING-latest
 onap/sdc-onboard-cassandra-init,1.4-STAGING-latest
-onap/sdnc-ansible-server-image,1.5-STAGING-latest
-onap/sdnc-dmaap-listener-image,1.5-STAGING-latest
-onap/sdnc-image,1.5-STAGING-latest
-onap/sdnc-ueb-listener-image,1.5-STAGING-latest
+onap/sdnc-ansible-server-image,1.5.0-STAGING-latest
+onap/sdnc-dmaap-listener-image,1.5.0-STAGING-latest
+onap/sdnc-image,1.5.0-STAGING-latest
+onap/sdnc-ueb-listener-image,1.5.0-STAGING-latest
 onap/search-data-service,1.4-STAGING-latest
 onap/service-decomposition,1.4.2
 onap/sniroemulator,1.0.0
index 8c84678..c79769e 100644 (file)
@@ -41,8 +41,8 @@ onap/dcae-fe,1.3.0
 onap/dcae-tools,1.3.0
 onap/dcae-tosca-app,1.3.0
 onap/dmaap/buscontroller,1.0.23
-onap/dmaap/datarouter-node,2.0.1
-onap/dmaap/datarouter-prov,2.0.1
+onap/dmaap/datarouter-node,2.0.2
+onap/dmaap/datarouter-prov,2.0.2
 onap/dmaap/dmaap-mr,1.1.9
 onap/dmaap/kafka01101,0.0.1
 onap/dmaap/zookeeper,1.0.0
@@ -53,13 +53,12 @@ onap/holmes/rule-management,1.2.3
 onap/model-loader,1.3.1
 onap/msb/msb_apigateway,1.2.1
 onap/msb/msb_discovery,1.2.1
-onap/multicloud/azure,1.2.1
+onap/multicloud/azure,1.2.2
 onap/multicloud/framework,1.2.2
-onap/multicloud/openstack-newton,1.2.2
-onap/multicloud/openstack-ocata,1.2.2
-onap/multicloud/openstack-pike,1.2.2
-onap/multicloud/openstack-windriver,1.2.2
-onap/multicloud/vio,1.2.1
+onap/multicloud/openstack-ocata,1.2.4
+onap/multicloud/openstack-pike,1.2.4
+onap/multicloud/openstack-windriver,1.2.4
+onap/multicloud/vio,1.2.2
 onap/multicloud/vio-vesagent,1.0.0
 onap/music/cassandra_3_11,3.0.24
 onap/music/cassandra_job,3.0.24
@@ -91,9 +90,9 @@ onap/org.onap.dcaegen2.platform.policy-handler,4.4.0
 onap/org.onap.dcaegen2.platform.servicechange-handler,1.1.5
 onap/org.onap.dcaegen2.services.prh.prh-app-server,1.1.1
 onap/policy-apex-pdp,2.0.3
-onap/policy-distribution,2.0.3
-onap/policy-drools,1.3.4
-onap/policy-pe,1.3.4
+onap/policy-distribution,2.0.5
+onap/policy-drools,1.3.6
+onap/policy-pe,1.3.6
 onap/pomba-aai-context-builder,1.3.2
 onap/pomba-context-aggregator,1.3.4
 onap/pomba-network-discovery-context-builder,1.3.1
index 209e7cc..9aeff74 100644 (file)
@@ -126,34 +126,34 @@ org.onap.appc.client,client-lib,1.4.4
 org.onap.appc.client,client-simulator,1.4.4
 org.onap.appc.client,code-generator,1.4.4
 org.onap.appc.plugins,dg-loader-provider,1.4.4
-org.onap.ccsdk.parent,binding-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,bundle-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,feature-repo-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,karaf4-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,mdsal-it-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,odlparent,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,odlparent-lite,1.2.1-SNAPSHOT
-org.onap.ccsdk.parent,single-feature-parent,1.2.1-SNAPSHOT
-org.onap.ccsdk.sli.adaptors,aai-service-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.adaptors,mdsal-resource-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.adaptors,resource-assignment-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.adaptors,sql-resource-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,dblib-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,filters-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,sli-common,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,sli-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,sli-recording,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,sliPluginUtils-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,sliapi-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.core,utils-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.northbound,asdcApi-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.northbound,dataChange-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.northbound,dmaap-listener,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.northbound,lcm-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.northbound,ueb-listener,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.plugins,fabric-discovery-plugin-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.plugins,properties-node-provider,0.4.2-SNAPSHOT
-org.onap.ccsdk.sli.plugins,restapi-call-node-provider,0.4.2-SNAPSHOT
+org.onap.ccsdk.parent,binding-parent,1.2.1
+org.onap.ccsdk.parent,bundle-parent,1.2.1
+org.onap.ccsdk.parent,feature-repo-parent,1.2.1
+org.onap.ccsdk.parent,karaf4-parent,1.2.1
+org.onap.ccsdk.parent,mdsal-it-parent,1.2.1
+org.onap.ccsdk.parent,odlparent,1.2.1
+org.onap.ccsdk.parent,odlparent-lite,1.2.1
+org.onap.ccsdk.parent,single-feature-parent,1.2.1
+org.onap.ccsdk.sli.adaptors,aai-service-provider,0.4.1
+org.onap.ccsdk.sli.adaptors,mdsal-resource-provider,0.4.1
+org.onap.ccsdk.sli.adaptors,resource-assignment-provider,0.4.1
+org.onap.ccsdk.sli.adaptors,sql-resource-provider,0.4.1
+org.onap.ccsdk.sli.core,dblib-provider,0.4.1
+org.onap.ccsdk.sli.core,filters-provider,0.4.1
+org.onap.ccsdk.sli.core,sli-common,0.4.1
+org.onap.ccsdk.sli.core,sli-provider,0.4.1
+org.onap.ccsdk.sli.core,sli-recording,0.4.1
+org.onap.ccsdk.sli.core,sliPluginUtils-provider,0.4.1
+org.onap.ccsdk.sli.core,sliapi-provider,0.4.1
+org.onap.ccsdk.sli.core,utils-provider,0.4.1
+org.onap.ccsdk.sli.northbound,asdcApi-provider,0.4.1
+org.onap.ccsdk.sli.northbound,dataChange-provider,0.4.1
+org.onap.ccsdk.sli.northbound,dmaap-listener,0.4.1
+org.onap.ccsdk.sli.northbound,lcm-provider,0.4.1
+org.onap.ccsdk.sli.northbound,ueb-listener,0.4.1
+org.onap.ccsdk.sli.plugins,fabric-discovery-plugin-provider,0.4.1
+org.onap.ccsdk.sli.plugins,properties-node-provider,0.4.1
+org.onap.ccsdk.sli.plugins,restapi-call-node-provider,0.4.1
 org.onap.ccsdk.storage.pgaas,pgaas,1.0.0
 org.onap.ccsdk.utils,utils,1.0.0
 org.onap.clamp.clds.clamp,clamp,3.0.3
@@ -196,8 +196,8 @@ org.onap.dcaegen2.services.prh,prh-aai-client,1.1.1
 org.onap.dcaegen2.services.prh,prh-app-server,1.1.1
 org.onap.dcaegen2.services.prh,prh-commons,1.1.1
 org.onap.dcaegen2.services.prh,prh-dmaap-client,1.1.1
-org.onap.dmaap.datarouter.datarouter-node,2.0.1
-org.onap.dmaap.datarouter.datarouter-prov,2.0.1
+org.onap.dmaap.datarouter.datarouter-node,2.0.2
+org.onap.dmaap.datarouter.datarouter-prov,2.0.2
 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
@@ -217,21 +217,21 @@ org.onap.modeling.toscaparsers,kwalify,1.0.0
 org.onap.modeling.toscaparsers.nfvparser,modeling-toscaparsers-nfvparser,1.0.0
 org.onap.msb.java-sdk,msb-java-sdk,1.1.1
 org.onap.msb.swagger-sdk,swagger-sdk,1.1.0
-org.onap.multicloud.azure,multicloud-azure,1.2.1
+org.onap.multicloud.azure,multicloud-azure,1.2.2
 org.onap.multicloud.framework,multivimbroker,1.2.2
-org.onap.multicloud.openstack,newton,1.2.2
-org.onap.multicloud.openstack,ocata,1.2.2
-org.onap.multicloud.openstack,windriver,1.2.2
+org.onap.multicloud.openstack,ocata,1.2.4
+org.onap.multicloud.openstack,pike,1.2.4
+org.onap.multicloud.openstack,windriver,1.2.4
 org.onap.multicloud.openstack.vmware,vesagent,1.0.0
-org.onap.multicloud.openstack.vmware,vio,1.2.1
+org.onap.multicloud.openstack.vmware,vio,1.2.2
 org.onap.music,MUSIC,3.0.23
-org.onap.oparent,oparent,1.2.2
-org.onap.policy.apex-pdp,apex-pdp,2.0.3
-org.onap.policy.common,common-modules,1.3.3
-org.onap.policy.distribution,distribution,2.0.3
-org.onap.policy.drools-applications,drools-pdp-apps,1.3.4
-org.onap.policy.drools-pdp,drools-pdp,1.3.4
-org.onap.policy.engine,PolicyEngineSuite,1.3.4
+org.onap.oparent,oparent,1.2.3
+org.onap.policy.apex-pdp,apex-pdp,2.0.4
+org.onap.policy.common,common-modules,1.3.4
+org.onap.policy.distribution,distribution,2.0.5
+org.onap.policy.drools-applications,drools-pdp-apps,1.3.6
+org.onap.policy.drools-pdp,drools-pdp,1.3.6
+org.onap.policy.engine,PolicyEngineSuite,1.3.6
 org.onap.policy.parent,parent,2.0.1
 org.onap.portal.sdk,epsdk-analytics,2.4.0
 org.onap.portal.sdk,epsdk-app-common,2.4.0
@@ -243,9 +243,9 @@ org.onap.sdc.jtosca,jtosca,1.4.5
 org.onap.sdc.sdc-distribution-client,sdc-distribution-client,1.3.0
 org.onap.sdc.sdc-titan-cassandra,sdc-titan-cassandra,1.2.0
 org.onap.sdc.sdc-tosca,sdc-tosca,1.4.6
-org.onap.sdnc.northbound,generic-resource-api.provider,1.5.0-SNAPSHOT
-org.onap.sdnc.northbound,vnfapi-provider,1.5.0-SNAPSHOT
-org.onap.sdnc.northbound,vnftools-provider,1.5.0-SNAPSHOT
+org.onap.sdnc.northbound,generic-resource-api.provider,1.5.0
+org.onap.sdnc.northbound,vnfapi-provider,1.5.0
+org.onap.sdnc.northbound,vnftools-provider,1.5.0
 org.onap.usecase-ui.server,usecase-ui-server,1.2.1
 org.onap.vfc.gvnfm.vnflcm.lcm,vfc-gvnfm-vnflcm-lcm,1.2.2
 org.onap.vfc.gvnfm.vnfmgr.mgr,vfc-gvnfm-vnfmgr-mgr,1.2.1