Adding intgration test for unimgr project 62/34362/11
authorMohamed El-Serngawy <melserngawy@inocybe.com>
Tue, 9 Feb 2016 22:50:18 +0000 (17:50 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 17 Feb 2016 22:27:17 +0000 (22:27 +0000)
Change-Id: Iadab5a4ec8c19f4b754fdfc8f301128ff27f861c
Signed-off-by: Mohamed El-Serngawy <melserngawy@inocybe.com>
csit/libraries/KarafKeywords.robot
csit/libraries/UnimgrKeywords.robot [new file with mode: 0644]
csit/suites/unimgr/uni_operations/010_unimanager_restconf.robot [new file with mode: 0644]
csit/suites/unimgr/uni_operations/020_unimanager_cli.robot [new file with mode: 0644]
csit/testplans/unimgr-basic.txt [new file with mode: 0644]
csit/testplans/unimgr.txt [deleted file]
csit/variables/unimgr/add_evc.json [new file with mode: 0644]
csit/variables/unimgr/add_uni.json [new file with mode: 0644]
csit/variables/unimgr/evc_egress_speed.json [new file with mode: 0644]
csit/variables/unimgr/evc_ingress_speed.json [new file with mode: 0644]
csit/variables/unimgr/uni_speed.json [new file with mode: 0644]

index f61e650d77a98ec9f552de1c760a60b9b09ad765..f1390b3c8937d3111c115e571dd512c0ec74a80f 100644 (file)
@@ -29,6 +29,14 @@ Issue Command On Karaf Console
     Log    ${output}
     [Return]    ${output}
 
+Check For Elements On Karaf Command Output Message
+    [Arguments]    ${cmd}    ${elements}    ${controller}=${ODL_SYSTEM_IP}    ${karaf_port}=${KARAF_SHELL_PORT}    ${timeout}=5
+    [Documentation]    Will execute the command using Issue Command On Karaf Console then check for the given elements
+    ...                in the command output message
+    ${output}    Issue Command On Karaf Console    ${cmd}    ${controller}    ${karaf_port}    ${timeout}
+    : FOR    ${i}    IN    @{elements}
+    \    Should Contain    ${output}    ${i}
+
 Verify Bundle Is Installed
     [Arguments]    ${bundle_name}    ${controller}=${ODL_SYSTEM_IP}    ${karaf_port}=${KARAF_SHELL_PORT}
     [Documentation]    Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "
diff --git a/csit/libraries/UnimgrKeywords.robot b/csit/libraries/UnimgrKeywords.robot
new file mode 100644 (file)
index 0000000..9129c07
--- /dev/null
@@ -0,0 +1,44 @@
+*** Settings ***
+Documentation    Unimgr keywords defination that will be used in Unimgr suite.
+Library    OperatingSystem
+Library    SSHLibrary
+Library    String
+Resource    ../../../libraries/OVSDB.robot
+Resource    ../../../libraries/Utils.robot
+Variables    ../../../variables/Variables.py
+
+*** Variables ***
+${Bridge_Name}    ovsbr0
+${UniMgr_Variables_DIR}    ../variables/unimgr
+
+*** Keywords ***
+Setup Unimgr Test Environment
+    [Documentation]    Establish the Opendayligh session and prepair the Mininet VMs
+    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    Prepair Unimgr Test Environment     ${TOOLS_SYSTEM_IP}
+    Prepair Unimgr Test Environment     ${TOOLS_SYSTEM_2_IP}
+
+Prepair Unimgr Test Environment
+    [Arguments]    ${Mininet_IP}
+    [Documentation]    delete the ovs bridge and manager then set the manager to a passive mode ptcp:6640.
+    Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl del-manager
+    Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl del-br ${Bridge_Name}
+    Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDBPORT}
+    ${stdout}=    Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl show
+    Should Contain     ${stdout}    "ptcp:${OVSDBPORT}"
+
+Get Add Uni Json
+    [Arguments]    ${IP-Address}    ${MAC-Address}
+    [Documentation]    read the add_uni.json file and replace the IPaddress and MACaddress with the give arguments.
+    ${json}    OperatingSystem.Get File    ${UniMgr_Variables_DIR}/add_uni.json
+    ${temp}    Replace String    ${json}    {mac-address}    ${MAC-Address}
+    ${uniJson}    Replace String    ${temp}    {uni-ip}    ${IP-Address}
+    [Return]    ${uniJson}
+
+Get Add Evc Json
+    [Arguments]    ${UNI1-IP}    ${UNI2-IP}
+    [Documentation]    read the add_evc.json file and replace the IP-address with the give arguments.
+    ${Json}    OperatingSystem.Get File    ${UniMgr_Variables_DIR}/add_evc.json
+    ${temp}    Replace String    ${Json}    {uni1-ip}    ${UNI1-IP}
+    ${evcJson}    Replace String    ${temp}    {uni2-ip}    ${UNI2-IP}
+    [Return]    ${evcJson}
\ No newline at end of file
diff --git a/csit/suites/unimgr/uni_operations/010_unimanager_restconf.robot b/csit/suites/unimgr/uni_operations/010_unimanager_restconf.robot
new file mode 100644 (file)
index 0000000..7afa031
--- /dev/null
@@ -0,0 +1,100 @@
+*** Settings ***
+Documentation     Test suite for all Uni Manager operations
+Suite Setup       Setup Unimgr Test Environment
+Suite Teardown    Delete All Sessions
+Library           OperatingSystem
+Library           String
+Library           Collections
+Library           SSHLibrary
+Library           RequestsLibrary
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/UnimgrKeywords.robot
+
+*** Variables ***
+${DEFAULT_LINUX_PROMPT}
+${Mininet1_IP}    ${TOOLS_SYSTEM_IP}
+${Mininet2_IP}    ${TOOLS_SYSTEM_2_IP}
+${UNI1_MAC}    68:5b:35:bb:f8:3e
+${UNI2_MAC}    52:7b:25:cb:a7:3c
+${Evc_topo_API}    topology/unimgr:evc/link/evc:%2F%2F1
+${Uni_topo_API}    topology/unimgr:uni/node/uni:%2F%2F
+${UniMgr_variables_DIR}    ${CURDIR}/../../../variables/unimgr
+
+
+*** Test Cases ***
+Create source and destination UNIs at the OVS instances using Restconf API
+    [Documentation]    Create source and destination UNIs
+    [Tags]    UniMgr UNIs Create
+    ${uniSource}    Get Add Uni Json    ${Mininet1_IP}    ${UNI1_MAC}
+    ${uniDest}    Get Add Uni Json    ${Mininet2_IP}    ${UNI2_MAC}
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}    data=${uniSource}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}    data=${uniDest}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
+
+
+Update UNI Speed
+    [Documentation]    Update the Unis source and destenation speed
+    [Tags]    UniMgr UNIs Speed
+    ${speedJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/uni_speed.json
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}/cl-unimgr-mef:speed    data=${speedJson}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}/cl-unimgr-mef:speed    data=${speedJson}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    speed-10G
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
+
+
+Create EVC tunnel between the Unis
+    [Documentation]    Create EVC between Unis
+    [Tags]    UniMgr EVC Create
+    ${evc}    Get Add Evc Json    ${Mininet1_IP}    ${Mininet2_IP}
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}    data=${evc}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    evc://1
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
+
+Update EVC Ingress and Egress Speed
+    [Documentation]    Update the EVC connection Ingress and Egress Speed
+    [Tags]    UniMgr EVC Speed
+    ${ingressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_ingress_speed.json
+    ${egressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_egress_speed.json
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:ingress-bw    data=${ingressJson}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:egress-bw    data=${egressJson}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    speed-1G
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
+
+
+Delete EVC tunnel between the Unis
+    [Documentation]    Delete EVC
+    [Tags]    UniMgr EVC Delete
+    ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    evc://1
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/unimgr:evc/    ${elements}
+
+Delete UNIs source and destination
+    [Documentation]    Delete both UNIs source and destination
+    [Tags]    UniMgr UNI Delete
+    ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
diff --git a/csit/suites/unimgr/uni_operations/020_unimanager_cli.robot b/csit/suites/unimgr/uni_operations/020_unimanager_cli.robot
new file mode 100644 (file)
index 0000000..00ef616
--- /dev/null
@@ -0,0 +1,60 @@
+*** Settings ***
+Documentation     Test suite for all Uni Manager operations
+Suite Setup       Setup Unimgr Test Environment
+Suite Teardown    Delete All Sessions
+Library           OperatingSystem
+Library           String
+Library           Collections
+Library           SSHLibrary
+Library           RequestsLibrary
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/UnimgrKeywords.robot
+
+*** Variables ***
+${DEFAULT_LINUX_PROMPT}
+${Mininet1_IP}    ${TOOLS_SYSTEM_IP}
+${Mininet2_IP}    ${TOOLS_SYSTEM_2_IP}
+${UNI1_MAC}    68:5b:35:bb:f8:3e
+${UNI2_MAC}    52:7b:25:cb:a7:3c
+
+*** Test Cases ***
+Create source and destination UNIs at the OVS instances using Restconf API
+    [Documentation]    Create source and destination UNIs
+    [Tags]    UniMgr UNIs Create
+    ${elements}    Create List    ${Mininet1_IP}
+    Check For Elements On Karaf Command Output Message    uni-add -ip ${Mininet1_IP} -ma ${UNI1_MAC}    ${elements}
+    ${elements}    Create List    ${Mininet2_IP}
+    Check For Elements On Karaf Command Output Message    uni-add -ip ${Mininet2_IP} -ma ${UNI2_MAC}    ${elements}
+
+List All UNIs
+    [Documentation]    List all existing UNIs in the config data store
+    [Tags]    UniMgr
+    ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
+    Check For Elements On Karaf Command Output Message    uni-list -c    ${elements}
+
+Show UNI
+    [Documentation]    Show the information of the created Unis from the operational data store
+    [Tags]    UniMgr
+    ${elements}    Create List    ${Mininet1_IP}
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements On Karaf Command Output Message    uni-show ${Mininet1_IP}    ${elements}
+
+Update the Unis Speed
+    [Documentation]    Update Created Unis speed
+    [Tags]    UniMgr
+    ${elements}    Create List    ${Mininet1_IP} updated
+    Check For Elements On Karaf Command Output Message    uni-update -ip ${Mininet1_IP} -ma ${UNI1_MAC} -s 10G    ${elements}
+    ${element}    Create List    Speed10G
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements On Karaf Command Output Message    uni-show ${Mininet1_IP}    ${element}
+
+Delete UNIs source and destination
+    [Documentation]    Delete both UNIs source and destination.
+    [Tags]    UniMgr UNI Delete
+    ${elements}    Create List    Uni successfully removed
+    Check For Elements On Karaf Command Output Message    uni-remove ${Mininet1_IP}    ${elements}
+    Check For Elements On Karaf Command Output Message    uni-remove ${Mininet2_IP}    ${elements}
+    ${elements}    Create List    No uni found
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements On Karaf Command Output Message    uni-show ${Mininet1_IP}    ${elements}
+    Wait Until Keyword Succeeds    16s    2s    Check For Elements On Karaf Command Output Message    uni-show ${Mininet2_IP}    ${elements}
\ No newline at end of file
diff --git a/csit/testplans/unimgr-basic.txt b/csit/testplans/unimgr-basic.txt
new file mode 100644 (file)
index 0000000..cdac0b8
--- /dev/null
@@ -0,0 +1,3 @@
+# Place the suites in run order:
+integration/test/csit/suites/unimgr/basic
+integration/test/csit/suites/unimgr/uni_operations
\ No newline at end of file
diff --git a/csit/testplans/unimgr.txt b/csit/testplans/unimgr.txt
deleted file mode 100644 (file)
index 46b12f2..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# Place the suites in run order:
-integration/test/csit/suites/unimgr/basic
\ No newline at end of file
diff --git a/csit/variables/unimgr/add_evc.json b/csit/variables/unimgr/add_evc.json
new file mode 100644 (file)
index 0000000..9ea84a6
--- /dev/null
@@ -0,0 +1,32 @@
+{
+    "link": [
+        {
+            "link-id": "evc://1",
+            "source": {
+                "source-node": "/network-topology/topology/node/uni://{uni1-ip}"
+            },
+            "destination": {
+                "dest-node": "/network-topology/topology/node/uni://{uni2-ip}"
+            },
+            "cl-unimgr-mef:uni-source": [
+                {
+                    "order": "0",
+                    "ip-address": "{uni1-ip}"
+                }
+            ],
+            "cl-unimgr-mef:uni-dest": [
+                {
+                    "order": "0",
+                    "ip-address": "{uni2-ip}"
+                }
+            ],
+            "cl-unimgr-mef:cos-id": "string",
+            "cl-unimgr-mef:ingress-bw": {
+                "speed-10G": {}
+            },
+            "cl-unimgr-mef:egress-bw": {
+                "speed-10G": {}
+            }
+        }
+    ]
+}
\ No newline at end of file
diff --git a/csit/variables/unimgr/add_uni.json b/csit/variables/unimgr/add_uni.json
new file mode 100644 (file)
index 0000000..1b41fd5
--- /dev/null
@@ -0,0 +1,17 @@
+{
+ "network-topology:node": [
+       {
+           "node-id": "uni://{uni-ip}",
+           "speed": {
+               "speed-1G": 1
+           },
+           "uni:mac-layer": "IEEE 802.3-2005",
+           "uni:physical-medium": "UNI TypeFull Duplex 2 Physical Interface",
+           "uni:mtu-size": 0,
+           "uni:type": "",
+           "uni:mac-address": "{mac-address}",
+           "uni:ip-address": "{uni-ip}",
+           "uni:mode": "Full Duplex"
+       }
+   ]
+}
\ No newline at end of file
diff --git a/csit/variables/unimgr/evc_egress_speed.json b/csit/variables/unimgr/evc_egress_speed.json
new file mode 100644 (file)
index 0000000..c5c31a2
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "egress-bw": {
+    "speed-1G": {}
+  }
+}
\ No newline at end of file
diff --git a/csit/variables/unimgr/evc_ingress_speed.json b/csit/variables/unimgr/evc_ingress_speed.json
new file mode 100644 (file)
index 0000000..4f821c5
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "ingress-bw": {
+    "speed-1G": {}
+  }
+}
\ No newline at end of file
diff --git a/csit/variables/unimgr/uni_speed.json b/csit/variables/unimgr/uni_speed.json
new file mode 100644 (file)
index 0000000..2e1e8a5
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "speed": {
+    "speed-10G": {}
+  }
+}
\ No newline at end of file