Adding link/port bounce test to basic openflow suite
[integration/test.git] / test / csit / suites / openflowplugin / MD_SAL_NSF_OF10 / 010__restconf_inventory.robot
index 447e686a694decf604bcb4619458687d875ba82e..00189689f960952e8bbd7cfc3e78fc718b490952 100644 (file)
@@ -10,33 +10,65 @@ Resource          ../../../libraries/Utils.txt
 
 *** Variables ***
 ${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+${VENDOR}         Nicira, Inc.
+${HARDWARE}       Open vSwitch
 @{node_list}      openflow:1    openflow:2    openflow:3
 
 *** Test Cases ***
 Get list of nodes
     [Documentation]    Get the inventory
-    Log    ${start}
+    Set Suite Variable    ${SW_IPADDRESS}    "flow-node-inventory:ip-address":"${MININET}"
+    Set Suite Variable    ${SW_VENDOR}    "flow-node-inventory:manufacturer":"${VENDOR}"
+    Set Suite Variable    ${SW_HARDWARE}    "flow-node-inventory:manufacturer":"${HARDWARE}"
+    Set Suite Variable    @{SW_CAPABILITIES}    "flow-node-inventory:flow-feature-capability-flow-stats"    "flow-node-inventory:flow-feature-capability-table-stats"    "flow-node-inventory:flow-feature-capability-port-stats"    "flow-node-inventory:flow-feature-capability-queue-stats"
     Wait Until Keyword Succeeds    30s    2s    Ensure All Nodes Are In Response    ${REST_CONTEXT}    ${node_list}
+    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
+    Log    ${resp.content}
 
-Get nodeconnector for a node 1
+Get node 1 inventory
     [Documentation]    Get the inventory for a node
-    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:1
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    openflow:1:1
-    Should Contain    ${resp.content}    openflow:1:2
+    @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:1:1
+    ...    openflow:1:2
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1    ${list}
 
-Get nodeconnector for a node 2
+Get node 2 inventory
     [Documentation]    Get the inventory for a node
-    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:2
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    openflow:2:1
-    Should Contain    ${resp.content}    openflow:2:2
-    Should Contain    ${resp.content}    openflow:2:3
+    @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:2:1
+    ...    openflow:2:2    openflow:2:3
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2    ${list}
 
-Get nodeconnector for a node 3
+Get node 3 inventory
     [Documentation]    Get the inventory for a node
-    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:3
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    openflow:3:1
-    Should Contain    ${resp.content}    openflow:3:2
-    Should Contain    ${resp.content}    openflow:3:3
+    @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:3:1
+    ...    openflow:3:2    openflow:3:3
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:3    ${list}
+
+Link Down
+    [Documentation]    Take link s1-s2 down
+    Write    link s1 s2 down
+    Read Until    mininet>
+    @{list}    Create List    "link-down":true
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1/node-connector/openflow:1:1    ${list}
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2/node-connector/openflow:2:3    ${list}
+
+Link Up
+    [Documentation]    Take link s1-s2 up
+    Write    link s1 s2 up
+    Read Until    mininet>
+    @{list}    Create List    "link-down":false
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1/node-connector/openflow:1:1    ${list}
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2/node-connector/openflow:2:3    ${list}
+
+Remove Port
+    [Documentation]    Remove port s2-eth1
+    Write    sh ovs-vsctl del-port s2 s2-eth1
+    Read Until    mininet>
+    @{list}    Create List    openflow:2:1
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements Not At URI    ${REST_CONTEXT}    ${list}
+
+Add Port
+    [Documentation]    Add port s2-eth1, new id 4
+    Write    sh ovs-vsctl add-port s2 s2-eth1
+    Read Until    mininet>
+    @{list}    Create List    openflow:2:4
+    Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}    ${list}