(two tiny cleanups and re-triggering the patch tests now that all the 503 18/11118/4
authorJamo Luhrsen <james.luhrsen@hp.com>
Fri, 12 Sep 2014 19:53:19 +0000 (12:53 -0700)
committerJamo Luhrsen <james.luhrsen@hp.com>
Tue, 16 Sep 2014 23:48:38 +0000 (16:48 -0700)
errors are gone)

(moving code to karaf suite locations)

INPORT action test now functional.  There is a bug open to move that
action to IN_PORT, but that may or may not be resolved.  Depending
on that, this test case may have to revert back to IN_PORT (bug is
https://bugs.opendaylight.org/show_bug.cgi?id=1725)

The FlowLib files (.py and .txt) have been upgraded.  There is now
an "Inventory" and "Service" type flow object to be used.  This was
needed so that the keyword to remove default flows (Steal to Controller)
could be removed via restconf @ the sal-flow:remove-flow RPC.

Change-Id: I85b40246e539d1c7872abc7e25f3b775efb0d596
Signed-off-by: Jamo Luhrsen <james.luhrsen@hp.com>
test/csit/libraries/FlowLib.py
test/csit/libraries/FlowLib.txt
test/csit/suites/base-of13/070__Flows_OF13/305__ttl.txt
test/csit/suites/base-of13/070__Flows_OF13/400__actions.txt
test/csit/suites/karaf-compatible/070__Flows_OF13/305__ttl.txt
test/csit/suites/karaf-compatible/070__Flows_OF13/400__actions.txt

index 2e42328a56e4d6bbc449432e6a7f0267379861ec..d985777dfc85667858e39e119edae7641d0e4766 100644 (file)
@@ -13,13 +13,18 @@ import string
 import robot
 from robot.libraries.BuiltIn import BuiltIn
 
-##bare bones xml for building a flow
-xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +      \
+##bare bones xml for building a flow xml for flow:inventory
+flow_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +      \
                '<flow xmlns="urn:opendaylight:flow:inventory">'         +      \
                     '<instructions></instructions>'                     +      \
                     '<match></match>'                                   +      \
                '</flow>'
 
+input_xml_skeleton = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +      \
+               '<input xmlns="urn:opendaylight:flow:service">'          +      \
+               '</input>'
+
+
 class Flow:
     '''
     Flow class for creating and interacting with OpenFlow flows
@@ -38,7 +43,7 @@ class Flow:
     priority = 0
     barrier = "false"
 
-    xml = xml_skeleton
+    xml = ""
 
     json = ""
 
@@ -51,12 +56,23 @@ class Flow:
         '''
         setattr(self, field, value)
 
-def Make_Flow_Object():
+def Make_Inventory_Flow():
     '''
         Robot Keyword to create and return an instance of the Flow
         class.
     '''
     flow = Flow()
+    flow.xml = flow_xml_skeleton
+    return flow
+
+def Make_Service_Flow():
+    '''
+        Robot Keyword to create an input XML that can be used to
+        directly send to flow:service for things like accessing
+        the remove-flow RPC via restconf
+    '''
+    flow = Flow()
+    flow.xml = input_xml_skeleton
     return flow
 
 def Set_Flow_Field(flow, field, value):
index e8e714131fd90eec829841512885b44b3bf8c5ef..3f0769d694bfadf09e4ffa4f1a8d8cef3d51ac48 100644 (file)
@@ -7,17 +7,18 @@ Library           ./FlowLib.py
 Library           XML
 
 *** Variables ***
-##default flow attributes ...
-@{default_flow_fields}    strict    table_id    id    hard_timeout    idle_timeout    flow_name    priority
-...               barrier    cookie    cookie_mask
 
 *** Keywords ***
-Create Flow
-    [Documentation]    Calls FlowLib.Make_Flow_Object() function and initializes and sanitizes
-    ...    the basic flow elements.
-    ${flow}=    Make Flow Object
-    : FOR    ${field}    IN    @{default_flow_fields}
-    \    Set "${flow}" "${field}" With "${flow.${field}}"
+Create Inventory Flow
+    [Documentation]    Calls FlowLib.Make_Inventory_Flow function and initializes and sanitizes
+    ...    the basic flow elements that can be given to flow:inventory
+    ${flow}=    Make Inventory Flow
+    [Return]    ${flow}
+
+Create Service Flow
+    [Documentation]    Used for creating an object that will use an XML format that
+    ...    can be given to flow:service.
+    ${flow}=    Make Service Flow
     [Return]    ${flow}
 
 Set "${flow}" "${property}" With "${property_val}"
@@ -100,6 +101,17 @@ Clear Flow Matches
     Remove Flow XML Element    ${flow}    match/${match_element}
     [Return]    ${flow}
 
+Set Flow XML Element Attribute
+    [Arguments]    ${flow}    ${element}    ${id}    ${value}
+    [Documentation]    Will set the given id/value pair to the given to the element provided
+    ...    and make the proper changes to the ${flow} object also provided.
+    ${flow_xml}=    Parse XML    ${flow.xml}
+    Set Element Attribute    ${flow_xml}    ${id}    ${value}    xpath=${element}
+    ${xml_string}=    Element To String    ${flow_xml}
+    Set Flow Field    ${flow}    xml    ${xml_string}
+    Log    ${flow.xml}
+    [Return]    ${flow}
+
 Add Flow XML Element
     [Arguments]    ${flow}    ${element}    ${element_val}=${EMPTY}    ${xpath}=.
     [Documentation]    Will modify the current xml representation of the ${flow} object to contain
@@ -112,6 +124,7 @@ Add Flow XML Element
     Add Element    ${flow_xml}    <${element}>${element_val}</${element}>    xpath=${xpath}
     ${xml_string}=    Element To String    ${flow_xml}
     Set Flow Field    ${flow}    xml    ${xml_string}
+    Log    ${flow.xml}
     [Return]    ${flow}
 
 Remove Flow XML Element
@@ -166,19 +179,22 @@ Verify Flow Does Not Exist On Mininet Switch
 Remove Default Flows
     [Arguments]    ${node_id}
     [Documentation]    Removes any flows considered "default". one such flow is
-    ...    to forward all traffic to the CONTROLLER. If/When others are implemented
-    ...    this keyword can be updated to include those.
-    ##The preference for deleting flows would be via REST to the controller, but
-    ##it's not possible with a call to the config API. For now, the flows are
-    ##deleted via dpctl on mininet. The flows are present in the operational
-    ##datastore, but you may need to wait for some time (15s) before it's refelcted
-    ##there.
-    write    dpctl del-flows -O OpenFlow13
+    ...    to forward all traffic to the CONTROLLER with priority 0 at flow-table 0
+    ...    If/When others are implemented this keyword can be updated to include those.
+    ${flow}=    Make Service Flow
+    Set "${flow}" "priority" With "0"
+    Set "${flow}" "flow-table" With "0"
+    Add Flow XML Element    ${flow}    node    /inv:nodes/inv:node[inv:id="${node_id}"]
+    Set Flow XML Element Attribute    ${flow}    node    xmlns:inv    urn:opendaylight:inventory
+    Log    Flow XML is ${flow.xml}
+    write    dpctl dump-flows -O OpenFlow13
     ${switchoutput}    Read Until    >
-    #${flow}=    Create Flow
-    #Set "${flow}" "table_id" With "0"
-    #Set "${flow}" "id" With "0"
-    #Set Flow Output Action    ${flow}    0    0    CONTROLLER
-    #Log    Flow XML is ${flow.xml}
-    #Remove Flow From Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
-    #Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow Does Not Exist On Mininet Switch    CONTROLLER
+    ${headers}=    Create Dictionary    Content-Type    application/yang.data+xml
+    ${resp}    RequestsLibrary.Post    session    restconf/operations/sal-flow:remove-flow    data=${flow.xml}    headers=${headers}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}=    Get    session    ${REST_OPR}
+    Log    ${resp.content}
+    Should Not Contain    ${resp.content}    "output-node-connector": "CONTROLLER",
+    ${strings_to_check_for}=    Create List    CONTROLLER
+    Verify Flow Does Not Exist On Mininet Switch    ${strings_to_check_for}
index f169fda92c6f7ca40954dd3ff3e211fad319b3c2..d47d3403dd1f9e0909a9aab952caf245d20fb815 100644 (file)
@@ -74,7 +74,7 @@ Create And Remove Flow
     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
     ##flow is a python Object to build flow details, including the xml format to send to controller
-    ${flow}=    Create Flow
+    ${flow}=    Create Inventory Flow
     Set "${flow}" "table_id" With "${table_id}"
     Set "${flow}" "id" With "${flow_id}"
     Clear Flow Actions    ${flow}
index 66b570805b1f7878ec3f257402ff25c18d5d33a7..1a22774dd9f4f60ec8437bd43956ae6ff6e32f4d 100644 (file)
@@ -3,13 +3,13 @@ Documentation     OF1.3 Suite for flow actions
 ...               - output ALL
 ...               - output CONTROLLER
 ...               - output TABLE
-...               - output IN_PORT
+...               - output INPORT
 ...               - output LOCAL
 ...               - output NORMAL
 ...               - output FLOOD
 ...               - output ANY
 ...
-...               NOTE: for OVS, IN_PORT does not appear to be supported
+...               NOTE: for OVS, INPORT does not appear to be supported
 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
 Suite Teardown    Delete All Sessions
 Test Template     Create And Remove Flow
@@ -35,7 +35,7 @@ ${eth_src}        00:ab:cd:ef:01:23
 ${eth_dst}        ff:ff:ff:ff:ff:ff
 ${node_id}        openflow:1
 ##documentation strings
-${IN_PORT_doc}    OF1.3: OFPP_IN_PORT = 0xfffffff8, /* Send the packet out the input port. This\nreserved port must be explicitly used\nin order to send back out of the input\nport. */\n
+${INPORT_doc}     OF1.3: OFPP_INPORT = 0xfffffff8, /* Send the packet out the input port. This\nreserved port must be explicitly used\nin order to send back out of the input\nport. */\n
 ${TABLE_doc}      OF1.3: OFPP_TABLE = 0xfffffff9, /* Submit the packet to the first flow table NB: This destination port can only be used in packet-out messages. */
 ${NORMAL_doc}     OF1.3 OFPP_NORMAL = 0xfffffffa, /* Process with normal L2/L3 switching. */
 ${FLOOD_doc}      OF1.3 OFPP_FLOOD = 0xfffffffb, /* All physical ports in VLAN, except input port and those blocked or link down. */
@@ -45,9 +45,9 @@ ${LOCAL_doc}      OF1.3 OFPP_LOCAL = 0xfffffffe, /* Local openflow "port". */
 ${ANY_doc}        OF1.3 OFPP_ANY = 0xffffffff /* Wildcard port used only for flow mod (delete) and flow stats requests. Selects all flows regardless of output port (including flows with no output port). */
 
 *** Test Cases ***    output port        tableID              flowID    verify OVS?    OVS specific strings
-IN_PORT               [Documentation]    ${IN_PORT_doc}
-                      [Tags]             in_port
-                      ${TEST_NAME}       22                   161       no             actions=${TEST_NAME}
+INPORT                [Documentation]    ${INPORT_doc}
+                      [Tags]             inport
+                      ${TEST_NAME}       22                   161       yes            actions=IN_PORT
 
 TABLE                 [Documentation]    ${TABLE_doc}
                       [Tags]             table
@@ -81,7 +81,6 @@ ANY                   [Documentation]    ${ANY_doc}
 Create And Remove Flow
     [Arguments]    ${output_port}    ${table_id}    ${flow_id}    ${verify_switch_flag}    ${additional_ovs_flowelements}
     Remove Default Flows    ${node_id}
-    Run Keyword If    "${output_port}" == "IN_PORT"    Pass Execution    Skipping ${output_port} test and marking it passed
     Run Keyword If    "${output_port}" == "ANY"    Pass Execution    Skipping ${output_port} test and marking it passed
     @{OVS_FLOWELEMENTS}    Create List    dl_dst=${eth_dst}    table=${table_id}    dl_src=${eth_src}    nw_src=${ipv4_src}    nw_dst=${ipv4_dst}
     ...    ${additional_ovs_flowelements}
@@ -89,7 +88,7 @@ Create And Remove Flow
     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
     ##flow is a python Object to build flow details, including the xml format to send to controller
-    ${flow}=    Create Flow
+    ${flow}=    Create Inventory Flow
     Set "${flow}" "table_id" With "${table_id}"
     Set "${flow}" "id" With "${flow_id}"
     Clear Flow Actions    ${flow}
index f169fda92c6f7ca40954dd3ff3e211fad319b3c2..8420815d948e94c4b6bbf61637b97a7a25707ab0 100644 (file)
@@ -25,7 +25,6 @@ Variables         ../../../variables/Variables.py
 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
 ${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
 ${GENERIC_ACTION_FLOW_FILE}    ${CURDIR}/../../../variables/xmls/genericActionFlow.xml
-${MININET_CMD}    sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch ovsk,protocols=OpenFlow13
 ${ipv4_src}       10.1.2.0/24
 ${ipv4_dst}       40.4.0.0/16
 ${eth_type}       0x800
@@ -74,7 +73,7 @@ Create And Remove Flow
     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
     ##flow is a python Object to build flow details, including the xml format to send to controller
-    ${flow}=    Create Flow
+    ${flow}=    Create Inventory Flow
     Set "${flow}" "table_id" With "${table_id}"
     Set "${flow}" "id" With "${flow_id}"
     Clear Flow Actions    ${flow}
index 66b570805b1f7878ec3f257402ff25c18d5d33a7..a45c4d80e146502c03092f633924b622dd3eda4c 100644 (file)
@@ -3,13 +3,13 @@ Documentation     OF1.3 Suite for flow actions
 ...               - output ALL
 ...               - output CONTROLLER
 ...               - output TABLE
-...               - output IN_PORT
+...               - output INPORT
 ...               - output LOCAL
 ...               - output NORMAL
 ...               - output FLOOD
 ...               - output ANY
 ...
-...               NOTE: for OVS, IN_PORT does not appear to be supported
+...               NOTE: for OVS, INPORT does not appear to be supported
 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
 Suite Teardown    Delete All Sessions
 Test Template     Create And Remove Flow
@@ -26,8 +26,6 @@ Variables         ../../../variables/Variables.py
 *** Variables ***
 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
 ${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
-${GENERIC_ACTION_FLOW_FILE}    ${CURDIR}/../../../variables/xmls/genericActionFlow.xml
-${MININET_CMD}    sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch ovsk,protocols=OpenFlow13
 ${ipv4_src}       11.3.0.0/16
 ${ipv4_dst}       99.0.0.0/8
 ${eth_type}       0x800
@@ -35,7 +33,7 @@ ${eth_src}        00:ab:cd:ef:01:23
 ${eth_dst}        ff:ff:ff:ff:ff:ff
 ${node_id}        openflow:1
 ##documentation strings
-${IN_PORT_doc}    OF1.3: OFPP_IN_PORT = 0xfffffff8, /* Send the packet out the input port. This\nreserved port must be explicitly used\nin order to send back out of the input\nport. */\n
+${INPORT_doc}     OF1.3: OFPP_INPORT = 0xfffffff8, /* Send the packet out the input port. This\nreserved port must be explicitly used\nin order to send back out of the input\nport. */\n
 ${TABLE_doc}      OF1.3: OFPP_TABLE = 0xfffffff9, /* Submit the packet to the first flow table NB: This destination port can only be used in packet-out messages. */
 ${NORMAL_doc}     OF1.3 OFPP_NORMAL = 0xfffffffa, /* Process with normal L2/L3 switching. */
 ${FLOOD_doc}      OF1.3 OFPP_FLOOD = 0xfffffffb, /* All physical ports in VLAN, except input port and those blocked or link down. */
@@ -45,9 +43,9 @@ ${LOCAL_doc}      OF1.3 OFPP_LOCAL = 0xfffffffe, /* Local openflow "port". */
 ${ANY_doc}        OF1.3 OFPP_ANY = 0xffffffff /* Wildcard port used only for flow mod (delete) and flow stats requests. Selects all flows regardless of output port (including flows with no output port). */
 
 *** Test Cases ***    output port        tableID              flowID    verify OVS?    OVS specific strings
-IN_PORT               [Documentation]    ${IN_PORT_doc}
-                      [Tags]             in_port
-                      ${TEST_NAME}       22                   161       no             actions=${TEST_NAME}
+INPORT                [Documentation]    ${INPORT_doc}
+                      [Tags]             inport
+                      ${TEST_NAME}       22                   161       yes            actions=IN_PORT
 
 TABLE                 [Documentation]    ${TABLE_doc}
                       [Tags]             table
@@ -81,7 +79,6 @@ ANY                   [Documentation]    ${ANY_doc}
 Create And Remove Flow
     [Arguments]    ${output_port}    ${table_id}    ${flow_id}    ${verify_switch_flag}    ${additional_ovs_flowelements}
     Remove Default Flows    ${node_id}
-    Run Keyword If    "${output_port}" == "IN_PORT"    Pass Execution    Skipping ${output_port} test and marking it passed
     Run Keyword If    "${output_port}" == "ANY"    Pass Execution    Skipping ${output_port} test and marking it passed
     @{OVS_FLOWELEMENTS}    Create List    dl_dst=${eth_dst}    table=${table_id}    dl_src=${eth_src}    nw_src=${ipv4_src}    nw_dst=${ipv4_dst}
     ...    ${additional_ovs_flowelements}
@@ -89,7 +86,7 @@ Create And Remove Flow
     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
     ##flow is a python Object to build flow details, including the xml format to send to controller
-    ${flow}=    Create Flow
+    ${flow}=    Create Inventory Flow
     Set "${flow}" "table_id" With "${table_id}"
     Set "${flow}" "id" With "${flow_id}"
     Clear Flow Actions    ${flow}