f8396b7a478b38d11377897dc310b32ae7412926
[integration/test.git] / test / csit / suites / karaf-compatible / 300_Switch_Qualification / 020_OpenFlow_Actions.txt
1 *** Settings ***
2 Documentation     OF1.3 Suite for flow actions
3 ...               - output ALL
4 ...               - output CONTROLLER
5 ...               - output TABLE
6 ...               - output INPORT
7 ...               - output LOCAL
8 ...               - output NORMAL
9 ...               - output FLOOD
10 ...               - output ANY
11 ...
12 ...               NOTE: for OVS, INPORT does not appear to be supported
13 Suite Setup       OpenFlow Actions Suite Setup
14 Suite Teardown    OpenFlow Actions Suite Teardown
15 Test Template     Create And Remove Flow
16 Library           Collections
17 Library           OperatingSystem
18 Library           String
19 Library           XML
20 Resource          ../../../libraries/FlowLib.txt
21 Resource          ../../../libraries/SwitchUtils.txt
22 Library           ../../../libraries/RequestsLibrary.py
23 Library           ../../../libraries/Common.py
24 Variables         ../../../variables/Variables.py
25 Library           ../../../libraries/SwitchClasses/${SWITCH_CLASS}.py
26
27 *** Variables ***
28 ${SWITCH_CLASS}    Ovs
29 ${SWITCH_IP}      ${MININET}
30 ${CONTROLLER}     null
31 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
32 ${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
33 ${ipv4_src}       11.3.0.0/16
34 ${ipv4_dst}       99.0.0.0/8
35 ${eth_type}       0x800
36 ${eth_src}        00:ab:cd:ef:01:23
37 ${eth_dst}        ff:ff:ff:ff:ff:ff
38 ##documentation strings
39 ${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
40 ${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. */
41 ${NORMAL_doc}     OF1.3 OFPP_NORMAL = 0xfffffffa, /* Process with normal L2/L3 switching. */
42 ${FLOOD_doc}      OF1.3 OFPP_FLOOD = 0xfffffffb, /* All physical ports in VLAN, except input port and those blocked or link down. */
43 ${ALL_doc}        OF1.3: OFPP_ALL = 0xfffffffc, /* All physical ports except input port. */
44 ${CONTROLLER_doc}    OF1.3 OFPP_CONTROLLER = 0xfffffffd, /* Send to controller. */
45 ${LOCAL_doc}      OF1.3 OFPP_LOCAL = 0xfffffffe, /* Local openflow "port". */
46 ${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). */
47
48 *** Test Cases ***    output port        tableID              flowID
49 INPORT                [Documentation]    ${INPORT_doc}
50                       [Tags]             inport
51                       ${TEST_NAME}       200                  161
52
53 TABLE                 [Documentation]    ${TABLE_doc}
54                       [Tags]             table
55                       ${TEST_NAME}       200                  261
56
57 NORMAL                [Documentation]    ${NORMAL_doc}
58                       [Tags]             normal
59                       ${TEST_NAME}       200                  361
60
61 FLOOD                 [Documentation]    ${FLOOD_doc}
62                       [Tags]             flood
63                       ${TEST_NAME}       200                  81
64
65 ALL                   [Documentation]    ${ALL_doc}
66                       [Tags]             all
67                       ${TEST_NAME}       200                  88
68
69 CONTROLLER            [Documentation]    ${CONTROLLER_doc}
70                       [Tags]             controller
71                       ${TEST_NAME}       200                  21
72
73 LOCAL                 [Documentation]    ${LOCAL_doc}
74                       [Tags]             local
75                       ${TEST_NAME}       200                  32
76
77 ANY                   [Documentation]    ${ANY_doc}
78                       [Tags]             any
79                       ${TEST_NAME}       200                  111
80
81 *** Keywords ***
82 Create And Remove Flow
83     [Arguments]    ${output_port}    ${table_id}    ${flow_id}
84     ##The dictionaries here will be used to populate the match and action elements of the flow mod
85     ${ethernet_match_dict}=    Create Dictionary    type=${eth_type}    destination=${eth_dst}    source=${eth_src}
86     ${ipv4_match_dict}=    Create Dictionary    source=${ipv4_src}    destination=${ipv4_dst}
87     ##flow is a python Object to build flow details, including the xml format to send to controller
88     ${flow}=    Create Inventory Flow
89     Set "${flow}" "table_id" With "${table_id}"
90     Set "${flow}" "id" With "${flow_id}"
91     Clear Flow Actions    ${flow}
92     Set Flow Output Action    ${flow}    0    0    ${output_port}
93     Set Flow Ethernet Match    ${flow}    ${ethernet_match_dict}
94     Set Flow IPv4 Match    ${flow}    ${ipv4_match_dict}
95     Log    Flow XML is ${flow.xml}
96     Call Method    ${test_switch}    create_flow_match_elements    ${flow.xml}
97     Log    ${test_switch.flow_validations}
98     ${dpid_id}=    Get Switch Datapath ID    ${test_switch}
99     Add Flow To Controller And Verify    ${flow.xml}    openflow:${dpid_id}    ${flow.table_id}    ${flow.id}
100     Validate Switch Output    ${test_switch}    ${test_switch.dump_all_flows}    ${test_switch.flow_validations}
101     Remove Flow From Controller And Verify    ${flow.xml}    openflow:${dpid_id}    ${flow.table_id}    ${flow.id}
102     Validate Switch Output    ${test_switch}    ${test_switch.dump_all_flows}    ${test_switch.flow_validations}    false
103
104 OpenFlow Actions Suite Setup
105     ${test_switch}=    Get Switch    ${SWITCH_CLASS}
106     Set Suite Variable    ${test_switch}
107     Call Method    ${test_switch}    set_mgmt_ip    ${SWITCH_IP}
108     Call Method    ${test_switch}    set_controller_ip    ${CONTROLLER}
109     Log    MAKE: ${test_switch.make}\n MODEL: ${test_switch.model}\n IP: ${test_switch.mgmt_ip}\n PROMPT: ${test_switch.mgmt_prompt}\n CONTROLLER_IP: ${test_switch.of_controller_ip}\n MGMT_PROTOCOL: ${test_switch.mgmt_protocol}
110     Ping    ${test_switch.mgmt_ip}
111     Initialize Switch    ${test_switch}
112     Configure OpenFlow    ${test_switch}
113     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
114
115 OpenFlow Actions Suite Teardown
116     Cleanup Switch    ${test_switch}
117     SSHLibrary.Close All Connections
118     Telnet.Close All Connections