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