adding voltha k8 resources to sanity k8 pod tests

Change-Id: Ie49b9a321b5234d0cfd624ada1ebff8e35160def
diff --git a/src/test/robot/SanityK8POD.robot b/src/test/robot/SanityK8POD.robot
index 282775d..1adccc7 100644
--- a/src/test/robot/SanityK8POD.robot
+++ b/src/test/robot/SanityK8POD.robot
@@ -22,9 +22,8 @@
 Resource          ../cord-api/Framework/utils/utils.robot
 
 *** Variables ***
-${profile}           rcord-lite
-${deployment}        virtual
-@{physical_nodes}    head1    compute1    compute2
+${deployment}        physical
+@{physical_nodes}    node1    node2    node3
 @{minikube_nodes}    minikube
 ${resources_file}    ${CURDIR}/data/k8resources.json
 
@@ -32,7 +31,7 @@
 *** Test Cases ***
 Validate K8 Nodes
     [Documentation]    Validates that all nodes that are running in the K8 are healthy
-    [Tags]    xos-core
+    [Tags]    nodes
     ${nodes}=    Run    kubectl get nodes -o json
     Log    ${nodes}
     @{nodes}=    Get Names    ${nodes}
@@ -68,6 +67,14 @@
     : FOR    ${i}    IN    @{rcord_lite_containers}
     \    Run Keyword and Continue on Failure    List Should Contain Value    ${rcord_container_names}    ${i}
 
+Validate Voltha Containers
+    [Documentation]    Validates that all voltha containers that are running in the K8 Pods are healthy
+    [Tags]    voltha
+    @{voltha_container_names}=    Run Keyword and Continue on Failure    Validate Pods    voltha-
+    #validates that all expected containers to be running are in one of the pods inspected above
+    : FOR    ${i}    IN    @{voltha_containers}
+    \    Run Keyword and Continue on Failure    List Should Contain Value    ${voltha_container_names}    ${i}
+
 Validate ONOS-Fabric Containers
     [Documentation]    Validates that all onos-fabric containers that are running in the K8 Pods are healthy
     [Tags]    onos-fabric
@@ -78,22 +85,27 @@
 
 Validate XOS Core Deployments
     [Documentation]    Validates that all xos-core deployments successfully rolled out and available
-    [Tags]    deployments    xos-core
+    [Tags]    xos-core
     Validate Deployments    xos-    ${core_deployments}
 
 Validate RCord-Lite Deployments
     [Documentation]    Validates that all rcord-lite deployments successfully rolled out and available
-    [Tags]    deployments    rcord-lite
+    [Tags]    rcord-lite
     Validate Deployments    rcord-lite-    ${rcord_lite_deployments}
 
 Validate ONOS-Fabric Deployments
     [Documentation]    Validates that all onos-fabric deployments successfully rolled out and available
-    [Tags]    deployments    onos-fabric
+    [Tags]    onos-fabric
     Validate Deployments    onos-fabric    ${onos_fabric_deployments}
 
+Validate Voltha Deployments
+    [Documentation]    Validates that all voltha deployments successfully rolled out and available
+    [Tags]    voltha
+    Validate Deployments    voltha    ${voltha_deployments}
+
 Validate XOS Core Services
     [Documentation]    Validates that all expected xos-core services that are running in K8s
-    [Tags]    services    xos-core
+    [Tags]    xos-core
     ${services}=    Run    kubectl get services -o json
     Log    ${services}
     @{services}=    Get Names    ${services}
@@ -106,7 +118,7 @@
 
 Validate ONOS-Fabric Services
     [Documentation]    Validates that all expected onos-fabric services that are running in K8s
-    [Tags]    services    onos-fabric
+    [Tags]    onos-fabric
     ${services}=    Run    kubectl get services -o json
     Log    ${services}
     @{services}=    Get Names    ${services}
@@ -117,17 +129,33 @@
     ## eg. kubectl get svc xos-core -o jsonpath='{.spec.ports[?(@.name=="secure")].port}'
     ## eg. kubectl get svc xos-core -o jsonpath='{.spec.ports[?(@.name=="secure")].targetPort}'
 
+Validate Voltha Services
+    [Documentation]    Validates that all expected voltha services that are running in K8s
+    [Tags]    voltha
+    ${services}=    Run    kubectl get services -o json
+    Log    ${services}
+    @{services}=    Get Names    ${services}
+    #validates that all expected services are running
+    : FOR    ${i}    IN    @{voltha_services}
+    \    Run Keyword and Continue on Failure    List Should Contain Value    ${services}    ${i}
+    ##check for appropriate ports for each service and match with values in helm charts
+    ## eg. kubectl get svc xos-core -o jsonpath='{.spec.ports[?(@.name=="secure")].port}'
+    ## eg. kubectl get svc xos-core -o jsonpath='{.spec.ports[?(@.name=="secure")].targetPort}'
+
 *** Keywords ***
 Setup
-    Log    Setting up
+    Log    Parsing the datafile for Kubernetes resources for each helm chart
     @{core_containers}=    Create List
     @{rcord_lite_containers}=    Create List
     @{onos_fabric_containers}=    Create List
+    @{voltha_containers}=    Create List
     @{core_deployments}=    Create List
     @{rcord_lite_deployments}=    Create List
     @{onos_fabric_deployments}=    Create List
+    @{voltha_deployments}=    Create List
     @{xos_core_services}=    Create List
     @{onos_fabric_services}=    Create List
+    @{voltha_services}=    Create List
     ${xos-core_containers}    utils.jsonToList    ${resources_file}    xos-core-containers
     : FOR    ${container}    IN    @{xos-core_containers}
     \    Append To List    ${core_containers}    ${container}
@@ -137,21 +165,30 @@
     ${onosfabric_containers}    utils.jsonToList    ${resources_file}    onos-fabric-containers
     : FOR    ${container}    IN    @{onosfabric_containers}
     \    Append To List    ${onos_fabric_containers}    ${container}
+    ${volthaContainers}    utils.jsonToList    ${resources_file}    voltha-containers
+    : FOR    ${container}    IN    @{volthaContainers}
+    \    Append To List    ${voltha_containers}    ${container}
     ${xos-core_deployments}    utils.jsonToList    ${resources_file}    xos-core-deployments
     : FOR    ${deployment}    IN    @{xos-core_containers}
     \    Append To List    ${core_deployments}    ${deployment}
     ${rcord_deployments}    utils.jsonToList    ${resources_file}    rcord-lite-deployments
     : FOR    ${deployment}    IN    @{rcord_deployments}
     \    Append To List    ${rcord_lite_deployments}    ${deployment}
-    ${onosfabric_deployments}    utils.jsonToList    ${resources_file}    rcord-lite-deployments
+    ${onosfabric_deployments}    utils.jsonToList    ${resources_file}    onos-fabric-deployments
     : FOR    ${deployment}    IN    @{onosfabric_deployments}
     \    Append To List    ${onos_fabric_deployments}    ${deployment}
+    ${volthaDeployments}    utils.jsonToList    ${resources_file}    voltha-deployments
+    : FOR    ${deployment}    IN    @{volthaDeployments}
+    \    Append To List    ${voltha_deployments}    ${deployment}
     ${core_services}    utils.jsonToList    ${resources_file}    xos-core-services
     : FOR    ${service}    IN    @{core_services}
     \    Append To List    ${xos_core_services}    ${service}
     ${onos_services}    utils.jsonToList    ${resources_file}    onos-fabric-services
     : FOR    ${service}    IN    @{onos_services}
     \    Append To List    ${onos_fabric_services}    ${service}
+    ${volthaServices}    utils.jsonToList    ${resources_file}    voltha-services
+    : FOR    ${service}    IN    @{volthaServices}
+    \    Append To List    ${voltha_services}    ${service}
     Set Suite Variable    @{core_containers}
     Set Suite Variable    @{rcord_lite_containers}
     Set Suite Variable    @{onos_fabric_containers}
@@ -160,9 +197,9 @@
     Set Suite Variable    @{onos_fabric_deployments}
     Set Suite Variable    @{xos_core_services}
     Set Suite Variable    @{onos_fabric_services}
-
-Teardown
-    Log    Tearing down
+    Set Suite Variable    @{voltha_containers}
+    Set Suite Variable    @{voltha_services}
+    Set Suite Variable    @{voltha_deployments}
 
 Get Names
     [Documentation]    Gets names of K8 resources running
@@ -197,11 +234,11 @@
     \    ${cstatus}=    Get From List    ${containerStatuses}    0
     \     Log    ${cstatus}
     \    ${restartCount}=    Get From Dictionary    ${cstatus}    restartCount
-    \    Should Be Equal As Integers    ${restartCount}    0
+    \    Run Keyword and Continue On Failure    Should Be Equal As Integers    ${restartCount}    0
     \    ${container_name}=    Get From Dictionary    ${cstatus}    name
     \    ${state}=    Get From Dictionary    ${cstatus}    state
-    \    Should Contain    ${state}    running
-    \    Should Not Contain    ${state}    stopped
+    \    Run Keyword and Continue On Failure    Should Contain    ${state}    running
+    \    Run Keyword and Continue On Failure    Should Not Contain    ${state}    stopped
     \    Log    ${state}
     \    Append To List    ${container_names}    ${container_name}
     [Return]    ${container_names}
@@ -213,11 +250,11 @@
     : FOR    ${i}    IN    @{deployments}
     \    Continue For Loop If    '${component}' not in '''${i}'''
     \    ${rollout_status}=    Run    kubectl rollout status deployment/${i}
-    \    Should Be Equal    ${rollout_status}    deployment "${i}" successfully rolled out
+    \    Run Keyword and Continue On Failure    Should Be Equal    ${rollout_status}    deployment "${i}" successfully rolled out
     \    ##validate replication sets
     \    ${desired}=    Run    kubectl get deployments ${i} -o jsonpath='{.status.replicas}'
     \    ${available}=    Run    kubectl get deployments ${i} -o jsonpath='{.status.availableReplicas}'
-    \    Should Be Equal    ${desired}    ${available}
+    \    Run Keyword and Continue On Failure    Should Be Equal    ${desired}    ${available}
     #validates that all expected deployments to exist
     : FOR    ${i}    IN    @{expected_deployments}
-    \    List Should Contain Value    ${deployments}    ${i}
\ No newline at end of file
+    \    Run Keyword and Continue On Failure    List Should Contain Value    ${deployments}    ${i}
\ No newline at end of file