Fixes in Openstack Keywords 31/67531/16
authorgvrangan <venkatrangang@hcl.com>
Thu, 25 Jan 2018 01:12:21 +0000 (06:42 +0530)
committerSam Hague <shague@redhat.com>
Wed, 31 Jan 2018 14:19:03 +0000 (14:19 +0000)
- Fixed the list access in
  Is Feature Installed

- Fixed the Clean All Keyword
  Made it work for features that does not
  support L3, by ignoring the listing failure

Change-Id: I06f6aa797d0cc3887d610349a7fc0bb90b7a193f
Signed-off-by: gvrangan <venkatrangang@hcl.com>
csit/libraries/OpenStackOperations.robot

index 1f6ae074fde7184a39e439a5c0f9fee66d2c7612..12ce06858d34cad505a49bde7f0d153bd6e87d31 100644 (file)
@@ -1052,14 +1052,16 @@ Neutron Cleanup
 
 OpenStack List All
     [Documentation]    Get a list of different OpenStack resources that might be in use.
-    @{modules} =    BuiltIn.Create List    floating ip    server    router    port    network
-    ...    subnet    security group    security group rule
+    @{modules} =    BuiltIn.Create List    server    port    network    subnet    security group
+    ...    security group rule
+    Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    Append To List    ${modules}    floating ip    router
     : FOR    ${module}    IN    @{modules}
     \    OpenStack CLI    openstack ${module} list
 
 OpenStack CLI Get List
     [Arguments]    ${cmd}
     [Documentation]    Return a json list from the output of an OpenStack command.
+    @{list} =    BuiltIn.Create List
     ${json} =    OpenStack CLI    ${cmd}
     @{list} =    RequestsLibrary.To Json    ${json}
     BuiltIn.Log    ${list}
@@ -1076,13 +1078,15 @@ OpenStack CLI
 OpenStack Cleanup All
     [Documentation]    Cleanup all Openstack resources with best effort. The keyword will query for all resources
     ...    in use and then attempt to delete them. Errors are ignored to allow the cleanup to continue.
-    @{fips} =    OpenStack CLI Get List    openstack floating ip list -f json
+    @{fips} =    Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    OpenStack CLI Get List    openstack floating ip list -f json
+    ...    ELSE    Create List    @{EMPTY}
     : FOR    ${fip}    IN    @{fips}
     \    BuiltIn.Run Keyword And Ignore Error    Delete Floating IP    ${fip['ID']}
     @{vms} =    OpenStack CLI Get List    openstack server list -f json
     : FOR    ${vm}    IN    @{vms}
     \    BuiltIn.Run Keyword And Ignore Error    Delete Vm Instance    ${vm['ID']}
-    @{routers} =    OpenStack CLI Get List    openstack router list -f json
+    @{routers} =    Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    OpenStack CLI Get List    openstack router list -f json
+    ...    ELSE    Create List    @{EMPTY}
     : FOR    ${router}    IN    @{routers}
     \    BuiltIn.Run Keyword And Ignore Error    Cleanup Router    ${router['ID']}
     @{ports} =    OpenStack CLI Get List    openstack port list -f json
@@ -1133,7 +1137,7 @@ Copy DHCP Files From Control Node
 
 Is Feature Installed
     [Arguments]    ${features}=none
-    : FOR    ${feature}    IN    ${features}
+    : FOR    ${feature}    IN    @{features}
     \    ${status}    ${output}    Run Keyword And Ignore Error    Builtin.Should Contain    ${CONTROLLERFEATURES}    ${feature}
     \    Return From Keyword If    "${status}" == "PASS"    True
     [Return]    False