Topoprocessing - tests correction
[integration/test.git] / csit / suites / topoprocessing / basic-topology-operations / 020_Filtration_nodes.robot
1 *** Settings ***
2 Documentation     Test suite to verify fitration operation on different models.
3 ...               Before test starts, configurational file have to be rewriten to change listners registration datastore type from CONFIGURATION to OPERATIONAL.
4 ...               Need for this change is also a reason why main feature (odl-topoprocessing-framework) is installed after file change and not during boot.
5 ...               Tests themselves install feature required for specific model, clear karaf logs for futher synchronization, send configurational xmls and verify output.
6 ...               Topology-id on the end of each urls must match topology-id from xml. Yang models of components in topology are defined in xmls.
7 Suite Setup       Setup Environment
8 Suite Teardown    Clean Environment
9 Test Teardown     Test Teardown    network-topology:network-topology/topology/topo:1
10 Library           RequestsLibrary
11 Library           SSHLibrary
12 Library           XML
13 Variables         ../../../variables/topoprocessing/TopologyRequests.py
14 Variables         ../../../variables/Variables.py
15 Resource          ../../../libraries/KarafKeywords.robot
16 Resource          ../../../libraries/Utils.robot
17 Resource          ../../../libraries/TopoprocessingKeywords.robot
18
19 *** Test Cases ***
20 Filtration IPV4 Network Topology Model
21     [Documentation]    Test of ipv4 type of filtration operation on Network Topology model
22     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:1
23     ${request}    Insert Filter    ${request}    ${FILTER_IPV4}    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4
24     ${request}    Set IPV4 Filter    ${request}    192.168.1.1/24
25     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
26     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
27     Should Contain X Times    ${resp.content}    <node-id>node:    2
28     Should Contain X Times    ${resp.content}    <node-ref>bgp:1</node-ref>    1
29     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
30     ${node}    Element to String    ${node}
31     Should Contain X Times    ${node}    <termination-point>    3
32     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:3</tp-ref>    1
33     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:2</tp-ref>    1
34     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:3</tp-ref>    1
35     Should Contain X Times    ${resp.content}    <node-ref>bgp:2</node-ref>    1
36
37 Filtration IPV4 Inventory Model
38     [Documentation]    Test of ipv4 type of filtration operation on Inventory model
39     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:1
40     ${request}    Insert Filter    ${request}    ${FILTER_IPV4}    flow-node-inventory:ip-address
41     ${request}    Set IPV4 Filter    ${request}    192.168.1.1/24
42     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
43     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
44     Should Contain X Times    ${resp.content}    <node-id>node:    3
45     : FOR    ${index}    IN RANGE    1    4
46     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
47
48 Filtration Range Number Network Topology Model
49     [Documentation]    Test of range number type of filtration operation on Network Topology model
50     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
51     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    ovsdb:ovs-version
52     ${request}    Set Range Number Filter    ${request}    20    25
53     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
54     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
55     Should Contain X Times    ${resp.content}    <node-id>node:    4
56     : FOR    ${index}    IN RANGE    7    11
57     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
58     Should Contain X Times    ${resp.content}    <termination-point>    5
59     #node bgp:7
60     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
61     ${node}    Element to String    ${node}
62     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
63     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
64     #node bgp:8
65     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:8']/..
66     ${node}    Element to String    ${node}
67     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:8/termination-point/tp:8:1</tp-ref>    1
68     #node bgp:9
69     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
70     ${node}    Element to String    ${node}
71     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
72     #node bgp:10
73     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
74     ${node}    Element to String    ${node}
75     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
76
77 Filtration Range Number Inventory Model
78     [Documentation]    Test of range number type of filtration operation on Inventory model
79     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
80     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    flow-node-inventory:serial-number
81     ${request}    Set Range Number Filter    ${request}    20    25
82     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
83     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
84     Should Contain X Times    ${resp.content}    <node-id>node:    3
85     : FOR    ${index}    IN RANGE    8    11
86     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
87
88 Filtration Specific Number Network Topology Model
89     [Documentation]    Test of specific number type of filtration operation on Network Topology model
90     Pass Execution    Test is being passed due to incorrect target field. Test will be included in execution when corrected.
91     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
92     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    ovsdb:ovs-version
93     ${request}    Set Specific Number Filter    ${request}    25
94     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
95     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
96     Should Contain X Times    ${resp.content}    <node-id>node:    2
97     Should Contain X Times    ${resp.content}    <node-ref>bgp:9</node-ref>    1
98     Should Contain X Times    ${resp.content}    <node-ref>bgp:10</node-ref>    1
99     Should Contain X Times    ${resp.content}    <termination-point>    2
100     Should Contain    ${resp.content}    <tp-id>tp:9:1</tp-id>
101     Should Contain    ${resp.content}    <tp-id>tp:10:1</tp-id>
102
103 Filtration Specific Number Inventory Model
104     [Documentation]    Test of specific number type of filtration operation on Inventory model
105     Pass Execution    Test is being passed due to incorrect target field. Test will be included in execution when corrected.
106     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
107     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    flow-node-inventory:serial-number
108     ${request}    Set Specific Number Filter    ${request}    21
109     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
110     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
111     Should Contain X Times    ${resp.content}    <node-id>node:    2
112     Should Contain X Times    ${resp.content}    <node-ref>of-node:8</node-ref>    1
113     Should Contain X Times    ${resp.content}    <node-ref>of-node:9</node-ref>    1
114
115 Filtration Specific String Network Topology Model
116     [Documentation]    Test of specific string type of filtration operation on Network Topology model
117     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
118     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    ovsdb:ovs-version
119     ${request}    Set Specific String Filter    ${request}    25
120     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
121     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
122     Should Contain X Times    ${resp.content}    <node-id>node:    2
123     Should Contain X Times    ${resp.content}    <node-ref>bgp:9</node-ref>    1
124     Should Contain X Times    ${resp.content}    <node-ref>bgp:10</node-ref>    1
125     Should Contain X Times    ${resp.content}    <termination-point>    2
126     #node bgp:9
127     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
128     ${node}    Element to String    ${node}
129     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
130     #node bgp:10
131     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
132     ${node}    Element to String    ${node}
133     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
134
135 Filtration Specific String Inventory Model
136     [Documentation]    Test of specific string type of filtration operation on Inventory model
137     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
138     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    flow-node-inventory:serial-number
139     ${request}    Set Specific String Filter    ${request}    21
140     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
141     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
142     Should Contain X Times    ${resp.content}    <node-id>node:    2
143     Should Contain X Times    ${resp.content}    <node-ref>of-node:8</node-ref>    1
144     Should Contain X Times    ${resp.content}    <node-ref>of-node:9</node-ref>    1
145
146 Filtration Range String Network Topology Model
147     [Documentation]    Test of range string type of filtration operation on Network Topology model
148     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
149     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    ovsdb:ovs-version
150     ${request}    Set Range String Filter    ${request}    20    25
151     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
152     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
153     Should Contain X Times    ${resp.content}    <node-id>node:    4
154     : FOR    ${index}    IN RANGE    7    11
155     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
156     Should Contain X Times    ${resp.content}    <termination-point>    5
157     #node bgp:7
158     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
159     ${node}    Element to String    ${node}
160     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
161     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
162     #node bgp:8
163     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:8']/..
164     ${node}    Element to String    ${node}
165     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:8/termination-point/tp:8:1</tp-ref>    1
166     #node bgp:9
167     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
168     ${node}    Element to String    ${node}
169     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
170     #node bgp:10
171     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
172     ${node}    Element to String    ${node}
173     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
174
175 Filtration Range String Inventory Model
176     [Documentation]    Test of range string type of filtration operation on Inventory model
177     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
178     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    flow-node-inventory:serial-number
179     ${request}    Set Range String Filter    ${request}    20    25
180     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
181     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
182     Should Contain X Times    ${resp.content}    <node-id>node:    3
183     : FOR    ${index}    IN RANGE    8    11
184     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
185
186 Filtration IPV6 Network Topology Model
187     [Documentation]    Test of ipv6 type of filtration operation on Network Topology model
188     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:3
189     ${request}    Insert Filter    ${request}    ${FILTER_IPV6}    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv6
190     ${request}    Set IPV6 Filter    ${request}    fe80:0:0:0:0:0:c0a8:101/120
191     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
192     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
193     Should Contain X Times    ${resp.content}    <node-id>node:    2
194     Should Contain X Times    ${resp.content}    <node-ref>bgp:11</node-ref>    1
195     Should Contain X Times    ${resp.content}    <node-ref>bgp:12</node-ref>    1
196     Should Contain X Times    ${resp.content}    <termination-point>    1
197     #node bgp:11
198     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:11']/..
199     ${node}    Element to String    ${node}
200     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:3/node/bgp:11/termination-point/tp:11:1</tp-ref>    1
201     #node bgp:12
202     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:12']/..
203     ${node}    Element to String    ${node}
204     Should Not Contain    ${node}    <tp-ref>
205
206 Filtration IPV6 Inventory Model
207     [Documentation]    Test of ipv6 type of filtration operation on Inventory model
208     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:3
209     ${request}    Insert Filter    ${request}    ${FILTER_IPV6}    flow-node-inventory:ip-address
210     ${request}    Set IPV6 Filter    ${request}    fe80:0:0:0:0:0:c0a8:201/120
211     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
212     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
213     Should Contain X Times    ${resp.content}    <node-id>node:    3
214     Should Contain X Times    ${resp.content}    <node-ref>of-node:12</node-ref>    1
215     Should Contain X Times    ${resp.content}    <node-ref>of-node:14</node-ref>    1
216     Should Contain X Times    ${resp.content}    <node-ref>of-node:15</node-ref>    1
217
218 Filtration Script Network Topology Model
219     [Documentation]    Test of script type of filtration operation on Network Topology model
220     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:1
221     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4
222     ${script}    Set Variable    if (node.getValue().indexOf("192.168.1") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
223     ${request}    Set Script Filter    ${request}    javascript    ${script}
224     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
225     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
226     Should Contain X Times    ${resp.content}    <node-id>node:    3
227     : FOR    ${index}    IN RANGE    3    6
228     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
229     Should Contain X Times    ${resp.content}    <termination-point>    5
230     #node bgp:3
231     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
232     ${node}    Element to String    ${node}
233     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:1</tp-ref>    1
234     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:2</tp-ref>    1
235     #node bgp:4
236     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
237     ${node}    Element to String    ${node}
238     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1</tp-ref>    1
239     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:2</tp-ref>    1
240     #node bgp:5
241     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
242     ${node}    Element to String    ${node}
243     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1</tp-ref>    1
244
245 Filtration Script Inventory Model
246     [Documentation]    Test of script type of filtration operation on Inventory model
247     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:1
248     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    flow-node-inventory:ip-address
249     ${script}    Set Variable    if (node.getValue().indexOf("192.168.2") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
250     ${request}    Set Script Filter    ${request}    javascript    ${script}
251     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
252     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
253     Should Contain X Times    ${resp.content}    <node-id>node:    3
254     : FOR    ${index}    IN RANGE    1    4
255     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1