Basic Elanservice Test case
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index 0f89dc8be1a1838e6b6828def714847455854ef4..aead4c2fcfd7a310bba3e98c5cc6bd8c85e1dd8f 100644 (file)
@@ -728,3 +728,28 @@ Create Neutron Port With Additional Params
     Log    ${port_id}
     Close Connection
     [Return]    ${OUTPUT}    ${port_id}
+
+Get Ports MacAddr
+    [Arguments]    ${portName_list}
+    [Documentation]    Retrieve the port MacAddr for the given list of port name and return the MAC address list.
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${MacAddr-list}    Create List
+    : FOR    ${portName}    IN    @{portName_list}
+    \    ${output} =    Write Commands Until Prompt    neutron port-list | grep "${portName}" | awk '{print $6}'    30s
+    \    Log    ${output}
+    \    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    \    ${macAddr}=    Get from List    ${splitted_output}    0
+    \    Log    ${macAddr}
+    \    Append To List    ${MacAddr-list}    ${macAddr}
+    [Return]    ${MacAddr-list}
+
+Delete SecurityGroup
+    [Arguments]    ${sg_name}
+    [Documentation]    Delete Security group
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    neutron security-group-delete ${sg_name}    40s
+    Log    ${output}
+    Should Match Regexp    ${output}    Deleted security_group: ${sg_name}|Deleted security_group\\(s\\): ${sg_name}
+    Close Connection