Create stats mgr + Complete some test cases with mininet + fix test file names
authorLuis Gomez <luis.gomez@ericsson.com>
Sun, 1 Dec 2013 12:14:06 +0000 (04:14 -0800)
committerLuis Gomez <luis.gomez@ericsson.com>
Sun, 1 Dec 2013 12:14:06 +0000 (04:14 -0800)
Change-Id: If337c3ce050f392a0760788b70ddd96ec44fcc66
Signed-off-by: Luis Gomez <luis.gomez@ericsson.com>
test/csit/suites/base/010__statistics_manager.txt [new file with mode: 0644]
test/csit/suites/base/015__topology_manager.txt [moved from test/csit/suites/base/010_topology_manager.txt with 85% similarity]
test/csit/suites/base/020__forwarding_rules_manager.txt [moved from test/csit/suites/base/015_forwarding_rules_manager.txt with 87% similarity]
test/csit/suites/base/025__host_tracker.txt [moved from test/csit/suites/base/020_host_tracker.txt with 86% similarity]
test/csit/suites/base/025_arp_handler.txt [deleted file]
test/csit/suites/base/030__arp_handler.txt [new file with mode: 0644]
test/csit/suites/base/035__forwarding_manager.txt [moved from test/csit/suites/base/030_forwarding_manager.txt with 84% similarity]
test/csit/suites/base/050__OVSDB_plugin.txt [moved from test/csit/suites/base/050_OVSDB_plugin.txt with 95% similarity]

diff --git a/test/csit/suites/base/010__statistics_manager.txt b/test/csit/suites/base/010__statistics_manager.txt
new file mode 100644 (file)
index 0000000..3b2e789
--- /dev/null
@@ -0,0 +1,54 @@
+*** Settings ***
+Documentation     Test suite for the statistics manager module
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${node1}       "node":{"type":"OF","id":"00:00:00:00:00:00:00:01"}
+${node2}       "node":{"type":"OF","id":"00:00:00:00:00:00:00:02"}
+${node3}       "node":{"type":"OF","id":"00:00:00:00:00:00:00:03"}
+${nodeconn1}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:01"},"id":"1"}
+${nodeconn2}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:01"},"id":"2"}
+${nodeconn3}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:02"},"id":"1"}
+${nodeconn4}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:02"},"id":"2"}
+${nodeconn5}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:02"},"id":"3"}
+${nodeconn6}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:03"},"id":"1"}
+${nodeconn7}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:03"},"id":"2"}
+${nodeconn8}   "nodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:03"},"id":"3"}
+
+${key}             portStatistics
+${REST_CONTEXT}    /controller/nb/v2/statistics
+
+*** Test Cases ***
+get port stats
+    [Documentation]    Show port stats and validate result
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/port
+    Should Contain    ${resp.content}    ${nodeconn1}
+    Should Contain    ${resp.content}    ${nodeconn2}
+    Should Contain    ${resp.content}    ${nodeconn3}
+    Should Contain    ${resp.content}    ${nodeconn4}
+    Should Contain    ${resp.content}    ${nodeconn5}
+    Should Contain    ${resp.content}    ${nodeconn6}
+    Should Contain    ${resp.content}    ${nodeconn7}
+    Should Contain    ${resp.content}    ${nodeconn8}
+get flow stats
+    [Documentation]    Show flow stats and validate result
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/flow
+    Should Contain    ${resp.content}    ${node1}
+    Should Contain    ${resp.content}    ${node2}
+    Should Contain    ${resp.content}    ${node3}
+get table stats
+    [Documentation]    Show flow stats and validate result
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/table
+    Should Contain    ${resp.content}    ${node1}
+    Should Contain    ${resp.content}    ${node2}
+    Should Contain    ${resp.content}    ${node3}
+
similarity index 85%
rename from test/csit/suites/base/010_topology_manager.txt
rename to test/csit/suites/base/015__topology_manager.txt
index 1b12f4c628b20a60a2e8ae1c48cf96cc44730661..e9ae23aa5f446348b5f199450caf5432a43fb494 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Test suite for Topology Manager
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
 Suite Teardown    Delete All Sessions
 Library           Collections
 Library           ../../libraries/RequestsLibrary.py
@@ -19,8 +20,6 @@ ${REST_CONTEXT}    /controller/nb/v2/topology
 Get Topology
     [Documentation]    Get Topology and validate the result.
     [Tags]    get
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080   headers=${headers}    auth=${auth}
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
     Log    ${resp.content}
@@ -33,8 +32,6 @@ Add a userlink
     [Tags]    add
     ${body}    Create Dictionary    name    ${name}    status    Success    srcNodeConnector
     ...    OF|1@OF|00:00:00:00:00:00:00:02    dstNodeConnector    OF|1@OF|00:00:00:00:00:00:00:03
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/userLink/${name}    data=${body}
     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/userLinks
@@ -48,8 +45,6 @@ Remove a userlink
     [Tags]    remove
     ${body}    Create Dictionary    name    ${name}    status    Success    srcNodeConnector
     ...    OF|1@OF|00:00:00:00:00:00:00:02    dstNodeConnector    OF|1@OF|00:00:00:00:00:00:00:03
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/userLink/${name}
     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/userLinks
similarity index 87%
rename from test/csit/suites/base/015_forwarding_rules_manager.txt
rename to test/csit/suites/base/020__forwarding_rules_manager.txt
index 88c2fa5eb7d2e967aae51517696e428b2c447b4d..1dcb2a48380aaa19b2a661ea2d3bd5293e0ec956 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Test suite for the forwarding rule manager module.
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080  auth=${AUTH}   headers=${HEADERS}
 Suite Teardown    Delete All Sessions
 Library           Collections
 Library           ../../libraries/RequestsLibrary.py
@@ -21,8 +22,6 @@ Add a flow
     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
     ...    ${node}    priority    1    etherType    0x800    nwDst
     ...    10.0.0.1/32    actions    ${actions}
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
@@ -39,8 +38,6 @@ Remove a flow
     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
     ...    ${node}    priority    1    etherType    0x800    nwDst
     ...    10.0.0.1/32    actions    ${actions}
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}
     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
similarity index 86%
rename from test/csit/suites/base/020_host_tracker.txt
rename to test/csit/suites/base/025__host_tracker.txt
index a01f73b409f31dda50c832a3666ae2813d032295..f82715f1cdb69befeae4e41991d4e8a3346019e5 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Test suite for the host tracker module.
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
 Suite Teardown    Delete All Sessions
 Library           Collections
 Library           ../../libraries/RequestsLibrary.py
@@ -18,8 +19,6 @@ Add a host
     ${body}    Create Dictionary    nodeType    OF    dataLayerAddress    5e:bf:79:84:10:a6    vlan
     ...    1    nodeId    00:00:00:00:00:00:00:03    nodeConnectorId    9    networkAddress
     ...    10.0.1.4    staticHost    ${True}    nodeConnectorType    OF
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}    data=${body}
     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
@@ -34,8 +33,6 @@ Remove a host
     ${body}    Create Dictionary    nodeType    OF    dataLayerAddress    5e:bf:79:84:10:a6    vlan
     ...    1    nodeId    00:00:00:00:00:00:00:03    nodeConnectorId    9    networkAddress
     ...    10.0.1.4    staticHost    ${True}    nodeConnectorType    OF
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}
     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
diff --git a/test/csit/suites/base/025_arp_handler.txt b/test/csit/suites/base/025_arp_handler.txt
deleted file mode 100644 (file)
index 3b01649..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-*** Settings ***
-Documentation     Test suite for the arp handler module.
-Suite Teardown    Delete All Sessions
-Library           Collections
-Library           ../../libraries/RequestsLibrary.py
-Library           ../../libraries/Common.py
-Variables         ../../variables/Variables.py
-
-*** Variables ***
-${name}           test
-${key}            subnetConfig
-${REST_CONTEXT}    /controller/nb/v2/subnetservice
-
-*** Test Cases ***
-Add a subnet
-    [Documentation]    Add a subnet, list to validate the result.
-    [Tags]    add
-    ${body}    Create Dictionary    name    ${name}    subnet    10.0.0.254/8
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
-    ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}    data=${body}
-    Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
-    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
-    Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
-    ${result}    To JSON    ${resp.content}
-    ${content}    Get From Dictionary    ${result}    ${key}
-    List Should Contain Value    ${content}    ${body}
-
-Remove a subnet
-    [Documentation]    Remove a subnet, list to validate the result.
-    [Tags]    remove
-    ${body}    Create Dictionary    name    ${name}    subnet    10.0.0.254/8
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
-    ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}
-    Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
-    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
-    Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
-    ${result}    To JSON    ${resp.content}
-    ${content}    Get From Dictionary    ${result}    ${key}
-    List Should Not Contain Value    ${content}    ${body}
diff --git a/test/csit/suites/base/030__arp_handler.txt b/test/csit/suites/base/030__arp_handler.txt
new file mode 100644 (file)
index 0000000..691a26b
--- /dev/null
@@ -0,0 +1,62 @@
+*** Settings ***
+Documentation     Test suite for the arp handler module.
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${name}           test
+${key}            subnetConfig
+${REST_CONTEXT}    /controller/nb/v2/subnetservice
+${REST_CONTEXT_HT}   /controller/nb/v2/hosttracker
+
+*** Test Cases ***
+List Subnets
+    [Documentation]    List subnets and verify default is there
+    [Tags]    Get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
+    Should Be Equal As Strings   ${resp.status_code}   200
+    ${result}    To JSON    ${resp.content}
+    ${subnet}    Get From Dictionary    ${result}    ${key}
+    ${content}   Get From List    ${subnet}    0
+    Dictionary Should Contain Value   ${content}   0.0.0.0/0
+Ping h1 to h4
+    [Documentation]    Ping h1 to h4, verify no packet loss
+    [Tags]   Get
+    Write   h1 ping -c 3 h4
+    Sleep   6
+    ${result}    Read
+    Should Contain   ${result}   64 bytes
+List hosts
+    [Documentation]    List hosts and verify h1 and h4
+    [Tags]   Get
+    ${resp}    Get    session    ${REST_CONTEXT_HT}/${CONTAINER}/hosts/active
+    Should Be Equal As Strings    ${resp.status_code}    200  
+    Should Contain     ${resp.content}    10.0.0.1
+    Should Contain     ${resp.content}    10.0.0.4
+Add a subnet
+    [Documentation]    Add a subnet, list to validate the result.
+    [Tags]    add
+    ${body}    Create Dictionary    name    ${name}    subnet    11.0.0.254/8
+    ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}    data=${body}
+    Should Be Equal As Strings    ${resp.status_code}    201
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary    ${result}    ${key}
+    List Should Contain Value    ${content}    ${body}
+Remove a subnet
+    [Documentation]    Remove a subnet, list to validate the result.
+    [Tags]    remove
+    ${body}    Create Dictionary    name    ${name}    subnet    11.0.0.254/8
+    ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}
+    Should Be Equal As Strings    ${resp.status_code}    204
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary    ${result}    ${key}
+    List Should Not Contain Value    ${content}    ${body}
similarity index 84%
rename from test/csit/suites/base/030_forwarding_manager.txt
rename to test/csit/suites/base/035__forwarding_manager.txt
index 0a2d3e954329accee5305b6fb232f6754428a5a4..d69a7b99aab1839935364f711fec19feaf54d052 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Test suite for the forwarding manager module.
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
 Suite Teardown    Delete All Sessions
 Library           Collections
 Library           ../../libraries/RequestsLibrary.py
@@ -17,8 +18,6 @@ Add a static route
     [Tags]    add
     ${body}    Create Dictionary    name    ${name}    prefix    192.168.1.0/24    nextHop
     ...    10.0.0.2
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/route/${name}    data=${body}
     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/routes
@@ -32,8 +31,6 @@ Remove a static route
     [Tags]    remove
     ${body}    Create Dictionary    name    ${name}    prefix    192.168.1.0/24    nextHop
     ...    10.0.0.2
-    ${headers}    Create Dictionary    Content-Type    application/json
-    Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/route/${name}
     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/routes
similarity index 95%
rename from test/csit/suites/base/050_OVSDB_plugin.txt
rename to test/csit/suites/base/050__OVSDB_plugin.txt
index 084d35395a04a1b35055dc79e31d0bac8439df7f..63fbf0c6af3fc27433d8124a832a244c9e5ec368 100644 (file)
@@ -2,6 +2,7 @@
 Documentation     Test suite for OVSDB plugin
 Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
 Suite Teardown    Delete All Sessions
+Library           SSHLibrary
 Library           Collections
 Library           ../../libraries/RequestsLibrary.py
 Library           ../../libraries/Common.py
@@ -36,7 +37,7 @@ Connect to mininet
     ${result}    To JSON    ${resp.content}
     ${content}    Get From Dictionary    ${result}    ${key}
     List Should Contain Value    ${content}    ${body}
-    Sleep   1
+    Sleep   2
 Add bridge s4
     [Documentation]    Add bridge s4
     [Tags]    add
@@ -91,6 +92,14 @@ Delete bridge s1
     [Tags]    Delete
     ${resp}    Delete    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s1
     Should Be Equal As Strings    ${resp.status_code}    200
+    Sleep   5
+Ping h1 to h4
+    [Documentation]    Ping h1 to h4, verify no packet loss
+    [Tags]   Get
+    Write   h1 ping -c 3 h4
+    Sleep   6
+    ${result}    Read
+    Should Contain   ${result}   64 bytes 
 Disconnect mininet
     [Documentation]    Disconnect mininet, list the nodes and validate result
     [Tags]    delete
@@ -102,4 +111,3 @@ Disconnect mininet
     ${result}    To JSON    ${resp.content}
     ${content}    Get From Dictionary    ${result}    ${key}
     List Should Not Contain Value    ${content}    ${body}
-