fix validate device
Change-Id: I9d63ba12b14e6bdd70931910f4fdbcdffb6adc97
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 4e01212..cc480b1 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -51,12 +51,16 @@
Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
+ ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip}
+ ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip}
+ Set Global Variable ${ONOS_REST_IP}
+ Set Global Variable ${ONOS_SSH_IP}
${k8s_node_user}= Evaluate ${nodes}[0].get("user")
${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
Check CLI Tools Configured
${onos_auth}= Create List karaf karaf
${HEADERS} Create Dictionary Content-Type=application/json
- Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
+ Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
${olt_ip}= Evaluate ${olts}[0].get("ip")
${olt_user}= Evaluate ${olts}[0].get("user")
${olt_pass}= Evaluate ${olts}[0].get("pass")
@@ -72,9 +76,6 @@
Set Suite Variable ${olt_ip}
Set Suite Variable ${olt_user}
Set Suite Variable ${olt_pass}
- Set Suite Variable ${k8s_node_ip}
- Set Suite Variable ${k8s_node_user}
- Set Suite Variable ${k8s_node_pass}
@{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Set Suite Variable ${container_list}
@@ -157,10 +158,10 @@
... Get ONU Port in ONOS ${src['onu']} ${of_id}
# Check ONU port is Enabled in ONOS
Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
- ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
# Verify EAPOL flows are added for the ONU port
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
# Verify ONU state in voltha
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
... ENABLED ACTIVE REACHABLE
@@ -172,9 +173,9 @@
... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
... ${src['container_type']} ${src['container_name']} ${wpa_log}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
- ... Verify ONU in AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
- ... Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
+ ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
@@ -182,7 +183,7 @@
... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
... ${dst['container_name']}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
- ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
Run Keyword and Ignore Error Collect Logs
END
@@ -202,9 +203,9 @@
... Get ONU Port in ONOS ${src['onu']} ${of_id}
# Check ONU port is Enabled in ONOS
Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
- ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
- ... Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
+ ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
# Verify ONU state in voltha
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
@@ -244,7 +245,7 @@
Set Suite Variable ${olt_device_id}
#validate olt states
Wait Until Keyword Succeeds ${timeout} 5s
- ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${EMPTY} ${olt_device_id}
+ ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
Sleep 5s
Enable Device ${olt_device_id}
Wait Until Keyword Succeeds 180s 5s
@@ -261,7 +262,7 @@
Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
# Clear devices from ONOS
#Remove All Devices From ONOS
- #... http://karaf:karaf@${k8s_node_ip}:${ONOS_REST_PORT}
+ #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Teardown
[Documentation] kills processes and cleans up interfaces on src+dst servers
@@ -301,10 +302,10 @@
... Get ONU Port in ONOS ${src['onu']} ${of_id}
# Check ONU port is Enabled in ONOD
Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
- ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify ONU Port Is Enabled ${ONOS_SSH_PORT} ${ONOS_SSH_PORT} ${onu_port}
# Verify EAPOL flows are added for the ONU port
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify Eapol Flows Added For ONU ${ONOS_SSH_PORT} ${ONOS_SSH_PORT} ${onu_port}
# Verify ONU state in voltha
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
... ENABLED ACTIVE REACHABLE
@@ -315,9 +316,9 @@
... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
... ${src['container_type']} ${src['container_name']}
Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify ONU in AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Verify ONU in AAA-Users ${ONOS_SSH_PORT} ${ONOS_SSH_PORT} ${onu_port}
Wait Until Keyword Succeeds ${timeout} 2s
- ... Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
+ ... Execute ONOS CLI Command ${ONOS_SSH_PORT} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
... Validate DHCP and Ping True True
@@ -326,7 +327,7 @@
... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
... ${dst['container_name']}
Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
- ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
+ ... Validate Subscriber DHCP Allocation ${ONOS_SSH_PORT} ${ONOS_SSH_PORT} ${onu_port}
Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
Run Keyword and Ignore Error Collect Logs
END
@@ -336,7 +337,7 @@
Run Keyword and Ignore Error Get Device List from Voltha
Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
- Get ONOS Status ${k8s_node_ip} ${ONOS_SSH_PORT}
+ Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Verify ping is succesful except for given device
[Arguments] ${num_onus} ${exceptional_onu_id}
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 4fe034d..2d5fbf7 100644
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -128,14 +128,16 @@
Validate Device
[Documentation]
- ... Parses the output of "voltctl device list" and inspects device ${serial_number} and ${device_id}
- ... Arguments are matched for device states of: "admin_state", "oper_status", and "connect_status"
- [Arguments] ${admin_state} ${oper_status} ${connect_status} ${serial_number}=${EMPTY}
- ... ${device_id}=${EMPTY} ${onu_reason}=${EMPTY} ${onu}=False
+ ... Parses the output of "voltctl device list" and inspects a device ${id}, specified as either
+ ... the serial number or device ID. Arguments are matched for device states of: "admin_state",
+ ... "oper_status", and "connect_status"
+ [Arguments] ${admin_state} ${oper_status} ${connect_status}
+ ... ${id}=${EMPTY} ${onu_reason}=${EMPTY} ${onu}=False
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
Should Be Equal As Integers ${rc} 0
${jsondata}= To Json ${output}
${length}= Get Length ${jsondata}
+ ${matched}= Set Variable False
FOR ${INDEX} IN RANGE 0 ${length}
${value}= Get From List ${jsondata} ${INDEX}
${astate}= Get From Dictionary ${value} adminstate
@@ -144,24 +146,26 @@
${sn}= Get From Dictionary ${value} serialnumber
${devId}= Get From Dictionary ${value} id
${mib_state}= Get From Dictionary ${value} reason
- Run Keyword If '${sn}' == '${serial_number}' or '${devId}' == '${device_id}' Exit For Loop
+ ${matched}= Set Variable If '${sn}' == '${id}' or '${devId}' == '${id}' True False
+ Run Keyword If ${matched} Exit For Loop
END
+ Should Be True ${matched}
+ ... No match found for ${id} to validate device
Log ${value}
- Should Be Equal '${astate}' '${admin_state}' Device ${serial_number} admin_state != ${admin_state}
+ Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state}
... values=False
- Should Be Equal '${opstatus}' '${oper_status}' Device ${serial_number} oper_status != ${oper_status}
+ Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status}
... values=False
- Should Be Equal '${cstatus}' '${connect_status}' Device ${serial_number} conn_status != ${connect_status}
+ Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status}
... values=False
Run Keyword If '${onu}' == 'True' Should Be Equal '${mib_state}' '${onu_reason}'
- ... Device ${serial_number} mib_state incorrect (${mib_state}) values=False
+ ... Device ${sn} mib_state incorrect (${mib_state}) values=False
Validate OLT Device
- [Arguments] ${admin_state} ${oper_status} ${connect_status} ${serial_number}=${EMPTY}
- ... ${device_id}=${EMPTY}
- [Documentation] Parses the output of "voltctl device list" and inspects device ${serial_number} and/or
- ... ${device_id} Match on OLT Serial number or Device Id and inspect states
- Validate Device ${admin_state} ${oper_status} ${connect_status} ${serial_number} ${device_id}
+ [Arguments] ${admin_state} ${oper_status} ${connect_status} ${id}=${EMPTY}
+ [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified
+ ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states
+ Validate Device ${admin_state} ${oper_status} ${connect_status} ${id}
Validate ONU Devices
[Arguments] ${admin_state} ${oper_status} ${connect_status} ${List_ONU_Serial}