Fixing mininet reads so that we always clear mininet
[integration/test.git] / test / csit / suites / base-of13 / 070__Flows_OF13 / 305__ttl.txt
1 *** Settings ***
2 Documentation     OF1.3 Suite to cover TTL Actions
3 ...               - Set IP TTL
4 ...               - Decrement IP TTL
5 ...               - Copy TTL outwards
6 ...               - Copy TTL inwards
7 ...               - Set MPLS TTL
8 ...               - Decrement MPLS TTL
9 ...
10 ...               NOTE: for OVS, it appears that set_ttl, and both copy in/out are not supported, so need to skip those checks for now.
11 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
12 Suite Teardown    Delete All Sessions
13 Test Template     Create And Remove Flow
14 Library           SSHLibrary
15 Library           Collections
16 Library           OperatingSystem
17 Library           String
18 Library           XML
19 Resource          ../../../libraries/FlowLib.txt
20 Library           ../../../libraries/RequestsLibrary.py
21 Library           ../../../libraries/Common.py
22 Variables         ../../../variables/Variables.py
23
24 *** Variables ***
25 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
26 ${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
27 ${GENERIC_ACTION_FLOW_FILE}    ${CURDIR}/../../../variables/xmls/genericActionFlow.xml
28 ${MININET_CMD}    sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch ovsk,protocols=OpenFlow13
29 ${ipv4_src}       10.1.2.0/24
30 ${ipv4_dst}       40.4.0.0/16
31 ${eth_type}       0x800
32 ${eth_src}        00:00:00:01:23:ae
33 ${eth_dst}        ff:ff:ff:ff:ff:ff
34 ${node_id}        openflow:1
35 ${set_ip_ttl_doc}    OF1.3: \ OFPAT_SET_NW_TTL = 23, /* IP TTL. */\n(currently not supported on OVS)
36 ${dec_ttl_doc}    OF1.3: \ OFPAT_DEC_NW_TTL = 24, /* Decrement IP TTL. */
37 ${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
38 ${copy_ttl_out_doc}    OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost\nto outermost */\n(currently NOT suported in OVS)
39 ${set_mpls_ttl_doc}    OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
40 ${dec_mpls_ttl_doc}    OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
41
42 *** Test Cases ***    ODL flow action        action key             action value    tableID    flowID    verify OVS?    OVS specific string?
43 Set_IP_TTL            [Documentation]        ${set_ip_ttl_doc}
44                       [Tags]                 ttl                    set
45                       set-nw-ttl-action      nw-ttl                 1               2          101       no             set_ttl
46
47 Dec_TTL               [Documentation]        ${dec_ttl_doc}
48                       [Tags]                 ttl                    dec
49                       dec-nw-ttl             none                   none            3          305       yes            dec_ttl
50
51 Copy_TTL_In           [Documentation]        ${copy_ttl_in_doc}
52                       [Tags]                 ttl                    copyin
53                       copy-ttl-in            none                   none            9          202       no             copy_ttl_in
54
55 Copy_TTL_Out          [Documentation]        ${copy_ttl_out_doc}
56                       [Tags]                 ttl                    copyout
57                       copy-ttl-out           none                   none            8          909       no             copy_ttl_out
58
59 Set_MPLS_TTL          [Documentation]        ${set_mpls_ttl_doc}
60                       [Tags]                 ttl                    setmpls
61                       set-mpls-ttl-action    mpls-ttl               1               4          505       yes            set_mpls_ttl
62
63 Dec_MPLS_TTL          [Documentation]        ${dec_mpls_ttl_doc}
64                       [Tags]                 ttl                    decmpls
65                       dec-mpls-ttl           none                   none            2          1001      yes            dec_mpls_ttl
66
67 *** Keywords ***
68 Create And Remove Flow
69     [Arguments]    ${flow_action}    ${action_key}    ${action_value}    ${table_id}    ${flow_id}    ${verify_switch_flag}
70     ...    ${additional_ovs_flowelements}
71     @{OVS_FLOWELEMENTS}    Create List    dl_dst=${eth_dst}    table=${table_id}    dl_src=${eth_src}    nw_src=${ipv4_src}    nw_dst=${ipv4_dst}
72     ...    ${additional_ovs_flowelements}
73     ##The dictionaries here will be used to populate the match and action elements of the flow mod
74     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
75     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
76     ##flow is a python Object to build flow details, including the xml format to send to controller
77     ${flow}=    Create Inventory Flow
78     Set "${flow}" "table_id" With "${table_id}"
79     Set "${flow}" "id" With "${flow_id}"
80     Clear Flow Actions    ${flow}
81     Set Flow Action    ${flow}    0    0    ${flow_action}
82     Set Flow Ethernet Match    ${flow}    ${ethernet_match_dict}
83     Set Flow IPv4 Match    ${flow}    ${ipv4_match_dict}
84     ##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)
85     Run Keyword If    "set" in "${flow_action}"    Add Flow XML Element    ${flow}    ${action_key}    ${action_value}    instructions/instruction/apply-actions/action/${flow_action}
86     Log    Flow XML is ${flow.xml}
87     Add Flow To Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
88     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Mininet Switch    ${OVS_FLOWELEMENTS}
89     Remove Flow From Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
90     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow Does Not Exist On Mininet Switch    ${OVS_FLOWELEMENTS}