08136a3787b34bef46b31cf268f97cdcce4fe786
[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}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:3</tp-ref>    1
52     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:2</tp-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}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:2</tp-ref>    1
57     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:1</tp-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}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:5/termination-point/tp:5:1</tp-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:maximum-speed
81     ${request}    Set Specific Number Filter    ${request}    2
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:    5
85     Should Contain X Times    ${resp.content}    <termination-point>    3
86     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
87     ${node}    Element to String    ${node}
88     Should Contain X Times    ${node}    <termination-point>    1
89     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:2</tp-ref>    1
90     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
91     ${node}    Element to String    ${node}
92     Should Contain X Times    ${node}    <termination-point>    2
93     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:2</tp-ref>    1
94     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:1</tp-ref>    1
95
96 Filtration Specific String Network Topology Model
97     [Documentation]    Test of specific string type of filtration operation on Network Topology model
98     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
99     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    ovsdb:name
100     ${request}    Set Specific String Filter    ${request}    portC
101     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
102     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
103     Should Contain X Times    ${resp.content}    <node-id>node:    5
104     Should Contain X Times    ${resp.content}    <termination-point>    1
105     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
106     ${node}    Element to String    ${node}
107     Should Contain X Times    ${node}    <termination-point>    1
108     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
109
110 Filtration Specific String Inventory Model
111     [Documentation]    Test of specific string type of filtration operation on Inventory model
112     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
113     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    flow-node-inventory:name
114     ${request}    Set Specific String Filter    ${request}    portB
115     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
116     Should Contain X Times    ${resp.content}    <node-id>node:    5
117     Should Contain X Times    ${resp.content}    <termination-point>    2
118     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
119     ${node}    Element to String    ${node}
120     Should Contain X Times    ${node}    <termination-point>    1
121     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:1</tp-ref>    1
122     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
123     ${node}    Element to String    ${node}
124     Should Contain X Times    ${node}    <termination-point>    1
125     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:5/termination-point/tp:5:1</tp-ref>    1
126
127 Filtration Range String Network Topology Model
128     [Documentation]    Test of range string type of filtration operation on Network Topology model
129     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:2
130     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    ovsdb:name
131     ${request}    Set Range String Filter    ${request}    portA    portC
132     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
133     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
134     Should Contain X Times    ${resp.content}    <node-id>node:    5
135     Should Contain X Times    ${resp.content}    <termination-point>    3
136     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:6']/..
137     ${node}    Element to String    ${node}
138     Should Contain X Times    ${node}    <termination-point>    1
139     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:6/termination-point/tp:6:1</tp-ref>    1
140     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:7']/..
141     ${node}    Element to String    ${node}
142     Should Contain X Times    ${node}    <termination-point>    1
143     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:7/termination-point/tp:7:2</tp-ref>    1
144     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
145     ${node}    Element to String    ${node}
146     Should Contain X Times    ${node}    <termination-point>    1
147     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:2/node/bgp:10/termination-point/tp:10:1</tp-ref>    1
148
149 Filtration Range String Inventory Model
150     [Documentation]    Test of range string type of filtration operation on Inventory model
151     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
152     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    flow-node-inventory:name
153     ${request}    Set Range String Filter    ${request}    portA    portB
154     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
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='of-node:2']/..
158     ${node}    Element to String    ${node}
159     Should Contain X Times    ${node}    <termination-point>    2
160     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:1</tp-ref>    1
161     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:3</tp-ref>    1
162     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
163     ${node}    Element to String    ${node}
164     Should Contain X Times    ${node}    <termination-point>    1
165     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:5/termination-point/tp:5:1</tp-ref>    1
166
167 Filtration Script Network Topology Model
168     [Documentation]    Test of script type of filtration operation on Network Topology model
169     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    termination-point    network-topo:1
170     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    ovsdb:ofport
171     ${script}    Set Variable    if (node.getValue() > 1117 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
172     ${request}    Set Script Filter    ${request}    javascript    ${script}
173     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
174     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
175     Should Contain X Times    ${resp.content}    <node-id>node:    5
176     Should Contain X Times    ${resp.content}    <termination-point>    3
177     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
178     ${node}    Element to String    ${node}
179     Should Contain X Times    ${node}    <termination-point>    2
180     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:2</tp-ref>    1
181     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1</tp-ref>    1
182     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
183     ${node}    Element to String    ${node}
184     Should Contain X Times    ${node}    <termination-point>    1
185     Should Contain X Times    ${node}    <tp-ref>/network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1</tp-ref>    1
186
187 Filtration Script Inventory Model
188     [Documentation]    Test of script type of filtration operation on Inventory model
189     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    termination-point    openflow-topo:1
190     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    flow-node-inventory:name
191     ${script}    Set Variable    if (node.getValue().indexOf("portB") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
192     ${request}    Set Script Filter    ${request}    javascript    ${script}
193     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
194     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
195     Should Contain X Times    ${resp.content}    <node-id>node:    5
196     Should Contain X Times    ${resp.content}    <termination-point>    3
197     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
198     ${node}    Element to String    ${node}
199     Should Contain X Times    ${node}    <termination-point>    2
200     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:3</tp-ref>    1
201     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:2</tp-ref>    1
202     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
203     ${node}    Element to String    ${node}
204     Should Contain X Times    ${node}    <termination-point>    1
205     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:1/termination-point/tp:1:1</tp-ref>    1