Added various test cases to update-suite
[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 And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
26     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
27     Should Contain X Times    ${resp.content}    <node-ref>bgp:1</node-ref>    1
28     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
29     ${node}    Element to String    ${node}
30     Should Contain X Times    ${node}    <termination-point>    3
31     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:3</tp-ref>    1
32     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:2</tp-ref>    1
33     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:1</tp-ref>    1
34     Should Contain X Times    ${resp.content}    <node-ref>bgp:2</node-ref>    1
35
36 Filtration IPV4 Inventory Model
37     [Documentation]    Test of ipv4 type of filtration operation on Inventory model
38     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:1
39     ${request}    Insert Filter    ${request}    ${FILTER_IPV4}    flow-node-inventory:ip-address
40     ${request}    Set IPV4 Filter    ${request}    192.168.1.1/24
41     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
42     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
43     : FOR    ${index}    IN RANGE    1    4
44     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
45
46 Filtration Range Number Network Topology Model
47     [Documentation]    Test of range number type of filtration operation on Network Topology model
48     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
49     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    ovsdb:ovs-version
50     ${request}    Set Range Number Filter    ${request}    20    25
51     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    4
52     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
53     : FOR    ${index}    IN RANGE    7    11
54     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
55     Should Contain X Times    ${resp.content}    <termination-point>    5
56     #node bgp:7
57     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
58     ${node}    Element to String    ${node}
59     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
60     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
61     #node bgp:8
62     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:8']/..
63     ${node}    Element to String    ${node}
64     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:8/termination-point/tp:8:1</tp-ref>    1
65     #node bgp:9
66     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
67     ${node}    Element to String    ${node}
68     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
69     #node bgp:10
70     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
71     ${node}    Element to String    ${node}
72     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
73
74 Filtration Range Number Inventory Model
75     [Documentation]    Test of range number type of filtration operation on Inventory model
76     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
77     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    flow-node-inventory:serial-number
78     ${request}    Set Range Number Filter    ${request}    20    25
79     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
80     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
81     : FOR    ${index}    IN RANGE    8    11
82     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
83
84 Filtration Specific Number Network Topology Model
85     [Documentation]    Test of specific number type of filtration operation on Network Topology model
86     Pass Execution    Test is being passed due to incorrect target field. Test will be included in execution when corrected.
87     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
88     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    ovsdb:ovs-version
89     ${request}    Set Specific Number Filter    ${request}    25
90     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
91     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
92     Should Contain X Times    ${resp.content}    <node-ref>bgp:9</node-ref>    1
93     Should Contain X Times    ${resp.content}    <node-ref>bgp:10</node-ref>    1
94     Should Contain X Times    ${resp.content}    <termination-point>    2
95     Should Contain    ${resp.content}    <tp-id>tp:9:1</tp-id>
96     Should Contain    ${resp.content}    <tp-id>tp:10:1</tp-id>
97
98 Filtration Specific Number Inventory Model
99     [Documentation]    Test of specific number type of filtration operation on Inventory model
100     Pass Execution    Test is being passed due to incorrect target field. Test will be included in execution when corrected.
101     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
102     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    flow-node-inventory:serial-number
103     ${request}    Set Specific Number Filter    ${request}    21
104     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
105     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
106     Should Contain X Times    ${resp.content}    <node-ref>of-node:8</node-ref>    1
107     Should Contain X Times    ${resp.content}    <node-ref>of-node:9</node-ref>    1
108
109 Filtration Specific String Network Topology Model
110     [Documentation]    Test of specific string type of filtration operation on Network Topology model
111     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
112     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    ovsdb:ovs-version
113     ${request}    Set Specific String Filter    ${request}    25
114     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
115     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>    ${EMPTY}
116     Should Contain X Times    ${resp.content}    <node-ref>bgp:9</node-ref>    1
117     Should Contain X Times    ${resp.content}    <node-ref>bgp:10</node-ref>    1
118     Should Contain X Times    ${resp.content}    <termination-point>    2
119     #node bgp:9
120     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
121     ${node}    Element to String    ${node}
122     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
123     #node bgp:10
124     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
125     ${node}    Element to String    ${node}
126     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
127
128 Filtration Specific String Inventory Model
129     [Documentation]    Test of specific string type of filtration operation on Inventory model
130     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
131     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    flow-node-inventory:serial-number
132     ${request}    Set Specific String Filter    ${request}    21
133     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
134     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
135     Should Contain X Times    ${resp.content}    <node-ref>of-node:8</node-ref>    1
136     Should Contain X Times    ${resp.content}    <node-ref>of-node:9</node-ref>    1
137
138 Filtration Range String Network Topology Model
139     [Documentation]    Test of range string type of filtration operation on Network Topology model
140     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:2
141     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    ovsdb:ovs-version
142     ${request}    Set Range String Filter    ${request}    20    25
143     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    4
144     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
145     : FOR    ${index}    IN RANGE    7    11
146     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
147     Should Contain X Times    ${resp.content}    <termination-point>    5
148     #node bgp:7
149     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
150     ${node}    Element to String    ${node}
151     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
152     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
153     #node bgp:8
154     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:8']/..
155     ${node}    Element to String    ${node}
156     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:8/termination-point/tp:8:1</tp-ref>    1
157     #node bgp:9
158     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:9']/..
159     ${node}    Element to String    ${node}
160     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:9/termination-point/tp:9:1</tp-ref>    1
161     #node bgp:10
162     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
163     ${node}    Element to String    ${node}
164     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
165
166 Filtration Range String Inventory Model
167     [Documentation]    Test of range string type of filtration operation on Inventory model
168     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:2
169     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    flow-node-inventory:serial-number
170     ${request}    Set Range String Filter    ${request}    20    25
171     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
172     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
173     : FOR    ${index}    IN RANGE    8    11
174     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
175
176 Filtration IPV6 Network Topology Model
177     [Documentation]    Test of ipv6 type of filtration operation on Network Topology model
178     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:3
179     ${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
180     ${request}    Set IPV6 Filter    ${request}    fe80:0:0:0:0:0:c0a8:101/120
181     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    2
182     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
183     Should Contain X Times    ${resp.content}    <node-ref>bgp:11</node-ref>    1
184     Should Contain X Times    ${resp.content}    <node-ref>bgp:12</node-ref>    1
185     Should Contain X Times    ${resp.content}    <termination-point>    1
186     #node bgp:11
187     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:11']/..
188     ${node}    Element to String    ${node}
189     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:3/node/bgp:11/termination-point/tp:11:1</tp-ref>    1
190     #node bgp:12
191     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:12']/..
192     ${node}    Element to String    ${node}
193     Should Not Contain    ${node}    <tp-ref>
194
195 Filtration IPV6 Inventory Model
196     [Documentation]    Test of ipv6 type of filtration operation on Inventory model
197     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:3
198     ${request}    Insert Filter    ${request}    ${FILTER_IPV6}    flow-node-inventory:ip-address
199     ${request}    Set IPV6 Filter    ${request}    fe80:0:0:0:0:0:c0a8:201/120
200     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
201     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
202     Should Contain X Times    ${resp.content}    <node-ref>of-node:12</node-ref>    1
203     Should Contain X Times    ${resp.content}    <node-ref>of-node:14</node-ref>    1
204     Should Contain X Times    ${resp.content}    <node-ref>of-node:15</node-ref>    1
205
206 Filtration Script Network Topology Model
207     [Documentation]    Test of script type of filtration operation on Network Topology model
208     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:1
209     ${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
210     ${script}    Set Variable    if (node.getValue().indexOf("192.168.1") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
211     ${request}    Set Script Filter    ${request}    javascript    ${script}
212     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
213     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
214     : FOR    ${index}    IN RANGE    3    6
215     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
216     Should Contain X Times    ${resp.content}    <termination-point>    5
217     #node bgp:3
218     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
219     ${node}    Element to String    ${node}
220     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:1</tp-ref>    1
221     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:2</tp-ref>    1
222     #node bgp:4
223     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
224     ${node}    Element to String    ${node}
225     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1</tp-ref>    1
226     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:2</tp-ref>    1
227     #node bgp:5
228     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
229     ${node}    Element to String    ${node}
230     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1</tp-ref>    1
231
232 Filtration Script Inventory Model
233     [Documentation]    Test of script type of filtration operation on Inventory model
234     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    node    openflow-topo:1
235     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    flow-node-inventory:ip-address
236     ${script}    Set Variable    if (node.getValue().indexOf("192.168.2") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
237     ${request}    Set Script Filter    ${request}    javascript    ${script}
238     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    3
239     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
240     : FOR    ${index}    IN RANGE    1    4
241     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1