Topoprocessing - tests correction
[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 Range Number Network Topology Model
21     [Documentation]    Test of range number type of filtration operation on Network Topology model
22     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
23     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    ovsdb:ofport
24     ${request}    Set Range Number Filter    ${request}    1115    1119
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>    3
29     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
30     ${node}    Element to String    ${node}
31     Should Contain X Times    ${node}    <termination-point>    2
32     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
33     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
34     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:6']/..
35     ${node}    Element to String    ${node}
36     Should Contain X Times    ${node}    <termination-point>    1
37     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:6/termination-point/tp:6:1</tp-ref>    1
38
39 Filtration Range Number Inventory Model
40     [Documentation]    Test of range number type of filtration operation on Inventory model
41     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
42     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    flow-node-inventory:port-number
43     ${request}    Set Range Number Filter    ${request}    2    4
44     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
45     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
46     Should Contain X Times    ${resp.content}    <node-id>node:    5
47     Should Contain X Times    ${resp.content}    <termination-point>    5
48     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
49     ${node}    Element to String    ${node}
50     Should Contain X Times    ${node}    <termination-point>    2
51     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:3</inventory-node-connector-ref>    1
52     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:2</inventory-node-connector-ref>    1
53     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
54     ${node}    Element to String    ${node}
55     Should Contain X Times    ${node}    <termination-point>    2
56     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:3:2</inventory-node-connector-ref>    1
57     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:3:1</inventory-node-connector-ref>    1
58     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
59     ${node}    Element to String    ${node}
60     Should Contain X Times    ${node}    <termination-point>    1
61     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:5:1</inventory-node-connector-ref>    1
62
63 Filtration Specific Number Network Topology Model
64     [Documentation]    Test of specific number type of filtration operation on Network Topology model
65     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
66     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    ovsdb:ofport
67     ${request}    Set Specific Number Filter    ${request}    1119
68     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
69     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
70     Should Contain X Times    ${resp.content}    <node-id>node:    5
71     Should Contain X Times    ${resp.content}    <termination-point>    1
72     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
73     ${node}    Element to String    ${node}
74     Should Contain X Times    ${node}    <termination-point>    1
75     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:1</tp-ref>    1
76
77 Filtration Specific Number Inventory Model
78     [Documentation]    Test of specific number type of filtration operation on Inventory model
79     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
80     #${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    flow-node-inventory:port-number
81     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_NUMBER}    flow-node-inventory:maximum-speed
82     ${request}    Set Specific Number Filter    ${request}    2
83     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
84     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
85     Should Contain X Times    ${resp.content}    <node-id>node:    5
86     Should Contain X Times    ${resp.content}    <termination-point>    3
87     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
88     ${node}    Element to String    ${node}
89     Should Contain X Times    ${node}    <termination-point>    1
90     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:2</inventory-node-connector-ref>    1
91     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
92     ${node}    Element to String    ${node}
93     Should Contain X Times    ${node}    <termination-point>    2
94     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:3:2</inventory-node-connector-ref>    1
95     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:3:1</inventory-node-connector-ref>    1
96
97 Filtration Specific String Network Topology Model
98     [Documentation]    Test of specific string type of filtration operation on Network Topology model
99     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
100     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    ovsdb:name
101     ${request}    Set Specific String Filter    ${request}    portC
102     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
103     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
104     Should Contain X Times    ${resp.content}    <node-id>node:    5
105     Should Contain X Times    ${resp.content}    <termination-point>    1
106     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
107     ${node}    Element to String    ${node}
108     Should Contain X Times    ${node}    <termination-point>    1
109     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
110
111 Filtration Specific String Inventory Model
112     [Documentation]    Test of specific string type of filtration operation on Inventory model
113     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
114     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    flow-node-inventory:name
115     ${request}    Set Specific String Filter    ${request}    portB
116     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
117     Should Contain X Times    ${resp.content}    <node-id>node:    5
118     Should Contain X Times    ${resp.content}    <termination-point>    2
119     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
120     ${node}    Element to String    ${node}
121     Should Contain X Times    ${node}    <termination-point>    1
122     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:1</inventory-node-connector-ref>    1
123     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
124     ${node}    Element to String    ${node}
125     Should Contain X Times    ${node}    <termination-point>    1
126     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:5:1</inventory-node-connector-ref>    1
127
128 Filtration Range String Network Topology Model
129     [Documentation]    Test of range string type of filtration operation on Network Topology model
130     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
131     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    ovsdb:name
132     ${request}    Set Range String Filter    ${request}    portA    portC
133     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
134     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
135     Should Contain X Times    ${resp.content}    <node-id>node:    5
136     Should Contain X Times    ${resp.content}    <termination-point>    3
137     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:6']/..
138     ${node}    Element to String    ${node}
139     Should Contain X Times    ${node}    <termination-point>    1
140     Should Contain    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:6/termination-point/tp:6:1</tp-ref>
141     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
142     ${node}    Element to String    ${node}
143     Should Contain X Times    ${node}    <termination-point>    1
144     Should Contain    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>
145     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
146     ${node}    Element to String    ${node}
147     Should Contain X Times    ${node}    <termination-point>    1
148     Should Contain    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>
149
150 Filtration Range String Inventory Model
151     [Documentation]    Test of range string type of filtration operation on Inventory model
152     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
153     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    flow-node-inventory:name
154     ${request}    Set Range String Filter    ${request}    portA    portB
155     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
156     Should Contain X Times    ${resp.content}    <node-id>node:    5
157     Should Contain X Times    ${resp.content}    <termination-point>    3
158     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
159     ${node}    Element to String    ${node}
160     Should Contain X Times    ${node}    <termination-point>    2
161     Should Contain    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:1</inventory-node-connector-ref>
162     Should Contain    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:3</inventory-node-connector-ref>
163     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
164     ${node}    Element to String    ${node}
165     Should Contain X Times    ${node}    <termination-point>    1
166     Should Contain    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:5:1</inventory-node-connector-ref>
167
168 Filtration Script Network Topology Model
169     [Documentation]    Test of script type of filtration operation on Network Topology model
170     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:1
171     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    ovsdb:ofport
172     ${script}    Set Variable    if (node.getValue() > 1117 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
173     ${request}    Set Script Filter    ${request}    javascript    ${script}
174     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
175     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
176     Should Contain X Times    ${resp.content}    <node-id>node:    5
177     Should Contain X Times    ${resp.content}    <termination-point>    3
178     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
179     ${node}    Element to String    ${node}
180     Should Contain X Times    ${node}    <termination-point>    2
181     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:2</tp-ref>    1
182     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1</tp-ref>    1
183     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
184     ${node}    Element to String    ${node}
185     Should Contain X Times    ${node}    <termination-point>    1
186     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1</tp-ref>    1
187
188 Filtration Script Inventory Model
189     [Documentation]    Test of script type of filtration operation on Inventory model
190     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
191     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    flow-node-inventory:name
192     ${script}    Set Variable    if (node.getValue().indexOf("portB") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
193     ${request}    Set Script Filter    ${request}    javascript    ${script}
194     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
195     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
196     Should Contain X Times    ${resp.content}    <node-id>node:    5
197     Should Contain X Times    ${resp.content}    <termination-point>    3
198     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
199     ${node}    Element to String    ${node}
200     Should Contain X Times    ${node}    <termination-point>    2
201     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:3</inventory-node-connector-ref>    1
202     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:2:2</inventory-node-connector-ref>    1
203     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
204     ${node}    Element to String    ${node}
205     Should Contain X Times    ${node}    <termination-point>    1
206     Should Contain X Times    ${node}    <inventory-node-connector-ref xmlns="urn:opendaylight:model:topology:inventory">openflow:1:1</inventory-node-connector-ref>    1