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