CORD-2905 Containerize XOS API tests
Change-Id: I40c4983946a6659dd6dd846fd39d266ad19595cb
diff --git a/Dockerfile.k8s-api-tester b/Dockerfile.k8s-api-tester
deleted file mode 100644
index 090ef3f..0000000
--- a/Dockerfile.k8s-api-tester
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# Copyright 2017-present Open Networking 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.
-
-
-FROM ubuntu:16.04
-
-RUN apt-get update && \
- apt-get install -y python python-pip python-setuptools
-
-RUN pip install robotframework robotframework-requests \
- robotframework-httplibrary robotframework-ride pygments pexpect pyyaml
-
-RUN pip install -U requests
-
-RUN mkdir -p /tests
-COPY src /tests
-COPY src/test/cord-api/Properties/K8S_RestApiProperties.py /tests/test/cord-api/Properties/RestApiProperties.py
-
-WORKDIR /tests/test/cord-api/Tests
-
-ENTRYPOINT ["pybot", "-L", "TRACE", "-d", "Log", "-T"]
-CMD ["Ch_ServiceTest.txt"]
diff --git a/src/test/cord-api/Dockerfile.k8s-api-tester b/src/test/cord-api/Dockerfile.k8s-api-tester
new file mode 100644
index 0000000..ded5a5d
--- /dev/null
+++ b/src/test/cord-api/Dockerfile.k8s-api-tester
@@ -0,0 +1,50 @@
+
+# Copyright 2017-present Open Networking 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.
+
+# Manual build example:
+# docker build -f Dockerfile.k8s-api-tester -t xos-api-tester:local .
+
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+ apt-get install -y python python-pip python-setuptools && \
+ pip install robotframework robotframework-requests pexpect \
+ robotframework-httplibrary robotframework-ride pygments pyyaml && \
+ pip install -U requests && rm -rf /var/lib/apt/lists/*
+
+RUN mkdir -p /src/cord-api
+
+COPY . /src/cord-api
+
+WORKDIR /src/cord-api/Tests
+
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=xos-api-tester
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+
+LABEL org.label-schema.schema-version=$org_label_schema_schema_version \
+ org.label-schema.name=$org_label_schema_name \
+ org.label-schema.version=$org_label_schema_version \
+ org.label-schema.vcs-url=$org_label_schema_vcs_url \
+ org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+ org.label-schema.build-date=$org_label_schema_build_date \
+ org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
+
+ENTRYPOINT ["pybot", "-L", "TRACE", "-d", "Log", "-T"]
+CMD ["Ch_ServiceTest.txt"]
diff --git a/src/test/cord-api/Framework/restApi.py b/src/test/cord-api/Framework/restApi.py
index 6e21535..a11664f 100644
--- a/src/test/cord-api/Framework/restApi.py
+++ b/src/test/cord-api/Framework/restApi.py
@@ -36,8 +36,16 @@
'''
Get and return values from properties file
'''
- rawValue = self.rp.getValueProperties(key)
- value = rawValue.replace("'","")
+ try:
+ rawValue = self.rp.getValueProperties(key)
+ value = rawValue.replace("'","")
+ except:
+ value = None
+
+ # Allow override from environment
+ if key in os.environ:
+ value = os.environ[key]
+
return value
def getURL(self, key):
diff --git a/src/test/cord-api/Properties/K8S_RestApiProperties.py b/src/test/cord-api/Properties/K8S_RestApiProperties.py
deleted file mode 100644
index f5084d4..0000000
--- a/src/test/cord-api/Properties/K8S_RestApiProperties.py
+++ /dev/null
@@ -1,60 +0,0 @@
-
-# Copyright 2017-present Open Networking 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.
-
-
-#!/usr/bin/env python
-
-SERVER_IP = 'xos-chameleon'
-SERVER_PORT = '9101'
-USER = 'admin@opencord.org'
-PASSWD = 'letmein'
-VOLT_SUBSCRIBER = '/xosapi/v1/rcord/cordsubscriberroots'
-VOLT_TENANT = '/xosapi/v1/volt/voltserviceinstances'
-CH_CORE_SERVICELINK = '/xosapi/v1/core/serviceinstancelinks'
-TENANT_SUBSCRIBER = '/api/tenant/cord/subscriber/'
-TENANT_VOLT = '/api/tenant/cord/volt/'
-UTILS_SYNCHRONIZER = '/api/utility/synchronizer/'
-UTILS_LOGIN = '/api/utility/login/'
-CORE_USERS = '/api/core/users/'
-CH_CORE_USERS = '/xosapi/v1/core/users'
-CORE_SERVICES = '/api/core/services/'
-CH_CORE_SERVICES = '/xosapi/v1/core/services'
-CORE_INSTANCES = '/api/core/instances/'
-CH_CORE_INSTANCES = '/xosapi/v1/core/instances'
-CORE_DEPLOYMENTS = '/api/core/deployments/'
-CH_CORE_DEPLOYMENTS = '/xosapi/v1/core/deployments'
-CORE_SANITY_INSTANCES = '/api/core/instances/?no_hyperlinks=1'
-CORE_SANITY_SLICES = '/api/core/slices/?no_hyperlinks=1'
-CORE_SLICES = '/api/core/slices/'
-CH_CORE_SLICES = '/xosapi/v1/core/slices'
-CORE_SANITY_NODES = '/api/core/nodes/?no_hyperlinks=1'
-CORE_NODES = '/api/core/nodes/'
-CH_CORE_NODES = '/xosapi/v1/core/nodes'
-CORE_FLAVORS = '/api/core/flavors/'
-CH_CORE_FLAVORS = '/xosapi/v1/core/flavors'
-CORE_SITES = '/api/core/sites/'
-CH_CORE_SITES = '/xosapi/v1/core/sites'
-CORE_IMAGES = '/api/core/images/'
-CH_CORE_IMAGES = '/xosapi/v1/core/images'
-CORE_SITEDEPLOYMENTS = '/api/core/sitedeployments'
-CH_CORE_NETWORKS = '/xosapi/v1/core/networks'
-CH_CORE_SLICES = '/xosapi/v1/core/slices'
-CH_CORE_NETWORK_SLICES = '/xosapi/v1/core/networkslices'
-CH_CORE_PORTS = '/xosapi/v1/core/ports'
-CH_CORE_SERVICES = '/xosapi/v1/core/services'
-CH_CORE_SITEDEPLOYMENTS = '/xosapi/v1/core/sitedeployments'
-CH_CORE_NETWORK_TEMPLATES = '/xosapi/v1/core/networktemplates'
-VSG_TENANT = '/xosapi/v1/vsg/vsgserviceinstances'
-VSGHW_TENANT = '/xosapi/v1/vsg-hw/vsghwserviceinstances'