summaryrefslogtreecommitdiffstats
path: root/conductor
diff options
context:
space:
mode:
Diffstat (limited to 'conductor')
-rw-r--r--conductor/conductor/tests/functional/simulators/aaisim/aai_imposter.jsont23
-rw-r--r--conductor/conductor/tests/functional/simulators/aaisim/responses/get_nst_response.json59
-rw-r--r--conductor/conductor/tests/functional/simulators/build_sdcsim.sh21
-rw-r--r--conductor/conductor/tests/functional/simulators/run_sdcsim.sh22
-rw-r--r--conductor/conductor/tests/functional/simulators/sdcsim/Dockerfile41
-rw-r--r--conductor/conductor/tests/functional/simulators/sdcsim/newembbnst.csarbin0 -> 48090 bytes
-rw-r--r--conductor/conductor/tests/functional/simulators/sdcsim/sdcsim.py55
7 files changed, 221 insertions, 0 deletions
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/aai_imposter.jsont b/conductor/conductor/tests/functional/simulators/aaisim/aai_imposter.jsont
index 93799cd..777bcb2 100644
--- a/conductor/conductor/tests/functional/simulators/aaisim/aai_imposter.jsont
+++ b/conductor/conductor/tests/functional/simulators/aaisim/aai_imposter.jsont
@@ -27,6 +27,29 @@
},
{
"responses": [
+ { "is": {
+ "statusCode": 200,
+ "body": {{ get_nst_response }}
+ }
+ }
+ ],
+ "predicates": [{
+ "and": [
+ {
+ "equals": {
+ "path": "/aai/v14/service-design-and-creation/models",
+ "method": "GET",
+ "query": {
+ "model-role": "NST",
+ "depth": 2
+ }
+ }
+ }
+ ]
+ }]
+ },
+ {
+ "responses": [
{ "is": {
"statusCode": 200,
"body": {{ get_nssi_response }}
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nst_response.json b/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nst_response.json
new file mode 100644
index 0000000..2c075e3
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nst_response.json
@@ -0,0 +1,59 @@
+{
+ "model":[
+ {
+ "model-invariant-id":"f0aa2f5c-a022-4947-80bf-fc05a1502d82",
+ "model-type":"service",
+ "model-role":"NST",
+ "resource-version":"1609762578458",
+ "model-vers":{
+ "model-ver":[
+ {
+ "model-version-id":"5d345ca8-1f8e-4f1e-aac7-6c8b33cc33e7",
+ "model-name":"EmbbNst",
+ "model-version":"1.0",
+ "distribution-status":"DISTRIBUTION_COMPLETE_OK",
+ "model-description":"EmbbNst",
+ "resource-version":"1609762782080",
+ "model-elements":{
+ "model-element":[
+ {
+ "model-element-uuid":"5c7f04ca-a3b6-4ef9-9b9e-f887121276b0",
+ "new-data-del-flag":"T",
+ "cardinality":"unbounded",
+ "resource-version":"1609762578458",
+ "relationship-list":{
+ "relationship":[
+ {
+ "related-to":"model-ver",
+ "relationship-label":"org.onap.relationships.inventory.IsA",
+ "related-link":"/aai/v21/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data":[
+ {
+ "relationship-key":"model.model-invariant-id",
+ "relationship-value":"82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key":"model-ver.model-version-id",
+ "relationship-value":"46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property":[
+ {
+ "property-key":"model-ver.model-name",
+ "property-value":"service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+
+
+ ]
+} \ No newline at end of file
diff --git a/conductor/conductor/tests/functional/simulators/build_sdcsim.sh b/conductor/conductor/tests/functional/simulators/build_sdcsim.sh
new file mode 100644
index 0000000..50cfa06
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/build_sdcsim.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (C) 2021 Wipro Limited.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
+cd ./sdcsim
+docker build -t sdcsim . \ No newline at end of file
diff --git a/conductor/conductor/tests/functional/simulators/run_sdcsim.sh b/conductor/conductor/tests/functional/simulators/run_sdcsim.sh
new file mode 100644
index 0000000..8ba9f9d
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/run_sdcsim.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (C) 2021 Wipro Limited.
+#
+# 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.
+#
+# -------------------------------------------------------------------------
+#
+docker run --name sdcsimulator -p 9595:9595 -d sdcsim
+
+sleep 10 \ No newline at end of file
diff --git a/conductor/conductor/tests/functional/simulators/sdcsim/Dockerfile b/conductor/conductor/tests/functional/simulators/sdcsim/Dockerfile
new file mode 100644
index 0000000..e7d6d0a
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/sdcsim/Dockerfile
@@ -0,0 +1,41 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (C) 2021 Wipro Limited.
+#
+# 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.
+#
+# -------------------------------------------------------------------------
+#
+# Use an official Python runtime as a parent image
+FROM python:3
+
+# Set the working directory to /su/python/webpy-rest-dockerized
+WORKDIR /opt/sdcsim
+
+
+
+# Copy the current directory contents into the container at /app
+ADD ./ .
+
+# Install any needed packages specified in requirements.txt
+#RUN pip install --no-cache-dir web.py
+RUN pip install requests httpserver
+# Make port 80 available to the world outside this container
+EXPOSE 9595
+
+# Define environment variable
+#ENV NAME sdcsim
+
+# Run aaisim.py when the container launches
+#CMD ["/bin/sh", "-c", "python3 -u sdcsim.py 9595 > /tmp/sdcsim.log 2>&1"]
+CMD ["python", "./sdcsim.py"] \ No newline at end of file
diff --git a/conductor/conductor/tests/functional/simulators/sdcsim/newembbnst.csar b/conductor/conductor/tests/functional/simulators/sdcsim/newembbnst.csar
new file mode 100644
index 0000000..d5c4270
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/sdcsim/newembbnst.csar
Binary files differ
diff --git a/conductor/conductor/tests/functional/simulators/sdcsim/sdcsim.py b/conductor/conductor/tests/functional/simulators/sdcsim/sdcsim.py
new file mode 100644
index 0000000..723e0be
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/sdcsim/sdcsim.py
@@ -0,0 +1,55 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (C) 2021 Wipro Limited.
+#
+# 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.
+#
+# -------------------------------------------------------------------------
+#
+
+from http.server import BaseHTTPRequestHandler, HTTPServer
+import socketserver
+import requests
+
+
+PORT = 9595
+
+
+
+
+
+class MockServerRequestHandler(BaseHTTPRequestHandler):
+ def do_GET(self):
+
+ # Process an HTTP GET request and return a response with an HTTP 200 status.
+ # Add response status code.
+ if self.path=="/sdc/v1/catalog/services/5d345ca8-1f8e-4f1e-aac7-6c8b33cc33e7/toscaModel":
+ self.send_response(requests.codes.ok)
+
+ # Add response headers.
+ self.send_header('Content-Type', 'application/octet-stream; charset=utf-8')
+ self.end_headers()
+
+ # Add response content.
+ fileres=open("newembbnst.csar",'rb')
+ response_content = fileres.read()
+ self.wfile.write(response_content)
+ return
+ else:
+ self.wfile.write("incorrect url".encode())
+ return
+
+handlerobj = MockServerRequestHandler
+
+myserver = socketserver.TCPServer(('', PORT), handlerobj)
+myserver.serve_forever()