Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / vtn / VTN_Mgr_OF13 / 010__vtn_manager_flowfilter.robot
1 *** Settings ***
2 Documentation     Test suite for VTN Manager using OF13
3 Suite Setup       Start SuiteVtnMaTest
4 Suite Teardown    Stop SuiteVtnMaTest
5 Resource          ../../../libraries/VtnMaKeywords.robot
6
7 *** Variables ***
8 ${flowfilterInetdata}    {"index":1,"condition":"cond1","filterType":{"pass":{}},"actions":[{"inet4src":{"address":"10.0.0.1"}},{"inet4dst":{"address":"10.0.0.3"}}]}
9 ${flowfilterInetdropdata}    {"index":1,"condition":"cond1","filterType":{"drop":{}},"actions":[{"inet4src":{"address":"10.0.0.1"}},{"inet4dst":{"address":"10.0.0.3"}}]}
10 ${flowfilterIcmpCodedata}    {"index":2,"condition":"cond1","filterType":{"pass":{}},"actions":[{"icmpcode":{"code":9}}]}
11 ${flowfilterTpsrcTpdstdata}    {"index":3,"condition":"cond1","filterType":{"pass":{}},"actions":[{"tpsrc":{"port":"5"}},{"tpdst":{"port":"10"}}]}
12 ${flowfilterDscpdata}    {"index":6,"condition":"cond1","filterType":{"pass":{}},"actions":[{"dscp": {"dscp": 10}}]}
13 ${macmap_data}    {"machost": [{"address": "0e:d5:e3:40:a3:f0", "vlan": "0"},{"address": "9a:dd:b0:8a:de:2f", "vlan": "0"}]}
14 ${flowfiltervlanpcp}    {"index":7,"condition":"cond1","filterType":{"pass":{}},"actions":[{"inet4src":{"address":"10.0.0.1"}},{"inet4dst":{"address":"10.0.0.3"}},{"icmpcode":{"code":1}},{"vlanpcp":{"priority":3}}]}
15 ${vtn_flowfilterInetdata}    {"index":8,"condition":"cond1","filterType":{"pass":{}},"actions":[{"inet4src":{"address":"10.0.0.1"}},{"inet4dst":{"address":"10.0.0.3"}}]}
16 ${vbr_flowfilterInetdata}    {"index":9,"condition":"cond1","filterType":{"pass":{}},"actions":[{"inet4src":{"address":"10.0.0.1"}},{"inet4dst":{"address":"10.0.0.3"}}]}
17
18 *** Test Cases ***
19 Check if switch1 detected
20     [Documentation]    Check if openflow:1 is detected
21     BuiltIn.Wait_Until_Keyword_Succeeds    12     3    Fetch vtn switch inventory     openflow:1
22
23 Check if switch2 detected
24     [Documentation]    Check if openflow:2 is detected
25     BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:2
26
27 Check if switch3 detected
28     [Documentation]    Check if openflow:3 is detected
29     BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:3
30
31 Add a vtn Tenant1
32     [Documentation]    Add a vtn Tenant1
33     Add a vtn    Tenant1    {"idleTimeout": "200","hardTimeout": "600","description": "Virtual Tenant1 for Hackfest network"}
34
35 Add a vBridge vBridge1
36     [Documentation]    Add a vBridge vBridge1 in vtn Tenant1
37     Add a vBridge    Tenant1    vBridge1    {"ageInterval": "300","description": "vBridge1 for Tenant1"}
38
39 Add a interface If1
40     [Documentation]    Add a interface if1 into vBridge vBridge1
41     Add a interface    Tenant1    vBridge1    if1    {"enabled": "true","description": "Interface1 for vBridge1 for Tenant1"}
42
43 Add a interface if2
44     [Documentation]    Add a interface if2 into vBridge vBridge1
45     Add a interface    Tenant1    vBridge1    if2    {"enabled": "true","description": "Interface2 for vBridge1 for Tenant1"}
46
47 Add a portmap for interface if1
48     [Documentation]    Create a portmap on Interface if1 of vBridge1
49     ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:02
50     ${port}    Create Dictionary    name=s2-eth1
51     ${portmap_data}    Create Dictionary    node=${node}    port=${port}
52     Add a portmap    Tenant1    vBridge1    if1    ${portmap_data}
53
54 Add a portmap for interface if2
55     [Documentation]    Create a portmap on Interface if2 of vBridge1
56     ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:03
57     ${port}    Create Dictionary    name=s3-eth1
58     ${portmap_data}    Create Dictionary    node=${node}    port=${port}
59     Add a portmap    Tenant1    vBridge1    if2    ${portmap_data}
60
61 Ping h1 to h3
62     [Documentation]    Ping h1 to h3, verify no packet loss
63     Mininet Ping Should Succeed     h1     h3
64
65 Add a vBridge vBridge2
66     [Documentation]    Add a vBridge vBridge2 in vtn Tenant1
67     Add a vBridge    Tenant1    vBridge2    {}
68
69 Add a interface If3
70     [Documentation]    Add a interface if3 into vBrdige vBridge1
71     Add a interface    Tenant1    vBridge1    if3    {}
72
73 Add a interface if4
74     [Documentation]    Add a interface if4 into vBrdige vBridge1
75     Add a interface    Tenant1    vBridge1    if4    {}
76
77 Add a portmap for interface if3
78     [Documentation]    Create a portmap on Interface if3 of vBridge1
79     ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:02
80     ${port}    Create Dictionary    name=s2-eth2
81     ${portmap_data}    Create Dictionary    node=${node}    port=${port}
82     Add a portmap    Tenant1    vBridge1    if3    ${portmap_data}
83
84 Add a portmap for interface if4
85     [Documentation]    Create a portmap on Interface if4 of vBridge1
86     ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:03
87     ${port}    Create Dictionary    name=s3-eth2
88     ${portmap_data}    Create Dictionary    node=${node}    port=${port}
89     Add a portmap    Tenant1    vBridge1    if4    ${portmap_data}
90
91 Ping h2 to h4
92     [Documentation]    Ping h2 to h4, verify no packet loss
93     Mininet Ping Should Succeed     h2     h4
94
95 Add a macmap
96     [Documentation]    Create a macmap on vBridge vBridge1
97     Add a macmap     Tenant1    vBridge1    ${macmap_data}
98
99 Get flow
100     [Documentation]    Get flow of a vtn Tenant1
101     Get flow    Tenant1
102
103 Add a flowcondition cond1
104     [Documentation]    Create a flowcondition cond1
105     ${inet4}=    Create Dictionary    src=10.0.0.1    dst=10.0.0.3
106     ${inetMatch}=    Create Dictionary    inet4=${inet4}
107     ${matchElement}=    Create Dictionary    index=1    inetMatch=${inetMatch}
108     @{matchlist}    Create List    ${matchElement}
109     ${flowcond_data}=    Create Dictionary    name=cond1    match=${matchlist}
110     Add a flowcondition  cond1    ${flowcond_data}
111
112 Add a flowfilter with inet4src and inet4dst
113     [Documentation]    Create a flowfilter with inet4 and Verify ping
114     Add a flowfilter    Tenant1    vBridge1    if1    ${flowfilterInetdata}    ${index}
115     Mininet Ping Should Succeed    h1    h3
116
117 Add a flowfilter with Icmp code
118     [Documentation]    Create a flowfilter with icmp code and Verify ping
119     Update a flowfilter    Tenant1    vBridge1    if1    ${flowfilterIcmpCodedata}    ${index}
120     Mininet Ping Should Succeed    h1    h3
121
122 Add a flowfilter with tpsrc and tpdst
123     [Documentation]    Create a flowfilter with tpsrc and tpdst and Verify ping
124     Update a flowfilter    Tenant1    vBridge1    if1    ${flowfilterTpsrcTpdstdata}    ${index}
125     Mininet Ping Should Succeed    h1    h3
126
127 Add a flowfilter with dscp
128     [Documentation]    Create a flowfilter with dscp and Verify ping
129     Update a flowfilter    Tenant1    vBridge1    if1    ${flowfilterDscpdata}    ${index}
130     Mininet Ping Should Succeed    h1    h3
131
132 Verify Flow Entry for Inet Flowfilter
133     [Documentation]    Verify Flow Entry for Inet Flowfilter
134     Verify Flow Entry for Inet Flowfilter
135
136 Add a flowfilter with vlanpcp
137     [Documentation]    Create a flowfilter with vlanpcp and Verify ping
138     Update a flowfilter    Tenant1    vBridge1    if1    ${flowfiltervlanpcp}    ${index}
139     Mininet Ping Should Succeed    h1    h3
140
141 Add a flowfilter_vtn with inet4src and inet4dst
142     [Documentation]    Create a vtn_flowfilter with inet4 and Verify ping
143     Add a flowfilter_vtn    Tenant1    ${vtn_flowfilterInetdata}    ${index}
144     Mininet Ping Should Succeed    h1    h3
145
146 Add a flowfilter_vbr with inet4src and inet4dst
147     [Documentation]    Create a vbr_flowfilter with inet4 and Verify ping
148     Add a flowfilter_vbr    Tenant1    vBridge1    ${vbr_flowfilterInetdata}    ${index}
149     Mininet Ping Should Succeed    h1    h3
150
151 Add a flowfilter with inet4 for drop
152     [Documentation]    Create a flowfilter with inet4 for drop action and Verify no pinging
153     Add a flowfilter for drop    Tenant1    vBridge1    if1    ${flowfilterInetdropdata}    ${index}
154     Mininet Ping Should Not Succeed    h1    h3
155
156 Verify Removed Flow Entry For Inet After Drop Action
157     [Documentation]    Verify no flows between the hosts after drop
158     Verify Removed Flow Entry for Inet Drop Flowfilter
159
160 Delete a flowcondition
161     [Documentation]    Delete a flowcondition
162     Delete a flowcondition    cond1
163
164 Delete a vtn Tenant1
165     [Documentation]    Delete a vtn Tenant1
166     Delete a vtn    Tenant1