SEBA-972 Changes necessary for physical OLT tests

Change-Id: If44d9195d8abe9766cd3bc9c44c36ddd1d960752
diff --git a/Makefile b/Makefile
index 3b0e919..ea75952 100644
--- a/Makefile
+++ b/Makefile
@@ -37,8 +37,10 @@
 
 ROBOT_MOCK_OLT_FILE             ?= $(ROOT_DIR)/demo_test/functional_test/robot-mock-olt.yaml
 ROBOT_MOCK_OLT_SINGLE_FILE      ?= $(ROOT_DIR)/demo_test/functional_test/robot-mock-olt-single.yaml
+ROBOT_PHYSICAL_OLT_SINGLE_FILE  ?= $(ROOT_DIR)/demo_test/functional_test/robot-physical-olt-single.yaml
 ROBOT_DEBUG_LOG_OPT             ?=
 ROBOT_MISC_ARGS                 ?=
+ROBOT_EXTRA_ARGS                ?=
 
 help:
 	@echo "Usage: make [<target>]"
@@ -67,10 +69,16 @@
 
 # target to invoke mock-olt robot tests, single OLT
 functional-mock-test-single: ROBOT_MISC_ARGS += $(ROBOT_DEBUG_LOG_OPT)
-functional-mock-test-single: ROBOT_CONFIG_FILE := $(ROBOT_MOCK_OLT_FILE)
+functional-mock-test-single: ROBOT_CONFIG_FILE := $(ROBOT_MOCK_OLT_SINGLE_FILE)
 functional-mock-test-single: ROBOT_FILE := $(ROOT_DIR)/demo_test/functional_test/importer.robot
 functional-mock-test-single: importer-functional-test
 
+# target to invoke physical-olt robot tests, single OLT
+functional-physical-test-single: ROBOT_MISC_ARGS += $(ROBOT_DEBUG_LOG_OPT)
+functional-physical-test-single: ROBOT_CONFIG_FILE := $(ROBOT_PHYSICAL_OLT_SINGLE_FILE)
+functional-physical-test-single: ROBOT_FILE := $(ROOT_DIR)/demo_test/functional_test/importer.robot
+functional-physical-test-single: importer-functional-test
+
 proto/importer.pb.go: proto/importer.proto
 	mkdir -p proto
 	protoc --proto_path=proto \
@@ -176,4 +184,4 @@
 importer-functional-test: vst_venv
 	VIRTUAL_ENV_DISABLE_PROMPT=true source ./$</bin/activate ; set -u ;\
 	cd demo_test/functional_test ;\
-	robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
+	robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_EXTRA_ARGS) $(ROBOT_FILE)
diff --git a/demo_test/functional_test/importer.robot b/demo_test/functional_test/importer.robot
index 749aa98..5116539 100644
--- a/demo_test/functional_test/importer.robot
+++ b/demo_test/functional_test/importer.robot
@@ -36,10 +36,14 @@
 # network fluctuation.
 ${pod_timeout}    300s
 
-# use_mock_redfish: If true, mock redfish OLTs will be used instead of a 
+# use_mock_redfish: If true, mock redfish OLTs will be used instead of a
 #    physical device. Default: False.
 ${use_mock_redfish}    False
 
+# use_kubernetes_importer: If true, then the importer and demo_test will
+#    be installed using Kubernetes. Default: False
+${use_kubernetes_install}    False
+
 # use_Containerized_dm: If true, then dm will be run from inside the
 #     demo-test container. Default: False.
 ${use_containerized_dm}    False
@@ -128,29 +132,38 @@
     Run Keyword If     ${voltha_suite_setup}    Common Test Suite Setup
     # Ensure the redfish import and demotest containers are deployed and running.
     Run Keyword If     ${use_mock_redfish}    Install Mock Redfish Server
+    Run Keyword If     ${use_kubernetes_install}    Install Importer Using Kubernetes
     Get IP AND PORT
 
 Teardown Suite
     [Documentation]    Clean up devices if desired
     ...    kills processes and cleans up interfaces on src+dst servers
+    Run Keyword If    ${use_kubernetes_install}    Clean Up Importer Using Kubernetes
     Run Keyword If    ${use_mock_redfish}    Clean Up Mock Redfish Server
 
 Install Mock Redfish Server
-    [Documentation]    Installs mock OLTS, redfish importer, demo-test
-    Apply Kubernetes Resources    ../../kubernetes/deploy-redfish-importer.yaml    default
+    [Documentation]    Installs Redfish Importer and Demotest
+    Apply Kubernetes Resources    ../../kubernetes/deploy-mock-olts.yaml    default
     Wait Until Keyword Succeeds    ${pod_timeout}    5s
     ...    Validate Pod Status    ${MOCK1_POD_NAME}    default     Running
     Wait Until Keyword Succeeds    ${pod_timeout}    5s
     ...    Validate Pod Status    ${MOCK2_POD_NAME}    default     Running
-    Wait Until Keyword Succeeds    ${pod_timeout}    5s
-    ...    Validate Pod Status    ${IMPORTER_POD_NAME}    default     Running
-    Wait Until Keyword Succeeds    ${pod_timeout}    5s
-    ...    Validate Pod Status    ${DEMOTEST_POD_NAME}    default     Running
     # After the pods have come online, it may still take a few seconds
     # before they start responding to requests.
     Sleep    10 Seconds
 
+Install Importer Using Kubernetes
+    [Documentation]    Installs mock OLTS
+    Apply Kubernetes Resources    ../../kubernetes/deploy-redfish-importer.yaml    default
+    Wait Until Keyword Succeeds    ${pod_timeout}    5s
+    ...    Validate Pod Status    ${IMPORTER_POD_NAME}    default     Running
+    Wait Until Keyword Succeeds    ${pod_timeout}    5s
+    ...    Validate Pod Status    ${DEMOTEST_POD_NAME}    default     Running
+
 Clean Up Mock Redfish Server
+    Delete Kubernetes Resources    ../../kubernetes/deploy-mock-olts.yaml    default
+
+Clean Up Importer Using Kubernetes
     Delete Kubernetes Resources    ../../kubernetes/deploy-redfish-importer.yaml    default
 
 Get IP AND PORT
diff --git a/demo_test/functional_test/robot-mock-olt-single.yaml b/demo_test/functional_test/robot-mock-olt-single.yaml
index d6a33ad..3f18036 100644
--- a/demo_test/functional_test/robot-mock-olt-single.yaml
+++ b/demo_test/functional_test/robot-mock-olt-single.yaml
@@ -18,6 +18,7 @@
 # to work with one mock redfish OLT.
 
 use_mock_redfish:    True
+use_kubernetes_install:    True
 use_containerized_dm:    True
 
 ADDR_LIST:
diff --git a/demo_test/functional_test/robot-mock-olt.yaml b/demo_test/functional_test/robot-mock-olt.yaml
index 0036154..edb0462 100644
--- a/demo_test/functional_test/robot-mock-olt.yaml
+++ b/demo_test/functional_test/robot-mock-olt.yaml
@@ -19,6 +19,7 @@
 # to work with two mock redfish OLTs.
 
 use_mock_redfish:    True
+use_kubernetes_install:    True
 use_containerized_dm:    True
 
 ADDR_LIST:
diff --git a/demo_test/functional_test/robot-physical-olt-single.yaml b/demo_test/functional_test/robot-physical-olt-single.yaml
new file mode 100644
index 0000000..5232db5
--- /dev/null
+++ b/demo_test/functional_test/robot-physical-olt-single.yaml
@@ -0,0 +1,22 @@
+---
+
+# 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.
+
+# This yaml file overrides importer.robot to configure the robot test
+# to work with one mock redfish OLT.
+
+
+use_kubernetes_install:    True
+use_containerized_dm:    True
diff --git a/kubernetes/deploy-mock-olts.yaml b/kubernetes/deploy-mock-olts.yaml
new file mode 100755
index 0000000..9000a10
--- /dev/null
+++ b/kubernetes/deploy-mock-olts.yaml
@@ -0,0 +1,96 @@
+# Copyright 2018-present Open Networking Foundation

+# Copyright 2018-present  Edgecore Networks Corporation

+#

+# 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.

+

+---

+

+apiVersion: apps/v1beta2

+kind: Deployment

+metadata:

+  name: mock-olt-1

+  labels:

+    app: mock-olt-1

+    chart: mock-olt-1

+spec:

+  replicas: 1

+  selector:

+    matchLabels:

+      app: mock-olt-1

+  template:

+    metadata:

+      labels:

+        app: mock-olt-1

+    spec:

+      containers:

+        - name: mock-olt-1

+          image: opencord/redfish-mockup-server:master

+          imagePullPolicy: Always

+          ports:

+            - containerPort: 8001

+              name: mock-redfish

+

+---

+

+apiVersion: v1

+kind: Service

+metadata:

+  name: mock-olt-1

+spec:

+  ports:

+    - name: mock-redfish

+      port: 8401

+      targetPort: 8001

+  selector:

+    app: mock-olt-1

+

+---

+

+apiVersion: apps/v1beta2

+kind: Deployment

+metadata:

+  name: mock-olt-2

+  labels:

+    app: mock-olt-2

+    chart: mock-olt-2

+spec:

+  replicas: 1

+  selector:

+    matchLabels:

+      app: mock-olt-2

+  template:

+    metadata:

+      labels:

+        app: mock-olt-2

+    spec:

+      containers:

+        - name: mock-olt-2

+          image: opencord/redfish-mockup-server:master

+          imagePullPolicy: Always

+          ports:

+            - containerPort: 8001

+              name: mock-redfish

+

+---

+

+apiVersion: v1

+kind: Service

+metadata:

+  name: mock-olt-2

+spec:

+  ports:

+    - name: mock-redfish

+      port: 8402

+      targetPort: 8001

+  selector:

+    app: mock-olt-2

diff --git a/kubernetes/deploy-redfish-importer.yaml b/kubernetes/deploy-redfish-importer.yaml
index ebdc0f3..4793357 100755
--- a/kubernetes/deploy-redfish-importer.yaml
+++ b/kubernetes/deploy-redfish-importer.yaml
@@ -18,88 +18,6 @@
 apiVersion: apps/v1beta2

 kind: Deployment

 metadata:

-  name: mock-olt-1

-  labels:

-    app: mock-olt-1

-    chart: mock-olt-1

-spec:

-  replicas: 1

-  selector:

-    matchLabels:

-      app: mock-olt-1

-  template:

-    metadata:

-      labels:

-        app: mock-olt-1

-    spec:

-      containers:

-        - name: mock-olt-1

-          image: opencord/redfish-mockup-server:master

-          imagePullPolicy: Always

-          ports:

-            - containerPort: 8001

-              name: mock-redfish

-

----

-

-apiVersion: v1

-kind: Service

-metadata:

-  name: mock-olt-1

-spec:

-  ports:

-    - name: mock-redfish

-      port: 8401

-      targetPort: 8001

-  selector:

-    app: mock-olt-1

-

----

-

-apiVersion: apps/v1beta2

-kind: Deployment

-metadata:

-  name: mock-olt-2

-  labels:

-    app: mock-olt-2

-    chart: mock-olt-2

-spec:

-  replicas: 1

-  selector:

-    matchLabels:

-      app: mock-olt-2

-  template:

-    metadata:

-      labels:

-        app: mock-olt-2

-    spec:

-      containers:

-        - name: mock-olt-2

-          image: opencord/redfish-mockup-server:master

-          imagePullPolicy: Always

-          ports:

-            - containerPort: 8001

-              name: mock-redfish

-

----

-

-apiVersion: v1

-kind: Service

-metadata:

-  name: mock-olt-2

-spec:

-  ports:

-    - name: mock-redfish

-      port: 8402

-      targetPort: 8001

-  selector:

-    app: mock-olt-2

-

----

-

-apiVersion: apps/v1beta2

-kind: Deployment

-metadata:

   name: redfish-importer

   labels:

     app: redfish-importer