From 06c4aa69e525c7865a9465c11594a271c3e5ffbd Mon Sep 17 00:00:00 2001 From: Jonathan Platt Date: Wed, 28 Jul 2021 13:00:04 -0400 Subject: Add A&AI Mock Response Simulator for Testing Added A&AI mock response simulator for CSIT test cases. Issue-ID: SDNC-1586 Signed-off-by: Jonathan Platt Change-Id: I89ab08598ae3628e668353097a6763c50951a14d Former-commit-id: 698315d91a4071d467bb7760f57d3584c9008c28 --- csit/plans/sdnc/setup.sh | 14 ---- csit/scripts/aaisimulator/aaiclient.properties | 82 ++++++++++++++++++++++ .../aaisimulator/wiremock/mappings/aai.json | 41 +++++++++++ csit/scripts/docker-compose.yml | 19 +++++ 4 files changed, 142 insertions(+), 14 deletions(-) create mode 100755 csit/scripts/aaisimulator/aaiclient.properties create mode 100755 csit/scripts/aaisimulator/wiremock/mappings/aai.json diff --git a/csit/plans/sdnc/setup.sh b/csit/plans/sdnc/setup.sh index 5b8e4fa8..2a418e6f 100644 --- a/csit/plans/sdnc/setup.sh +++ b/csit/plans/sdnc/setup.sh @@ -147,20 +147,6 @@ cp ${REQUEST_DATA_PATH}/mount.xml.tmpl ${REQUEST_DATA_PATH}/mount.xml sed -i "s/pnfaddr/${LOCAL_IP}/g" "${REQUEST_DATA_PATH}"/mount.xml -# Load test dgs -docker exec ${SDNC_CONTAINER_NAME} mkdir -p /tmp/gra.patch - -for file in ${WORKSPACE}/plans/sdnc/testdata/*xml -do - docker cp $file ${SDNC_CONTAINER_NAME}:/tmp/gra.patch - mname=$(basename $file | cut -d. -f1| cut -d_ -f1) - bname=$(basename $file | cut -d. -f1| cut -d_ -f2-) - echo ${mname} ${bname} aai-disabled sync >> ${WORKSPACE}/archives/graph.versions -done -docker cp ${WORKSPACE}/archives/graph.versions ${SDNC_CONTAINER_NAME}:/tmp/gra.patch -docker exec ${SDNC_CONTAINER_NAME} /opt/onap/sdnc/svclogic/bin/svclogic.sh install /tmp/gra.patch /opt/onap/sdnc/svclogic/config/svclogic.properties - - ######################################################################### # Export SDNC, AAF-Certservice-Cient, Netconf-Pnp-Simulator Continer Names diff --git a/csit/scripts/aaisimulator/aaiclient.properties b/csit/scripts/aaisimulator/aaiclient.properties new file mode 100755 index 00000000..74b5e567 --- /dev/null +++ b/csit/scripts/aaisimulator/aaiclient.properties @@ -0,0 +1,82 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 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========================================================= +### + +# +# Configuration file for A&AI Client +# + +# +# Certificate keystore and truststore +# +org.onap.ccsdk.sli.adaptors.aai.ssl.trust=/opt/onap/sdnc/data/stores/truststoreONAPall.jks +org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd=${AAI_TRUSTSTORE_PASSWORD} +org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=true + +org.onap.ccsdk.sli.adaptors.aai.client.name=${AAI_CLIENT_NAME} +org.onap.ccsdk.sli.adaptors.aai.client.psswd=${AAI_CLIENT_PASSWORD} + +org.onap.ccsdk.sli.adaptors.aai.application=openECOMP +# +# Configuration file for A&AI Client +# +org.onap.ccsdk.sli.adaptors.aai.uri=http://aaihost:8080 +connection.timeout=60000 +read.timeout=60000 + +# query +org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v13/search/sdn-zone-query +org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v13/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name} +org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v13/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3 + +# named query +org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query + +#update +org.onap.ccsdk.sli.adaptors.aai.update=/aai/v13/actions/update + +# UBB Notify +org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v13/actions/notify +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=<%= @ubbUri %>/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=<%= @ubbUri %>/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information + +# P-Interfaces +org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces +org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name} + +# VNF IMAGES +org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v13/service-design-and-creation/vnf-images +org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v13/service-design-and-creation/vnf-images/vnf-image/{att-uuid} +org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} + +# service instance +org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query=/aai/v13/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance +org.onap.ccsdk.sli.adaptors.aai.path.service.instance=/aai/v13/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id} + +# VNF IMAGES QUERY +org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} + +# +# Formatting +# +org.onap.ccsdk.sli.adaptors.aai.param.format=filter=%s:%s +org.onap.ccsdk.sli.adaptors.aai.param.vnf_type=vnf-type +org.onap.ccsdk.sli.adaptors.aai.param.physical.location.id=physical-location-id +org.onap.ccsdk.sli.adaptors.aai.param.service.type=service-type diff --git a/csit/scripts/aaisimulator/wiremock/mappings/aai.json b/csit/scripts/aaisimulator/wiremock/mappings/aai.json new file mode 100755 index 00000000..64739068 --- /dev/null +++ b/csit/scripts/aaisimulator/wiremock/mappings/aai.json @@ -0,0 +1,41 @@ +{ + "mappings": [{ + "request": { + "method": "GET", + "url": "/aai/v24/business/customers/customer/testsvc1/service-subscriptions/service-subscription/test/service-instances/service-instance/5c4f2d89-57a3-47e9-b49b-d3c63eb0b3ca?depth=1" + }, + "response": { + "status": 200, + "jsonBody": { + "service-instance-id": "5c4f2d89-57a3-47e9-b49b-d3c63eb0b3ca", + "service-instance-name": "Nzrdm61asmsf01_svc", + "service-type": "INFRASTRUCTURE", + "service-role": "PROVIDER-NETWORK", + "environment-context": "General_Revenue-Bearing", + "workload-context": "Testing", + "resource-version": "1616417209896", + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/5c4f2d89-57a3-47e9-b49b-d3c63eb0b3ca/service-data/service-topology/", + "orchestration-status": "Inventoried" + } + } + }, + { + "request": { + "method": "PATCH", + "url": "/aai/v24/business/customers/customer/testsvc1/service-subscriptions/service-subscription/test/service-instances/service-instance/5c4f2d89-57a3-47e9-b49b-d3c63eb0b3ca?resource-version=1616417209896", + "bodyPatterns": [{ + "equalToJson": { + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/5c4f2d89-57a3-47e9-b49b-d3c63eb0b3ca/service-data/service-topology/", + "resource-version": "1616417209896", + "service-instance-name": "zrdm61asmsf01_svc" + }, + "ignoreArrayOrder": true, + "ignoreExtraElements": true + }] + }, + "response": { + "status": 200 + } + } + ] +} diff --git a/csit/scripts/docker-compose.yml b/csit/scripts/docker-compose.yml index 525538a4..b852c973 100755 --- a/csit/scripts/docker-compose.yml +++ b/csit/scripts/docker-compose.yml @@ -22,12 +22,30 @@ services: max-size: "30m" max-file: "5" + aaisim: + image: rodolpheche/wiremock + ports: + - "8080:8080" + command: --verbose + container_name: aaisim + volumes: + - /etc/localtime:/etc/localtime:ro + - ./aaisimulator/wiremock:/home/wiremock:ro + hostname: + aaisim + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + sdnc: image: onap/sdnc-image:latest container_name: sdnc_controller volumes: - /etc/localtime:/etc/localtime:ro - $SDNC_CERT_PATH:/opt/opendaylight/current/certs + - ./aaisimulator/aaiclient.properties:/opt/onap/sdnc/data/properties/aaiclient.properties:ro entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"] ports: - "8282:8181" @@ -37,6 +55,7 @@ services: - mariadb:dbhost - mariadb:sdnctldb01 - mariadb:sdnctldb02 + - aaisim:aaihost environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - MYSQL_USER=${MYSQL_USER} -- cgit 1.2.3-korg