Merge "Updated modules.conf and modules-shards.conf to updated the util.py to remove...
[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
35 *** Test Cases ***    ODL flow action        action key                                                                                                                      action value    tableID    flowID    verify OVS?    OVS specific string?
36 Set_IP_TTL            [Documentation]        OF1.3: \ OFPAT_SET_NW_TTL = 23, /* IP TTL. */\n(currently not supported on OVS)\n
37                       [Tags]                 ttl                                                                                                                             set
38                       set-nw-ttl-action      nw-ttl                                                                                                                          1               2          101       no             set_ttl
39
40 Dec_TTL               [Documentation]        OF1.3: \ OFPAT_DEC_NW_TTL = 24, /* Decrement IP TTL. */\n
41                       [Tags]                 ttl                                                                                                                             dec
42                       dec-nw-ttl             none                                                                                                                            none            3          305       yes            dec_ttl
43
44 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
45                       [Tags]                 ttl                                                                                                                             copyin
46                       copy-ttl-in            none                                                                                                                            none            9          202       no             copy_ttl_in
47
48 Copy_TTL_Out          [Documentation]        OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost\nto outermost */\n(currently NOT suported in OVS)
49                       [Tags]                 ttl                                                                                                                             copyout
50                       copy-ttl-out           none                                                                                                                            none            8          909       no             copy_ttl_out
51
52 Set_MPLS_TTL          [Documentation]        OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
53                       [Tags]                 ttl                                                                                                                             setmpls
54                       set-mpls-ttl-action    mpls-ttl                                                                                                                        1               4          505       yes            set_mpls_ttl
55
56 Dec_MPLS_TTL          [Documentation]        OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
57                       [Tags]                 ttl                                                                                                                             decmpls
58                       dec-mpls-ttl           none                                                                                                                            none            2          1001      yes            dec_mpls_ttl
59
60 *** Keywords ***
61 Create And Remove Flow
62     [Arguments]    ${flow_action}    ${action_key}    ${action_value}    ${table_id}    ${flow_id}    ${verify_switch_flag}
63     ...    ${additional_ovs_flowelements}
64     @{OVS_FLOWELEMENTS}    Create List    dl_dst=${eth_dst}    table=${table_id}    dl_src=${eth_src}    nw_src=${ipv4_src}    nw_dst=${ipv4_dst}
65     ...    ${additional_ovs_flowelements}
66     ##The dictionaries here will be used to populate the match and action elements of the flow mod
67     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
68     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
69     ##flow is a python Object to build flow details, including the xml format to send to controller
70     ${flow}=    Create Flow
71     Set "${flow}" "table_id" With "${table_id}"
72     Set "${flow}" "id" With "${flow_id}"
73     Clear Flow Actions    ${flow}
74     Set Flow Action    ${flow}    0    0    ${flow_action}
75     Set Flow Ethernet Match    ${flow}    ${ethernet_match_dict}
76     Set Flow IPv4 Match    ${flow}    ${ipv4_match_dict}
77     ##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)
78     Run Keyword If    "set" in "${flow_action}"    Add Flow XML Element    ${flow}    ${action_key}    ${action_value}    instructions/instruction/apply-actions/action/${flow_action}
79     Log    Flow XML is ${flow.xml}
80     Add Flow To Controller And Verify    ${flow.xml}    ${flow.table_id}    ${flow.id}
81     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Switch    ${OVS_FLOWELEMENTS}
82     Remove Flow From Controller And Verify    ${flow.xml}    ${flow.table_id}    ${flow.id}
83     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow Does Not Exist On Switch    ${OVS_FLOWELEMENTS}
84
85 Add Flow To Controller And Verify
86     [Arguments]    ${flow_body}    ${table_id}    ${flow_id}
87     [Documentation]    Push flow through REST-API and verify in data-store
88     ${resp}    Put Xml    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}    data=${flow_body}
89     Log    ${resp.content}
90     Should Be Equal As Strings    ${resp.status_code}    200
91     ${resp}    get    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}    headers=${ACCEPT_XML}
92     Log    ${resp.content}
93     Should Be Equal As Strings    ${resp.status_code}    200
94     compare xml    ${flow_body}    ${resp.content}
95
96 Verify Flow On Switch
97     [Arguments]    ${flow_elements}
98     [Documentation]    Checking flow on switch
99     sleep    1
100     write    dpctl dump-flows -O OpenFlow13
101     ${switchoutput}    Read Until    >
102     : FOR    ${flowElement}    IN    @{flow_elements}
103     \    should Contain    ${switchoutput}    ${flowElement}
104
105 Remove Flow From Controller And Verify
106     [Arguments]    ${flow_body}    ${table_id}    ${flow_id}
107     [Documentation]    Remove flow
108     ${resp}    Delete    session    ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}
109     Log    ${resp.content}
110     Should Be Equal As Strings    ${resp.status_code}    200
111     ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/${table_id}
112     Log    ${resp.content}
113     Should Not Contain    ${resp.content}    ${flow_id}
114
115 Verify Flow Does Not Exist On Switch
116     [Arguments]    ${flow_elements}
117     [Documentation]    Checking flow on switch is removed
118     sleep    1
119     write    dpctl dump-flows -O OpenFlow13
120     ${switchoutput}    Read Until    >
121     : FOR    ${flowElement}    IN    @{flow_elements}
122     \    should Not Contain    ${switchoutput}    ${flowElement}