Update Robot Framework format - step 7
[integration/test.git] / csit / suites / groupbasedpolicy / GBP / 3-node / gbp1 / 010_icmp.robot
1 *** Settings ***
2 Documentation       Tests for ICMP flow
3
4 Library             SSHLibrary
5 Resource            ../../../../../libraries/Utils.robot
6 Resource            ../../../../../libraries/GBP/ConnUtils.robot
7 Resource            ../../../../../libraries/GBP/DockerUtils.robot
8 Resource            ../../../../../libraries/GBP/OpenFlowUtils.robot
9 Variables           ../../../../../variables/Variables.py
10 Resource            ../Variables.robot
11
12 Suite Setup         Set Test Variables    client_switch_ip=${GBP1}    client_docker=h35_2    client_ip=10.0.35.2    client_mac=00:00:00:00:35:02    same_webserver_docker=h36_4    same_webserver_ip=10.0.36.4
13 ...                     same_webserver_mac=00:00:00:00:36:04    diff_webserver_switch_ip=${GBP3}    diff_webserver_docker=h36_3    diff_webserver_ip=10.0.36.3    diff_webserver_mac=00:00:00:00:36:03
14
15 Default Tags        single-tenant    icmp    single-tenant-main
16
17
18 *** Variables ***
19 ${timeout}      10s
20
21
22 *** Test Cases ***
23 Same switch, ping once from h35_2 to h36_4
24     [Documentation]    Ping between endpoints located on the same switch "sw1".
25     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
26     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
27     SSHLibrary.Close Connection
28
29 Same switch, start endless ping from h35_2 to h36_4
30     [Documentation]    Start endless ping from h35_2 to h36_4 so that icmp traffic
31     ...    can be inspected.
32     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
33     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
34     SSHLibrary.Close Connection
35
36 Same switch, ICMP request ovs-dpctl output check on sw1
37     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_4
38     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
39     @{matches}    Create List
40     @{actions}    Create List
41     Append In Port Check    ${matches}    4
42     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
43     Append Ether-Type Check    ${matches}    0x0800
44     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
45     Append Proto Check    ${matches}    1
46     Append Inner MAC Check    ${actions}    dst_addr=${SAME_WEBSERVER_MAC}
47     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
48     Append Proto Check    ${actions}    1
49     Append Out Port Check    ${actions}    6
50     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
51     SSHLibrary.Close Connection
52
53 Same switch, ICMP reply ovs-dpctl output check on sw1
54     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h36_4 to h35_2
55     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
56     Set Suite Variable    @{matches}    @{EMPTY}
57     Set Suite Variable    @{actions}    @{EMPTY}
58     Append In Port Check    ${matches}    6
59     Append Inner MAC Check    ${matches}    src_addr=${SAME_WEBSERVER_MAC}
60     Append Ether-Type Check    ${matches}    0x0800
61     Append Inner IPs Check    ${matches}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
62     Append Proto Check    ${matches}    1
63     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
64     Append Inner IPs Check    ${actions}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
65     Append Proto Check    ${actions}    1
66     Append Out Port Check    ${actions}    4
67     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
68     SSHLibrary.Close Connection
69
70 Same switch, stop endless ping from h35_2 to h36_4
71     [Documentation]    Stops endless pinging from h35_2 to h36_4 when traffic inspection finishes.
72     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
73     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
74     SSHLibrary.Close Connection
75
76 Different switches, ping once from h35_2 to h36_3
77     [Documentation]    Different switches (sw1 -> sw3)
78     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
79     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
80     SSHLibrary.Close Connection
81
82 Different switches, start endless ping from h35_2 to h36_3
83     [Documentation]    Starting icmp session for traffic inspection between endpoints located
84     ...    on different switches.
85     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
86     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
87     SSHLibrary.Close Connection
88
89 Different switches, ICMP request ovs-dpctl output check on sw1
90     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3
91     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
92     @{matches}    Create List
93     @{actions}    Create List
94     Append In Port Check    ${matches}    4
95     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
96     Append Ether-Type Check    ${matches}    0x0800
97     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
98     Append Proto Check    ${matches}    1
99     Append Tunnel Set Check    ${actions}
100     Append Inner MAC Check    ${actions}    dst_addr=${DIFF_WEBSERVER_MAC}
101     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
102     Append Proto Check    ${actions}    1
103     Append Out Port Check    ${actions}    3
104     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
105     SSHLibrary.Close Connection
106
107 Different switches, ICMP request ovs-dpctl output check on sw3
108     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3
109     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
110     @{matches}    Create List
111     @{actions}    Create List
112     Append Tunnel Set Check    ${matches}
113     Append Outer IPs Check    ${matches}    src_ip=${CLIENT_SWITCH_IP}
114     Append Outer IPs Check    ${matches}    dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
115     Append In Port Check    ${matches}    3
116     Append Inner MAC Check    ${matches}    dst_addr=${DIFF_WEBSERVER_MAC}
117     Append Ether-Type Check    ${matches}    0x0800
118     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
119     Append Proto Check    ${matches}    1
120     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
121     Append Proto Check    ${actions}    1
122     Append Out Port Check    ${actions}    5
123     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
124     SSHLibrary.Close Connection
125
126 Different switches, ICMP reply ovs-dpctl output check on sw3
127     [Documentation]    assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2
128     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
129     @{matches}    Create List
130     @{actions}    Create List
131     Append In Port Check    ${matches}    5
132     Append Inner MAC Check    ${matches}    src_addr=${DIFF_WEBSERVER_MAC}
133     Append Ether-Type Check    ${matches}    0x0800
134     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
135     Append Proto Check    ${matches}    1
136     Append Tunnel Set Check    ${actions}
137     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
138     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
139     Append Proto Check    ${actions}    1
140     Append Out Port Check    ${actions}    3
141     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
142     SSHLibrary.Close Connection
143
144 Different switches, ICMP reply ovs-dpctl output check on sw1
145     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2
146     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
147     @{matches}    Create List
148     @{actions}    Create List
149     Append Tunnel Set Check    ${matches}
150     Append Outer IPs Check    ${matches}    src_ip=${DIFF_WEBSERVER_SWITCH_IP}
151     Append Outer IPs Check    ${matches}    dst_ip=${CLIENT_SWITCH_IP}
152     Append In Port Check    ${matches}    3
153     Append Inner MAC Check    ${matches}    dst_addr=${CLIENT_MAC}
154     Append Ether-Type Check    ${matches}    0x0800
155     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
156     Append Proto Check    ${matches}    1
157     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
158     Append Proto Check    ${actions}    1
159     Append Out Port Check    ${actions}    4
160     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
161     SSHLibrary.Close Connection
162
163 Different switches, stop endless ping from h35_2 to h36_3
164     [Documentation]    Stops endless pinging from h35_2 to h36_3 when traffic inspection finishes.
165     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
166     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
167     SSHLibrary.Close Connection