aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2018-10-02 17:50:20 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-02 17:50:20 +0000
commit9d5af7d79a3c32099da70c512d35fa2662812b7a (patch)
tree67cea56bec84d4024e92c3131f8dcb054110987e
parent2a18be3ce4100042b448ca399009855f7c9c0499 (diff)
parentcfee73cdf05a76edf69ebdea23a87e2105637c89 (diff)
Merge "Dockerize osdf simulators for csit"
-rw-r--r--test/functest/simulators/Dockerfile34
-rwxr-xr-xtest/functest/simulators/build_sim_image.sh47
-rwxr-xr-xtest/functest/simulators/oof_dependencies_simulators.py17
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json16
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json19
-rw-r--r--test/policy-local-files/hpa_policy_vG_1.json5
6 files changed, 110 insertions, 28 deletions
diff --git a/test/functest/simulators/Dockerfile b/test/functest/simulators/Dockerfile
new file mode 100644
index 0000000..7f6b49f
--- /dev/null
+++ b/test/functest/simulators/Dockerfile
@@ -0,0 +1,34 @@
+#
+# -------------------------------------------------------------------------
+# 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.
+#
+# -------------------------------------------------------------------------
+#
+
+FROM ubuntu:16.04
+
+RUN apt-get update -y \
+ && apt-get install -y vim unzip wget libmpfr-dev \
+ && apt-get install -y git libqt5printsupport5 build-essential \
+ && apt-get install -y python3 python3-setuptools python3-dev \
+ && easy_install3 pip \
+ && pip install --upgrade virtualenv pip wheel
+
+RUN ln -s /usr/bin/python3.5 /usr/bin/python
+ADD requirements.txt /requirements.txt
+RUN pip install -r requirements.txt
+ADD sim /sim
+
+CMD cd /sim && python oof_dependencies_simulators.py > simulator-logs 2>&1 \ No newline at end of file
diff --git a/test/functest/simulators/build_sim_image.sh b/test/functest/simulators/build_sim_image.sh
new file mode 100755
index 0000000..c035e9a
--- /dev/null
+++ b/test/functest/simulators/build_sim_image.sh
@@ -0,0 +1,47 @@
+#!/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.
+#
+# -------------------------------------------------------------------------
+#
+
+SCRIPTDIR=$(dirname $(readlink -f $0))
+FUNC_TEST_DIR=$(dirname $SCRIPTDIR)
+TEST_DIR=$(dirname $FUNC_TEST_DIR)
+SIMULATORS_DIR=$FUNC_TEST_DIR/simulators
+OSDF_DIR=$(dirname $TEST_DIR)
+DOCKER_DIR=$SIMULATORS_DIR/tmp_docker
+
+mkdir -p $DOCKER_DIR/sim/osdf/policy/response-payloads/pdp-has-vcpe-good
+
+cp $SIMULATORS_DIR/Dockerfile $DOCKER_DIR/.
+
+cp -r $OSDF_DIR/osdf $DOCKER_DIR/sim
+mkdir -p $DOCKER_DIR/sim/config/
+cp $SIMULATORS_DIR/simulated-config/*.yaml $DOCKER_DIR/sim/config/
+cp $SIMULATORS_DIR/simulated-config/*.config $DOCKER_DIR/sim/config/
+cp -r $SIMULATORS_DIR/configdb $DOCKER_DIR/sim
+cp -r $SIMULATORS_DIR/has-api $DOCKER_DIR/sim
+cp -r $SIMULATORS_DIR/policy $DOCKER_DIR/sim
+cp $TEST_DIR/policy-local-files/*.json $DOCKER_DIR/sim/policy/response-payloads/pdp-has-vcpe-good
+cp $SIMULATORS_DIR/oof_dependencies_simulators.py $DOCKER_DIR/sim/oof_dependencies_simulators.py
+cp $OSDF_DIR/requirements.txt $DOCKER_DIR
+
+cd $DOCKER_DIR
+
+docker build -t osdf_sim .
+
+rm -rf $DOCKER_DIR
diff --git a/test/functest/simulators/oof_dependencies_simulators.py b/test/functest/simulators/oof_dependencies_simulators.py
index 9c20e79..b7e6cb5 100755
--- a/test/functest/simulators/oof_dependencies_simulators.py
+++ b/test/functest/simulators/oof_dependencies_simulators.py
@@ -20,6 +20,8 @@
Simulators for dependencies of OSDF (e.g. HAS-API, Policy, SO-callback, etc.)
"""
import glob
+import json
+import os
from flask import Flask, jsonify, request
from osdf.utils.interfaces import json_from_file
@@ -77,7 +79,18 @@ def get_policies(sub_component):
"""
main_dir = "policy/response-payloads/" + sub_component
files = glob.glob("{}/*.json".format(main_dir))
- return jsonify([json_from_file(x) for x in files])
+ list_json = []
+ for x in files:
+ list_json.append({
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": json.dumps(json_from_file(x)),
+ "policyName": os.path.basename(x),
+ "policyType": "MicroService",
+ "policyVersion": "1"
+ })
+ return jsonify(list_json)
@app.route("/simulated/configdb/getCellList", methods=["GET"])
@@ -98,4 +111,4 @@ def get_nbr_list():
if __name__ == "__main__":
- app.run(debug=True)
+ app.run(debug=True, host='0.0.0.0')
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
index 85b1e82..ce0b7e3 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
@@ -67,7 +67,7 @@
"hpa-feature" : "cpuInstructionSetExtensions",
"mandatory" : "True",
"architecture": "INTEL-64",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
]
@@ -93,7 +93,7 @@
"hpa-feature" : "cpuPinningy",
"mandatory" : "True",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
{"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
@@ -103,7 +103,7 @@
"hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
{"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
@@ -114,7 +114,7 @@
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
{"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
@@ -125,7 +125,7 @@
"hpa-feature" : "pcie",
"mandatory" : "True",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
{"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
@@ -155,7 +155,7 @@
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
{"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
@@ -168,7 +168,7 @@
"hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
{"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
@@ -179,7 +179,7 @@
"mandatory" : "False",
"score" : "7",
"architecture": "generic",
- "directives":[],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
]
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
index 262ffe7..5d2499f 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
@@ -122,25 +122,14 @@
]
},
{
- "hpa-feature" : "pcie",
+ "hpa-feature" : "pciePassthrough",
"mandatory" : "True",
"architecture": "generic",
- "directives": [
- {
- "type": "pcie_directives",
- "attributes": [
- {
- "attribute_name": "<pcie_label_name>",
- "attribute_value": "<value for pcie network>"
- }
- ]
- }
- ],
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
{"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "physicalNetwork", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""}
]
}
]
@@ -164,8 +153,8 @@
"hpa-feature" : "numa",
"mandatory" : "False",
"score" : "5",
- "directives": [],
"architecture": "generic",
+ "directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
{"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
diff --git a/test/policy-local-files/hpa_policy_vG_1.json b/test/policy-local-files/hpa_policy_vG_1.json
index 4dfb6ce..5d2499f 100644
--- a/test/policy-local-files/hpa_policy_vG_1.json
+++ b/test/policy-local-files/hpa_policy_vG_1.json
@@ -122,15 +122,14 @@
]
},
{
- "hpa-feature" : "pcie",
+ "hpa-feature" : "pciePassthrough",
"mandatory" : "True",
"architecture": "generic",
"directives": [],
"hpa-feature-attributes": [
{"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
{"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "functionType", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""}
]
}
]