Topoprocessing - System tests refactor
[integration/test.git] / csit / libraries / TopoprocessingKeywords.robot
1 *** Settings ***
2 Variables         ../variables/Variables.py
3 Variables         ../variables/topoprocessing/Topologies.py
4 Variables         ../variables/topoprocessing/TopologyRequests.py
5 Library           RequestsLibrary
6 Library           SSHLibrary
7 Library           XML
8 Resource          KarafKeywords.robot
9 Resource          Utils.robot
10
11 *** Variables ***
12 ${CONFIGURATION_XML}    ${CURDIR}/../suites/topoprocessing/configuration.xml
13 ${OPERATIONAL_XML}    ${CURDIR}/../suites/topoprocessing/operational.xml
14 ${REMOTE_FILE}    ${WORKSPACE}/${BUNDLEFOLDER}/etc/opendaylight/karaf/80-topoprocessing-config.xml
15
16 *** Keywords ***
17 Basic Request Put
18     [Arguments]    ${request}    ${overlay_topology_url}
19     [Documentation]    Send a simple HTTP PUT request to Configurational datastore
20     ${resp}    Put Request    session    ${CONFIG_API}/${overlay_topology_url}    data=${request}
21     Log    ${CONFIG_API}/${overlay_topology_url}
22     Should Be Equal As Strings    ${resp.status_code}    200
23     Wait For Karaf Log    Correlation configuration successfully read
24     Wait For Karaf Log    Transaction successfully written
25
26 Basic Request Get And Test
27     [Arguments]    ${overlay_topology_url}    ${should_contain}    ${times}
28     [Documentation]    Send a simple HTTP GET request to a given URL and test if response contains the expected item X times
29     ${resp}    Basic Request Get    ${overlay_topology_url}
30     Should Contain X Times    ${resp.content}    ${should_contain}    ${times}
31     [Return]    ${resp}
32
33 Basic Request Get
34     [Arguments]    ${overlay_topology_url}
35     [Documentation]    Send a simple HTTP GET request to a given URL
36     ${resp}    Get Request    session    ${OPERATIONAL_API}/${overlay_topology_url}
37     Should Be Equal As Strings    ${resp.status_code}    200
38     [Return]    ${resp}
39
40 Send Basic Request And Test If Contain X Times
41     [Arguments]    ${request}    ${overlay_topology_url}    ${should_contain}    ${times}
42     [Documentation]    Send a basic HTTP PUT request to a given URL and test if response contains the expexted item X times
43     Basic Request Put    ${request}    ${overlay_topology_url}
44     ${resp}    Wait Until Keyword Succeeds    40x    250ms    Basic Request Get And Test    ${overlay_topology_url}    ${should_contain}
45     ...    ${times}
46     Log    ${resp.content}
47     [Return]    ${resp}
48
49 Setup Environment
50     [Documentation]    Setup karaf enviroment for following tests
51     Log    ---- Setup Environment ----
52     Open Connection    ${ODL_SYSTEM_IP}
53     Flexible Controller Login
54     Put File    ${CONFIGURATION_XML}    ${REMOTE_FILE}
55     Close Connection
56     Issue Command On Karaf Console    log:set DEBUG org.opendaylight.topoprocessing
57     Install a Feature    odl-restconf-noauth    timeout=30
58     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${SEND_ACCEPT_XML_HEADERS}
59     ${features}    Issue Command On Karaf Console    feature:list -i
60     ${lines}    Get Lines Containing String    ${features}    odl-topoprocessing-framework
61     ${length}    Get Length    ${lines}
62     Install a Feature    odl-openflowplugin-nsf-model odl-topoprocessing-framework odl-topoprocessing-network-topology odl-topoprocessing-inventory odl-mdsal-models odl-ovsdb-southbound-impl    timeout=120
63     Run Keyword If    ${length} == 0    Wait For Karaf Log    Registering Topology Request Listener    60
64     Prepare New Feature Installation
65     Insert Underlay topologies
66
67 Clean Environment
68     [Documentation]    Revert startup changes
69     Log    ---- Clean Environment ----
70     Open Connection    ${ODL_SYSTEM_IP}
71     Flexible Controller Login
72     Put File    ${OPERATIONAL_XML}    ${REMOTE_FILE}
73     Close Connection
74     Delete All Sessions
75
76 Test Teardown
77     [Arguments]    ${overlay_topology}
78     [Documentation]    Delete overlay topologies from datastore
79     Log    ---- Test Teardown ----
80     Log    Deleting overlay topology from ${CONFIG_API}/${overlay_topology}
81     ${resp}    Delete Request    session    ${CONFIG_API}/${overlay_topology}
82     Should Be Equal As Strings    ${resp.status_code}    200
83
84 Test Teardown With Underlay Topologies Refresh
85     [Arguments]    ${overlay_topology}
86     [Documentation]    Deletes given overlay topology from datastore and overwrites the underlaying ones with initial topologies
87     Test Teardown    ${overlay_topology}
88     Insert Underlay Topologies
89
90 Prepare New Feature Installation
91     [Documentation]    Clears karaf logs and CONFIGURATION datastore
92     ${resp}    Delete Request    session    ${CONFIG_API}/network-topology:network-topology
93     ${resp}    Delete Request    session    ${CONFIG_API}/opendaylight-inventory:nodes
94     Issue Command On Karaf Console    log:clear
95
96 Insert Underlay Topologies
97     [Documentation]    Insert underlay topologies used by following tests
98     Log    Inserting underlay topologies
99     # Network underlay topologies
100     : FOR    ${index}    IN RANGE    1    7
101     \    ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:${index}    data=${NETWORK_UNDERLAY_TOPOLOGY_${index}}
102     \    Log    ${resp.content}
103     \    Should Be Equal As Strings    ${resp.status_code}    200
104     # Openflow underlay nodes
105     ${resp}    Put Request    session    ${CONFIG_API}/opendaylight-inventory:nodes    data=${OPENFLOW_UNDERLAY_NODES}
106     Log    ${resp.content}
107     Should Be Equal As Strings    ${resp.status_code}    200
108     # Openflow underlay topologies
109     : FOR    ${index}    IN RANGE    1    7
110     \    ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:${index}    data=${OPENFLOW_UNDERLAY_TOPOLOGY_${index}}
111     \    Log    ${resp.content}
112     \    Should Be Equal As Strings    ${resp.status_code}    200
113     Issue Command On Karaf Console    log:clear
114     Log    ${resp.content}
115
116 Prepare Unification Inside Topology Request
117     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${underlay_topo1}
118     [Documentation]    Prepare topology request for unification inside from template
119     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlations/output-model
120     ${request_template}    Set Element Text    ${request_template}    aggregation-only    xpath=.//correlations/correlation/type
121     ${request_template}    Set Element Text    ${request_template}    ${correlation_item}    xpath=.//correlation/correlation-item
122     ${request_template}    Set Element Text    ${request_template}    unification    xpath=.//correlation/aggregation/aggregation-type
123     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlation/aggregation/mapping[1]/input-model
124     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo1}    xpath=.//correlation/aggregation/mapping[1]/underlay-topology
125     ${request_template}    Element to String    ${request_template}
126     [Return]    ${request_template}
127
128 Prepare Unification Topology Request
129     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${underlay_topo1}    ${underlay_topo2}
130     [Documentation]    Prepare topology request for unification on two topologies from template
131     ${request_template}    Prepare Unification Inside Topology Request    ${request_template}    ${model}    ${correlation_item}    ${underlay_topo1}
132     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo2}    xpath=.//correlation/aggregation/mapping[2]/underlay-topology
133     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlation/aggregation/mapping[2]/input-model
134     ${request_template}    Element to String    ${request_template}
135     [Return]    ${request_template}
136
137 Prepare Unification Filtration Topology Request
138     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${target_field1}    ${underlay_topo1}    ${target_field2}
139     ...    ${underlay_topo2}
140     [Documentation]    Prepare topology request for unification on two topologies from template
141     ${request_template}    Prepare Unification Filtration Inside Topology Request    ${request_template}    ${model}    ${correlation_item}    ${target_field1}    ${underlay_topo1}
142     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo2}    xpath=.//correlation/aggregation/mapping[2]/underlay-topology
143     Insert Target Field    ${request_template}    2    ${target_field2}    1
144     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlation/aggregation/mapping[2]/input-model
145     ${request_template}    Element to String    ${request_template}
146     [Return]    ${request_template}
147
148 Prepare Unification Filtration Inside Topology Request
149     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${target-field}    ${underlay_topo}
150     [Documentation]    Prepare topology request for unification filtration inside from template
151     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlations/output-model
152     ${request_template}    Set Element Text    ${request_template}    filtration-aggregation    xpath=.//correlations/correlation/type
153     ${request_template}    Set Element Text    ${request_template}    ${correlation_item}    xpath=.//correlation/correlation-item
154     ${request_template}    Set Element Text    ${request_template}    unification    xpath=.//correlation/aggregation/aggregation-type
155     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlation/aggregation/mapping[1]/input-model
156     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo}    xpath=.//correlation/aggregation/mapping[1]/underlay-topology
157     Insert Target Field    ${request_template}    1    ${target-field}    1
158     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo}    xpath=.//correlation/filtration/underlay-topology
159     ${request_template}    Element to String    ${request_template}
160     [Return]    ${request_template}
161
162 Insert Apply Filters
163     [Arguments]    ${request_template}    ${mapping}    ${filter_id}
164     ${request_template}    Add Element    ${request_template}    ${APPLY_FILTERS}    xpath=.//correlation/aggregation/mapping[${mapping}]
165     ${request_template}    Set Element Text    ${request_template}    ${filter_id}    xpath=.//correlation/aggregation/mapping[${mapping}]/apply-filters
166     [Return]    ${request_template}
167
168 Prepare Filtration Topology Request
169     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${underlay_topo}
170     [Documentation]    Prepare topology request for filtration from template
171     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlations/output-model
172     ${request_template}    Set Element Text    ${request_template}    ${correlation_item}    xpath=.//correlation/correlation-item
173     ${request_template}    Set Element Text    ${request_template}    ${underlay_topo}    xpath=.//correlation/filtration/underlay-topology
174     [Return]    ${request_template}
175
176 Insert Target Field
177     [Arguments]    ${request_template}    ${mapping_index}    ${target_field_path}    ${matching_key}
178     [Documentation]    Add target field to request
179     ${target_field_template}    Set Element Text    ${TARGET_FIELD}    ${target_field_path}    xpath=.//target-field-path
180     ${target_field_template}    Set Element Text    ${target_field_template}    ${matching_key}    xpath=.//matching-key
181     ${request_template}    Add Element    ${request_template}    ${target_field_template}    xpath=.//correlation/aggregation/mapping[${mapping_index}]
182     ${request_template}    Element to String    ${request_template}
183     [Return]    ${request_template}
184
185 Insert Filter
186     [Arguments]    ${request_template}    ${filter_template}    ${target_field}
187     [Documentation]    Add filter to filtration
188     ${request_template}    Add Element    ${request_template}    ${filter_template}    xpath=.//correlation/filtration
189     ${model}    Get Element Text    ${request_template}    xpath=.//correlations/output-model
190     ${request_template}    Set Element Text    ${request_template}    ${model}    xpath=.//correlation/filtration/filter/input-model
191     ${request_template}    Set Element Text    ${request_template}    ${target_field}    xpath=.//correlation/filtration/filter/target-field
192     [Return]    ${request_template}
193
194 Insert Filter With ID
195     [Arguments]    ${request_template}    ${filter_template}    ${target_field}    ${filter_id}
196     [Documentation]    Add filter to filtration with specified id
197     ${request_template}    Insert Filter    ${request_template}    ${filter_template}    ${target_field}
198     ${request_template}    Set Element Text    ${request_template}    ${filter_id}    xpath=.//correlation/filtration/filter/filter-id
199     [Return]    ${request_template}
200
201 Set IPV4 Filter
202     [Arguments]    ${request_template}    ${ip_address}
203     [Documentation]    Set filter ipv4 address
204     ${request_template}    Set Element Text    ${request_template}    ${ip_address}    xpath=.//correlation/filtration/filter/ipv4-address-filter/ipv4-address
205     ${request_template}    Element to String    ${request_template}
206     [Return]    ${request_template}
207
208 Set Range Number Filter
209     [Arguments]    ${request_template}    ${min_number}    ${max_number}
210     [Documentation]    Set filter minimum and maximum number values
211     ${request_template}    Set Element Text    ${request_template}    ${min_number}    xpath=.//correlation/filtration/filter/range-number-filter/min-number-value
212     ${request_template}    Set Element Text    ${request_template}    ${max_number}    xpath=.//correlation/filtration/filter/range-number-filter/max-number-value
213     ${request_template}    Element to String    ${request_template}
214     [Return]    ${request_template}
215
216 Set Range String Filter
217     [Arguments]    ${request_template}    ${min_value}    ${max_value}
218     [Documentation]    Set filter minimum and maximum string values
219     ${request_template}    Set Element Text    ${request_template}    ${min_value}    xpath=.//correlation/filtration/filter/range-string-filter/min-string-value
220     ${request_template}    Set Element Text    ${request_template}    ${max_value}    xpath=.//correlation/filtration/filter/range-string-filter/max-string-value
221     ${request_template}    Element to String    ${request_template}
222     [Return]    ${request_template}
223
224 Set Specific Number Filter
225     [Arguments]    ${request_template}    ${number}
226     [Documentation]    Set filter number value
227     ${request_template}    Set Element Text    ${request_template}    ${number}    xpath=.//correlation/filtration/filter/specific-number-filter/specific-number
228     ${request_template}    Element to String    ${request_template}
229     [Return]    ${request_template}
230
231 Set Specific String Filter
232     [Arguments]    ${request_template}    ${string_value}
233     [Documentation]    Set filter string value
234     ${request_template}    Set Element Text    ${request_template}    ${string_value}    xpath=.//correlation/filtration/filter/specific-string-filter/specific-string
235     ${request_template}    Element to String    ${request_template}
236     [Return]    ${request_template}
237
238 Set IPV6 Filter
239     [Arguments]    ${request_template}    ${ip_address}
240     [Documentation]    Set filter ipv6 address
241     ${request_template}    Set Element Text    ${request_template}    ${ip_address}    xpath=.//correlation/filtration/filter/ipv6-address-filter/ipv6-address
242     ${request_template}    Element to String    ${request_template}
243     [Return]    ${request_template}
244
245 Set Script Filter
246     [Arguments]    ${request_template}    ${script_language}    ${script}
247     [Documentation]    Set filter script
248     ${request_template}    Set Element Text    ${request_template}    ${script_language}    xpath=.//correlation/filtration/filter/script-filter/scripting/language
249     ${request_template}    Set Element Text    ${request_template}    ${script}    xpath=.//correlation/filtration/filter/script-filter/scripting/script
250     ${request_template}    Element to String    ${request_template}
251     [Return]    ${request_template}
252
253 Insert Link Computation Inside
254     [Arguments]    ${request_template}    ${link_computation_template}    ${input_model}    ${underlay_topology}
255     [Documentation]    Add link computation to request
256     ${request_template}    Add Element    ${request_template}    ${link_computation_template}    xpath=.
257     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/node-info/input-model
258     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/link-info/input-model
259     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/output-model
260     ${request_template}    Set Element Text    ${request_template}    ${underlay_topology}    xpath=.//link-computation/link-info/link-topology
261     ${request_template}    Set Element Attribute    ${request_template}    xmlns:n    urn:opendaylight:topology:correlation    xpath=./link-computation
262     ${request_template}    Element to String    ${request_template}
263     [Return]    ${request_template}
264
265 Insert Link Computation
266     [Arguments]    ${request_template}    ${link_computation_template}    ${input_model}    ${underlay_topology_1}    ${underlay_topology_2}
267     [Documentation]    Add link computation to request
268     ${request_template}    Add Element    ${request_template}    ${link_computation_template}    xpath=.
269     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/node-info/input-model
270     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/link-info[1]/input-model
271     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/link-info[2]/input-model
272     ${request_template}    Set Element Text    ${request_template}    ${input_model}    xpath=.//link-computation/output-model
273     ${request_template}    Set Element Text    ${request_template}    ${underlay_topology_1}    xpath=.//link-computation/link-info[1]/link-topology
274     ${request_template}    Set Element Text    ${request_template}    ${underlay_topology_2}    xpath=.//link-computation/link-info[2]/link-topology
275     ${request_template}    Set Element Attribute    ${request_template}    xmlns:n    urn:opendaylight:topology:correlation    xpath=./link-computation
276     ${request_template}    Element to String    ${request_template}
277     [Return]    ${request_template}
278
279 Insert Scripting into Request
280     [Arguments]    ${request}    ${language}    ${script}
281     [Documentation]    Insert Scripting into Request under aggregation node
282     ${request}    Add Element    ${request}    ${SCRIPTING}    xpath=.//correlation/aggregation
283     ${request}    Set Element Text    ${request}    ${script}    xpath=.//correlation/aggregation/scripting/script
284     ${request}    Set Element Text    ${request}    ${language}    xpath=.//correlation/aggregation/scripting/language
285     ${request}    Element to String    ${request}
286     [Return]    ${request}
287
288 Create Isis Node
289     [Arguments]    ${node-id}    ${ovs-version}=23    ${router-id-ipv4}=10.0.0.1
290     [Documentation]    Create an isis node element with id and ip
291     ${request}    Set Element Text    ${NODE_ISIS}    ${node-id}    xpath=.//node-id
292     ${request}    Set Element Text    ${request}    ${ovs-version}    xpath=.//ovs-version
293     ${request}    Set Element Text    ${request}    ${router-id-ipv4}    xpath=.//igp-node-attributes/isis-node-attributes/ted/te-router-id-ipv4
294     ${request}    Element to String    ${request}
295     [Return]    ${request}
296
297 Create Openflow Node
298     [Arguments]    ${node-id}    ${ip-address}=10.0.0.1    ${serial-number}=27
299     [Documentation]    Create an Openflow node element with id and ip
300     ${request}    Set Element Text    ${NODE_OPENFLOW}    ${node-id}    xpath=.//id
301     ${request}    Set Element Text    ${request}    ${ip-address}    xpath=.//ip-address
302     ${request}    Set Element Text    ${request}    ${serial-number}    xpath=.//serial-number
303     ${request}    Element to String    ${request}
304     [Return]    ${request}
305
306 Create OVSDB Termination Point
307     [Arguments]    ${tp-id}    ${ofport}
308     [Documentation]    Create an OVSDB termination point element with id and port
309     ${request}    Set Element Text    ${TERMINATION_POINT_OVSDB}    ${tp-id}    xpath=.//tp-id
310     ${request}    Set Element Text    ${request}    ${ofport}    xpath=.//ofport
311     ${request}    Element to String    ${request}
312     [Return]    ${request}
313
314 Create Openflow Node Connector
315     [Arguments]    ${nc-id}    ${port-number}
316     [Documentation]    Create an Openflow node connector element with id and port number
317     ${request}    Set Element Text    ${NODE_CONNECTOR_OPENFLOW}    ${nc-id}    xpath=.//id
318     ${request}    Set Element Text    ${request}    ${port-number}    xpath=.//port-number
319     ${request}    Element to String    ${request}
320     [Return]    ${request}
321
322 Create Link
323     [Arguments]    ${link-id}    ${source-node}    ${dest-node}    ${name}    ${metric}
324     ${request}    Set Element Text    ${LINK}    ${link-id}    xpath=.//link-id
325     ${request}    Set Element Text    ${request}    ${source-node}    xpath=.//source/source-node
326     ${request}    Set Element Text    ${request}    ${dest-node}    xpath=.//destination/dest-node
327     ${request}    Set Element Text    ${request}    ${name}    xpath=.//igp-link-attributes/name
328     ${request}    Set Element Text    ${request}    ${metric}    xpath=.//igp-link-attributes/metric
329     ${request}    Element to String    ${request}
330     [Return]    ${request}
331
332 Extract Node from Topology
333     [Arguments]    ${topology}    ${supp_node_id}
334     [Documentation]    Returns node that contains supporting node with ID specified in argument supp_node_id
335     ${xpath}    Set Variable    .//node/supporting-node[node-ref='${supp_node_id}']/..
336     ${node}    Get Element    ${topology}    xpath=${xpath}
337     ${node}    Element to String    ${node}
338     [Return]    ${node}
339
340 Extract Termination Point from Topology
341     [Arguments]    ${model}    ${topology}    ${topo_id}    ${node_id}    ${tp_id}
342     [Documentation]    Returns termination point that contains supporting termination point from specified topology, node and with specified id
343     Check Supported Model    ${model}
344     ${xpath}    Set Variable If    '${model}' == 'network-topology-model' or '${model}' == 'opendaylight-inventory-model'    .//termination-point[tp-ref='/network-topology:network-topology/topology/${topo_id}/node/${node_id}/termination-point/${tp_id}']    .//termination-point/supporting-termination-point[tp-ref='${tp_id}']/..
345     ${tp}    Get Element    ${topology}    xpath=${xpath}
346     ${tp}    Element to String    ${tp}
347     [Return]    ${tp}
348
349 Extract Link from Topology
350     [Arguments]    ${model}    ${topology}    ${topo_id}    ${link_id}
351     [Documentation]    Returns link that contains supporting link
352     Check Supported Model    ${model}
353     ${xpath}    Set Variable If    '${model}' == 'network-topology-model' or '${model}' == 'opendaylight-inventory-model'    .//link/supporting-link[link-ref='/network-topology/topology/${topo_id}/link/${link_id}']/..    .//link/supporting-link[tp-ref='${tp_id}']/..
354     ${link}    Get Element    ${topology}    xpath=${xpath}
355     ${link}    Element to String    ${link}
356     [Return]    ${link}
357
358 Check Supported Model
359     [Arguments]    ${model}
360     [Documentation]    Checks if model is supported.
361     Run Keyword If    '${model}' != 'network-topology-model' and '${model}' != 'i2rs-model' and '${model}' != 'opendaylight-inventory-model'    Fail    Not supported model
362
363 Check Aggregated Node in Topology
364     [Arguments]    ${model}    ${topology}    ${tp_count}    @{supp_node_ids}
365     [Documentation]    Checks number of termination points and concrete supporting nodes in aggregated node and returns overlay node id. Model should be 'network-topology-model', 'opendaylight-inventory-model' or 'i2rs-model'.
366     Check Supported Model    ${model}
367     ${node_id}    Get From List    ${supp_node_ids}    0
368     ${aggregated_node}    Extract Node from Topology    ${topology}    ${node_id}
369     ${supp_node_count}    Get Length    ${supp_node_ids}
370     Should Contain X Times    ${aggregated_node}    <supporting-node>    ${supp_node_count}
371     Should Contain X Times    ${aggregated_node}    <termination-point>    ${tp_count}
372     Should Contain X Times    ${aggregated_node}    <tp-ref>    ${tp_count}
373     : FOR    ${supp_node_id}    IN    @{supp_node_ids}
374     \    Element Text Should Be    ${aggregated_node}    ${supp_node_id}    xpath=.//supporting-node[node-ref='${supp_node_id}']/node-ref
375     ${overlay_node_id}    Get Element Text    ${aggregated_node}    xpath=./node-id
376     [Return]    ${overlay_node_id}
377
378 Check Aggregated Termination Point in Node
379     [Arguments]    ${model}    ${topology}    ${topology_id}    ${node_id}    ${tp_id}    @{supp_tp_ids}
380     [Documentation]    Checks supporting termination points in aggregated termination point. Model should be 'network-topology-model', 'opendaylight-inventory-model' or 'i2rs-model'.
381     Check Supported Model    ${model}
382     ${tp}    Extract Termination Point from Topology    ${model}    ${topology}    ${topology_id}    ${node_id}    ${tp_id}
383     ${supp_tp_count}    Get Length    ${supp_tp_ids}
384     Should Contain X Times    ${tp}    <tp-ref>    ${supp_tp_count}
385     : FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
386     \    Should Contain X Times    ${tp}    ${supp_tp_id}</tp-ref>    1
387
388 Check Filtered Nodes in Topology
389     [Arguments]    ${topology}    ${tp_count}    @{node_ids}
390     [Documentation]    Checks nodes in filtered topology
391     ${node_count}    Get Length    ${node_ids}
392     Should Contain X Times    ${topology}    <node>    ${node_count}
393     Should Contain X Times    ${topology}    <supporting-node>    ${node_count}
394     Should Contain X Times    ${topology}    <termination-point>    ${tp_count}
395     : FOR    ${node_id}    IN    @{node_ids}
396     \    Element Text Should Be    ${topology}    ${node_id}    xpath=.//node/supporting-node[node-ref='${node_id}']/node-ref
397
398 Check Filtered Termination Points in Node
399     [Arguments]    ${topology}    ${supp_node_id}    @{supp_tp_ids}
400     [Documentation]    Checks termination points in filtered topology
401     ${node}    Extract Node from Topology    ${topology}    ${supp_node_id}
402     ${supp_tp_count}    Get Length    ${supp_tp_ids}
403     Should Contain X Times    ${node}    <supporting-node>    1
404     Should Contain X Times    ${node}    <termination-point>    ${supp_tp_count}
405     Should Contain X Times    ${node}    <tp-ref>    ${supp_tp_count}
406     : FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
407     \    Should Contain X Times    ${node}    ${supp_tp_id}    1
408
409 Check Filtered Links In Topology
410     [Arguments]    ${topology}    @{supp_link_ids}
411     [Documentation]    Checks links in filtered topology
412     ${supp_link_count}    Get Length    ${supp_link_ids}
413     Should Contain X Times    ${topology}    <link>    ${supp_link_count}
414     Should Contain X Times    ${topology}    <link-ref>    ${supp_link_count}
415     : FOR    ${supp_link_id}    IN    @{supp_link_ids}
416     \    Should Contain X Times    ${topology}    ${supp_link_id}</link-ref>    1
417
418 Check Overlay Link Source And Destination
419     [Arguments]    ${model}    ${topology}    ${topo_id}    ${link_id}    ${expected_source}    ${expected_destination}
420     [Documentation]    Checks if the overlay link's source and destination specified by a supporting link ref matches given source and destination
421     ${link}    Extract Link from Topology    ${model}    ${topology}    ${topo_id}    ${link_id}
422     ${link_source}    Get Element Text    ${link}    xpath=.//source-node
423     ${link_destination}    Get Element Text    ${link}    xpath=.//dest-node
424     Should Be Equal As Strings    ${link_source}    ${expected_source}
425     Should Be Equal As Strings    ${link_destination}    ${expected_destination}