Initial commit for vtn manager system test cases
authorDenghui Huang <huangdenghui@gmail.com>
Wed, 15 Jan 2014 13:32:25 +0000 (21:32 +0800)
committerDenghui Huang <huangdenghui@gmail.com>
Wed, 15 Jan 2014 13:32:25 +0000 (21:32 +0800)
Signed-off-by: Denghui Huang <huangdenghui@gmail.com>
test/csit/suites/vtn/030__vtn_manager.txt [new file with mode: 0644]

diff --git a/test/csit/suites/vtn/030__vtn_manager.txt b/test/csit/suites/vtn/030__vtn_manager.txt
new file mode 100644 (file)
index 0000000..52073d6
--- /dev/null
@@ -0,0 +1,120 @@
+*** Settings ***
+Documentation     Test suite for VTN Manager
+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
+Library           ../../libraries/Topology.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT_VTNS}    controller/nb/v2/vtn/default/vtns
+
+*** Test Cases ***
+Add a vtn Tenant1
+    [Documentation]    Add a vtn Tenant1
+    [Tags]    add
+    Add a vtn    Tenant1    {"description": "Virtual Tenant 1 for Hackfest network"}
+
+Add a vBridge vBridge1
+    [Documentation]    Add a vBridge vBridge1 in vtn Tenant1
+    [Tags]    add
+    Add a vBridge    Tenant1    vBridge1    {}
+
+Add a interface If1
+    [Documentation]    Add a interface if1 into vBrdige vBrdige1
+    [Tags]    add
+    Add a interface    Tenant1    vBridge1    if1    {}
+
+Add a interface if2
+    [Documentation]    Add a interface if2 into vBrdige vBrdige1
+    [Tags]    add
+    Add a interface    Tenant1    vBridge1    if2    {}
+
+Add a portmap for interface if1
+    [Documentation]    Create a portmap on Interface if1 of vBridge1
+    [Tags]    add
+    ${node}    Create Dictionary    type    OF    id    00:00:00:00:00:00:00:02
+    ${port}    Create Dictionary    name    s2-eth1
+    ${portmap_data}    Create Dictionary    node    ${node}    port    ${port}
+    Add a portmap    Tenant1    vBridge1    if1    ${portmap_data}
+
+Add a portmap for interface if2
+    [Documentation]    Create a portmap on Interface if2 of vBridge1
+    ${node}    Create Dictionary    type    OF    id    00:00:00:00:00:00:00:03
+    ${port}    Create Dictionary    name    s3-eth1
+    ${portmap_data}    Create Dictionary    node    ${node}    port    ${port}
+    Add a portmap    Tenant1    vBridge1    if2    ${portmap_data} 
+
+Add a vBridge vBridge2
+    [Documentation]    Add a vBridge vBridge2 in vtn Tenant1
+    [Tags]    add
+    Add a vBridge    Tenant1    vBridge2    {}
+
+Add a interface If3
+    [Documentation]    Add a interface if3 into vBrdige vBrdige2
+    [Tags]    add
+    Add a interface    Tenant1    vBridge2    if3    {}
+
+Add a interface if4
+    [Documentation]    Add a interface if4 into vBrdige vBrdige2
+    [Tags]    add
+    Add a interface    Tenant1    vBridge2    if4    {}
+
+Add a portmap for interface if3
+    [Documentation]    Create a portmap on Interface if3 of vBridge2
+    [Tags]    add
+    ${node}    Create Dictionary    type    OF    id    00:00:00:00:00:00:00:02
+    ${port}    Create Dictionary    name    s2-eth2
+    ${portmap_data}    Create Dictionary    node    ${node}    port    ${port}
+    Add a portmap    Tenant1    vBridge2    if3    ${portmap_data}
+
+Add a portmap for interface if4
+    [Documentation]    Create a portmap on Interface if4 of vBridge2
+    ${node}    Create Dictionary    type    OF    id    00:00:00:00:00:00:00:03
+    ${port}    Create Dictionary    name    s3-eth2
+    ${portmap_data}    Create Dictionary    node    ${node}    port    ${port}
+    Add a portmap    Tenant1    vBridge2    if4    ${portmap_data}
+
+Ping h1 to h3
+    [Documentation]    Ping h1 to h3, verify no packet loss
+    Sleep    5
+    Write    h1 ping -c 30 h3
+    Sleep    40
+    ${result}    Read
+    Should Contain    ${result}    64 bytes
+
+Ping h2 to h4
+    [Documentation]    Ping h2 to h4, verify no packet loss
+    Sleep    5
+    Write    h2 ping -c 30 h4
+    Sleep    40
+    ${result}    Read
+    Should Contain    ${result}    64 bytes
+
+*** Keywords ***
+Add a vtn
+    [Arguments]    ${vtn_name}    ${vtn_data}
+    [Documentation]    Create a vtn with specified parameters.
+    ${resp}    Post    session    ${REST_CONTEXT_VTNS}/${vtn_name}    data=${vtn_data}
+    Should Be Equal As Strings    ${resp.status_code}    201
+
+Add a vBridge
+    [Arguments]    ${vtn_name}    ${vBridge_name}    ${vBridge_data}
+    [Documentation]    Create a vBridge in a VTN
+    ${resp}    Post    session    ${REST_CONTEXT_VTNS}/${vtn_name}/vbridges/${vBridge_name}    data=${vBridge_data}
+    Should Be Equal As Strings    ${resp.status_code}    201
+
+Add a interface
+    [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${interface_data}
+    [Documentation]    Create a interface into a vBridge of a VTN
+    ${resp}    Post    session    ${REST_CONTEXT_VTNS}/${vtn_name}/vbridges/${vBridge_name}/interfaces/${interface_name}    data=${interface_data}
+    Should Be Equal As Strings    ${resp.status_code}    201
+
+Add a portmap
+    [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${portmap_data}
+    [Documentation]    Create a portmap for a interface of a vbridge
+    ${resp}    Put    session    ${REST_CONTEXT_VTNS}/${vtn_name}/vbridges/${vBridge_name}/interfaces/${interface_name}/portmap    data=${portmap_data}
+    Should Be Equal As Strings    ${resp.status_code}    200