summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com>2018-04-06 14:37:34 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-06 14:37:34 +0000
commiteff9d116c1e9b96023649c83fb7650cd00451718 (patch)
treeffdb6938561b8fd77cd3f76a3e6a31b2ad573818
parent4e2ee79d4dc2b25c396d6ffc5ac9c0845c492fc5 (diff)
parent8eb085fa11d53faeb9bfefb72107ee3cf2602c5e (diff)
Merge "Add multicloud sim"
-rwxr-xr-xconductor/conductor/tests/functional/simulators/aaisim/Dockerfile18
-rwxr-xr-xconductor/conductor/tests/functional/simulators/aaisim/aaisim.py18
-rwxr-xr-xconductor/conductor/tests/functional/simulators/build_aaisim.sh19
-rwxr-xr-xconductor/conductor/tests/functional/simulators/build_multicloudsim.sh22
-rwxr-xr-xconductor/conductor/tests/functional/simulators/destroy_aaisim.sh21
-rwxr-xr-xconductor/conductor/tests/functional/simulators/destroy_multicloudsim.sh23
-rwxr-xr-xconductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile39
-rwxr-xr-xconductor/conductor/tests/functional/simulators/multicloudsim/multicloudsim.py90
-rwxr-xr-xconductor/conductor/tests/functional/simulators/multicloudsim/requirements.txt1
-rw-r--r--conductor/conductor/tests/functional/simulators/multicloudsim/responses/healthcheck.json1
-rw-r--r--conductor/conductor/tests/functional/simulators/multicloudsim/responses/post_check_vim_capacity.json1
-rwxr-xr-xconductor/conductor/tests/functional/simulators/run_aaisim.sh19
-rwxr-xr-xconductor/conductor/tests/functional/simulators/run_multicloudsim.sh21
13 files changed, 292 insertions, 1 deletions
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile b/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
index 3f241b0..9ab4213 100755
--- a/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
+++ b/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
@@ -1,3 +1,21 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
# Use an official Python runtime as a parent image
FROM python:2.7
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/aaisim.py b/conductor/conductor/tests/functional/simulators/aaisim/aaisim.py
index 2e60bd3..2a96e97 100755
--- a/conductor/conductor/tests/functional/simulators/aaisim/aaisim.py
+++ b/conductor/conductor/tests/functional/simulators/aaisim/aaisim.py
@@ -1,3 +1,21 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
import web
import web.webapi
import json
diff --git a/conductor/conductor/tests/functional/simulators/build_aaisim.sh b/conductor/conductor/tests/functional/simulators/build_aaisim.sh
index 0fcd129..441b6b9 100755
--- a/conductor/conductor/tests/functional/simulators/build_aaisim.sh
+++ b/conductor/conductor/tests/functional/simulators/build_aaisim.sh
@@ -1,3 +1,22 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
cd ./aaisim
docker build -t aaisim .
diff --git a/conductor/conductor/tests/functional/simulators/build_multicloudsim.sh b/conductor/conductor/tests/functional/simulators/build_multicloudsim.sh
new file mode 100755
index 0000000..054a41f
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/build_multicloudsim.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
+cd ./multicloudsim
+docker build -t multicloudsim .
+
diff --git a/conductor/conductor/tests/functional/simulators/destroy_aaisim.sh b/conductor/conductor/tests/functional/simulators/destroy_aaisim.sh
index ddc3798..0bf2ac0 100755
--- a/conductor/conductor/tests/functional/simulators/destroy_aaisim.sh
+++ b/conductor/conductor/tests/functional/simulators/destroy_aaisim.sh
@@ -1,4 +1,23 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
docker stop aaisim
-docker rm aasim
+docker rm aaisim
docker rmi aaisim
diff --git a/conductor/conductor/tests/functional/simulators/destroy_multicloudsim.sh b/conductor/conductor/tests/functional/simulators/destroy_multicloudsim.sh
new file mode 100755
index 0000000..48a9c9e
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/destroy_multicloudsim.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
+docker stop multicloudsim
+docker rm multicloudsim
+docker rmi multicloudsim
+
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile b/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile
new file mode 100755
index 0000000..aeaf2b9
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile
@@ -0,0 +1,39 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
+# Use an official Python runtime as a parent image
+FROM python:2.7
+
+# Set the working directory to /su/python/webpy-rest-dockerized
+WORKDIR /opt/multicloudsim
+
+# Copy the current directory contents into the container at /app
+ADD ./ /opt/multicloudsim
+
+# Install any needed packages specified in requirements.txt
+RUN pip install web.py
+
+# Make port 80 available to the world outside this container
+EXPOSE 8082
+
+# Define environment variable
+ENV NAME multicloudsim
+
+# Run multicloudsim.py when the container launches
+CMD ["/bin/sh", "-c", "python -u multicloudsim.py 8082 > /tmp/multicloudsim.log 2>&1"]
+
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/multicloudsim.py b/conductor/conductor/tests/functional/simulators/multicloudsim/multicloudsim.py
new file mode 100755
index 0000000..d3d2228
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/multicloudsim.py
@@ -0,0 +1,90 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
+import web
+import web.webapi
+import json
+
+from subprocess import Popen, PIPE
+from xml.dom import minidom
+
+
+urls = (
+ '/healthcheck','healthcheck',
+ '/api/multicloud/v0/check_vim_capacity','post_check_vim_capacity',
+)
+
+
+myok = {"ok":"ok"}
+json_data={}
+
+replydir = "./responses/"
+
+def replyToAaiGet(web, replydir, replyfile):
+ print ("------------------------------------------------------")
+ fullreply = replydir + replyfile
+ trid=web.ctx.env.get('X_TRANSACTIONID','111111')
+ #print ("X-TransactionId : {}".format(trid))
+ print ("this is the context : {}".format(web.ctx.fullpath))
+ with open(fullreply) as json_file:
+ json_data = json.load(json_file)
+ print(json_data)
+
+ web.header('Content-Type', 'application/json')
+ web.header('X-TransactionId', trid)
+ return json.dumps(json_data)
+
+class healthcheck:
+ def GET(self):
+ print ("------------------------------------------------------")
+ replyfile = "healthcheck.json"
+ #replyToAaiGet (web, replydir, replyfile)
+ fullreply = replydir + replyfile
+ trid=web.ctx.env.get('X_TRANSACTIONID','111111')
+ #print ("X-TransactionId : {}".format(trid))
+ print ("this is the context : {}".format(web.ctx.fullpath))
+ with open(fullreply) as json_file:
+ json_data = json.load(json_file)
+ print(json_data)
+
+ web.header('Content-Type', 'application/json')
+ web.header('X-TransactionId', trid)
+ return json.dumps(json_data)
+
+class post_check_vim_capacity:
+ def POST(self):
+ print ("------------------------------------------------------")
+ replyfile = "post_check_vim_capacity.json"
+ #replyToAaiGet (web, replydir, replyfile)
+ fullreply = replydir + replyfile
+ trid=web.ctx.env.get('X_TRANSACTIONID','111111')
+ #print ("X-TransactionId : {}".format(trid))
+ print ("this is the context : {}".format(web.ctx.fullpath))
+ with open(fullreply) as json_file:
+ json_data = json.load(json_file)
+ print(json_data)
+
+ web.header('Content-Type', 'application/json')
+ web.header('X-TransactionId', trid)
+ return json.dumps(json_data)
+
+
+
+if __name__ == "__main__":
+ app = web.application(urls, globals())
+ app.run()
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/requirements.txt b/conductor/conductor/tests/functional/simulators/multicloudsim/requirements.txt
new file mode 100755
index 0000000..c077218
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/requirements.txt
@@ -0,0 +1 @@
+web
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/responses/healthcheck.json b/conductor/conductor/tests/functional/simulators/multicloudsim/responses/healthcheck.json
new file mode 100644
index 0000000..b0bd6da
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/responses/healthcheck.json
@@ -0,0 +1 @@
+{"status":"success"}
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/responses/post_check_vim_capacity.json b/conductor/conductor/tests/functional/simulators/multicloudsim/responses/post_check_vim_capacity.json
new file mode 100644
index 0000000..aef2ee9
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/responses/post_check_vim_capacity.json
@@ -0,0 +1 @@
+{"VIMs": ["HPA-cloud_cloud-region-1"]}
diff --git a/conductor/conductor/tests/functional/simulators/run_aaisim.sh b/conductor/conductor/tests/functional/simulators/run_aaisim.sh
index 21c7bb3..203de16 100755
--- a/conductor/conductor/tests/functional/simulators/run_aaisim.sh
+++ b/conductor/conductor/tests/functional/simulators/run_aaisim.sh
@@ -1,2 +1,21 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
docker run -d --name aaisim -p 8081:8081 aaisim
diff --git a/conductor/conductor/tests/functional/simulators/run_multicloudsim.sh b/conductor/conductor/tests/functional/simulators/run_multicloudsim.sh
new file mode 100755
index 0000000..50f4c8f
--- /dev/null
+++ b/conductor/conductor/tests/functional/simulators/run_multicloudsim.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T 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.
+#
+# -------------------------------------------------------------------------
+#
+docker run -d --name multicloudsim -p 8082:8082 multicloudsim
+