Merge "Update test case due to XML file changing"
authorLuis Gomez <ecelgp@gmail.com>
Tue, 9 Sep 2014 15:34:14 +0000 (15:34 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Sep 2014 15:34:14 +0000 (15:34 +0000)
features/pom.xml
features/src/main/resources/features.xml
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 [new file with mode: 0644]

index c8cad3ddbdca3fd7b322c6b0ef0f3ed32df63d7b..9ff83f188276ac98e3561b87887bca140213ec2e 100644 (file)
       <classifier>features</classifier>
       <type>xml</type>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>features-netconf-connector</artifactId>
+      <version>${feature.mdsal.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>features-adsal</artifactId>
index 345ec8ef543d6ffc0befb2d43d6b7aa0164f109c..bd072cb41435788c22cd6e2673b822660c875714 100644 (file)
@@ -55,6 +55,7 @@
     <repository>mvn:org.opendaylight.controller/features-adsal/${feature.adsal.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-adsal-compatibility/1.4.2-SNAPSHOT/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-mdsal/${feature.mdsal.version}/xml/features</repository>
+    <repository>mvn:org.opendaylight.controller/features-netconf-connector/${feature.mdsal.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-nsf/${feature.nsf.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.dlux/features-dlux/${feature.dlux.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.groupbasedpolicy/features-groupbasedpolicy/${feature.groupbasedpolicy.version}/xml/features</repository>
@@ -72,6 +73,7 @@
 
     <feature name='odl-integration-compatible-with-all' version='${project.version}'>
         <feature version='1.1-SNAPSHOT'>odl-mdsal-broker</feature>
+        <feature version='${feature.mdsal.version}'>odl-netconf-connector-ssh</feature>
         <feature version='1.1-SNAPSHOT'>odl-restconf</feature>
         <feature version='${feature.adsal.version}'>odl-adsal-all</feature>
         <feature version='${feature.nsf.version}'>odl-nsf-all</feature>
index 8e7b405c55d5cf3cba0f51196312a367c9f08dae..e8e714131fd90eec829841512885b44b3bf8c5ef 100644 (file)
@@ -51,6 +51,12 @@ Set Flow Action
     Add Flow XML Element    ${flow}    ${action}    ${action_val}    instructions/instruction/apply-actions/action
     [Return]    ${flow}
 
+Set Flow Output Action
+    [Arguments]    ${flow}    ${instruction_order}    ${action_order}    ${output_port}
+    Set Flow Action    ${flow}    ${instruction_order}    ${action_order}    output-action
+    Add Flow XML Element    ${flow}    output-node-connector    ${output_port}    instructions/instruction/apply-actions/action/output-action
+    [Return]    ${flow}
+
 Set Flow Ethernet Match
     [Arguments]    ${flow}    ${match_value_dict}
     [Documentation]    Specific keyword for adding an ethernet match rules where the elements are given
@@ -117,3 +123,62 @@ Remove Flow XML Element
     ${xml_string}=    Element To String    ${flow_xml}
     Set Flow Field    ${flow}    xml    ${xml_string}
     [Return]    ${flow}
+
+Add Flow To Controller And Verify
+    [Arguments]    ${flow_body}    ${node_id}    ${table_id}    ${flow_id}
+    [Documentation]    Push flow through REST-API and verify in data-store
+    ${resp}    Put Xml    session    ${REST_CON}/node/${node_id}/table/${table_id}/flow/${flow_id}    data=${flow_body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    get    session    ${REST_CON}/node/${node_id}/table/${table_id}/flow/${flow_id}    headers=${ACCEPT_XML}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    compare xml    ${flow_body}    ${resp.content}
+
+Verify Flow On Mininet Switch
+    [Arguments]    ${flow_elements}
+    [Documentation]    Checking flow on switch
+    sleep    1
+    write    dpctl dump-flows -O OpenFlow13
+    ${switchoutput}    Read Until    >
+    : FOR    ${flowElement}    IN    @{flow_elements}
+    \    should Contain    ${switchoutput}    ${flowElement}
+
+Remove Flow From Controller And Verify
+    [Arguments]    ${flow_body}    ${node_id}    ${table_id}    ${flow_id}
+    [Documentation]    Remove flow
+    ${resp}    Delete    session    ${REST_CON}/node/${node_id}/table/${table_id}/flow/${flow_id}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    Get    session    ${REST_CON}/node/${node_id}/table/${table_id}
+    Log    ${resp.content}
+    Should Not Contain    ${resp.content}    ${flow_id}
+
+Verify Flow Does Not Exist On Mininet Switch
+    [Arguments]    ${flow_elements}
+    [Documentation]    Checking flow on switch is removed
+    sleep    1
+    write    dpctl dump-flows -O OpenFlow13
+    ${switchoutput}    Read Until    >
+    : FOR    ${flowElement}    IN    @{flow_elements}
+    \    should Not Contain    ${switchoutput}    ${flowElement}
+
+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
+    ${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
index 5b05b6c5470d0642e45df7e0ae1d792af77df344..f169fda92c6f7ca40954dd3ff3e211fad319b3c2 100644 (file)
@@ -31,31 +31,38 @@ ${ipv4_dst}       40.4.0.0/16
 ${eth_type}       0x800
 ${eth_src}        00:00:00:01:23:ae
 ${eth_dst}        ff:ff:ff:ff:ff:ff
+${node_id}        openflow:1
+${set_ip_ttl_doc}    OF1.3: \ OFPAT_SET_NW_TTL = 23, /* IP TTL. */\n(currently not supported on OVS)
+${dec_ttl_doc}    OF1.3: \ OFPAT_DEC_NW_TTL = 24, /* Decrement IP TTL. */
+${copy_ttl_in_doc}    OFPAT_COPY_TTL_IN = 12, /* Copy TTL "inwards" -- from outermost to\nnext-to-outermost */\n(currently NOT supported in OVS)\n
+${copy_ttl_out_doc}    OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost\nto outermost */\n(currently NOT suported in OVS)
+${set_mpls_ttl_doc}    OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
+${dec_mpls_ttl_doc}    OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
 
-*** Test Cases ***    ODL flow action        action key                                                                                                                      action value    tableID    flowID    verify OVS?    OVS specific string?
-Set_IP_TTL            [Documentation]        OF1.3: \ OFPAT_SET_NW_TTL = 23, /* IP TTL. */\n(currently not supported on OVS)\n
-                      [Tags]                 ttl                                                                                                                             set
-                      set-nw-ttl-action      nw-ttl                                                                                                                          1               2          101       no             set_ttl
+*** Test Cases ***    ODL flow action        action key             action value    tableID    flowID    verify OVS?    OVS specific string?
+Set_IP_TTL            [Documentation]        ${set_ip_ttl_doc}
+                      [Tags]                 ttl                    set
+                      set-nw-ttl-action      nw-ttl                 1               2          101       no             set_ttl
 
-Dec_TTL               [Documentation]        OF1.3: \ OFPAT_DEC_NW_TTL = 24, /* Decrement IP TTL. */\n
-                      [Tags]                 ttl                                                                                                                             dec
-                      dec-nw-ttl             none                                                                                                                            none            3          305       yes            dec_ttl
+Dec_TTL               [Documentation]        ${dec_ttl_doc}
+                      [Tags]                 ttl                    dec
+                      dec-nw-ttl             none                   none            3          305       yes            dec_ttl
 
-Copy_TTL_In           [Documentation]        OFPAT_COPY_TTL_IN = 12, /* Copy TTL "inwards" -- from outermost to\nnext-to-outermost */\n(currently NOT supported in OVS)\n
-                      [Tags]                 ttl                                                                                                                             copyin
-                      copy-ttl-in            none                                                                                                                            none            9          202       no             copy_ttl_in
+Copy_TTL_In           [Documentation]        ${copy_ttl_in_doc}
+                      [Tags]                 ttl                    copyin
+                      copy-ttl-in            none                   none            9          202       no             copy_ttl_in
 
-Copy_TTL_Out          [Documentation]        OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost\nto outermost */\n(currently NOT suported in OVS)
-                      [Tags]                 ttl                                                                                                                             copyout
-                      copy-ttl-out           none                                                                                                                            none            8          909       no             copy_ttl_out
+Copy_TTL_Out          [Documentation]        ${copy_ttl_out_doc}
+                      [Tags]                 ttl                    copyout
+                      copy-ttl-out           none                   none            8          909       no             copy_ttl_out
 
-Set_MPLS_TTL          [Documentation]        OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
-                      [Tags]                 ttl                                                                                                                             setmpls
-                      set-mpls-ttl-action    mpls-ttl                                                                                                                        1               4          505       yes            set_mpls_ttl
+Set_MPLS_TTL          [Documentation]        ${set_mpls_ttl_doc}
+                      [Tags]                 ttl                    setmpls
+                      set-mpls-ttl-action    mpls-ttl               1               4          505       yes            set_mpls_ttl
 
-Dec_MPLS_TTL          [Documentation]        OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
-                      [Tags]                 ttl                                                                                                                             decmpls
-                      dec-mpls-ttl           none                                                                                                                            none            2          1001      yes            dec_mpls_ttl
+Dec_MPLS_TTL          [Documentation]        ${dec_mpls_ttl_doc}
+                      [Tags]                 ttl                    decmpls
+                      dec-mpls-ttl           none                   none            2          1001      yes            dec_mpls_ttl
 
 *** Keywords ***
 Create And Remove Flow
@@ -77,46 +84,7 @@ Create And Remove Flow
     ##If the ${flow_action} contains the string "set" we need to include a deeper action detail (e.g. set-ttl needs a element to indicate the value to set it to)
     Run Keyword If    "set" in "${flow_action}"    Add Flow XML Element    ${flow}    ${action_key}    ${action_value}    instructions/instruction/apply-actions/action/${flow_action}
     Log    Flow XML is ${flow.xml}
-    Add Flow To Controller And Verify    ${flow.xml}    ${flow.table_id}    ${flow.id}
-    Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Switch    ${OVS_FLOWELEMENTS}
-    Remove Flow From Controller And Verify    ${flow.xml}    ${flow.table_id}    ${flow.id}
-    Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow Does Not Exist On Switch    ${OVS_FLOWELEMENTS}
-
-Add Flow To Controller And Verify
-    [Arguments]    ${flow_body}    ${table_id}    ${flow_id}
-    [Documentation]    Push flow through REST-API and verify in data-store
-    ${resp}    Put Xml    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}    data=${flow_body}
-    Log    ${resp.content}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    ${resp}    get    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}    headers=${ACCEPT_XML}
-    Log    ${resp.content}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    compare xml    ${flow_body}    ${resp.content}
-
-Verify Flow On Switch
-    [Arguments]    ${flow_elements}
-    [Documentation]    Checking flow on switch
-    sleep    1
-    write    dpctl dump-flows -O OpenFlow13
-    ${switchoutput}    Read Until    >
-    : FOR    ${flowElement}    IN    @{flow_elements}
-    \    should Contain    ${switchoutput}    ${flowElement}
-
-Remove Flow From Controller And Verify
-    [Arguments]    ${flow_body}    ${table_id}    ${flow_id}
-    [Documentation]    Remove flow
-    ${resp}    Delete    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}
-    Log    ${resp.content}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/${table_id}
-    Log    ${resp.content}
-    Should Not Contain    ${resp.content}    ${flow_id}
-
-Verify Flow Does Not Exist On Switch
-    [Arguments]    ${flow_elements}
-    [Documentation]    Checking flow on switch is removed
-    sleep    1
-    write    dpctl dump-flows -O OpenFlow13
-    ${switchoutput}    Read Until    >
-    : FOR    ${flowElement}    IN    @{flow_elements}
-    \    should Not Contain    ${switchoutput}    ${flowElement}
+    Add Flow To Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
+    Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Mininet Switch    ${OVS_FLOWELEMENTS}
+    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    ${OVS_FLOWELEMENTS}
diff --git a/test/csit/suites/base-of13/070__Flows_OF13/400__actions.txt b/test/csit/suites/base-of13/070__Flows_OF13/400__actions.txt
new file mode 100644 (file)
index 0000000..66b5708
--- /dev/null
@@ -0,0 +1,103 @@
+*** Settings ***
+Documentation     OF1.3 Suite for flow actions
+...               - output ALL
+...               - output CONTROLLER
+...               - output TABLE
+...               - output IN_PORT
+...               - output LOCAL
+...               - output NORMAL
+...               - output FLOOD
+...               - output ANY
+...
+...               NOTE: for OVS, IN_PORT 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
+Library           SSHLibrary
+Library           Collections
+Library           OperatingSystem
+Library           String
+Library           XML
+Resource          ../../../libraries/FlowLib.txt
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+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
+${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
+${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. */
+${ALL_doc}        OF1.3: OFPP_ALL = 0xfffffffc, /* All physical ports except input port. */
+${CONTROLLER_doc}    OF1.3 OFPP_CONTROLLER = 0xfffffffd, /* Send to controller. */
+${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}
+
+TABLE                 [Documentation]    ${TABLE_doc}
+                      [Tags]             table
+                      ${TEST_NAME}       29                   261       yes            actions=${TEST_NAME}
+
+NORMAL                [Documentation]    ${NORMAL_doc}
+                      [Tags]             normal
+                      ${TEST_NAME}       13                   361       yes            actions=${TEST_NAME}
+
+FLOOD                 [Documentation]    ${FLOOD_doc}
+                      [Tags]             flood
+                      ${TEST_NAME}       47                   81        yes            actions=${TEST_NAME}
+
+ALL                   [Documentation]    ${ALL_doc}
+                      [Tags]             all
+                      ${TEST_NAME}       42                   88        yes            actions=${TEST_NAME}
+
+CONTROLLER            [Documentation]    ${CONTROLLER_doc}
+                      [Tags]             controller
+                      ${TEST_NAME}       81                   21        yes            actions=${TEST_NAME}
+
+LOCAL                 [Documentation]    ${LOCAL_doc}
+                      [Tags]             local
+                      ${TEST_NAME}       122                  32        yes            actions=${TEST_NAME}
+
+ANY                   [Documentation]    ${ANY_doc}
+                      [Tags]             any
+                      ${TEST_NAME}       222                  111       yes            actions=${TEST_NAME}
+
+*** Keywords ***
+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}
+    ##The dictionaries here will be used to populate the match and action elements of the flow mod
+    ${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
+    Set "${flow}" "table_id" With "${table_id}"
+    Set "${flow}" "id" With "${flow_id}"
+    Clear Flow Actions    ${flow}
+    Set Flow Output Action    ${flow}    0    0    ${output_port}
+    Set Flow Ethernet Match    ${flow}    ${ethernet_match_dict}
+    Set Flow IPv4 Match    ${flow}    ${ipv4_match_dict}
+    Log    Flow XML is ${flow.xml}
+    Add Flow To Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
+    Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Mininet Switch    ${OVS_FLOWELEMENTS}
+    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    ${OVS_FLOWELEMENTS}