Build virtualenv using the Makefile
Add tidy target (don't use yet as there's a bug)
Make lint target cover all the files
Start at documentation generation using libdoc/testdoc within robot
Change-Id: I8117baf4bd006588ae9383e0731c49e17102348c
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 9f7c802..9250ab8 100644
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -37,35 +37,37 @@
[Return] ${output}
Validate OLT Device in ONOS
- [Documentation] Checks if olt has been connected to ONOS
[Arguments] ${serial_number}
+ [Documentation] Checks if olt has been connected to ONOS
${resp}= Get Request ONOS onos/v1/devices
${jsondata}= To Json ${resp.content}
Should Not Be Empty ${jsondata['devices']}
${length}= Get Length ${jsondata['devices']}
@{serial_numbers}= Create List
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
- \ ${of_id}= Get From Dictionary ${value} id
- \ ${sn}= Get From Dictionary ${value} serial
- \ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata['devices']} ${INDEX}
+ ${of_id}= Get From Dictionary ${value} id
+ ${sn}= Get From Dictionary ${value} serial
+ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ END
Should Be Equal As Strings ${sn} ${serial_number}
[Return] ${of_id}
Get ONU Port in ONOS
+ [Arguments] ${onu_serial_number} ${olt_of_id}
[Documentation] Retrieves ONU port for the ONU in ONOS
- [Arguments] ${onu_serial_number} ${olt_of_id}
${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports
${jsondata}= To Json ${resp.content}
Should Not Be Empty ${jsondata['ports']}
${length}= Get Length ${jsondata['ports']}
@{ports}= Create List
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata['ports']} ${INDEX}
- \ ${annotations}= Get From Dictionary ${value} annotations
- \ ${onu_port}= Get From Dictionary ${value} port
- \ ${portName}= Get From Dictionary ${annotations} portName
- \ Run Keyword If '${portName}' == '${onu_serial_number}' Exit For Loop
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata['ports']} ${INDEX}
+ ${annotations}= Get From Dictionary ${value} annotations
+ ${onu_port}= Get From Dictionary ${value} port
+ ${portName}= Get From Dictionary ${annotations} portName
+ Run Keyword If '${portName}' == '${onu_serial_number}' Exit For Loop
+ END
Should Be Equal As Strings ${portName} ${onu_serial_number}
[Return] ${onu_port}
diff --git a/libraries/utils.robot b/libraries/utils.robot
index db67643..e303379 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -31,5 +31,4 @@
# check voltctl and kubectl configured
${voltctl_rc}= Run And Return RC ${VOLTCTL_CONFIG}; voltctl device list
${kubectl_rc}= Run And Return RC ${KUBECTL_CONFIG}; kubectl get pods
- Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
- ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
+ Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR VOLTCTL and KUBECTL not configured. Please configure before executing tests.
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index d7dc48a..88541c7 100644
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -30,24 +30,26 @@
[Arguments] ${ip} ${port}
[Documentation] Parses the output of "voltctl device list" and inspects device ${serial_number}
#create/preprovision device
- ${rc} ${device_id}= Run and Return Rc and Output
- ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${ip}:${port}
+ ${rc} ${device_id}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${ip}:${port}
Should Be Equal As Integers ${rc} 0
[Return] ${device_id}
Enable Device
[Arguments] ${device_id}
+ [Documentation] Enables a device in VOLTHA
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${device_id}
Should Be Equal As Integers ${rc} 0
Get Device Flows from Voltha
[Arguments] ${device_id}
+ [Documentation] Gets device flows from VOLTHA
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device flows ${device_id}
Should Be Equal As Integers ${rc} 0
[Return] ${output}
Get Logical Device Output from Voltha
[Arguments] ${device_id}
+ [Documentation] Gets logicaldevice flows and ports from VOLTHA
${rc1} ${flows}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl logicaldevice flows ${device_id}
${rc2} ${ports}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl logicaldevice ports ${device_id}
Log ${flows}
@@ -57,6 +59,7 @@
Get Device Output from Voltha
[Arguments] ${device_id}
+ [Documentation] Gets device flows and ports from VOLTHA
${rc1} ${flows}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device flows ${device_id}
${rc2} ${ports}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device ports ${device_id}
Log ${flows}
@@ -72,20 +75,20 @@
${jsondata}= To Json ${output}
Log ${jsondata}
${length}= Get Length ${jsondata}
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata} ${INDEX}
- \ ${astate}= Get From Dictionary ${value} adminstate
- \ ${opstatus}= Get From Dictionary ${value} operstatus
- \ ${cstatus}= Get From Dictionary ${value} connectstatus
- \ ${sn}= Get From Dictionary ${value} serialnumber
- \ ${mib_state}= Get From Dictionary ${value} reason
- \ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata} ${INDEX}
+ ${astate}= Get From Dictionary ${value} adminstate
+ ${opstatus}= Get From Dictionary ${value} operstatus
+ ${cstatus}= Get From Dictionary ${value} connectstatus
+ ${sn}= Get From Dictionary ${value} serialnumber
+ ${mib_state}= Get From Dictionary ${value} reason
+ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ END
Should Be Equal ${astate} ${admin_state} Device ${serial_number} admin_state != ENABLED values=False
Should Be Equal ${opstatus} ${oper_status} Device ${serial_number} oper_status != ACTIVE values=False
Should Be Equal ${cstatus} ${connect_status} Device ${serial_number} connect_status != REACHABLE values=False
Run Keyword If '${onu}' == 'True' Should Be Equal ${mib_state} ${onu_reason} Device ${serial_number} mib_state incorrect values=False
-
Get Device ID From SN
[Arguments] ${serial_number}
[Documentation] Gets the device id by matching for ${serial_number}
@@ -93,11 +96,12 @@
${jsondata}= To Json ${output}
Log ${jsondata}
${length}= Get Length ${jsondata}
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata} ${INDEX}
- \ ${id}= Get From Dictionary ${value} id
- \ ${sn}= Get From Dictionary ${value} serialnumber
- \ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata} ${INDEX}
+ ${id}= Get From Dictionary ${value} id
+ ${sn}= Get From Dictionary ${value} serialnumber
+ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ END
[Return] ${id}
Get Logical Device ID From SN
@@ -107,11 +111,12 @@
${jsondata}= To Json ${output}
Log ${jsondata}
${length}= Get Length ${jsondata}
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata} ${INDEX}
- \ ${id}= Get From Dictionary ${value} parentid
- \ ${sn}= Get From Dictionary ${value} serialnumber
- \ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata} ${INDEX}
+ ${id}= Get From Dictionary ${value} parentid
+ ${sn}= Get From Dictionary ${value} serialnumber
+ Run Keyword If '${sn}' == '${serial_number}' Exit For Loop
+ END
[Return] ${id}
Validate Device Removed
@@ -122,8 +127,9 @@
Log ${jsondata}
${length}= Get Length ${jsondata}
@{ids}= Create List
- : FOR ${INDEX} IN RANGE 0 ${length}
- \ ${value}= Get From List ${jsondata} ${INDEX}
- \ ${device_id}= Get From Dictionary ${value} id
- \ Append To List ${ids} ${device_id}
+ FOR ${INDEX} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata} ${INDEX}
+ ${device_id}= Get From Dictionary ${value} id
+ Append To List ${ids} ${device_id}
+ END
List Should Not Contain Value ${ids} ${id}