f9a3410eacab0a9ba806ce4061444bb5295ce086
[integration/test.git] / csit / suites / topoprocessing / basic-topology-operations / 030_Filtration_termination_points.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    termination-point    network-topo:1
23     ${request}    Insert Filter    ${request}    ${FILTER_IPV4}    l3-unicast-igp-topology:igp-termination-point-attributes/l3-unicast-igp-topology:ip-address
24     ${request}    Set IPV4 Filter    ${request}    192.168.1.1/8
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:    5
28     Should Contain X Times    ${resp.content}    <termination-point>    4
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>    2
32     Should Contain    ${node}    <tp-id>tp:1:1</tp-id>
33     Should Contain    ${node}    <tp-id>tp:1:2</tp-id>
34     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
35     ${node}    Element to String    ${node}
36     Should Contain X Times    ${node}    <termination-point>    2
37     Should Contain    ${node}    <tp-id>tp:3:1</tp-id>
38     Should Contain    ${node}    <tp-id>tp:3:2</tp-id>
39
40 Filtration Range Number Network Topology Model
41     [Documentation]    Test of range number type of filtration operation on Network Topology model
42     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
43     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    ovsdb:ofport
44     ${request}    Set Range Number Filter    ${request}    1115    1119
45     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
46     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
47     Should Contain X Times    ${resp.content}    <node-id>node:    5
48     Should Contain X Times    ${resp.content}    <termination-point>    3
49     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
50     ${node}    Element to String    ${node}
51     Should Contain X Times    ${node}    <termination-point>    2
52     Should Contain    ${node}    <tp-id>tp:7:1</tp-id>
53     Should Contain    ${node}    <tp-id>tp:7:2</tp-id>
54     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:6']/..
55     ${node}    Element to String    ${node}
56     Should Contain X Times    ${node}    <termination-point>    1
57     Should Contain    ${node}    <tp-id>tp:6:1</tp-id>
58
59 Filtration Range Number Inventory Model
60     [Documentation]    Test of range number type of filtration operation on Inventory model
61     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
62     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    flow-node-inventory:port-number
63     ${request}    Set Range Number Filter    ${request}    2    4
64     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
65     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
66     Should Contain X Times    ${resp.content}    <node-id>node:    5
67     Should Contain X Times    ${resp.content}    <termination-point>    5
68     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
69     ${node}    Element to String    ${node}
70     Should Contain X Times    ${node}    <termination-point>    2
71     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
72     ${node}    Element to String    ${node}
73     Should Contain X Times    ${node}    <termination-point>    2
74     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
75     ${node}    Element to String    ${node}
76     Should Contain X Times    ${node}    <termination-point>    1
77     [Teardown]    Run Keywords    Test Teardown    network-topology:network-topology/topology/topo:1
78     ...    AND    Report_Failure_Due_To_Bug    4674
79
80 Filtration Specific Number Network Topology Model
81     [Documentation]    Test of specific number type of filtration operation on Network Topology model
82     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
83     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    ovsdb:ofport
84     ${request}    Set Specific Number Filter    ${request}    1119
85     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
86     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
87     Should Contain X Times    ${resp.content}    <node-id>node:    5
88     Should Contain X Times    ${resp.content}    <termination-point>    1
89     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
90     ${node}    Element to String    ${node}
91     Should Contain X Times    ${node}    <termination-point>    1
92     Should Contain    ${node}    <tp-id>tp:7:1</tp-id>
93
94 Filtration Specific Number Inventory Model
95     [Documentation]    Test of specific number type of filtration operation on Inventory model
96     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
97     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    flow-node-inventory:port-number
98     ${request}    Set Specific Number Filter    ${request}    1
99     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
100     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
101     Should Contain X Times    ${resp.content}    <node-id>node:    5
102     Should Contain X Times    ${resp.content}    <termination-point>    7
103     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
104     ${node}    Element to String    ${node}
105     Should Contain X Times    ${node}    <termination-point>    2
106     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
107     ${node}    Element to String    ${node}
108     Should Contain X Times    ${node}    <termination-point>    1
109     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
110     ${node}    Element to String    ${node}
111     Should Contain X Times    ${node}    <termination-point>    1
112     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:4']/..
113     ${node}    Element to String    ${node}
114     Should Contain X Times    ${node}    <termination-point>    3
115     [Teardown]    Run Keywords    Test Teardown    network-topology:network-topology/topology/topo:1
116     ...    AND    Report_Failure_Due_To_Bug    4674
117
118 Filtration Specific String Network Topology Model
119     [Documentation]    Test of specific string type of filtration operation on Network Topology model
120     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
121     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    ovsdb:name
122     ${request}    Set Specific String Filter    ${request}    portC
123     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
124     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
125     Should Contain X Times    ${resp.content}    <node-id>node:    5
126     Should Contain X Times    ${resp.content}    <termination-point>    1
127     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
128     ${node}    Element to String    ${node}
129     Should Contain X Times    ${node}    <termination-point>    1
130
131 Filtration Specific String Inventory Model
132     [Documentation]    Test of specific string type of filtration operation on Inventory model
133     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
134     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    flow-node-inventory:name
135     ${request}    Set Specific String Filter    ${request}    portB
136     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
137     Should Contain X Times    ${resp.content}    <node-id>node:    5
138     Should Contain X Times    ${resp.content}    <termination-point>    2
139     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
140     ${node}    Element to String    ${node}
141     Should Contain X Times    ${node}    <termination-point>    1
142     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
143     ${node}    Element to String    ${node}
144     Should Contain X Times    ${node}    <termination-point>    1
145     [Teardown]    Run Keywords    Test Teardown    network-topology:network-topology/topology/topo:1
146     ...    AND    Report_Failure_Due_To_Bug    4674
147
148 Filtration Range String Network Topology Model
149     [Documentation]    Test of range string type of filtration operation on Network Topology model
150     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
151     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    ovsdb:name
152     ${request}    Set Range String Filter    ${request}    portA    portC
153     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
154     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
155     Should Contain X Times    ${resp.content}    <node-id>node:    5
156     Should Contain X Times    ${resp.content}    <termination-point>    3
157     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:6']/..
158     ${node}    Element to String    ${node}
159     Should Contain X Times    ${node}    <termination-point>    1
160     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
161     ${node}    Element to String    ${node}
162     Should Contain X Times    ${node}    <termination-point>    1
163     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
164     ${node}    Element to String    ${node}
165     Should Contain X Times    ${node}    <termination-point>    1
166
167 Filtration Range String Inventory Model
168     [Documentation]    Test of range string type of filtration operation on Inventory model
169     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
170     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    flow-node-inventory:name
171     ${request}    Set Range String Filter    ${request}    portA    portB
172     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
173     Should Contain X Times    ${resp.content}    <node-id>node:    5
174     Should Contain X Times    ${resp.content}    <termination-point>    3
175     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
176     ${node}    Element to String    ${node}
177     Should Contain X Times    ${node}    <termination-point>    2
178     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
179     ${node}    Element to String    ${node}
180     Should Contain X Times    ${node}    <termination-point>    1
181     [Teardown]    Run Keywords    Test Teardown    network-topology:network-topology/topology/topo:1
182     ...    AND    Report_Failure_Due_To_Bug    4674
183
184 Filtration IPV6 Network Topology Model
185     [Documentation]    Test of ipv6 type of filtration operation on Network Topology model
186     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:3
187     ${request}    Insert Filter    ${request}    ${FILTER_IPV6}    l3-unicast-igp-topology:igp-termination-point-attributes/l3-unicast-igp-topology:ip-address
188     ${request}    Set IPV6 Filter    ${request}    fe80:0:0:0:0:0:c0a8:101/120
189     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
190     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
191     Should Contain X Times    ${resp.content}    <node-id>node:    5
192     Should Contain X Times    ${resp.content}    <termination-point>    1
193     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:11']/..
194     ${node}    Element to String    ${node}
195     Should Contain X Times    ${node}    <termination-point>    1
196
197 Filtration Script Network Topology Model
198     [Documentation]    Test of script type of filtration operation on Network Topology model
199     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:1
200     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    l3-unicast-igp-topology:igp-termination-point-attributes/l3-unicast-igp-topology:ip-address
201     ${script}    Set Variable    if (node.getValue().indexOf("192.168.1") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
202     ${request}    Set Script Filter    ${request}    javascript    ${script}
203     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
204     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
205     Should Contain X Times    ${resp.content}    <node-id>node:    5
206     Should Contain X Times    ${resp.content}    <termination-point>    3
207     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
208     ${node}    Element to String    ${node}
209     Should Contain X Times    ${node}    <termination-point>    2
210     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
211     ${node}    Element to String    ${node}
212     Should Contain X Times    ${node}    <termination-point>    1
213
214 Filtration Script Inventory Model
215     [Documentation]    Test of script type of filtration operation on Inventory model
216     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
217     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    flow-node-inventory:name
218     ${script}    Set Variable    if (node.getValue().indexOf("portB") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
219     ${request}    Set Script Filter    ${request}    javascript    ${script}
220     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
221     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
222     Should Contain X Times    ${resp.content}    <node-id>node:    5
223     Should Contain X Times    ${resp.content}    <termination-point>    3
224     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
225     ${node}    Element to String    ${node}
226     Should Contain X Times    ${node}    <termination-point>    2
227     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
228     ${node}    Element to String    ${node}
229     Should Contain X Times    ${node}    <termination-point>    1
230     [Teardown]    Run Keywords    Test Teardown    network-topology:network-topology/topology/topo:1
231     ...    AND    Report_Failure_Due_To_Bug    4674