Step 1: Move vm scripts to the right place
[integration/test.git] / csit / suites / openflowplugin / Flows_OF13 / 305__ttl.robot
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           RequestsLibrary
19 Library           XML
20 Resource          ../../../libraries/FlowLib.robot
21 Library           ../../../libraries/Common.py
22 Variables         ../../../variables/Variables.py
23
24 *** Variables ***
25 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
26 ${GENERIC_ACTION_FLOW_FILE}    ${CURDIR}/../../../variables/xmls/genericActionFlow.xml
27 ${ipv4_src}       10.1.2.0/24
28 ${ipv4_dst}       40.4.0.0/16
29 ${eth_type}       0x800
30 ${eth_src}        00:00:00:01:23:ae
31 ${eth_dst}        ff:ff:ff:ff:ff:ff
32 ${node_id}        openflow:1
33 ${set_ip_ttl_doc}    OF1.3: \ OFPAT_SET_NW_TTL = 23, /* IP TTL. */\n(currently not supported on OVS)
34 ${dec_ttl_doc}    OF1.3: \ OFPAT_DEC_NW_TTL = 24, /* Decrement IP TTL. */
35 ${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
36 ${copy_ttl_out_doc}    OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost\nto outermost */\n(currently NOT suported in OVS)
37 ${set_mpls_ttl_doc}    OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
38 ${dec_mpls_ttl_doc}    OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
39
40 *** Test Cases ***    ODL flow action        action key             action value    tableID    flowID    priority    verify OVS?    OVS specific string?
41 Set_IP_TTL            [Documentation]        ${set_ip_ttl_doc}
42                       [Tags]                 ttl                    set
43                       set-nw-ttl-action      nw-ttl                 1               2          101       10          no             set_ttl
44
45 Dec_TTL               [Documentation]        ${dec_ttl_doc}
46                       [Tags]                 ttl                    dec
47                       dec-nw-ttl             none                   none            3          305       311          yes            dec_ttl
48
49 Copy_TTL_In           [Documentation]        ${copy_ttl_in_doc}
50                       [Tags]                 ttl                    copyin
51                       copy-ttl-in            none                   none            9          202       9          no             copy_ttl_in
52
53 Copy_TTL_Out          [Documentation]        ${copy_ttl_out_doc}
54                       [Tags]                 ttl                    copyout
55                       copy-ttl-out           none                   none            8          909       4242          no             copy_ttl_out
56
57 Set_MPLS_TTL          [Documentation]        ${set_mpls_ttl_doc}
58                       [Tags]                 ttl                    setmpls
59                       set-mpls-ttl-action    mpls-ttl               1               4          505       9021          yes            set_mpls_ttl
60
61 Dec_MPLS_TTL          [Documentation]        ${dec_mpls_ttl_doc}
62                       [Tags]                 ttl                    decmpls
63                       dec-mpls-ttl           none                   none            2          1001      81          yes            dec_mpls_ttl
64
65 *** Keywords ***
66 Create And Remove Flow
67     [Arguments]    ${flow_action}    ${action_key}    ${action_value}    ${table_id}    ${flow_id}    ${priority}
68     ...    ${verify_switch_flag}    ${additional_ovs_flowelements}
69     @{OVS_FLOWELEMENTS}    Create List    dl_dst=${eth_dst}    table=${table_id}    dl_src=${eth_src}    nw_src=${ipv4_src}    nw_dst=${ipv4_dst}
70     ...    ${additional_ovs_flowelements}
71     ##The dictionaries here will be used to populate the match and action elements of the flow mod
72     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
73     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
74     ##flow is a python Object to build flow details, including the xml format to send to controller
75     ${flow}=    Create Inventory Flow
76     Set "${flow}" "table_id" With "${table_id}"
77     Set "${flow}" "id" With "${flow_id}"
78     Set "${flow}" "priority" With "${priority}"
79     Clear Flow Actions    ${flow}
80     Set Flow Action    ${flow}    0    0    ${flow_action}
81     Set Flow Ethernet Match    ${flow}    ${ethernet_match_dict}
82     Set Flow IPv4 Match    ${flow}    ${ipv4_match_dict}
83     ##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)
84     Run Keyword If    "set" in "${flow_action}"    Add Flow XML Element    ${flow}    ${action_key}    ${action_value}    instructions/instruction/apply-actions/action/${flow_action}
85     Log    Flow XML is ${flow.xml}
86     Add Flow To Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
87     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow On Mininet Switch    ${OVS_FLOWELEMENTS}
88     Remove Flow From Controller And Verify    ${flow.xml}    ${node_id}    ${flow.table_id}    ${flow.id}
89     Run Keyword If    "${verify_switch_flag}" == "yes"    Verify Flow Does Not Exist On Mininet Switch    ${OVS_FLOWELEMENTS}