From: Lasse Kaihlavirta Date: Thu, 4 Mar 2021 08:36:10 +0000 (+0000) Subject: Merge "Update SDNC CSIT for Honolulu changes" X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6d6447035fae83955e97e7c13804bf55a728e6a9;hp=af0838981ce48bb1d004edd2a16a5eb22df0da74;p=integration%2Fcsit.git Merge "Update SDNC CSIT for Honolulu changes" --- diff --git a/plans/ccsdk-oran/polmansuite/config/application_configuration.json.nosdnc b/plans/ccsdk-oran/polmansuite/config/application_configuration.json.nosdnc deleted file mode 100644 index deb88a08..00000000 --- a/plans/ccsdk-oran/polmansuite/config/application_configuration.json.nosdnc +++ /dev/null @@ -1,39 +0,0 @@ -{ - "config":{ - "//description":"Application configuration", - "ric":[ - { - "name":"ric1", - "baseUrl":"https://a1-sim-OSC:8185/", - "managedElementIds":[ - "kista_1", - "kista_2" - ] - }, - { - "name":"ric2", - "baseUrl":"https://a1-sim-STD-v2:8185/", - "managedElementIds":[ - "kista_1", - "kista_2" - ] - } - ], - "streams_publishes":{ - "dmaap_publisher":{ - "type":"message_router", - "dmaap_info":{ - "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE" - } - } - }, - "streams_subscribes":{ - "dmaap_subscriber":{ - "type":"message_router", - "dmaap_info":{ - "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" - } - } - } - } - } \ No newline at end of file diff --git a/plans/ccsdk-oran/polmansuite/config/application_configuration.json.sdnc b/plans/ccsdk-oran/polmansuite/config/application_configuration.json.sdnc deleted file mode 100644 index 0f05de17..00000000 --- a/plans/ccsdk-oran/polmansuite/config/application_configuration.json.sdnc +++ /dev/null @@ -1,48 +0,0 @@ -{ - "config":{ - "controller": [ - { - "name": "controller1", - "baseUrl": "https://a1-controller:8443", - "userName": "admin", - "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" - } - ], - "ric":[ - { - "name":"ric1", - "controller": "controller1", - "baseUrl":"https://a1-sim-OSC:8185/", - "managedElementIds":[ - "kista_1", - "kista_2" - ] - }, - { - "name":"ric2", - "controller": "controller1", - "baseUrl":"https://a1-sim-STD-v2:8185/", - "managedElementIds":[ - "kista_1", - "kista_2" - ] - } - ], - "streams_publishes":{ - "dmaap_publisher":{ - "type":"message_router", - "dmaap_info":{ - "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE" - } - } - }, - "streams_subscribes":{ - "dmaap_subscriber":{ - "type":"message_router", - "dmaap_info":{ - "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" - } - } - } - } - } diff --git a/plans/ccsdk-oran/polmansuite/data/preparePmsData.sh b/plans/ccsdk-oran/polmansuite/data/preparePmsData.sh deleted file mode 100755 index 9644a41d..00000000 --- a/plans/ccsdk-oran/polmansuite/data/preparePmsData.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. 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================================================= -# - -# The scripts in data/ will generate some dummy data in the running system. -# It will create: -# one policy type in a1-sim-OSC -# one service in policy agent -# one policy in a1-sim-OSC -# one policy in a1-sim-STD - -# Run command: -# ./preparePmsData.sh [policy-agent port] [a1-sim-OSC port] [a1-sim-STD port] [http/https] - -policy_agent_port=${1:-8081} -a1_sim_OSC_port=${2:-30001} -a1_sim_STD_port=${3:-30005} -httpx=${4:-"http"} -SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) - -echo "using policy_agent port: "$policy_agent_port -echo "using a1-sim-OSC port: "$a1_sim_OSC_port -echo "using a1-sim-STD port: "$a1_sim_STD_port -echo "using protocol: "$httpx -echo -e "\n" - -checkRes (){ - if [ "$res" != "$expect" ]; then - echo "$res is not expected! exit!" - exit 1; - fi -} - -echo "policy agent status:" -curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/status" -res=$($curlString) -echo "$res" -expect="hunky dory200" -checkRes -echo -e "\n" - -echo "ric1 version:" -curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/counter/interface" -res=$($curlString) -echo "$res" -expect="OSC_2.1.0200" -checkRes -echo -e "\n" - -echo "ric2 version:" -curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/counter/interface" -res=$($curlString) -echo "$res" -expect="STD_2.0.0200" -checkRes -echo -e "\n" - -echo "create policy type 1 to ric1:" -curlString="curl -X PUT -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/OSC/policy_type.json" -res=$($curlString) -echo "$res" -expect="Policy type 1 is OK.201" -checkRes -echo -e "\n" - -echo "create policy type 2 to ric2:" -curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @${SHELL_FOLDER}/testdata/v2/policy_type.json" -res=$($curlString) -echo "$res" -expect="Policy type 2 is OK.201" -checkRes -echo -e "\n" - -for i in {1..30}; do - echo "policy types from policy agent:" - curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policy-types" - res=$($curlString) - echo "$res" - expect="{\"policytype_ids\":[\"1\",\"2\"]}200" - if [ "$res" == "$expect" ]; then - echo -e "\n" - break; - else - sleep $i - fi -done - -echo "create service ric-registration to policy agent:" -curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/services" --data-binary @${SHELL_FOLDER}/testdata/v2/service.json" -res=$($curlString) -echo "$res" -expect="201" -checkRes -echo -e "\n" - -echo "create policy aa8feaa88d944d919ef0e83f2172a5000 to ric1 with type 1 and service controlpanel via policy agent:" -curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/testdata/v2/policy_osc.json" -res=$($curlString) -echo "$res" -expect="201" -checkRes -echo -e "\n" - -echo "policy numbers from ric1:" -curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/counter/num_instances" -res=$($curlString) -echo "$res" -expect="1200" -checkRes -echo -e "\n" - -echo "create policy aa8feaa88d944d919ef0e83f2172a5100 to ric2 with type 2 and service controlpanel via policy agent:" -curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/testdata/v2/policy_std_v2.json" -res=$($curlString) -echo "$res" -expect="201" -checkRes -echo -e "\n" - -echo "policy numbers from ric2:" -curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/counter/num_instances" -res=$($curlString) -echo "$res" -expect="1200" -checkRes -echo -e "\n" - -echo "policy id aa8feaa88d944d919ef0e83f2172a5000 from policy agent:" -curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5000" -res=$($curlString) -echo "$res" -expect="200" -checkRes -echo -e "\n" - -echo "policy id aa8feaa88d944d919ef0e83f2172a5100 from policy agent:" -curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5100" -res=$($curlString) -echo "$res" -expect="200" -checkRes -echo -e "\n" diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/OSC/policy_type.json b/plans/ccsdk-oran/polmansuite/data/testdata/OSC/policy_type.json deleted file mode 100644 index aeea7733..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/OSC/policy_type.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "pt1", - "description": "pt1 policy type", - "policy_type_id": 1, - "create_schema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "OSC_Type1_1.0.0", - "description": "Type 1 policy type", - "type": "object", - "properties": { - "scope": { - "type": "object", - "properties": { - "ueId": { - "type": "string" - }, - "qosId": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "ueId", - "qosId" - ] - }, - "qosObjectives": { - "type": "object", - "properties": { - "priorityLevel": { - "type": "number" - } - }, - "additionalProperties": false, - "required": [ - "priorityLevel" - ] - } - }, - "additionalProperties": false, - "required": [ - "scope", "qosObjectives" - ] - } -} diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/policy.json b/plans/ccsdk-oran/polmansuite/data/testdata/policy.json deleted file mode 100644 index ac1b538b..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/policy.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "scope": { - "ueId": "ue3100", - "qosId": "qos3100" - }, - "qosObjectives": { - "priorityLevel": 3100 - } -} diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/service.json b/plans/ccsdk-oran/polmansuite/data/testdata/service.json deleted file mode 100644 index 7bb66514..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/service.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "callbackUrl": "https://callback-receiver:8091/callbacks/1", - "keepAliveIntervalSeconds": "3600", - "serviceName": "service1" -} diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_osc.json b/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_osc.json deleted file mode 100644 index 902f9111..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_osc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ric_id": "ric1", - "policy_id": "aa8feaa88d944d919ef0e83f2172a5100", - "service_id": "controlpanel", - "policytype_id": "1", - "status_notification_uri": "http://callback-receiver:8090/callbacks/test", - "policy_data": { - "scope": { - "ueId": "ue5100", - "qosId": "qos5100" - }, - "qosObjectives": { - "priorityLevel": 5100 - } - } -} \ No newline at end of file diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_std_v2.json b/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_std_v2.json deleted file mode 100644 index dcb7e38f..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_std_v2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ric_id": "ric2", - "policy_id": "aa8feaa88d944d919ef0e83f2172a5000", - "service_id": "controlpanel", - "policytype_id": "2", - "status_notification_uri": "http://callback-receiver:8090/callbacks/test", - "policy_data": { - "scope": { - "ueId": "ue5000", - "qosId": "qos5000" - }, - "qosObjectives": { - "priorityLevel": 5000 - } - } -} \ No newline at end of file diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_type.json b/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_type.json deleted file mode 100644 index 931498c4..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/v2/policy_type.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "policySchema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "STD_QOS_0_2_0", - "description": "STD QOS policy type", - "type": "object", - "properties": { - "scope": { - "type": "object", - "properties": { - "ueId": { - "type": "string" - }, - "qosId": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "ueId", - "qosId" - ] - }, - "qosObjectives": { - "type": "object", - "properties": { - "priorityLevel": { - "type": "number" - } - }, - "additionalProperties": false, - "required": [ - "priorityLevel" - ] - } - } - }, - "statusSchema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "STD_QOS_0.2.0", - "description": "STD QOS policy type status", - "type": "object", - "properties": { - "enforceStatus": { - "type": "string" - }, - "enforceReason": { - "type": "string" - }, - "additionalProperties": false, - "required": [ - "enforceStatus" - ] - } - } - } \ No newline at end of file diff --git a/plans/ccsdk-oran/polmansuite/data/testdata/v2/service.json b/plans/ccsdk-oran/polmansuite/data/testdata/v2/service.json deleted file mode 100644 index d984cbab..00000000 --- a/plans/ccsdk-oran/polmansuite/data/testdata/v2/service.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "callback_url": "http://callback-receiver:8090/callbacks/ric-registration", - "keep_alive_interval_seconds": "0", - "service_id": "ric-registration" -} \ No newline at end of file diff --git a/plans/ccsdk-oran/polmansuite/docker-compose.yml b/plans/ccsdk-oran/polmansuite/docker-compose.yml deleted file mode 100644 index a50115f7..00000000 --- a/plans/ccsdk-oran/polmansuite/docker-compose.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2021 Nordix Foundation. 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================================================= -# -version: '3' - -networks: - default: - driver: bridge - -services: - policy-agent: - image: nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice:1.1.1-STAGING-latest - container_name: policy-agent - networks: - default: - aliases: - - policy-agent-container - ports: - - 8081:8081 - - 8433:8433 - volumes: - - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro - # For using own certs instead of the default ones (built into the container), - # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines - # - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro - # - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro - # - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro - - a1-sim-OSC: - image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 - container_name: a1-sim-OSC - networks: - - default - ports: - - 30001:8085 - - 30002:8185 - environment: - - A1_VERSION=OSC_2.1.0 - - REMOTE_HOSTS_LOGGING=1 - - ALLOW_HTTP=true - - a1-sim-STD: - image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 - container_name: a1-sim-STD - networks: - - default - ports: - - 30003:8085 - - 30004:8185 - environment: - - A1_VERSION=STD_1.1.3 - - REMOTE_HOSTS_LOGGING=1 - - ALLOW_HTTP=true - - a1-sim-STD-v2: - image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 - container_name: a1-sim-STD-v2 - networks: - - default - ports: - - 30005:8085 - - 30006:8185 - environment: - - A1_VERSION=STD_2.0.0 - - REMOTE_HOSTS_LOGGING=1 - - ALLOW_HTTP=true diff --git a/plans/ccsdk-oran/polmansuite/sdnc/config/https-props-a1controller.properties b/plans/ccsdk-oran/polmansuite/sdnc/config/https-props-a1controller.properties deleted file mode 100644 index 7c4b1c17..00000000 --- a/plans/ccsdk-oran/polmansuite/sdnc/config/https-props-a1controller.properties +++ /dev/null @@ -1,24 +0,0 @@ -# ========================LICENSE_START================================= -# O-RAN-SC -# %% -# Copyright (C) 2021 Nordix Foundation -# %% -# 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=================================== - -key-store=/etc/ssl/certs/java/keystore.jks -key-password=sdnc-a1-controller -keystore-password=sdnc-a1-controller -isTrustStoreUsed=true -trust-store=/etc/ssl/certs/java/truststore.jks -truststore-password=sdnc-a1-controller diff --git a/plans/ccsdk-oran/polmansuite/sdnc/docker-compose.yml b/plans/ccsdk-oran/polmansuite/sdnc/docker-compose.yml deleted file mode 100644 index 86dd3a54..00000000 --- a/plans/ccsdk-oran/polmansuite/sdnc/docker-compose.yml +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2021 Nordix Foundation. 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================================================= -# -version: '3' - -networks: - default: - driver: bridge - -services: - db: - image: mysql/mysql-server:5.6 - container_name: sdnc-db - networks: - - default - ports: - - "3306" - environment: - - MYSQL_ROOT_PASSWORD=openECOMP1.0 - - MYSQL_ROOT_HOST=% - logging: - driver: "json-file" - options: - max-size: "30m" - max-file: "5" - - a1-controller: - image: onap/sdnc-image:2.1.0 - depends_on : - - db - container_name: a1-controller - networks: - - default - entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"] - ports: - - 8282:8181 - - 8443:8443 - links: - - db:dbhost - - db:sdnctldb01 - - db:sdnctldb02 - environment: - - MYSQL_ROOT_PASSWORD=openECOMP1.0 - - SDNC_DB_INIT=true - - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties - - A1_TRUSTSTORE_PASSWORD=a1adapter - # For using own certs instead of the default ones (built into the container), - # place them in config/ directory, update the https-props-a1controller.properties file, and uncomment the following lines - #volumes: - # - ./sdnc/config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro - # - ./sdnc/config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro - # - ./sdnc/config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro - logging: - driver: "json-file" - options: - max-size: "30m" - max-file: "5" diff --git a/plans/ccsdk-oran/polmansuite/setup.sh b/plans/ccsdk-oran/polmansuite/setup.sh deleted file mode 100755 index 188b84db..00000000 --- a/plans/ccsdk-oran/polmansuite/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. 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================================================= - - -cd $WORKSPACE/archives - -POLMAN_PLANS=$WORKSPACE/plans/ccsdk-oran/polmansuite -ARCHIVES=$WORKSPACE/archives - -#Copy test script -cp $POLMAN_PLANS/docker-compose.yml $WORKSPACE/archives/docker-compose.yml -cp -rf $POLMAN_PLANS/config/ $WORKSPACE/archives/config/ -cp -rf $POLMAN_PLANS/data/ $WORKSPACE/archives/data/ -cp -rf $POLMAN_PLANS/test/ $WORKSPACE/archives/test/ -cp -rf $POLMAN_PLANS/sdnc/ $WORKSPACE/archives/sdnc/ - -#Make the env vars availble to the robot scripts -ROBOT_VARIABLES="-b debug.log -v ARCHIVES:${ARCHIVES}" - diff --git a/plans/ccsdk-oran/polmansuite/teardown.sh b/plans/ccsdk-oran/polmansuite/teardown.sh deleted file mode 100755 index c619d0c9..00000000 --- a/plans/ccsdk-oran/polmansuite/teardown.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. 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================================================= - -# All started containers stopped and removed by the test case -docker stop $(docker ps -aq) -docker system prune -f diff --git a/plans/ccsdk-oran/polmansuite/test/pms_a1sim.sh b/plans/ccsdk-oran/polmansuite/test/pms_a1sim.sh deleted file mode 100755 index f3344cf1..00000000 --- a/plans/ccsdk-oran/polmansuite/test/pms_a1sim.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. 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================================================= - -SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) -docker stop $(docker ps -aq) -docker system prune -f - -cd ${SHELL_FOLDER}/../config -cp application_configuration.json.nosdnc application_configuration.json - -cd ${SHELL_FOLDER}/../ -docker-compose up -d - -checkStatus(){ - for i in {1..20}; do - res=$($1) - echo "$res" - expect=$2 - if [ "$res" == "$expect" ]; then - echo -e "$3 is alive!\n" - break; - else - sleep $i - fi - done -} -# Healthcheck docker containers - -# check SIM1 status -echo "check SIM1 status:" -checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" - -# check SIM2 status -echo "check SIM2 status:" -checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" - -# check SIM3 status -echo "check SIM3 status:" -checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" - -# check PMS status -echo "check PMS status:" -checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" - -cd ${SHELL_FOLDER}/../data -./preparePmsData.sh - diff --git a/plans/ccsdk-oran/polmansuite/test/pms_a1sim_sdnc.sh b/plans/ccsdk-oran/polmansuite/test/pms_a1sim_sdnc.sh deleted file mode 100755 index 5bf81b3f..00000000 --- a/plans/ccsdk-oran/polmansuite/test/pms_a1sim_sdnc.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2021 Nordix Foundation. 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================================================= - -SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) -docker stop $(docker ps -aq) -docker system prune -f - -cd ${SHELL_FOLDER}/../config -cp application_configuration.json.sdnc application_configuration.json - -cd ${SHELL_FOLDER}/../ -docker-compose -f docker-compose.yml -f sdnc/docker-compose.yml up -d - -checkStatus(){ - for i in {1..20}; do - res=$($1) - echo "$res" - expect=$2 - if [ "$res" == "$expect" ]; then - echo -e "$3 is alive!\n" - break; - else - sleep $i - fi - done -} -# Healthcheck docker containers - -# check SIM1 status -echo "check SIM1 status:" -checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" - -# check SIM2 status -echo "check SIM2 status:" -checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" - -# check SIM3 status -echo "check SIM3 status:" -checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" - -# check PMS status -echo "check PMS status:" -checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" - -# check SDNC status -echo "check SDNC status:" -checkStatus "curl -s -o /dev/null -I -w %{http_code} http://localhost:8282/apidoc/explorer/" "200" "SDNC" - -cd ${SHELL_FOLDER}/../data -./preparePmsData.sh - diff --git a/plans/ccsdk-oran/polmansuite/testplan.txt b/plans/ccsdk-oran/polmansuite/testplan.txt deleted file mode 100644 index 29191bd8..00000000 --- a/plans/ccsdk-oran/polmansuite/testplan.txt +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. 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================================================= - - -# Test suites are relative paths under [integration/csit.git]/tests/. -# Place the suites in run order. -# Temporary change to trigger verify job. -ccsdk-oran/polmansuite - diff --git a/plans/dcaegen2-collectors-datafile/Functional-suite/testplan.txt b/plans/dcaegen2-collectors-datafile/Functional-suite/testplan.txt index cb9aecf3..25a7d8c2 100755 --- a/plans/dcaegen2-collectors-datafile/Functional-suite/testplan.txt +++ b/plans/dcaegen2-collectors-datafile/Functional-suite/testplan.txt @@ -3,4 +3,4 @@ dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Ftp-suite dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Http-suite dcaegen2-collectors-datafile/testsuites/Strict-Host-Checking-suite -dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite +dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json new file mode 100644 index 00000000..0666a7d5 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json @@ -0,0 +1,20 @@ +{ + "delivery":{ + "url":"http://dcae-pm-mapper:8081/delivery", + "user":"username", + "password":"password", + "use100":true + }, + "follow_redirect":false, + "metadataOnly":false, + "suspend":false, + "groupid":0, + "links":{ + "self": "https://dmaap-dr-prov/subscribe/1", + "log": "https://dmaap-dr-prov/feedlog/1", + "feed": "https://dmaap-dr-prov/feed/1" + }, + "subscriber":"pmmapper", + "decompress":true, + "privilegedSubscriber": true + } \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json new file mode 100644 index 00000000..a29956fb --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json @@ -0,0 +1,7 @@ +{ + "ID": "cbs", + "Name": "config_binding_service", + "Tags": ["cbs"], + "Address": "ipaddress", + "Port": 10000 +} \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks new file mode 100644 index 00000000..33dc9a31 Binary files /dev/null and b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks differ diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json new file mode 100644 index 00000000..3f1009d4 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json @@ -0,0 +1,35 @@ +{ + "pm-mapper-filter": { "filters":[]}, + "key_store_path": "/opt/app/pm-mapper/etc/certs/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/certs/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/certs/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/certs/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json new file mode 100644 index 00000000..f93633dc --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json @@ -0,0 +1,18 @@ +{ + "name": "PM Mapper Feed", + "version": "m1.0", + "description": "PM Mapper Feed", + "business_description": "PM Mapper", + "suspend": false, + "deleted": false, + "changeowner": true, + "authorization": { + "classification": "unclassified", + "endpoint_addrs": [], + "endpoint_ids": [ + { + "password": "pmmapper", + "id": "pmmapper" + }] + } + } \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass new file mode 100644 index 00000000..ae8f7e72 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass @@ -0,0 +1 @@ +Er1tmip;T4w[%1}YE?x{fN9v \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js new file mode 100644 index 00000000..cc845712 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js @@ -0,0 +1,28 @@ +var httpServer = function () { + var http = require('http'), + url = require('url'), + fs = require('fs'), + + start = function (port) { + var server = http.createServer(function (req, res) { + processHttpRequest(res); + }); + server.listen(port, function () { + console.log('Listening on ' + port + '...'); + }); + }, + + processHttpRequest = function (res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + console.log('received message'); + setTimeout(() => { + res.end('Published Successfully.\n'); + }, 100); + }; + + return { + start: start + } +}(); + +httpServer.start(3904); diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties new file mode 100644 index 00000000..7abaf60a --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties @@ -0,0 +1,89 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * Modifications Copyright (C) 2021 Nokia Intellectual Property +# * =========================================================================== +# * 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==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- +# +# Configuration parameters set at startup for the DataRouter node +# +# URL to retrieve dynamic configuration +ProvisioningURL = https://dmaap-dr-prov:8443/internal/prov +# +# URL to upload PUB/DEL/EXP logs +LogUploadURL = https://dmaap-dr-prov:8443/internal/logs +# +# The port number for http as seen within the server +IntHttpPort = 8080 +# +# The port number for https as seen within the server +IntHttpsPort = 8443 +# +# The external port number for https taking port mapping into account +ExtHttpsPort = 443 +# +# The minimum interval between fetches of the dynamic configuration from the provisioning server +MinProvFetchInterval = 10000 +# +# The minimum interval between saves of the redirection data file +MinRedirSaveInterval = 10000 +# +# The path to the directory where log files are stored +LogDir = /opt/app/datartr/logs +# +# The retention interval (in days) for log files +LogRetention = 30 +# +# The path to the directories where data and meta data files are stored +SpoolDir = /opt/app/datartr/spool +# +# The path to the redirection data file +RedirectionFile = etc/redirections.dat +# +# The type of keystore for https +KeyStoreType = PKCS12 +# +# The type of truststore for https +TrustStoreType = jks +# +# The path to the file used to trigger an orderly shutdown +QuiesceFile = etc/SHUTDOWN +# +# The key used to generate passwords for node to node transfers +NodeAuthKey = Node123! +# +# DR_NODE DEFAULT ENABLED TLS PROTOCOLS +NodeHttpsProtocols = TLSv1.1|TLSv1.2 +# +# AAF type to generate permission string +AAFType = org.onap.dmaap-dr.feed +# +# AAF default instance to generate permission string - default should be legacy +AAFInstance = legacy +# +# AAF action to generate permission string - default should be publish +AAFAction = publish +# +# AAF CADI enabled flag +CadiEnabled = false +# +# AAF Props file path +AAFPropsFilePath = /opt/app/osaaf/local/org.onap.dmaap-dr.props diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties new file mode 100644 index 00000000..cd333efb --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties @@ -0,0 +1,62 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * Modifications Copyright (C) 2021 Nokia Intellectual Property +# * =========================================================================== +# * 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==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- + +#Jetty Server properties +org.onap.dmaap.datarouter.provserver.http.port = 8080 +org.onap.dmaap.datarouter.provserver.https.port = 8443 +org.onap.dmaap.datarouter.provserver.https.relaxation = true + +org.onap.dmaap.datarouter.provserver.aafprops.path = /opt/app/osaaf/local/org.onap.dmaap-dr.props + +org.onap.dmaap.datarouter.provserver.accesslog.dir = /opt/app/datartr/logs +org.onap.dmaap.datarouter.provserver.spooldir = /opt/app/datartr/spool +org.onap.dmaap.datarouter.provserver.dbscripts = /opt/app/datartr/etc/misc +org.onap.dmaap.datarouter.provserver.logretention = 30 + +#DMAAP-597 (Tech Dept) REST request source IP auth +# relaxation to accommodate OOM kubernetes deploy +org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false + +#Localhost address config +org.onap.dmaap.datarouter.provserver.localhost = 127.0.0.1 + +# Database access +org.onap.dmaap.datarouter.db.driver = org.mariadb.jdbc.Driver +org.onap.dmaap.datarouter.db.url = jdbc:mariadb://datarouter-mariadb:3306/datarouter +org.onap.dmaap.datarouter.db.login = datarouter +org.onap.dmaap.datarouter.db.password = datarouter + +# PROV - DEFAULT ENABLED TLS PROTOCOLS +org.onap.dmaap.datarouter.provserver.https.include.protocols = TLSv1.1|TLSv1.2 + +# AAF config +org.onap.dmaap.datarouter.provserver.cadi.enabled = false + +org.onap.dmaap.datarouter.provserver.passwordencryption = PasswordEncryptionKey#@$%^&1234# +org.onap.dmaap.datarouter.provserver.aaf.feed.type = org.onap.dmaap-dr.feed +org.onap.dmaap.datarouter.provserver.aaf.sub.type = org.onap.dmaap-dr.sub +org.onap.dmaap.datarouter.provserver.aaf.instance = legacy +org.onap.dmaap.datarouter.provserver.aaf.action.publish = publish +org.onap.dmaap.datarouter.provserver.aaf.action.subscribe = subscribe diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks new file mode 100644 index 00000000..679c95a5 Binary files /dev/null and b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks differ diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.pass b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.pass new file mode 100644 index 00000000..d3d01b0a --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.pass @@ -0,0 +1 @@ +583Ls;XF(qDQu3p!L22gyh1t \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/docker-compose.yml b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/docker-compose.yml new file mode 100644 index 00000000..66946ea0 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/docker-compose.yml @@ -0,0 +1,119 @@ +version: '3.3' + +services: + datarouter-prov: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov + container_name: datarouter-prov + hostname: dmaap-dr-prov + ports: + - "443:8443" + - "8443:8443" + - "8080:8080" + volumes: + - /var/tmp/provserver.properties:/opt/app/datartr/etc/provserver.properties + depends_on: + - mariadb + healthcheck: + test: ["CMD", "curl", "-f", "http://dmaap-dr-prov:8080/internal/prov"] + interval: 10s + timeout: 10s + retries: 5 + networks: + pmmapper-network: + ipv4_address: $DR_PROV_IP + extra_hosts: + - "dmaap-dr-node:$DR_NODE_IP" + - "dcae-pm-mapper:$PMMAPPER_IP" + + datarouter-node: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-node + container_name: datarouter-node + hostname: dmaap-dr-node + ports: + - "9443:8443" + - "9090:8080" + volumes: + - /var/tmp/node.properties:/opt/app/datartr/etc/node.properties + depends_on: + - datarouter-prov + networks: + pmmapper-network: + ipv4_address: $DR_NODE_IP + extra_hosts: + - "dmaap-dr-prov:$DR_PROV_IP" + - "dcae-pm-mapper:$PMMAPPER_IP" + + node: + image: nexus3.onap.org:10001/node:10-slim + container_name: mr-simulator + volumes: + - /var/tmp/mrserver.js:/tmp/mrserver.js + command: + nodejs /tmp/mrserver.js + networks: + pmmapper-network: + ipv4_address: $NODE_IP + + mariadb: + image: nexus3.onap.org:10001/mariadb:10.2.14 + container_name: mariadb + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: datarouter + MYSQL_DATABASE: datarouter + MYSQL_USER: datarouter + MYSQL_PASSWORD: datarouter + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"] + interval: 10s + timeout: 30s + retries: 5 + networks: + pmmapper-network: + ipv4_address: $MARIADB_IP + + consul: + container_name: consul + image: nexus3.onap.org:10001/consul:latest + networks: + pmmapper-network: + ipv4_address: $CONSUL_IP + + cbs: + container_name: cbs + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest + environment: + CONSUL_HOST: $CONSUL_IP + networks: + pmmapper-network: + ipv4_address: $CBS_IP + + pmmapper: + container_name: pmmapper + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:latest + ports: + - "8081:8081" + volumes: + - /var/tmp/:/opt/app/pm-mapper/etc/certs/ + depends_on: + - datarouter-prov + environment: + CONFIG_BINDING_SERVICE_SERVICE_HOST: $CBS_IP + CONFIG_BINDING_SERVICE_SERVICE_PORT: 10000 + HOSTNAME: pmmapper + networks: + pmmapper-network: + ipv4_address: $PMMAPPER_IP + extra_hosts: + - "dmaap-dr-node:$DR_NODE_IP" + - "message-router:$NODE_IP" + + +networks: + pmmapper-network: + driver: bridge + ipam: + config: + - subnet: 172.18.0.0/16 + diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/setup.sh b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/setup.sh new file mode 100644 index 00000000..f314055e --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/setup.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +docker login -u docker -p docker nexus3.onap.org:10001 + +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-pmmapper/files-processing-config-pmmapper + +export GATEWAY_IP=172.18.0.1 +export DR_NODE_IP=172.18.0.2 +export DR_PROV_IP=172.18.0.3 +export CONSUL_IP=172.18.0.4 +export CBS_IP=172.18.0.5 +export MARIADB_IP=172.18.0.6 +export NODE_IP=172.18.0.7 +export PMMAPPER_IP=172.18.0.8 + +for asset in provserver.properties node.properties cbs.json mrserver.js cert.jks jks.pass trust.jks trust.pass; do + cp $TEST_PLANS_DIR/assets/${asset} /var/tmp/ +done + +sed -i 's/datarouter-mariadb/'$MARIADB_IP'/g' /var/tmp/provserver.properties +sed -i 's/ipaddress//g' /var/tmp/cbs.json + +# ------------------------------------ +#Prepare enviroment for client +#install docker sdk +echo "Uninstall docker-py and reinstall docker." +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 + +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d mariadb consul cbs node + +echo "Waiting for MariaDB to come up healthy..." +for i in {1..30}; do + mariadb_state=$(docker inspect --format='{{json .State.Health.Status}}' mariadb) + if [ $mariadb_state = '"healthy"' ] + then + break + else + sleep 2 + fi +done +[ "$mariadb_state" != '"healthy"' ] && echo "Error: MariaDB container state not healthy" && exit 1 + +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d datarouter-node datarouter-prov + +unset http_proxy +unset https_proxy +curl --request PUT --data @/var/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register +curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT \ + -H 'Accept: application/json' \ + -H 'Content-Type: application/json' \ + -H 'X-Requested-With: XMLHttpRequest' \ + --data @$TEST_PLANS_DIR/assets/config.json + +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d pmmapper +sleep 2 + +# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS +containers_ok=false +for i in {1..5}; do + if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' mr-simulator) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' cbs) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' pmmapper) ] + then + echo "All required docker containers are up." + containers_ok=true + break + else + sleep $i + fi +done +[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1 + +# Data Router Configuration. +docker exec -i datarouter-prov sh -c \ + "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$GATEWAY_IP" +docker exec -i datarouter-prov sh -c \ + "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$GATEWAY_IP" + +# Create PM Mapper feed and create PM Mapper subscriber on data router +curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" \ + --data-ascii @$TEST_PLANS_DIR/assets/createFeed.json \ + --post301 --location-trusted -k https://${DR_PROV_IP}:8443 +curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" \ + --data-ascii @$TEST_PLANS_DIR/assets/addSubscriber.json \ + --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 + +docker cp pmmapper:/var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log /tmp/pmmapper.log +sleep 10 +docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" +curl -k https://$DR_PROV_IP:8443/internal/prov + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v CONSUL_IP:${CONSUL_IP} -v DR_PROV_IP:${DR_PROV_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v PMMAPPER_IP:${PMMAPPER_IP} -v DR_NODE_IP:${DR_NODE_IP} -v NODE_IP:${NODE_IP}" diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/teardown.sh b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/teardown.sh new file mode 100644 index 00000000..ffa2da60 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/teardown.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Starting teardown script" +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-pmmapper/files-processing-config-pmmapper +mkdir -p $WORKSPACE/archives +docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +kill-instance.sh pmmapper +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml logs > $WORKSPACE/archives/files-processing-config-pmmapper-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt new file mode 100644 index 00000000..543973d0 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-pmmapper/files-processing-config-pmmapper diff --git a/plans/so/integration-etsi-testing/config/camunda-sql/mariadb_engine_7.10.0.sql b/plans/so/integration-etsi-testing/config/camunda-sql/mariadb_engine_7.10.0.sql index deb0342e..b8062107 100644 --- a/plans/so/integration-etsi-testing/config/camunda-sql/mariadb_engine_7.10.0.sql +++ b/plans/so/integration-etsi-testing/config/camunda-sql/mariadb_engine_7.10.0.sql @@ -222,7 +222,7 @@ create table ACT_RU_VARIABLE ( BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, - TEXT_ varchar(4000), + TEXT_ varchar(10000), TEXT2_ varchar(4000), VAR_SCOPE_ varchar(64) not null, SEQUENCE_COUNTER_ bigint, @@ -862,7 +862,7 @@ create table ACT_HI_VARINST ( BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, - TEXT_ varchar(4000), + TEXT_ varchar(10000), TEXT2_ varchar(4000), TENANT_ID_ varchar(64), STATE_ varchar(20), @@ -892,7 +892,7 @@ create table ACT_HI_DETAIL ( BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, - TEXT_ varchar(4000), + TEXT_ varchar(10000), TEXT2_ varchar(4000), SEQUENCE_COUNTER_ bigint, TENANT_ID_ varchar(64), @@ -1302,7 +1302,7 @@ create table ACT_HI_DEC_IN ( BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, - TEXT_ varchar(4000), + TEXT_ varchar(10000), TEXT2_ varchar(4000), TENANT_ID_ varchar(64), CREATE_TIME_ datetime(3), @@ -1324,7 +1324,7 @@ create table ACT_HI_DEC_OUT ( BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, - TEXT_ varchar(4000), + TEXT_ varchar(10000), TEXT2_ varchar(4000), TENANT_ID_ varchar(64), CREATE_TIME_ datetime(3), diff --git a/plans/so/integration-etsi-testing/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz b/plans/so/integration-etsi-testing/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz new file mode 100755 index 00000000..f826c2eb Binary files /dev/null and b/plans/so/integration-etsi-testing/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz differ diff --git a/plans/so/integration-etsi-testing/config/override-files/openstack-adapter/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/openstack-adapter/onapheat/override.yaml new file mode 100644 index 00000000..7e2afa85 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/override-files/openstack-adapter/onapheat/override.yaml @@ -0,0 +1,147 @@ +server: + port: 8087 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: false + + security: + usercredentials: + - + username: sdnc + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SDNC-Client + - + username: sitecontrol + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SiteControl-Client + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: sniro + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SNIRO-Client + - + username: apih + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: MSO-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + + +org: + onap: + so: + adapters: + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + vnf: + bpelauth: D1A67FA93B6A6419132D0F83CC771AF774FD3C60853C50C22C8C6FC5088CC79E9E81EDE9EA39F22B2F66A0068E + checkRequiredParameters: true + addGetFilesOnVolumeReq: false + sockettimeout: 30 + connecttimeout: 30 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + valet_enabled: false + fail_requests_on_valet_failure: false + network: + bpelauth: D1A67FA93B6A6419132D0F83CC771AF774FD3C60853C50C22C8C6FC5088CC79E9E81EDE9EA39F22B2F66A0068E + sockettimeout: 5 + connecttimeout: 5 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 + tenant: + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + default_tenant_description: Tenant + default_region_type: single + default_user_role: admin + default_success_status_string: Success + default_no_regions_status_string: no regions + default_quota_value: 10 + set_default_quota: false + +ecomp: + mso: + adapters: + po: + retryCodes: 504 + retryDelay: 5 + retryCount: 3 + pollTimeout: 7500 + pollInterval: 15 + +mso: + adapters: + requestDb: + endpoint: http://so-request-db-adapter.onap:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + auth: BEA8637716A7EB617DF472BA6552D22F68C1CB17B0D094D77DDA562F4ADAAC4457CAB848E1A4 + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: ./logs/openstack + msb-ip: multicloud-simulator + msb-port: 9996 + msb-scheme: http + workflow: + endpoint: http://bpmn-infra:8081/sobpmnengine + config: + cadi: + aafId: poBpmn + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + site-name: localDevEnv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + +cloud_config: + identity_services: + RAX_KEYSTONE: + identity_url: "https://identity.api.rackspacecloud.com/v2.0" + mso_id: "RACKSPACE_ACCOUNT_ID" + mso_pass: "RACKSPACE_ACCOUNT_APIKEY" + admin_tenant: "service" + member_role: "admin" + tenant_metadata: true + identity_server_type: "KEYSTONE" + identity_authentication_type: "RACKSPACE_APIKEY" + cloud_sites: + Dallas: + region_id: "DFW" + clli: "DFW" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Northern Virginia: + region_id: "IAD" + clli: "IAD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Chicago: + region_id: "ORD" + clli: "ORD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + DEFAULT: + region_id: "DFW" + clli: "DFW" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml index f7b56c01..5f3d34cf 100644 --- a/plans/so/integration-etsi-testing/docker-compose.yml +++ b/plans/so/integration-etsi-testing/docker-compose.yml @@ -108,6 +108,36 @@ services: max-file: "5" user: root entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +################################################################################ + openstack-adapter: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/openstack-adapter:1.8.0-STAGING-latest + ports: + - "8087:8087" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${CONFIG_DIR_PATH}/override-files/openstack-adapter/onapheat:/app/config + environment: + - APP=openstack-adapter + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + openstack-adapter.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' ################################################################################ sdc-controller: image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/sdc-controller:${TAG} @@ -115,7 +145,7 @@ services: - "8085:8085" volumes: - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates - - ${CONFIG_DIR_PATH}/distribution-test-zip/zipped_sdc_csar.tar.gz:/distribution-test-zip/zipped_sdc_csar.tar.gz + - ${CONFIG_DIR_PATH}/distribution-test-zip:/distribution-test-zip - ${CONFIG_DIR_PATH}/override-files/sdc-controller/onapheat:/app/config environment: - APP=sdc-controller @@ -138,7 +168,7 @@ services: max-size: "30m" max-file: "5" user: root - entrypoint: /bin/sh -c 'mkdir -p /distribution-test-zip/unzipped && tar -xvzf /distribution-test-zip/zipped_sdc_csar.tar.gz -C /distribution-test-zip/unzipped && chmod 777 -R /distribution-test-zip/ && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' + entrypoint: /bin/sh -c 'mkdir -p /distribution-test-zip/unzipped && tar -xvzf /distribution-test-zip/zipped_sdc_csar.tar.gz -C /distribution-test-zip/unzipped && tar -xvzf /distribution-test-zip/macro_zipped_sdc_csar.tar.gz -C /distribution-test-zip/unzipped && chmod 777 -R /distribution-test-zip/ && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' ################################################################################ bpmn-infra: image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/bpmn-infra:${TAG} @@ -335,6 +365,24 @@ services: options: max-size: "30m" max-file: "5" +################################################################################# + multicloud-simulator: + image: simulators/multicloud-simulator:latest + ports: + - "9996:9996" + environment: + - APP=MULTICLOUD-SIMULATOR + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + multicloud-simulator + depends_on: + - mariadb + - so-vnfm-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" ################################################################################ populate-aai-config: image: jobs/workaround-job-container:latest diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java index 43fe47da..27a0e79d 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java @@ -22,6 +22,7 @@ package org.onap.so.aaisimulator.controller; import static org.onap.so.aaisimulator.utils.Constants.APPLICATION_MERGE_PATCH_JSON; import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSHIP_LIST_URL; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF; +import static org.onap.so.aaisimulator.utils.Constants.VF_MODULE; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNFS_URL; import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL; import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; @@ -35,6 +36,8 @@ import javax.ws.rs.core.MediaType; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; import org.onap.so.aaisimulator.service.providers.GenericVnfCacheServiceProvider; import org.onap.so.aaisimulator.utils.HttpServiceUtils; import org.onap.so.aaisimulator.utils.RequestErrorResponseUtils; @@ -47,6 +50,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -211,5 +215,66 @@ public class GenericVnfsController { return getRequestErrorResponseEntity(request, GENERIC_VNF); } + + + @GetMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity getVfModule(@PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, + @RequestParam(name = "depth", required = false) final Integer depth, + @RequestParam(name = "resultIndex", required = false) final Integer resultIndex, + @RequestParam(name = "resultSize", required = false) final Integer resultSize, + @RequestParam(name = "format", required = false) final String format, final HttpServletRequest request) { + LOGGER.info( + "Will get VfModule for 'vf-module-id': {} with depth: {}, resultIndex: {}, resultSize:{}, format: {} ...", + vnfId, vfModuleId, depth, resultIndex, resultSize, format); + + final Optional optional = cacheServiceProvider.getVfModule(vnfId, vfModuleId); + + if (optional.isPresent()) { + final VfModule vfModule = optional.get(); + LOGGER.info("found VfModule {} in cache", vfModule); + return ResponseEntity.ok(vfModule); + } + + LOGGER.error( + "Unable to find VfModule in cache for 'vf-module-id': {} with depth: {}, resultIndex: {}, resultSize:{}, format:{} ...", + vnfId, vfModuleId, depth, resultIndex, resultSize, format); + return getRequestErrorResponseEntity(request, VF_MODULE); + + } + + + + @PutMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity putVfModule(@RequestBody final VfModule vfModule, + @PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, final HttpServletRequest request) { + LOGGER.info("Will add VfModule to cache with 'vf-module-id': {} ...", vfModuleId); + + cacheServiceProvider.putVfModule(vnfId, vfModuleId, vfModule); + return ResponseEntity.accepted().build(); + } + + @PostMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, APPLICATION_MERGE_PATCH_JSON}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity patchVfModule(@RequestBody final VfModule vfModule, + @PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) { + + LOGGER.info("Will post VfModule to cache with 'vf-module-id': {} and '{}': {} ...", vfModuleId, X_HTTP_METHOD_OVERRIDE, + xHttpHeaderOverride); + + if (HttpMethod.PATCH.toString().equalsIgnoreCase(xHttpHeaderOverride)) { + if (cacheServiceProvider.patchVfModule(vnfId, vfModuleId, vfModule)) { + return ResponseEntity.accepted().build(); + } + LOGGER.error("Unable to apply patch to VmModule using 'vf-module-id': {} ... ", vfModule); + return getRequestErrorResponseEntity(request, VF_MODULE); + } + LOGGER.error("{} not supported ... ", xHttpHeaderOverride); + + return getRequestErrorResponseEntity(request, VF_MODULE); + } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java index 901c2594..0ee2d00c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java @@ -23,6 +23,9 @@ import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; +import org.onap.aai.domain.yang.v10.VolumeGroup; import org.springframework.http.HttpHeaders; /** @@ -49,5 +52,9 @@ public interface GenericVnfCacheServiceProvider extends Clearable { boolean deleteGenericVnf(final String vnfId, final String resourceVersion); + void putVfModule(String vnfId, String vfModuleId, VfModule vfModule); + Optional getVfModule(final String vnfId, final String vfModuleId); + + boolean patchVfModule(String vnfId, String vfModuleId, VfModule vfModule); } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java index e7a42106..5a0423b5 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java @@ -24,6 +24,7 @@ import static org.onap.so.aaisimulator.utils.Constants.COMPOSED_OF; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF_VNF_ID; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF_VNF_NAME; +import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getBiDirectionalRelationShipListRelatedLink; import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getRelationShipListRelatedLink; import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getTargetUrl; @@ -37,6 +38,10 @@ import org.onap.aai.domain.yang.RelatedToProperty; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.v10.VfModules; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.v10.VolumeGroups; import org.onap.so.aaisimulator.utils.ShallowBeanCopy; import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; @@ -58,6 +63,7 @@ public class GenericVnfCacheServiceProviderImpl extends AbstractCacheServiceProv private static final Logger LOGGER = LoggerFactory.getLogger(GenericVnfCacheServiceProviderImpl.class); private final HttpRestServiceProvider httpRestServiceProvider; + final org.onap.aai.domain.yang.VfModules vfModules = new org.onap.aai.domain.yang.VfModules(); @Autowired public GenericVnfCacheServiceProviderImpl(final CacheManager cacheManager, @@ -255,4 +261,61 @@ public class GenericVnfCacheServiceProviderImpl extends AbstractCacheServiceProv clearCache(GENERIC_VNF_CACHE.getName()); } -} + @Override + public Optional getVfModule(final String vnfId, final String vfModuleId) { + LOGGER.info("Getting vfModule from cache for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + final Cache cache = getCache(GENERIC_VNF_CACHE.getName()); + final GenericVnf value = cache.get(vnfId, GenericVnf.class); + LOGGER.info("Getting vfModule from cache for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + if (value.getVfModules() != null) { + for (int i=0; i genericVnfOptional = getGenericVnf(vnfId); + final Cache cache = getCache(GENERIC_VNF_CACHE.getName()); + if (genericVnfOptional.isPresent()) { + final GenericVnf genericVnf = genericVnfOptional.get(); + + vfModules.getVfModule().add(vfModule); + genericVnf.setVfModules(vfModules); + cache.put(vfModuleId, vfModule); + } + } + + @Override + public boolean patchVfModule(String vnfId, String vfModuleId, VfModule vfModule) { + final Optional genericVnfOptional = getGenericVnf(vnfId); + LOGGER.info("Create vfModule for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + if (genericVnfOptional.isPresent()) { + final GenericVnf cachedGenericVnf = genericVnfOptional.get(); + LOGGER.info("vfModuleId is Matched"); + try { + for (int i=0; i \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd new file mode 100644 index 00000000..c8d43372 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml new file mode 100644 index 00000000..926ea140 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + org.onap.so.simulators + so-simulators + 1.0-SNAPSHOT + + multicloud-simulator + ${project.artifactId} + Demo project for Spring Boot + + 11 + + + + ${project.parent.groupId} + common + ${project.version} + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + com.googlecode.json-simple + json-simple + 1.1 + + + + org.pacesys + openstack4j-core + 3.2.0 + + + org.pacesys.openstack4j.connectors + openstack4j-httpclient + 3.2.0 + + + org.onap.so.adapters + mso-adapters-rest-interface + 1.7.1-SNAPSHOT + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + 2.1.1.RELEASE + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + org.onap.so.multicloudsimulator.MultiCloudSimulatorApplication + + + + + repackage + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java new file mode 100644 index 00000000..949cd9ba --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java @@ -0,0 +1,13 @@ +package org.onap.so.multicloudsimulator; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication(scanBasePackages = {"org.onap"}) +public class MultiCloudSimulatorApplication { + + public static void main(String[] args) { + SpringApplication.run(MultiCloudSimulatorApplication.class, args); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java new file mode 100644 index 00000000..e8f9e125 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java @@ -0,0 +1,93 @@ + +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.multicloudsimulator.beans; + +import java.util.List; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"id", "request", "namespace", "resources"}) +@JsonIgnoreProperties(value = "true") +public class InstanceResponse extends Response { + + @JsonProperty("id") + private String id; + @JsonProperty("request") + private MulticloudInstanceRequest request; + @JsonProperty("namespace") + private String namespace; + @JsonProperty("resources") + private List resources = null; + + public InstanceResponse(String errorMsg) { + super(errorMsg); + } + + public InstanceResponse() { + super(""); + //new Response(""); + } + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("request") + public MulticloudInstanceRequest getRequest() { + return request; + } + + @JsonProperty("request") + public void setRequest(MulticloudInstanceRequest request) { + this.request = request; + } + + @JsonProperty("namespace") + public String getNamespace() { + return namespace; + } + + @JsonProperty("namespace") + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + @JsonProperty("resources") + public List getResources() { + return resources; + } + + @JsonProperty("resources") + public void setResources(List resources) { + this.resources = resources; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java new file mode 100644 index 00000000..f524aa97 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java @@ -0,0 +1,99 @@ +package org.onap.so.multicloudsimulator.beans; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"}) +public class MulticloudCreateResponse implements Serializable { + private static final long serialVersionUID = -5215028275577848311L; + + @JsonProperty("template_type") + private String templateType; + @JsonProperty("workload_id") + private String workloadId; + @JsonProperty("template_response") + private JsonNode templateResponse; + @JsonProperty("workload_status_reason") + private JsonNode workloadStatusReason; + @JsonProperty("workload_status") + private String workloadStatus; + + @JsonCreator + public MulticloudCreateResponse(@JsonProperty("template_type") String templateType, + @JsonProperty("workload_id") String workloadId, + @JsonProperty("template_response") JsonNode templateResponse) { + this.templateType = templateType; + this.workloadId = workloadId; + this.templateResponse = templateResponse; + } + public MulticloudCreateResponse() { + + } + + @JsonProperty("template_type") + public String getTemplateType() { + return templateType; + } + + @JsonProperty("template_type") + public void setTemplateType(String templateType) { + this.templateType = templateType; + } + + @JsonProperty("workload_id") + public String getWorkloadId() { + return workloadId; + } + + @JsonProperty("workload_id") + public void setWorkloadId(String workloadId) { + this.workloadId = workloadId; + } + + @JsonProperty("template_response") + public void setTemplateResponse(JsonNode templateResponse) { + this.templateResponse = templateResponse; + } + + @JsonProperty("template_response") + public JsonNode getTemplateResponse() { + return templateResponse; + } + + @JsonProperty("workload_status_reason") + public void setWorkloadStatusReason(JsonNode workloadStatusReason) { + this.workloadStatusReason = workloadStatusReason; + } + + @JsonProperty("workload_status_reason") + public JsonNode getWorkloadStatusReason() { + return workloadStatusReason; + } + + @JsonProperty("workload_status") + public String getWorkloadSstatus() { + return workloadStatus; + } + + @JsonProperty("workload_status") + public void setWorkloadStatus(String workloadStatus) { + this.workloadStatus = workloadStatus; + } + + + @Override + public String toString() { + return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId) + .append("templateResponse", templateResponse) + .append("workload_status_reason", workloadStatusReason.toString()) + .append("workload_status", workloadStatus).toString(); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java new file mode 100644 index 00000000..c88e7f15 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java @@ -0,0 +1,87 @@ +package org.onap.so.multicloudsimulator.beans; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(value = "true") +public class MulticloudInstanceRequest { + + @JsonProperty(value = "cloud-region") + private String cloudRegion; + + @JsonProperty(value = "rb-name") + private String rbName; + + @JsonProperty(value = "rb-version") + private String rbVersion; + + @JsonProperty(value = "profile-name") + private String profileName; + + @JsonProperty(value = "labels") + private Map labels; + + @JsonProperty(value = "override-values") + private Map overrideValues; + + @JsonProperty(value = "release-name") + private String vfModuleUuid; + + public String getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(String cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public String getRbName() { + return rbName; + } + + public void setRbName(String rbName) { + this.rbName = rbName; + } + + public String getRbVersion() { + return rbVersion; + } + + public void setRbVersion(String rbVersion) { + this.rbVersion = rbVersion; + } + + public String getProfileName() { + return profileName; + } + + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + public Map getLabels() { + return labels; + } + + public void setLabels(Map labels) { + this.labels = labels; + } + + public Map getOverrideValues() { + return overrideValues; + } + + public void setOverrideValues(Map overrideValues) { + this.overrideValues = overrideValues; + } + + public String getVfModuleUuid() { + return vfModuleUuid; + } + + public void setVfModuleUuid(String vfModuleUuid) { + this.vfModuleUuid = vfModuleUuid; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java new file mode 100644 index 00000000..c2ec1910 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Intel Corp. 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.so.multicloudsimulator.beans; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; +import com.woorea.openstack.heat.model.CreateStackParam; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"generic-vnf-id", "vf-module-id", "vf-module-model-invariant-id", "vf-module-model-version-id", + "vf-module-model-customization-id", "oof_directives", "sdnc_directives", "user_directives", "template_type", + "template_data"}) +public class MulticloudRequest implements Serializable { + private static final long serialVersionUID = -5215028275577848311L; + + @JsonProperty("generic-vnf-id") + private String genericVnfId; + @JsonProperty("vf-module-id") + private String vfModuleId; + @JsonProperty("vf-module-model-invariant-id") + private String vfModuleModelInvariantId; + @JsonProperty("vf-module-model-version-id") + private String vfModuleModelVersionId; + @JsonProperty("vf-module-model-customization-id") + private String vfModuleModelCustomizationId; + @JsonProperty("oof_directives") + private JsonNode oofDirectives; + @JsonProperty("sdnc_directives") + private JsonNode sdncDirectives; + @JsonProperty("user_directives") + private JsonNode userDirectives; + @JsonProperty("template_type") + private String templateType; + @JsonProperty("template_data") + private CreateStackParam templateData; + + + @JsonProperty("generic-vnf-id") + public String getGenericVnfId() { + return genericVnfId; + } + + @JsonProperty("generic-vnf-id") + public void setGenericVnfId(String genericVnfId) { + this.genericVnfId = genericVnfId; + } + + @JsonProperty("vf-module-id") + public String getVfModuleId() { + return vfModuleId; + } + + @JsonProperty("vf-module-id") + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @JsonProperty("vf-module-model-invariant-id") + public String getVfModuleModelInvariantId() { + return vfModuleModelInvariantId; + } + + @JsonProperty("vf-module-model-invariant-id") + public void setVfModuleModelInvariantId(String vfModuleModelInvariantId) { + this.vfModuleModelInvariantId = vfModuleModelInvariantId; + } + + @JsonProperty("vf-module-model-version-id") + public String getVfModuleModelVersionId() { + return vfModuleModelVersionId; + } + + @JsonProperty("vf-module-model-version-id") + public void setVfModuleModelVersionId(String vfModuleModelVersionId) { + this.vfModuleModelVersionId = vfModuleModelVersionId; + } + + @JsonProperty("vf-module-model-customization-id") + public String getVfModuleModelCustomizationId() { + return vfModuleModelCustomizationId; + } + + @JsonProperty("vf-module-model-customization-id") + public void setVfModuleModelCustomizationId(String vfModuleModelCustomizationId) { + this.vfModuleModelCustomizationId = vfModuleModelCustomizationId; + } + + @JsonProperty("oof_directives") + public JsonNode getOofDirectives() { + return oofDirectives; + } + + @JsonProperty("oof_directives") + public void setOofDirectives(JsonNode oofDirectives) { + this.oofDirectives = oofDirectives; + } + + @JsonProperty("sdnc_directives") + public JsonNode getSdncDirectives() { + return sdncDirectives; + } + + @JsonProperty("sdnc_directives") + public void setSdncDirectives(JsonNode sdncDirectives) { + this.sdncDirectives = sdncDirectives; + } + + @JsonProperty("user_directives") + public JsonNode getUserDirectives() { + return userDirectives; + } + + @JsonProperty("user_directives") + public void setUserDirectives(JsonNode userDirectives) { + this.userDirectives = userDirectives; + } + + @JsonProperty("template_type") + public String getTemplateType() { + return templateType; + } + + @JsonProperty("template_type") + public void setTemplateType(String templateType) { + this.templateType = templateType; + } + + @JsonProperty("template_data") + public CreateStackParam getTemplateData() { + return templateData; + } + + @JsonProperty("template_data") + public void setTemplateData(CreateStackParam templateData) { + this.templateData = templateData; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("genericVnfId", genericVnfId).append("vfModuleId", vfModuleId) + .append("vfModuleModelInvariantId", vfModuleModelInvariantId) + .append("vfModuleModelVersionId", vfModuleModelVersionId) + .append("vfModuleModelCustomizationId", vfModuleModelCustomizationId) + .append("oofDirectives", oofDirectives).append("sdncDirectives", sdncDirectives) + .append("userDirectives", userDirectives).append("templateType", templateType) + .append("templateData", templateData).toString(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java new file mode 100644 index 00000000..368ab6d7 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.multicloudsimulator.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"resource-type", "resource-link"}) +public class Resource { + + @JsonProperty("resource-type") + private String resourceType; + @JsonProperty("resource-link") + private String resourceLink; + + @JsonProperty("resource-type") + public String getResourceType() { + return resourceType; + } + + @JsonProperty("resource-type") + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + @JsonProperty("resource-link") + public String getResourceLink() { + return resourceLink; + } + + //@JsonProperty("resource-link") + public void setResourceLink(String resourceLink) { + this.resourceLink = resourceLink; + } + +} + diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java new file mode 100644 index 00000000..77a6150c --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.multicloudsimulator.beans; + +public class Response { + + private String errorMsg; + + public Response(String errorMsg) { + this.errorMsg = errorMsg; + } + + public Response() { + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/ApplicationConfigration.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/ApplicationConfigration.java new file mode 100644 index 00000000..34015ea1 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/ApplicationConfigration.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.multicloudsimulator.configration; + +import static org.onap.so.multicloudsimulator.utils.Constants.SERVICE_TOPOLOGY_OPERATION_CACHE; +import java.util.Arrays; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCache; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Configuration +public class ApplicationConfigration { + + @Bean + public CacheManager cacheManager() { + final SimpleCacheManager manager = new SimpleCacheManager(); + manager.setCaches(Arrays.asList(getCache(SERVICE_TOPOLOGY_OPERATION_CACHE))); + return manager; + } + + private Cache getCache(final String name) { + return new ConcurrentMapCache(name); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/WebSecurityConfigImpl.java new file mode 100644 index 00000000..a0c1f755 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configration/WebSecurityConfigImpl.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.multicloudsimulator.configration; + +import static org.onap.so.multicloudsimulator.utils.Constants.OPERATIONS_URL; +import org.onap.so.simulator.configuration.SimulatorSecurityConfigurer; +import org.onap.so.simulator.model.UserCredentials; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@Configuration +@EnableWebSecurity +public class WebSecurityConfigImpl extends SimulatorSecurityConfigurer { + + @Autowired + public WebSecurityConfigImpl(final UserCredentials userCredentials) { + super(userCredentials.getUsers()); + } + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers(OPERATIONS_URL + "/**/**").authenticated().and() + .httpBasic(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java new file mode 100644 index 00000000..b0e13362 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java @@ -0,0 +1,171 @@ +package org.onap.so.multicloudsimulator.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.MediaType; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.onap.so.multicloudsimulator.beans.InstanceResponse; +import org.onap.so.multicloudsimulator.beans.MulticloudInstanceRequest; +import org.onap.so.multicloudsimulator.beans.MulticloudCreateResponse; +import org.onap.so.multicloudsimulator.beans.MulticloudRequest; +import org.onap.so.openstack.beans.HeatStatus; + +import org.springframework.http.ResponseEntity; + +import org.springframework.web.bind.annotation.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URI; + +import static org.onap.so.multicloudsimulator.utils.Constants.BASE_URL; +@RestController +@RequestMapping(path = BASE_URL) +public class MultiCloudController { + + public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override"; + private static final Logger LOGGER = LoggerFactory.getLogger(MultiCloudController.class); + public MulticloudCreateResponse multicloudCreateResponse = new MulticloudCreateResponse(); + + @PostMapping(value="/v1/instance") + public ResponseEntity createInstance(@RequestBody MulticloudInstanceRequest req){ + System.out.println("MultiCloud createInstance "); + InstanceResponse InstanceResponse = new InstanceResponse(); + + return ResponseEntity.ok(InstanceResponse); + } + + @GetMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload", produces = { + MediaType.APPLICATION_JSON }) + public ResponseEntity getInstance( + @PathVariable("cloud-owner") String cloudOwner, @PathVariable("cloud-region-id") String cloudRegionId, + @RequestParam(value = "depth", required = false, defaultValue = "0") Integer depth, + @RequestParam(name = "format", required = false) final String name, final HttpServletRequest request) throws IOException { + + LOGGER.info("found CloudOwner {} in cache", cloudOwner); + LOGGER.info("found cloudRegionId {} in cache", cloudRegionId); + LOGGER.info("found name {} in cache", name); + JSONObject json = new JSONObject(); + + json.put("template_type", "heat"); + json.put("workload_id", ""); + json.put("workload_status", "GET_COMPLETE"); + JSONObject workload = new JSONObject(); + workload.put("stacks", HeatStatus.NOTFOUND); + json.put("workload_status_reason", workload); + + return ResponseEntity.ok(json); + } + + @PostMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity postCreateInstance( + @RequestBody final MulticloudRequest inputRequest, @PathVariable("cloud-owner") final String cloudOwner, + @PathVariable("cloud-region-id") final String cloudRegionId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) throws IOException { + + LOGGER.info("input request {}: ",inputRequest.toString()); + String input = "{\n" + + " \"template_type\": \"heat\",\n" + + " \"workload_id\": \"sad_sammet\",\n" + + " \"template_response\": [\n" + + " {\n" + + " \"GVK\": {\n" + + " \"Group\": \"k8s.plugin.opnfv.org\",\n" + + " \"Version\": \"v1alpha1\",\n" + + " \"Kind\": \"Network\"\n" + + " },\n" + + " \"Name\": \"k8s-region-2-onap-nf-20210120t221126760z-management-network\"\n" + + " },\n" + + " {\n" + + " \"GVK\": {\n" + + " \"Group\": \"k8s.plugin.opnfv.org\",\n" + + " \"Version\": \"v1alpha1\",\n" + + " \"Kind\": \"Network\"\n" + + " },\n" + + " \"Name\": \"k8s-region-2-onap-nf-20210120t221126760z-protected-network\"\n" + + " },\n" + + " {\n" + + " \"GVK\": {\n" + + " \"Group\": \"k8s.plugin.opnfv.org\",\n" + + " \"Version\": \"v1alpha1\",\n" + + " \"Kind\": \"Network\"\n" + + " },\n" + + " \"Name\": \"k8s-region-2-onap-nf-20210120t221126760z-unprotected-network\"\n" + + " },\n" + + " {\n" + + " \"GVK\": {\n" + + " \"Group\": \"k8s.cni.cncf.io\",\n" + + " \"Version\": \"v1\",\n" + + " \"Kind\": \"NetworkAttachmentDefinition\"\n" + + " },\n" + + " \"Name\": \"k8s-region-2-onap-nf-20210120t221126760z-ovn-nat\"\n" + + " }\n" + + " ],\n" + + " \"workload_status\": \"CREATE_COMPLETE\",\n" + + " \"workload_status_reason\": \"test\"\n" + + "}"; + + ObjectMapper objectMapper = new ObjectMapper(); + JSONObject workload = new JSONObject(); + + workload.put("stack",true); + + JsonNode jsonNode = objectMapper.readTree(workload.toJSONString()); + MulticloudCreateResponse multiResponse = objectMapper.readValue(input, MulticloudCreateResponse.class); + multiResponse.setWorkloadStatusReason(null); + + LOGGER.info("workload reason: {}",multiResponse.getWorkloadStatusReason()); + multiResponse.setWorkloadId("sad_sammet"); + multiResponse.setTemplateType("heat"); + multiResponse.setWorkloadStatus("CREATE_COMPLETE"); + + return ResponseEntity.status(201).body(multiResponse); + } + + @GetMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}", produces = { + MediaType.APPLICATION_JSON }) + public ResponseEntity getInstanceName( + @PathVariable("cloud-owner") String cloudOwner, @PathVariable("cloud-region-id") String cloudRegionId, + @PathVariable("workload-id") String workloadId, + @RequestParam(value = "depth", required = false, defaultValue = "0") Integer depth, + @RequestParam(name = "format", required = false) final String name, final HttpServletRequest request) throws IOException { + + LOGGER.info("Calling getInstanceName"); + LOGGER.info("found CloudOwner {} in cache", cloudOwner); + LOGGER.info("found cloudRegionId {} in cache", cloudRegionId); + LOGGER.info("found name {} in cache", name); + JSONObject json = new JSONObject(); + + json.put("template_type", "heat"); + json.put("workload_id", "sad_sammet"); + json.put("workload_status", "CREATE_COMPLETE"); + JSONObject workload = new JSONObject(); + workload.put("stacks", true); + json.put("workload_status_reason", null); + + return ResponseEntity.ok(json); + } + + @PostMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity postCreateInstanceName( + @RequestBody final MulticloudRequest inputRequest, @PathVariable("cloud-owner") final String cloudOwner, + @PathVariable("workload-id") String workloadId, + @PathVariable("cloud-region-id") final String cloudRegionId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) throws IOException { + + LOGGER.info("Calling postCreateInstanceName"); + + return ResponseEntity.status(405).build(); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java new file mode 100644 index 00000000..5f54f5da --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.multicloudsimulator.utils; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class Constants { + + public static final String BASE_URL = "/api/multicloud/v1"; + + public static final String OPERATIONS_URL = BASE_URL + "/operations"; + + public static final String SERVICE_TOPOLOGY_OPERATION_CACHE = "service-topology-operation-cache"; + + public static final String HEALTHY = "healthy"; + + public static final String YES = "Y"; + + public static final String SERVICE_TOPOLOGY_OPERATION = "service-topology-operation"; + + public static final String RESTCONF_CONFIG_END_POINT = "restconf/config/GENERIC-RESOURCE-API:services/service/"; + + public static final String VNF_DATA_VNF_TOPOLOGY = "/vnf-data/vnf-topology/"; + + public static final String SERVICE_DATA_VNFS_VNF = "/service-data/vnfs/vnf/"; + + private Constants() {} +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml new file mode 100644 index 00000000..7299ff92 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml @@ -0,0 +1,18 @@ +server: + port: 9996 + tomcat: + max-threads: 4 +ssl-enable: false +spring: + security: + users: + - username: mso + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID + - username: admin + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID + main: + allow-bean-definition-overriding: true \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java new file mode 100644 index 00000000..ccce88c9 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java @@ -0,0 +1,13 @@ +package org.onap.so.multicloudsimulator; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class MultiCloudSimulatorApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml index 9334a095..9173439f 100644 --- a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml @@ -99,6 +99,29 @@ + + simulators/multicloud-simulator + + try + docker-files + Dockerfile.so-simulator-base-image + + ${project.version} + + + + + + + org.onap.so.simulators:multicloud-simulator + + app.jar + + + + + + simulators/vnfm-simulator @@ -170,6 +193,11 @@ sdnc-simulator ${project.version} + + ${project.parent.groupId} + multicloud-simulator + ${project.version} + org.onap.so.simulators.vnfm vnfm-service diff --git a/plans/so/integration-etsi-testing/so-simulators/pom.xml b/plans/so/integration-etsi-testing/so-simulators/pom.xml index fb08bbb4..352c18b1 100644 --- a/plans/so/integration-etsi-testing/so-simulators/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/pom.xml @@ -18,6 +18,7 @@ common + multicloud-simulator sdc-simulator aai-simulator sdnc-simulator diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java index 2f24ef69..6077bddd 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java @@ -23,14 +23,24 @@ import static org.onap.sdnc.northbound.client.model.GenericResourceApiRequestAct import static org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE; import static org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration.DELETE; import static org.onap.so.sdncsimulator.utils.Constants.OPERATIONS_URL; +import static org.onap.so.sdncsimulator.utils.Constants.BASE_URL; +import static org.onap.so.sdncsimulator.utils.Constants.RESTCONF_CONFIG_END_POINT; + +import java.util.ArrayList; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; + import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; import org.onap.so.sdncsimulator.models.InputRequest; import org.onap.so.sdncsimulator.models.Output; import org.onap.so.sdncsimulator.models.OutputRequest; @@ -41,6 +51,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,7 +62,7 @@ import org.springframework.web.bind.annotation.RequestMapping; * */ @Controller -@RequestMapping(path = OPERATIONS_URL) +@RequestMapping(path = BASE_URL) public class OperationsController { private static final String HTTP_STATUS_OK = HttpStatus.OK.value() + ""; @@ -63,7 +75,7 @@ public class OperationsController { this.cacheServiceProvider = cacheServiceProvider; } - @PostMapping(value = "/GENERIC-RESOURCE-API:service-topology-operation/", + @PostMapping(value = "/operations/GENERIC-RESOURCE-API:service-topology-operation/", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity postServiceOperationInformation( @@ -90,7 +102,7 @@ public class OperationsController { } - @PostMapping(value = "/GENERIC-RESOURCE-API:vnf-topology-operation/", + @PostMapping(value = "/operations/GENERIC-RESOURCE-API:vnf-topology-operation/", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity postVnfOperationInformation( @@ -147,4 +159,60 @@ public class OperationsController { return cacheServiceProvider.putVnfOperationInformation(apiVnfOperationInformation); } + @PostMapping(value = "/operations/GENERIC-RESOURCE-API:vf-module-topology-operation/", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity postVfModuleOperationInformation( + @RequestBody final InputRequest inputRequest, + final HttpServletRequest request) { + LOGGER.info("Request Received for VfModule : {} ...", inputRequest); + + final GenericResourceApiVfModuleOperationInformation apiVfModuleperationInformation = inputRequest.getInput(); + if (apiVfModuleperationInformation == null) { + LOGGER.error("Invalid input request: {}", inputRequest); + return ResponseEntity.badRequest().build(); + } + + final Output output = getOutput(apiVfModuleperationInformation); + final OutputRequest outputRequest = new OutputRequest(output); + + if (output.getResponseCode().equals(HTTP_STATUS_OK)) { + LOGGER.info("Sucessfully executed request vnf sending response: {}", outputRequest); + return ResponseEntity.ok(outputRequest); + } + + LOGGER.error("Unable to execute input request: {}, will send OutputRequest: {}", inputRequest, outputRequest); + return ResponseEntity.badRequest().body(outputRequest); + + } + + private Output getOutput(final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation) { + + return cacheServiceProvider.putVfModuleOperationInformation(apiVfModuleOperationInformation); + } + + + @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vnf-topology/") + public ResponseEntity getVNf(@PathVariable("service-id") String serviceId, + @PathVariable("vnf-id") String vnfId) { + + LOGGER.info("Get vnf-topology with serviceId {} and vnfId {}",serviceId, vnfId); + GenericResourceApiVnfTopology genericResourceApiVnfTopology = new GenericResourceApiVnfTopology(); + + genericResourceApiVnfTopology = cacheServiceProvider.getGenericResourceApiVnfTopology(); + return ResponseEntity.ok(genericResourceApiVnfTopology); + } + + @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/vf-module-data/vf-module-topology/", produces = { + MediaType.APPLICATION_JSON }) + public ResponseEntity getVFmodule(@PathVariable("service-id") String serviceId, + @PathVariable("vnf-id") String vnfId, @PathVariable("vf-module-id") String vfModuleId) { + LOGGER.info("Get vfModule-topology with serviceId {}, vnfId {} and vfModuleId {}",serviceId, vnfId,vfModuleId); + + GenericResourceApiVfModuleTopology genericResourceApiVfModuleTopology = new GenericResourceApiVfModuleTopology(); + + genericResourceApiVfModuleTopology = cacheServiceProvider.getGenericResourceApiVfModuleTopology(); + return ResponseEntity.ok(genericResourceApiVfModuleTopology); + + } } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java index d64b0b0c..7cc0bdaf 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java @@ -48,7 +48,10 @@ public class Output implements Serializable { private GenericResourceApiInstanceReference serviceResponseInformation = null; @JsonProperty("vnf-response-information") - private GenericResourceApiInstanceReference vnfResponseInformation = null; + private GenericResourceApiInstanceReference vnfResponseInformation = null; + + @JsonProperty("vf-module-response-information") + private GenericResourceApiInstanceReference vfModuleResponseInformation = null; /** * @return the responseMessage @@ -164,6 +167,11 @@ public class Output implements Serializable { this.vnfResponseInformation = vnfResponseInformation; return this; + } + public Output vfModuleResponseInformation(final GenericResourceApiInstanceReference vfModuleResponseInformation) { + this.vfModuleResponseInformation = vfModuleResponseInformation; + return this; + } @JsonIgnore @@ -177,6 +185,7 @@ public class Output implements Serializable { sb.append(" responseCode: ").append(responseCode).append("\n"); sb.append(" serviceResponseInformation: ").append(serviceResponseInformation).append("\n"); sb.append(" vnfResponseInformation: ").append(vnfResponseInformation).append("\n"); + sb.append(" vfModuleResponseInformation: ").append(vfModuleResponseInformation).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java index c3a80ec3..d7dbec8e 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java @@ -19,10 +19,15 @@ */ package org.onap.so.sdncsimulator.providers; +import java.util.List; import java.util.Optional; + import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServicemodelinfrastructureService; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; import org.onap.so.sdncsimulator.models.Output; /** @@ -44,6 +49,11 @@ public interface ServiceOperationsCacheServiceProvider { Output deleteVnfOperationInformation(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation); - void clearAll(); + Output putVfModuleOperationInformation(final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation); + + public GenericResourceApiVfModuleTopology getGenericResourceApiVfModuleTopology(); -} + public GenericResourceApiVnfTopology getGenericResourceApiVnfTopology(); + + void clearAll(); +} \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java index 88db4c13..90255de2 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.validation.Valid; + import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference; import org.onap.sdnc.northbound.client.model.GenericResourceApiLastActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiLastRpcActionEnumeration; @@ -60,6 +61,17 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnf import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyidentifierstructureVnfTopologyIdentifierStructure; + +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; + import org.onap.so.sdncsimulator.models.Output; import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; @@ -82,6 +94,9 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ private static final String HTTP_STATUS_OK = Integer.toString(HttpStatus.OK.value()); private static final String EMPTY_STRING = ""; private static final Logger LOGGER = LoggerFactory.getLogger(ServiceOperationsCacheServiceProviderimpl.class); + private static List vfModuleList; + GenericResourceApiVfModuleTopology genericResourceApiVfModuleTopology = new GenericResourceApiVfModuleTopology(); + GenericResourceApiVnfTopology genericResourceApiVnfTopology = new GenericResourceApiVnfTopology(); @Autowired public ServiceOperationsCacheServiceProviderimpl(final CacheManager cacheManager) { @@ -198,7 +213,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ if (ifVnfNotExists(vnfId, svcAction, vnfsList)) { vnfsList.add(getGenericResourceApiServicedataVnf(serviceInstanceId, vnfId, input)); - + getVnfsList(vnfsList); final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus(); return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator()) @@ -507,4 +522,128 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } -} + @Override + public Output putVfModuleOperationInformation( + GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation(); + final GenericResourceApiVnfinformationVnfInformation vnfInformation = input.getVnfInformation(); + final GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = input.getVfModuleInformation(); + // Call getVfModule to make a vfList for get the vf-module-information while GET reqest + vfModuleList = getVfModule(input); + + final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); + final String svcRequestId = getSvcRequestId(requestHeader); + + if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId()) && vnfInformation != null + && isValid(vnfInformation.getVnfId()) && vfModuleInformation !=null && isValid(vfModuleInformation.getVfModuleId())) { + + + final String serviceInstanceId = serviceInformation.getServiceInstanceId(); + final String vnfId = vnfInformation.getVnfId(); + final String vfModuleId = vfModuleInformation.getVfModuleId(); + + final Optional optional = + getGenericResourceApiServicemodelinfrastructureService(serviceInstanceId); + if (optional.isPresent()) { + final GenericResourceApiServicemodelinfrastructureService service = optional.get(); + final GenericResourceApiServicedataServiceData serviceData = service.getServiceData(); + if (serviceData != null) { + + final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus(); + + return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator()) + .responseCode(serviceStatus.getResponseCode()) + .responseMessage(serviceStatus.getResponseMessage()).svcRequestId(svcRequestId) + .serviceResponseInformation(new GenericResourceApiInstanceReference() + .instanceId(serviceInstanceId).objectPath(getObjectPath(serviceInstanceId))) + .vnfResponseInformation(new GenericResourceApiInstanceReference().instanceId(vnfId) + .objectPath(getObjectPath(serviceInstanceId, vnfId))) + .vfModuleResponseInformation(new GenericResourceApiInstanceReference().instanceId(vfModuleId) + .objectPath(getObjectPath(vnfId, vfModuleId))); + } + } + LOGGER.error( + "Unable to find existing GenericResourceApiServiceModelInfrastructure in cache using service instance id: {}", + serviceInstanceId); + } + LOGGER.error( + "Unable to add GenericResourceApiServiceOperationInformation in cache due to invalid input: {}... ", + input); + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) + .responseMessage("Unable to add vfModule").svcRequestId(svcRequestId); + } + + private List getVfModule(GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiVfmoduletopologyVfModuleTopology apiVfModuletopologyVfModuleTopology = + new GenericResourceApiVfmoduletopologyVfModuleTopology(); + + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData vfModuleData = + new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData(); + vfModuleData.setVfModuleInformation(input.getVfModuleInformation()); + vfModuleData.setVfModuleRequestInput(input.getVfModuleRequestInput()); + + GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = new GenericResourceApiVfmoduletopologyVfModuleTopology(); + + vfModuleTopology.setSdncGeneratedCloudResources(true); + GenericResourceApiParam vfModuleParametersData = new GenericResourceApiParam(); + List params = new ArrayList(); + GenericResourceApiParamParam param = new GenericResourceApiParamParam(); + param.setName("k8s-rb-profile-name"); + param.setValue("k8s-rb-profile-value"); + + params.add(param); + vfModuleParametersData.setParam(params); + vfModuleTopology.setVfModuleParameters(vfModuleParametersData); + + vfModuleTopology.setOnapModelInformation(vfModuleData.getVfModuleInformation().getOnapModelInformation()); + vfModuleTopology.setVfModuleParameters(vfModuleData.getVfModuleRequestInput().getVfModuleInputParameters()); + vfModuleTopology.setAicClli(vfModuleData.getVfModuleRequestInput().getAicClli()); + vfModuleTopology.setAicCloudRegion(vfModuleData.getVfModuleRequestInput().getAicCloudRegion()); + vfModuleTopology.setCloudOwner(vfModuleData.getVfModuleRequestInput().getCloudOwner()); + + apiVfModuletopologyVfModuleTopology.vfModuleTopologyIdentifier(getVfModuleTopologyIdentifierStructure(input)); + + vfModuleTopology.setVfModuleTopologyIdentifier(apiVfModuletopologyVfModuleTopology.getVfModuleTopologyIdentifier()); + vfModuleTopology.setTenant(vfModuleData.getVfModuleRequestInput().getTenant()); + + genericResourceApiVfModuleTopology.setVfModuleTopology(vfModuleTopology); + + return null; + + } + + public GenericResourceApiVfModuleTopology getGenericResourceApiVfModuleTopology() { + return genericResourceApiVfModuleTopology; + } + + private GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier getVfModuleTopologyIdentifierStructure( + @Valid final GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = input.getVfModuleInformation(); + return new GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier() + .vfModuleId(vfModuleInformation.getVfModuleId()).vfModuleType(vfModuleInformation.getVfModuleType()).vfModuleName(input.getVfModuleRequestInput().getVfModuleName()); + } + + public GenericResourceApiVnfTopology getGenericResourceApiVnfTopology() { + return genericResourceApiVnfTopology; + } + + public void getVnfsList(List vnfsList) { + + GenericResourceApiVnftopologyVnfTopology vnfTopology = new GenericResourceApiVnftopologyVnfTopology(); + LOGGER.info(String.valueOf(vnfsList)); + vnfTopology.setOnapModelInformation(vnfsList.get(0).getVnfData().getVnfInformation().getOnapModelInformation()); + vnfTopology.setAicClli(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getAicClli())); + vnfTopology.setAicCloudRegion(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getAicCloudRegion())); + vnfTopology.setCloudOwner(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getCloudOwner())); + vnfTopology.setTenant(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getTenant())); + vnfTopology.setVnfResourceAssignments(vnfsList.get(0).getVnfData().getVnfTopology().getVnfResourceAssignments()); + vnfTopology.setVnfTopologyIdentifierStructure(vnfsList.get(0).getVnfData().getVnfTopology().getVnfTopologyIdentifierStructure()); + vnfTopology.setVnfParametersData(vnfsList.get(0).getVnfData().getVnfTopology().getVnfParametersData()); + vnfTopology.setSdncGeneratedCloudResources(vnfsList.get(0).getVnfData().getVnfTopology().getSdncGeneratedCloudResources()); + + genericResourceApiVnfTopology.setVnfTopology(vnfTopology); + } +} \ No newline at end of file diff --git a/plans/so/macroflow/cloud_owner_sql/cloud_owner.sql b/plans/so/macroflow/cloud_owner_sql/cloud_owner.sql new file mode 100644 index 00000000..e5147993 --- /dev/null +++ b/plans/so/macroflow/cloud_owner_sql/cloud_owner.sql @@ -0,0 +1,2 @@ +Use catalogdb; +insert into cloud_sites(ID, REGION_ID, IDENTITY_SERVICE_ID, CLOUD_VERSION, CLLI, ORCHESTRATOR) values("EtsiCloudRegion", "EtsiCloudRegion", "DEFAULT_KEYSTONE", "2.5", "clli2", "multicloud"); \ No newline at end of file diff --git a/plans/so/macroflow/setup.sh b/plans/so/macroflow/setup.sh new file mode 100644 index 00000000..8255562f --- /dev/null +++ b/plans/so/macroflow/setup.sh @@ -0,0 +1,194 @@ +#!/bin/bash + +MAVEN_VERSION_DIR="apache-maven-3.3.9" +MAVEN_TAR_FILE="$MAVEN_VERSION_DIR-bin.tar.gz" +MAVEN_TAR_LOCATION="https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/$MAVEN_TAR_FILE" + +# SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# Integration-Etsi Path +SCRIPT_HOME=$WORKSPACE/plans/so/integration-etsi-testing +SCRIPT_NAME=$(basename $0) +CONFIG_DIR=$SCRIPT_HOME/config +ENV_FILE=$CONFIG_DIR/env +TEMP_DIR_PATH=$SCRIPT_HOME/temp +TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab +DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml +DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE=$SCRIPT_HOME/docker-compose.local.yml +TEAR_DOWN_SCRIPT=$SCRIPT_HOME/teardown.sh +CAMUNDA_SQL_SCRIPT_NAME=mariadb_engine_7.10.0.sql +CAMUNDA_SQL_SCRIPT_DIR=$CONFIG_DIR/camunda-sql +TEST_LAB_SQL_SCRIPTS_DIR=$TEST_LAB_DIR_PATH/volumes/mariadb/docker-entrypoint-initdb.d/db-sql-scripts + +MAVEN_DIR=$TEMP_DIR_PATH/maven +INSTALLED_MAVEN_DIR=$MAVEN_DIR/$MAVEN_VERSION_DIR +MVN=$INSTALLED_MAVEN_DIR/bin/mvn +MVN_VERSION="$MVN -v" +MVN_SETTINGS_XML="$SCRIPT_HOME/settings.xml" +MVN_CLEAN_INSTALL="$MVN clean install" +SIMULATOR_MAVEN_PROJECT_POM="$SCRIPT_HOME/so-simulators/pom.xml" +WAIT_FOR_WORKAROUND_SCRIPT=$CONFIG_DIR/"wait-for-workaround-job.sh" +WAIT_FOR_POPULATE_AAI_SCRIPT=$CONFIG_DIR/"wait-for-aai-config-job.sh" +WAIT_FOR_CONTAINER_SCRIPT=$CONFIG_DIR/"wait-for-container.sh" + +# Macroflow Path +MACRO_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SQL_PATH=$MACRO_HOME/cloud_owner_sql + + + +echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." + +export $(egrep -v '^#' $ENV_FILE | xargs) + +MANDATORY_VARIABLES_NAMES=( "NEXUS_DOCKER_REPO_MSO" "DOCKER_ENVIRONMENT" "TAG" "TIME_OUT_DEFAULT_VALUE_SEC" "PROJECT_NAME" "DEFAULT_NETWORK_NAME", "ETSI_CATALOG_IMAGE_VERSION", "SOL_003_ADAPTER_IMAGE_VERSION", "ETSI_NFVO_NS_LCM_IMAGE_VERSION", "MARIADB_VERSION") + +for var in "${MANDATORY_VARIABLES_NAMES[@]}" + do + if [ -z "${!var}" ]; then + echo "Missing mandatory attribute $var in $ENV_FILE" + exit 1 + fi +done + +if [[ ! "$TEMP_DIR_PATH" || ! -d "$TEMP_DIR_PATH" ]]; then + echo "Creating temporary directory $TEMP_DIR_PATH" + mkdir $TEMP_DIR_PATH + + if [ $? -ne 0 ]; then + echo "Could not create $TEMP_DIR_PATH" + exit 1 + fi + +fi +echo "Will use ${TEMP_DIR_PATH} directory" + +if [[ ! "$MAVEN_DIR" || ! -d "$MAVEN_DIR" ]]; then + echo "Creating temporary maven directory $MAVEN_DIR" + mkdir $MAVEN_DIR + + if [ $? -ne 0 ]; then + echo "Could not create $MAVEN_DIR" + exit 1 + fi +fi +echo "Will use ${MAVEN_DIR} directory for maven install" + +if [[ ! "$INSTALLED_MAVEN_DIR" || ! -d "$INSTALLED_MAVEN_DIR" ]]; then + echo "Installing maven ..." + cd $MAVEN_DIR + + CURL=`which curl` + if [[ ! "$CURL" ]]; then + echo "curl command is not installed" + echo "Unable to execute test plan" + exit 1 + fi + curl -O $MAVEN_TAR_LOCATION + + TAR=`which tar` + if [[ ! "$TAR" ]]; then + echo "tar command is not installed" + echo "Unable to execute test plan" + exit 1 + fi + + tar -xzvf $MAVEN_TAR_FILE + + echo "Finished installing maven ..." +fi + +echo "Maven installed under directory $INSTALLED_MAVEN_DIR" + +$MVN_VERSION + +if [ $? -ne 0 ]; then + echo "Unable to run mvn -v command" + exit 1 +fi + +cd $SCRIPT_HOME + +echo "Will build simulator project using $MVN_CLEAN_INSTALL -f $SIMULATOR_MAVEN_PROJECT_POM --settings $MVN_SETTINGS_XML" +$MVN_CLEAN_INSTALL -f $SIMULATOR_MAVEN_PROJECT_POM --settings $MVN_SETTINGS_XML + +if [ $? -ne 0 ]; then + echo "Maven build failed" + exit 1 +fi + +echo "Will clone docker-config project ... " + + +if [[ -d "$TEST_LAB_DIR_PATH" ]]; then + echo "$TEST_LAB_DIR_PATH already exists" + echo "Removing $TEST_LAB_DIR_PATH directory ..." + rm -rf $TEST_LAB_DIR_PATH +fi + +git clone http://gerrit.onap.org/r/so/docker-config.git $TEST_LAB_DIR_PATH + +echo "Replacing $CAMUNDA_SQL_SCRIPT_NAME ..." +rm -rf $TEST_LAB_SQL_SCRIPTS_DIR/$CAMUNDA_SQL_SCRIPT_NAME +cp $CAMUNDA_SQL_SCRIPT_DIR/$CAMUNDA_SQL_SCRIPT_NAME $TEST_LAB_SQL_SCRIPTS_DIR + +export TEST_LAB_DIR=$TEST_LAB_DIR_PATH +export CONFIG_DIR_PATH=$CONFIG_DIR + +if [ "$DOCKER_ENVIRONMENT" == "remote" ]; then + echo "Starting docker containers with remote images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d +elif [ "$DOCKER_ENVIRONMENT" == "local" ]; then + echo "Starting docker containers with local images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -f $DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE -p $PROJECT_NAME up -d +else + echo "DOCKER_ENVIRONMENT not set correctly in $ENV_FILE. Allowed values: local | remote" + exit 1 +fi + +echo "Sleeping for 3m" +sleep 3m + +docker ps -a +export SQL_DIR_PATH=$SQL_PATH +docker cp $SQL_DIR_PATH/cloud_owner.sql $(docker container ls | grep mariadb | awk '{ print $1 }'):/ +docker exec $(docker container ls | grep mariadb | awk '{ print $1 }') sh -c 'mysql -u root -ppassword < /cloud_owner.sql' + +echo "Will execute $WAIT_FOR_WORKAROUND_SCRIPT script" +$WAIT_FOR_WORKAROUND_SCRIPT + +if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_WORKAROUND_SCRIPT failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 +fi + +echo "Will execute $WAIT_FOR_POPULATE_AAI_SCRIPT script" +$WAIT_FOR_POPULATE_AAI_SCRIPT + +if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_POPULATE_AAI_SCRIPT failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 +fi + +PODS_NAMES=( "api-handler-infra" "bpmn-infra") + +for pod in "${PODS_NAMES[@]}" + do + echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $pod container to start up" + $WAIT_FOR_CONTAINER_SCRIPT -c "$pod" -t "300" -n "$DEFAULT_NETWORK_NAME" + + if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_CONTAINER_SCRIPT for pod: $pod failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 + fi +done + +REPO_IP='127.0.0.1' +ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" + +echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME" diff --git a/plans/so/macroflow/teardown.sh b/plans/so/macroflow/teardown.sh new file mode 100644 index 00000000..82966887 --- /dev/null +++ b/plans/so/macroflow/teardown.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_HOME=$WORKSPACE/plans/so/integration-etsi-testing +SCRIPT_NAME=$(basename $0) +CONFIG_DIR=$SCRIPT_HOME/config +ENV_FILE=$CONFIG_DIR/env +TEMP_DIR_PATH=$SCRIPT_HOME/temp +TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab +DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml +DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE=$SCRIPT_HOME/docker-compose.local.yml + + +echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." +export $(egrep -v '^#' $ENV_FILE | xargs) +export TEST_LAB_DIR=$TEST_LAB_DIR_PATH +export CONFIG_DIR_PATH=$CONFIG_DIR + +echo "Sleeping 2m for completing the macroflow task" +sleep 2m + +if [ "$DOCKER_ENVIRONMENT" == "remote" ]; then + echo "Tearing down docker containers from remote images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down +elif [ "$DOCKER_ENVIRONMENT" == "local" ]; then + echo "Tearing down docker containers from local images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -f $DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE -p $PROJECT_NAME down +else + echo "Couldn't find valid property for DOCKER_ENVIRONMENT in $ENV_FILE." + echo "Attempting normal teardown ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down +fi + +echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME" diff --git a/plans/so/macroflow/testplan.txt b/plans/so/macroflow/testplan.txt new file mode 100644 index 00000000..00a8d8b7 --- /dev/null +++ b/plans/so/macroflow/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +so/sanity-check/macroflow.robot diff --git a/scripts/dmaap-datarouter/remove_cert_from_ca.py b/scripts/dmaap-datarouter/remove_cert_from_ca.py index 192e274f..4ed9b777 100644 --- a/scripts/dmaap-datarouter/remove_cert_from_ca.py +++ b/scripts/dmaap-datarouter/remove_cert_from_ca.py @@ -28,7 +28,7 @@ dr_cert_exists = False with open(cafile, 'r+b', buffering=0) as outfile: for line in outfile.readlines()[-35:-34]: - if "# Serial: 0x9EAEEDC0A7CEB59D" in line: + if '# Serial: 0x9EAEEDC0A7CEB59D'.encode() in line: dr_cert_exists = True if dr_cert_exists: outfile.seek(0, os.SEEK_END) diff --git a/tests/ccsdk-oran/polmansuite/__init__.robot b/tests/ccsdk-oran/polmansuite/__init__.robot deleted file mode 100644 index bf52713b..00000000 --- a/tests/ccsdk-oran/polmansuite/__init__.robot +++ /dev/null @@ -1,2 +0,0 @@ -*** Settings *** -Documentation Non-RT RIC Policy Management - polmansuite diff --git a/tests/ccsdk-oran/polmansuite/test.robot b/tests/ccsdk-oran/polmansuite/test.robot deleted file mode 100644 index 59d73eb8..00000000 --- a/tests/ccsdk-oran/polmansuite/test.robot +++ /dev/null @@ -1,17 +0,0 @@ -*** Settings *** -Library OperatingSystem -Library Process - -*** Test Cases *** - -Functional Test Case 1 - [Documentation] Deploy PMS without SDNC - Start Process ${ARCHIVES}/test/pms_a1sim.sh - ${cli_cmd_output}= Wait For Process timeout=3600 - Should Be Equal as Integers ${cli_cmd_output.rc} 0 - -Functional Test Case 2 - [Documentation] Deploy PMS with SDNC - Start Process ${ARCHIVES}/test/pms_a1sim_sdnc.sh - ${cli_cmd_output}= Wait For Process timeout=3600 - Should Be Equal as Integers ${cli_cmd_output.rc} 0 diff --git a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Ftp-suite/FuncSingleFileFtp.robot b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Ftp-suite/FuncSingleFileFtp.robot index cecb8d11..bb70b502 100755 --- a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Ftp-suite/FuncSingleFileFtp.robot +++ b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Ftp-suite/FuncSingleFileFtp.robot @@ -109,3 +109,5 @@ Set Default Environment Variables Set Environment Variable HTTP_SIMS http-https-server0:80 Set Environment Variable HTTPS_SIMS http-https-server0:443 Set Environment Variable HTTPS_SIMS_NO_AUTH http-https-server0:8080 + Set Environment Variable HTTP_JWT_SIMS http-https-server0:32000 + Set Environment Variable HTTPS_JWT_SIMS http-https-server0:32100 diff --git a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Http-suite/FuncSingleFileHttp.robot b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Http-suite/FuncSingleFileHttp.robot index f279391c..f96c2f96 100755 --- a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Http-suite/FuncSingleFileHttp.robot +++ b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-Http-suite/FuncSingleFileHttp.robot @@ -112,3 +112,5 @@ Set Default Environment Variables Set Environment Variable HTTP_SIMS http-https-server0:80 Set Environment Variable HTTPS_SIMS http-https-server0:443 Set Environment Variable HTTPS_SIMS_NO_AUTH http-https-server0:8080 + Set Environment Variable HTTP_JWT_SIMS http-https-server0:32000 + Set Environment Variable HTTPS_JWT_SIMS http-https-server0:32100 diff --git a/tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/HttpsVariousConnectionTypes.robot b/tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/HttpVariousConnectionTypes.robot similarity index 82% rename from tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/HttpsVariousConnectionTypes.robot rename to tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/HttpVariousConnectionTypes.robot index c8d09c2b..9e69e536 100755 --- a/tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/HttpsVariousConnectionTypes.robot +++ b/tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/HttpVariousConnectionTypes.robot @@ -22,16 +22,29 @@ Verify single event with single 1MB file with HTTPS connection (basic authentica Verify single event with single 1MB file HTTPS connection (client certificate authentication). From event poll to published file [TAGS] DFC_FUNCTIONAL_41 - [Documentation] Verify single event with single HTTPS (basic authentication) 5MB file from event poll to published file. + [Documentation] Verify single event with single 1MB file HTTPS connection (client certificate authentication). From event poll to published file Verify Single Event From Event Poll To Published File 1 --tc403 HTTPS Verify single event with single 1MB file HTTPS (no authentication). From event poll to published file [TAGS] DFC_FUNCTIONAL_42 - [Documentation] Verify single event with single HTTPS (basic authentication) 50MB file from event poll to published file. + [Documentation] Verify single event with single 1MB file HTTPS (no authentication). From event poll to published file Verify Single Event From Event Poll To Published File 1 --tc404 HTTPS +Verify single event with single 1MB file with HTTP JWT. From event poll to published file + [TAGS] DFC_FUNCTIONAL_43 + [Documentation] Verify single event with single 1MB file with HTTP JWT. From event poll to published file + ${cli_cmd_output}= Run Process ${DFC_ROOT}/../dfc-containers-clean.sh stderr=STDOUT + Verify Single Event From Event Poll To Published File 1 --tc303 HTTP + + +Verify single event with single 1MB file with HTTPS JWT. From event poll to published file + [TAGS] DFC_FUNCTIONAL_44 + [Documentation] Verify single event with single 1MB file with HTTPS JWT. From event poll to published file + ${cli_cmd_output}= Run Process ${DFC_ROOT}/../dfc-containers-clean.sh stderr=STDOUT + Verify Single Event From Event Poll To Published File 1 --tc405 HTTPS + *** Keywords *** Verify Single Event From Event Poll To Published File @@ -93,3 +106,5 @@ Set Default Environment Variables Set Environment Variable HTTP_SIMS http-https-server0:80 Set Environment Variable HTTPS_SIMS http-https-server0:443 Set Environment Variable HTTPS_SIMS_NO_AUTH http-https-server0:8080 + Set Environment Variable HTTP_JWT_SIMS http-https-server0:32000 + Set Environment Variable HTTPS_JWT_SIMS http-https-server0:32100 diff --git a/tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/__init__.robot b/tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/__init__.robot new file mode 100755 index 00000000..b4fa2714 --- /dev/null +++ b/tests/dcaegen2-collectors-datafile/testsuites/HTTP-Various-Connection-Types-suite/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation DFC HTTP/HTTPS various connection types test suite. Single event with single file. diff --git a/tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/__init__.robot b/tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/__init__.robot deleted file mode 100755 index dac245f8..00000000 --- a/tests/dcaegen2-collectors-datafile/testsuites/HTTPS-Various-Connection-Types-suite/__init__.robot +++ /dev/null @@ -1,2 +0,0 @@ -*** Settings *** -Documentation DFC HTTPS various connection types test suite. Single event with single file. diff --git a/tests/dcaegen2-collectors-datafile/testsuites/Strict-Host-Checking-suite/StrictHostChecking.robot b/tests/dcaegen2-collectors-datafile/testsuites/Strict-Host-Checking-suite/StrictHostChecking.robot index 9baf11f6..61f689d1 100755 --- a/tests/dcaegen2-collectors-datafile/testsuites/Strict-Host-Checking-suite/StrictHostChecking.robot +++ b/tests/dcaegen2-collectors-datafile/testsuites/Strict-Host-Checking-suite/StrictHostChecking.robot @@ -93,6 +93,8 @@ Setup Strict Host Key Checking Test Set Environment Variable HTTP_SIMS http-https-server0:80 Set Environment Variable HTTPS_SIMS http-https-server0:443 Set Environment Variable HTTPS_SIMS_NO_AUTH http-https-server0:8080 + Set Environment Variable HTTP_JWT_SIMS http-https-server0:32000 + Set Environment Variable HTTPS_JWT_SIMS http-https-server0:32100 ${cli_cmd_output}= Run Process ./simulators-start.sh cwd=${SIMGROUP_ROOT} Log To Console Simulator-start: diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot new file mode 100644 index 00000000..9eda6de0 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Files Processing Config PM Mapper Testcases diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes new file mode 100644 index 00000000..57cdc503 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml new file mode 100644 index 00000000..8a3bcf4d --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env new file mode 100644 index 00000000..050d2f2a --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=10 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env new file mode 100644 index 00000000..c138912b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env new file mode 100644 index 00000000..b4c290e8 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=10 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json new file mode 100644 index 00000000..da809d7b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Ericsson", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V9" + } \ No newline at end of file diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot new file mode 100644 index 00000000..09a7de4f --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot @@ -0,0 +1,148 @@ +*** Settings *** +Documentation Testing PM Mapper functionality +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library Process +Library String +Library libraries/DockerContainerManager.py +Library libraries/LogReader.py + +*** Variables *** + +${NR_VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json +${CLI_EXEC_CLI_PM_LOG_CLEAR} docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1 +${CLI_EXEC_LOGS_LIST} docker exec datarouter-node /bin/sh -c "ls /opt/app/datartr/logs" +${DOCKER_CLIENT_IMAGE} nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:latest +${CLIENT_CONTAINER_NAME} pmmapper +${FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml +${CONFIG_ENVS_1_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env +${CONFIG_ENVS_4_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_4_1.env +${CONFIG_ENVS_10_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env +${CONFIG_ENVS_1_10} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env + +*** Test Cases *** + +Verify that PM Mapper rejects 6-9 messages when limitRate is 1 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_1 + [Documentation] Verify that PM Mapper rejects 6-9/10 messages. Configuration: limitRate=1, threadsCount=1 + [Timeout] 15 minute + + RestartPmmapper ${CONFIG_ENVS_1_1} + + ${testname}= Set Variable Afirst- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 40s + ${isCorrectDroppedCount}= Evaluate ${5} < ${dropped_nr} < ${10} + SavePmMapperLogsAndDroppedCount config_1_1 ${dropped_nr} + Should Be True ${isCorrectDroppedCount} Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 6-9 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 10 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_2 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=10, threadsCount=1 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_10_1} + + ${testname}= Set Variable Athird- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_10_1 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 1 and threads count is 10 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_3 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=1, threadsCount=10 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_1_10} + + ${testname}= Set Variable Afourth- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_1_10 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +*** Keywords *** + +SendFilesToDatarouter + [Arguments] ${testnr} + FOR ${i} IN RANGE 10 + SendToDatarouter ${FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=${i} ${testnr} ${i} + END + Sleep 20s + +SendToDatarouter + [Arguments] ${filepath} ${metadatapath} ${request_id} ${testnr} ${i} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${newFilename} Catenate SEPARATOR= ${testnr} ${i} .xml + ${resp}= PutCall ${PUBLISH_NODE_URL}/${newFilename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + +PutCall + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream X-DMAAP-DR-ON-BEHALF-OF=${user} Authorization=Basic cG1tYXBwZXI6cG1tYXBwZXI= + ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests + [Return] ${resp} + +VerifyResponse + [Arguments] ${actual_response_value} ${expected_response_value} + Should Be Equal As Strings ${actual_response_value} ${expected_response_value} + +ClearLogs + Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes + +GetLogsOutput + ${filesString}= Run Process ${CLI_EXEC_LOGS_LIST} shell=yes + ${filesList}= Get Log Files List ${filesString.stdout} + ${output}= Set Variable ${EMPTY} + FOR ${file} IN @{filesList} + ${file_path}= Catenate SEPARATOR= "cat /opt/app/datartr/logs/ ${file} " + ${exec}= Catenate docker exec datarouter-node /bin/sh -c ${file_path} + ${single_file}= Run Process ${exec} shell=yes + ${output}= Catenate SEPARATOR=\n ${output} ${single_file.stdout} + END + [Return] ${output} + +GetFilteredLogs + [Arguments] ${all_logs} ${testname} + ${filtered_logs}= Filter Unique ${all_logs} ${testname} + [Return] ${filtered_logs} + +GetDroppedNumber + [Arguments] ${logs_output} + ${number}= Get Number Of Dropped Messages ${logs_output} + [Return] ${number} + +RestartPmmapper + [Arguments] ${envs} + Remove Container ${CLIENT_CONTAINER_NAME} + Sleep 5s + Run Pmmapper Container ${DOCKER_CLIENT_IMAGE} ${CLIENT_CONTAINER_NAME} ${envs} ${DR_NODE_IP} ${NODE_IP} + Sleep 15s + +SavePmMapperLogsAndDroppedCount + [Arguments] ${test_name} ${dropped_count} + Run Process echo "Dropped: ${dropped_count}" > %{WORKSPACE}/archives/${test_name}_dropped_count.log shell=yes + Run Process docker logs ${CLIENT_CONTAINER_NAME} > %{WORKSPACE}/archives/${test_name}_pm_mapper_container_logs.log shell=yes + diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py new file mode 100644 index 00000000..3e3ae58e --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py @@ -0,0 +1,29 @@ +import docker +from EnvsReader import EnvsReader +from docker.types import Mount + +class DockerContainerManager: + + def run_pmmapper_container(self, client_image, container_name, path_to_env, dr_node_ip, mr_ip): + client = docker.from_env() + environment = EnvsReader().read_env_list_from_file(path_to_env) + environment.append("CONFIG_BINDING_SERVICE_SERVICE_HOST=172.18.0.5") + environment.append("CONFIG_BINDING_SERVICE_SERVICE_PORT=10000") + environment.append("HOSTNAME=pmmapper") + client.containers.run( + image=client_image, + name=container_name, + environment=environment, + ports={'8081': 8081}, + network='filesprocessingconfigpmmapper_pmmapper-network', + extra_hosts={'dmaap-dr-node': dr_node_ip, 'message-router': mr_ip}, + user='root', + mounts=[Mount(target='/opt/app/pm-mapper/etc/certs/', source='/var/tmp/', type='bind')], + detach=True + ) + + def remove_container(self, container_name): + client = docker.from_env() + container = client.containers.get(container_name) + container.stop() + container.remove() diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py new file mode 100644 index 00000000..cc60eed6 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py @@ -0,0 +1,11 @@ + +class EnvsReader: + + def read_env_list_from_file(self, path): + f = open(path, "r") + r_list = [] + for line in f: + line = line.strip() + if line[0] != "#": + r_list.append(line) + return r_list diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py new file mode 100644 index 00000000..01718e35 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py @@ -0,0 +1,22 @@ +import re + +class LogReader: + + def filter_unique(self, merged_logs_output, testname): + logs = merged_logs_output.splitlines() + del_logs = list(filter(lambda line: "|DEL|" in line, logs)) + nrs_set = set() + ret_logs = set() + for log in del_logs: + filename = re.findall(testname + "\d", log) + if len(filename) > 0 and filename[0] not in nrs_set: + ret_logs.add(log) + nrs_set.add(filename[0]) + return ret_logs + + def get_number_of_dropped_messages(self, logs_output): + return len(list(filter(lambda line: "|429|" in line, logs_output))) + + def get_log_files_list(self, fileNames): + files = fileNames.split() + return files diff --git a/tests/dcaegen2/testcases/assets/json_events/ves7_pnf_registration_event.json b/tests/dcaegen2/testcases/assets/json_events/ves7_pnf_registration_event.json index dcd3aa5d..1726e064 100644 --- a/tests/dcaegen2/testcases/assets/json_events/ves7_pnf_registration_event.json +++ b/tests/dcaegen2/testcases/assets/json_events/ves7_pnf_registration_event.json @@ -28,7 +28,7 @@ "unitFamily": "BBU", "vendorName": "Nokia", "oamV4IpAddress": "10.11.12.13", - "oamV6IpAddress": "1::::9", + "oamV6IpAddress": "2001:db2:31:1041:204a::1337", "softwareVersion": "val7" } } diff --git a/tests/so/sanity-check/data/macroflow.json b/tests/so/sanity-check/data/macroflow.json new file mode 100644 index 00000000..87f782a4 --- /dev/null +++ b/tests/so/sanity-check/data/macroflow.json @@ -0,0 +1,161 @@ +{ + "requestDetails": { + "requestInfo": { + "suppressRollback": false, + "productFamilyId": "1234", + "requestorId": "demo", + "instanceName": "CsitEtsiInstance", + "source": "VID" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantId": "b9202a74-4c16-4245-83ad-1cd53c813214", + "modelVersionId": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "modelName": "vfw_k8s_demo_CNF", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "tenantId": "693c7729b2364a26a3ca602e6f66187d", + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "EtsiCloudRegion" + }, + "subscriberInfo": { + "globalSubscriberId": "DemoCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "vCPE", + "userParams": [{ + "Homing_Solution": "none" + }, { + "service": { + "instanceParams": [], + "instanceName": "CsitEtsiInstance", + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelName": "VF_vfw_k8s_demo_CNF", + "modelVersionId": "daeb6a5c-3a8a-40b0-a575-8cca71dd0b7c", + "modelInvariantUuid": "517403c8-fab8-4cfe-9bc5-d94f5e34b257", + "modelVersion": "1.0", + "modelCustomizationId": "8b8b67bd-01a4-42f7-b0fc-1d3a0f2765fd", + "modelInstanceName": "VF_vfw_k8s_demo_CNF 0" + }, + "cloudConfiguration": { + "tenantId": "693c7729b2364a26a3ca602e6f66187d", + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "EtsiCloudRegion" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "LOB-Demonstration" + }, + "productFamilyId": "1234", + "instanceName": "VF_frankfurt_vfw_k8s_demo_final", + "instanceParams": [{ + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "1.0.45", + "sdnc_artifact_name": "vnf" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..base_template..module-0", + "modelVersionId": "86224a10-c17e-42c9-9809-f3c31ba1b781", + "modelInvariantUuid": "2bc34946-d57d-4053-9e9f-d60587c9aa12", + "modelVersion": "1", + "modelCustomizationId": "905ffa63-7011-4cbe-943c-237f303b4e9f" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..base_template..module-0", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "test-vfw1", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "1.0.45", + "vf_module_label": "base_template" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vsn..module-1", + "modelVersionId": "3c50323b-5f8c-4b31-938f-8e996a2e0001", + "modelInvariantUuid": "11e50367-a4c9-4203-a838-518446ec816a", + "modelVersion": "1", + "modelCustomizationId": "1812807a-9f6b-42e4-b78c-814c3fea5a4c" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vsn..module-1", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vsn" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vpkg..module-2", + "modelVersionId": "104e8b4e-d404-4a5b-9beb-f92a217fd6ee", + "modelInvariantUuid": "1782dcdb-2a4c-4665-8d04-be6b989fea8e", + "modelVersion": "1", + "modelCustomizationId": "02fb0319-f37d-4e8b-9009-263fffdb2549" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vpkg..module-2", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vpkg" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vfw..module-3", + "modelVersionId": "a5f678db-2e5f-47be-8fab-1540bc7482d8", + "modelInvariantUuid": "c0869243-7667-4434-b9cc-84791f07a13a", + "modelVersion": "1", + "modelCustomizationId": "f144c7c8-da93-4e06-ba93-d26e69eba509" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vfw..module-3", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vfw" + } + ] + } + + ] + } + ] + }, + "modelInfo": { + "modelVersion": "1.0", + "modelVersionId": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "modelInvariantId": "b9202a74-4c16-4245-83ad-1cd53c813214", + "modelName": "vfw_k8s_demo_CNF", + "modelType": "service" + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "etsiCsitProject" + }, + "owningEntity": { + "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a", + "owningEntityName": "OE-Demonstration" + } + } +} diff --git a/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json b/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json new file mode 100644 index 00000000..02485e18 --- /dev/null +++ b/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json @@ -0,0 +1,294 @@ +{ + "distributionID": "2d6c5aa8-b644-4f30-a632-5577801ef959", + "serviceName": "vfw_k8s_demo_CNF", + "serviceVersion": "1.0", + "serviceUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "serviceDescription": "service", + "serviceInvariantUUID": "b9202a74-4c16-4245-83ad-1cd53c813214", + "resources": [ + { + "resourceInstanceName": "VF_vfw_k8s_demo_CNF 0", + "resourceName": "VF_vfw_k8s_demo_CNF", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "daeb6a5c-3a8a-40b0-a575-8cca71dd0b7c", + "resourceInvariantUUID": "517403c8-fab8-4cfe-9bc5-d94f5e34b257", + "resourceCustomizationUUID": "8b8b67bd-01a4-42f7-b0fc-1d3a0f2765fd", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [{ + "artifactName": "vf_vfw_k8s_demo_cnf0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/unzipped_sdc_csar/vf_vfw_k8s_demo_cnf0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "86224a10-c17e-42c9-9809-f3c31ba1b781", + "artifactVersion": "1" + }, +{ + "artifactName": "vf_vfw_k8s_demo_cnf1_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/unzipped_sdc_csar/vf_vfw_k8s_demo_cnf0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "3c50323b-5f8c-4b31-938f-8e996a2e0001", + "artifactVersion": "1" + }, + +{ + "artifactName": "base_template.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "ede4c2de-133f-49e3-9daa-8c56b65b5c6b", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + }, + +{ + "artifactName": "base_template.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "7f1dbc99-849e-4af8-bdcb-6c214f939428", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "71607418-af27-4712-8e0c-cfe992b95a38", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vfw.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vfw_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "33f7aab2-3324-4523-b37a-625b0cf77dfe", + "artifactVersion": "1" + }, +{ + "artifactName": "vpkg_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vpkg_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8ab17b5a-3fbd-4142-a75f-c55ffd4c5af5", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vsn.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "e17c1e60-f7da-4767-9a0e-02c8ff9c0f2e", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "989dbc01-2fa5-463b-abaa-cf73996ea12b", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vfw_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + }, +{ + "artifactName": "vpkg_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vpkg_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8ab17b5a-3fbd-4142-a75f-c55ffd4c5af5", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "aaeee885-5821-4e08-8da6-0bb3b74f24e9", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "b4510b34-e39c-4239-bacc-7dd2f3c2a418", + "artifactVersion": "1" + } + +, +{ + "artifactName": "base_template.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/base_template.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "33f7aab2-3324-4523-b37a-625b0cf77dfe", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vfw.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vfw.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vpkg.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vpkg.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "42b80d18-69ec-4233-8844-f0df6ebb6e3d", + "artifactVersion": "1" + } +, +{ + "artifactName": "vsn.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vsn.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/unzipped_sdc_csar/vendor-license-model.xml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6e1dbc99-849e-4af8-bdcb-6c214f939491", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/unzipped_sdc_csar/vf-license-model.xml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "ede4c2de-133f-49e3-9daa-8c56b65b5c6b", + "artifactVersion": "1" + } + +] + } + + + ], + "serviceArtifacts": [ + { + "artifactName": "service-VfwK8sDemoCnf-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/unzipped_sdc_csar/service-VfwK8sDemoCnf-template.yml", + "artifactChecksum": "NTUzMDU5YzM3MTk4OGNiNjQ2OGRlMWY2YjU3MjE2YjM\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "artifactVersion": "1" + }, + { + "artifactName": "service-VfwK8sDemoCnf-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/unzipped_sdc_csar/service-VfwK8sDemoCnf-csar.csar", + "artifactChecksum": "ZTRhOGI0M2UxN2ZhYjQ0ODI5ZDZhZTExZTFkMGU3N2Y\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} + diff --git a/tests/so/sanity-check/macroflow.robot b/tests/so/sanity-check/macroflow.robot new file mode 100644 index 00000000..92224ea1 --- /dev/null +++ b/tests/so/sanity-check/macroflow.robot @@ -0,0 +1,25 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Test Cases *** +Distribute Service Template + Create Session sdc_controller_session http://${REPO_IP}:8085 + ${data}= Get Binary File ${CURDIR}${/}data${/}serviceBasicVfCnfnotification.json + &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/distribution-test-zip/unzipped/ Content-Type=application/json Accept=application/json + ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers} + Log To Console Received status code: ${resp.status_code} + Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result + Should Be Equal As Strings '${resp.status_code}' '200' + + +Macroflow + Create Session api_handler_session http://${REPO_IP}:8080 + ${data}= Get Binary File ${CURDIR}${/}data${/}macroflow.json + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances data=${data} headers=${headers} + Log To Console Received status code: ${service_instantiation_request.status_code} + Run Keyword If '${service_instantiation_request.status_code}' == '202' log to console \nexecuted with expected result + Should Be Equal As Strings '${service_instantiation_request.status_code}' '202'