Tag for ping all test has been set to pingall 17/8517/1
authorSefa Sahin Koc <shnkoc@gmail.com>
Tue, 1 Jul 2014 21:26:37 +0000 (14:26 -0700)
committerSefa Sahin Koc <shnkoc@gmail.com>
Tue, 1 Jul 2014 21:32:01 +0000 (14:32 -0700)
Change-Id: I9fa76e9d37e16b5bb42662a85a6c760303b8222d
Signed-off-by: Sefa Sahin Koc <shnkoc@gmail.com>
test/csit/libraries/Common.py
test/csit/libraries/Topologynew.py
test/csit/suites/base-of13/080__Inventory_Scalibility/010__restconf_inventory.txt [new file with mode: 0644]
test/csit/suites/base-of13/080__Inventory_Scalibility/020__switch_manager.txt [new file with mode: 0644]
test/csit/suites/base-of13/080__Inventory_Scalibility/030__statistics_manager.txt [new file with mode: 0644]
test/csit/suites/base-of13/080__Inventory_Scalibility/040__topology_manager.txt [new file with mode: 0644]
test/csit/suites/base-of13/080__Inventory_Scalibility/050__ping_test.txt [new file with mode: 0644]
test/csit/suites/base-of13/080__Inventory_Scalibility/__init__.txt [new file with mode: 0644]
test/csit/variables/Variables.py

index 6b1570907ab34f743d6e65fff80d210a0d206a7a..e748caad89757c47190aa5c8d99794752da9bef1 100644 (file)
@@ -54,10 +54,28 @@ def compare_xml(xml1, xml2):
 
     return True
 
-    
-
+def num_of_nodes(depth, fanout):
+    '''returns num of switches of a mininet with tree topology 
+    with particular depth and fanout parameters
+    '''
+    result = 0
+    for i in xrange(depth):
+        result += fanout**i
+    return result    
 
-if __name__ == '__main__':
+def num_of_links_for_node(nodeid, leaflist, fanout):
+    '''
+    If the given node is a leaf node, there will be an only one link for it
+    and nodeid will be represented 2 times in topology
+    If the given node is not a leaf node, then there will be fanout+1 links
+    for it and nodeid will be represented (fanout+1)*2 times in topology
     
+    p.s. root node is excluded.
+    '''
+    if nodeid in leaflist:
+        return 1
+    return (fanout+1)
 
-    pass
+if __name__ == '__main__':
+       print num_of_nodes(3,4)
+       pass
index 700e9df09084a2dc7aa5c458597b3c6849782fd9..8d1ee18c6e47444e1518ebe356c0aab12a7babb9 100644 (file)
@@ -5,15 +5,20 @@ Updated: 2013-11-10
 """
 import string
 import robot
+import re
 from robot.libraries.BuiltIn import BuiltIn
+import Common 
 
 class Topologynew(object):
     '''
     Topology class provide topology database and provide many method to get property of topology.
+    
+    node_boilerplate = {u'type': u'MD_SAL', u'id': u'openflow:%d'}
     '''
     topo_nodes_db=[[],
             [{u'type': u'MD_SAL', u'id': u'openflow:1'}],
             [{u'type': u'MD_SAL', u'id': u'openflow:1'},{u'type': u'MD_SAL', u'id': u'openflow:2'},{u'type': u'MD_SAL', u'id': u'openflow:3'}]]
+    
     def __init__(self):
         self.builtin = BuiltIn()
 
@@ -35,8 +40,65 @@ class Topologynew(object):
             return self.topo_nodes_db[topo_level]
         else:
             return None
+    
+    def get_nodes_from_tree_topo(self, topo, exceptroot="0"):
+        '''
+        This function generates a dictionary that contains type and id of each node.
+        It follows tree level topology.
+        @parameter topo: either an interer (in this case, depth is set and fanout will be 2)
+                         or a string in format of "(a,b)"   (a and b are integers and they
+                         stands for depth and fanout respectively)
+        @return array of dicitonary objects that contains info about each node
+        '''
+        depth=0
+        fanout=2
+        if isinstance(topo, str) or isinstance(topo, unicode):
+            t = tuple(int(v) for v in re.findall("[0-9]+", topo))
+            if len(t) == 1:
+                depth = t[0]        
+            elif len(t) == 2:
+                depth = t[0]
+                fanout = t[1]
+            else:
+                return None                 #topology consists of two parameters: depth and fanout
+        elif isinstance(topo, int):
+            depth = topo
+        else:
+            return  None                    #topo parameter is not given in a desired way
+
+        num_nodes = Common.num_of_nodes(depth, fanout)
+        nodelist = []
+        for i in xrange(1, num_nodes+1):
+            temp = { "id": "00:00:00:00:00:00:00:%s" % format(i, '02x'), "type": "OF" }
+            nodelist.append(temp)      
+        if int(exceptroot):
+            del nodelist[0]
+        return nodelist
+
+    def get_ids_of_leaf_nodes(self, fanout, depth):
+        '''
+        For a tree structure, it numerates leaf nodes
+        by following depth-first strategy
+        @parameter  fanout: fanout of tree
+        @parameter  depth:  total depth of a tree
+        @return     leafnodes:  list of ids of leaf nodes
+        '''
+        leafnodes = []
+        self._enumerate_nodes(0, 1, 1, fanout, depth-1, leafnodes)
+        return leafnodes
+
+    def _enumerate_nodes(self, currentdepth, nodeid, currentbranch, fanout, depth, leafnodes):
+        if currentdepth==depth:
+            leafnodes.append("00:00:00:00:00:00:00:%s" % format(nodeid, '02x'))
+            return 1
+        nodes = 1
+        for i in xrange(1,  fanout+1):
+            nodes += self._enumerate_nodes(currentdepth+1, nodeid+nodes, i, fanout, depth, leafnodes)
+        return nodes 
 
 if __name__ == '__main__':
     topologynew = Topologynew()
-    print topologynew.get_nodes_from_topology(2)
-    print topologynew.get_nodes_from_topology('2')
+    #print topologynew.get_nodes_from_tree_topo(2)
+    #print topologynew.get_nodes_from_tree_topo('2')
+    print topologynew.get_nodes_from_tree_topo('(2,3)')
+    #print topologynew.get_ids_of_leaf_nodes(2,2 )#, depth)
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/010__restconf_inventory.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/010__restconf_inventory.txt
new file mode 100644 (file)
index 0000000..4b0d3a1
--- /dev/null
@@ -0,0 +1,57 @@
+*** Settings ***
+Documentation     Test suite for RESTCONF inventory
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+
+
+*** Test Cases *** 
+Get list of nodes
+    [Documentation]    Get the inventory
+       ${resp}    Get    session    ${REST_CONTEXT}
+    Should Be Equal As Strings    ${resp.status_code}    200
+       ${TOPO_TREE_DEPTH}    Convert To Integer  ${TOPO_TREE_DEPTH}
+       ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+       ${numnodes}             Num Of Nodes    ${TOPO_TREE_DEPTH}      ${TOPO_TREE_FANOUT}
+       :FOR    ${IND}  IN RANGE        1       ${numnodes+1}   
+    \   Should Contain     ${resp.content}  openflow:${IND}
+
+Get nodeconnector for the root node 
+    [Documentation]    Get the inventory for the root node
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+    ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:1
+    Should Be Equal As Strings   ${resp.status_code}    200
+    Check conn loop   ${TOPO_TREE_FANOUT}   1  ${resp.content}
+
+Get nodeconnector for a node 
+    [Documentation]    Get the inventory for a node
+    ${TOPO_TREE_DEPTH}    Convert To Integer  ${TOPO_TREE_DEPTH}
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+    ${numnodes}     Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
+    :FOR    ${IND}  IN RANGE    2   ${numnodes+1}
+    \   ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:${IND}
+    \   Should Be Equal As Strings   ${resp.status_code}    200
+    \   Check conn loop   ${TOPO_TREE_FANOUT+1}   ${IND}  ${resp.content}
+
+Get Stats for a node
+    [Documentation]    Get the stats for a node
+    ${TOPO_TREE_DEPTH}    Convert To Integer  ${TOPO_TREE_DEPTH}
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+    ${numnodes}     Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
+    :FOR    ${IND}  IN RANGE    1   ${numnodes+1}
+    \   ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:${IND}
+    \   Should Be Equal As Strings   ${resp.status_code}    200
+    \   Should Contain     ${resp.content}      opendaylight-port-statistics
+    \   Should Contain     ${resp.content}      opendaylight-flow-table-statistics
+
+*** Keywords ***
+Check conn loop
+    [Arguments]     ${arg}  ${outerind}     ${content}
+    :FOR    ${var}  IN RANGE    1   ${arg+1}
+    \   Should Contain     ${content}      openflow:${outerind}:${var}
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/020__switch_manager.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/020__switch_manager.txt
new file mode 100644 (file)
index 0000000..cafa3e1
--- /dev/null
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation     Test suite for Switch Manager
+Suite Setup       Create Session    ${ODL_CONTROLLER_SESSION}    http://${CONTROLLER}:8080    auth=${AUTH}    headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           Collections
+Library           RequestsLibrary
+Library           ../../../libraries/Common.py
+Library           ../../../libraries/SwitchManager.py
+Variables         ../../../variables/Variables.py
+Library           ../../../libraries/Topologynew.py
+
+*** Variables ***
+${REST_CONTEXT}    /controller/nb/v2/switchmanager
+
+*** Test Cases ***
+
+List all nodes
+    [Documentation]    List all nodes and their properties in the network.
+    [Tags]    list_info
+    Log    ${TOPO_TREE_LEVEL}
+    ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})
+    ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/nodes
+    Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
+    ${jsondata}=    To JSON    ${resp.content}
+    ${nodes}    Extract All Nodes    ${jsondata}
+    List Should Contain Sublist   ${nodes}    ${topo_nodes}
+
+Check root node connectors 
+    [Documentation]    List node connectors and verify all connectors are there
+    [Tags]    list_info
+    ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/OF/00:00:00:00:00:00:00:01
+    Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+    Check conn loop     ${TOPO_TREE_FANOUT}   1   ${resp.content}
+
+Check node i connectors              
+    [Documentation]    List node connectors and verify all connectors are there                      
+    [Tags]    list_info
+    ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})   1
+    :FOR    ${ITEM}  IN     @{topo_nodes}
+    \   ${IND}  Get From Dictionary    ${ITEM}    id
+    \   ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/OF/${IND}
+    \   Should Be Equal As Strings   ${resp.status_code}    200
+    \   Check conn loop   ${TOPO_TREE_FANOUT+1}   ${IND}  ${resp.content}
+
+*** Keywords ***
+Check conn loop
+    [Arguments]     ${arg}  ${outerind}     ${content}
+    :FOR    ${var}  IN RANGE    0   ${arg+1}
+    \   Should Contain     ${content}      "id":"${var}"
+
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/030__statistics_manager.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/030__statistics_manager.txt
new file mode 100644 (file)
index 0000000..0f834d1
--- /dev/null
@@ -0,0 +1,48 @@
+*** Settings ***
+Documentation     Test suite for Statistics Manager
+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
+Library           ../../../libraries/Topologynew.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${nodeprefix}   openflow:
+${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 Be Equal As Strings    ${resp.status_code}    200 
+       ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})   1
+    Should Contain X Times   ${resp.content}    "00:00:00:00:00:00:00:01"      ${TOPO_TREE_FANOUT+2}    
+    :FOR    ${ITEM}  IN        @{topo_nodes}
+    \   ${IND}  Get From Dictionary    ${ITEM}    id
+    \   Should Contain X Times   ${resp.content}    "${IND}"    ${TOPO_TREE_FANOUT+3}
+
+get flow stats
+    [Documentation]    Show flow stats and validate result
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/flow
+    Should Be Equal As Strings    ${resp.status_code}    200 
+       ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})
+    :FOR    ${ITEM}  IN     @{topo_nodes}
+    \   ${IND}  Get From Dictionary    ${ITEM}    id
+    \   Should Contain    ${resp.content}    "${IND}"
+
+get table stats
+    [Documentation]    Show flow stats and validate result
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/table
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})
+    :FOR    ${ITEM}  IN     @{topo_nodes}
+    \   ${IND}  Get From Dictionary    ${ITEM}    id
+    \   Should Contain    ${resp.content}    "${IND}"
+
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/040__topology_manager.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/040__topology_manager.txt
new file mode 100644 (file)
index 0000000..06865ce
--- /dev/null
@@ -0,0 +1,32 @@
+*** 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
+Library           ../../../libraries/Common.py
+Library           ../../../libraries/Topologynew.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${nodeprefix}   openflow:
+${REST_CONTEXT}    /controller/nb/v2/topology
+
+*** Test Cases ***
+Get Topology
+    [Documentation]    Get Topology and validate the result.
+    [Tags]    get
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    ${TOPO_TREE_DEPTH}    Convert To Integer  ${TOPO_TREE_DEPTH}
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+    Should Contain X Times  ${resp.content}   "00:00:00:00:00:00:00:01"   ${TOPO_TREE_FANOUT*2}
+    ${leaflist}    Get Ids Of Leaf Nodes    ${TOPO_TREE_FANOUT}   ${TOPO_TREE_DEPTH} 
+    ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})   1
+    :FOR    ${ITEM}  IN     @{topo_nodes}
+    \   ${IND}  Get From Dictionary    ${ITEM}    id
+    \   ${linkcnt}      Num Of Links For Node       ${IND}      ${leaflist}     ${TOPO_TREE_FANOUT}
+    \   Should Contain X Times  ${resp.content}     "${IND}"    ${linkcnt*2}   
+
+
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/050__ping_test.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/050__ping_test.txt
new file mode 100644 (file)
index 0000000..12d5172
--- /dev/null
@@ -0,0 +1,22 @@
+*** Settings ***
+Documentation     Test suite for do pingall test
+Library           SSHLibrary
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+
+*** Test Cases ***
+Ping all
+    [Documentation]    Do ping all test, verify no packet loss
+    [Tags]   pingall
+       ${TOPO_TREE_DEPTH}    Convert To Integer  ${TOPO_TREE_DEPTH}
+    ${TOPO_TREE_FANOUT}   Convert To Integer  ${TOPO_TREE_FANOUT}
+       ${numnodes}             Num Of Nodes            ${TOPO_TREE_DEPTH}      ${TOPO_TREE_FANOUT}
+       Write   pingall
+    Sleep   ${numnodes*3}
+    ${result}    Read
+    Should Not Contain   ${result}     X  
+
diff --git a/test/csit/suites/base-of13/080__Inventory_Scalibility/__init__.txt b/test/csit/suites/base-of13/080__Inventory_Scalibility/__init__.txt
new file mode 100644 (file)
index 0000000..5b1f49c
--- /dev/null
@@ -0,0 +1,33 @@
+*** Settings ***
+Documentation     Test suite for MD-SAL NSF
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+Library       ../../../libraries/Common.py
+Variables     ../../../variables/Variables.py
+
+*** Variables ***
+
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT}
+
+** Keywords ***
+Start Suite  
+    Log    Start mininet
+       ${TOPO_TREE_DEPTH}  Convert To Integer  ${TOPO_TREE_DEPTH}
+       ${TOPO_TREE_FANOUT}     Convert To Integer  ${TOPO_TREE_FANOUT}
+       ${numnodes}     Num Of Nodes    ${TOPO_TREE_DEPTH}  ${TOPO_TREE_FANOUT}
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any 
+    Write    sudo ovs-vsctl set-manager ptcp:6644
+    Write    sudo mn -c
+    Sleep    2
+    Write    ${start}
+    Sleep    ${numnodes*3+15}
+    Read
+Stop Suite
+    Log    Stop mininet
+    Read
+    Write    exit 
+    Sleep    4
+    Read 
+    Close Connection 
index 74f3a16e27338c523564075da80f70157a1d4faa..defeb2c54793dbc8ccf36f7e76f17b5912d88385 100644 (file)
@@ -18,7 +18,8 @@ HEADERS_XML={'Content-Type': 'application/xml'}
 ACCEPT_XML={'Accept': 'application/xml'}
 ODL_CONTROLLER_SESSION=None
 TOPO_TREE_LEVEL=2
-
+TOPO_TREE_DEPTH=3
+TOPO_TREE_FANOUT=2
 # VTN Coordinator Variables
 VTNC = '127.0.0.1'
 VTNCPORT = '8083'