topoprocessing - fix for bug 5448
[integration/test.git] / csit / suites / topoprocessing / basic-topology-operations / 010_Aggregation.robot
1 *** Settings ***
2 Documentation     Test suite to verify unification operation on different models.
3 ...               Before test starts, configurational file have to be rewriten to change listners registration datastore type from CONFIG_API to OPERATIONAL_API.
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 ...               Suite setup also install features required for tested models, clear karaf logs for further synchronization. Tests themselves send configurational
6 ...               xmls and verify output. 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 Unification Node
21     [Documentation]    Test unification operation on Network Topology model
22     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    network-topology-model    node    network-topo:1    network-topo:2
23     ${request}    Insert Target Field    ${request}    0    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    0
24     ${request}    Insert Target Field    ${request}    1    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    0
25     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    8
26     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
27     : FOR    ${index}    IN RANGE    1    10
28     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
29     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
30     ${node}    Element to String    ${node}
31     Should Contain X Times    ${node}    <node-ref>bgp:10</node-ref>    1
32     Should Contain X Times    ${node}    <node-ref>bgp:5</node-ref>    1
33
34 Unification Node Inventory
35     [Documentation]    Test unification operation on inventory model
36     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    opendaylight-inventory-model    node    openflow-topo:1    openflow-topo:2
37     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
38     ${request}    Insert Target Field    ${request}    1    flow-node-inventory:ip-address    0
39     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    7
40     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
41     : FOR    ${index}    IN RANGE    1    11
42     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
43     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
44     ${node}    Element to String    ${node}
45     Should Contain X Times    ${node}    <node-ref>of-node:6</node-ref>    1
46     Should Contain X Times    ${node}    <node-ref>of-node:1</node-ref>    1
47     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:4']/..
48     ${node}    Element to String    ${node}
49     Should Contain X Times    ${node}    <node-ref>of-node:10</node-ref>    1
50     Should Contain X Times    ${node}    <node-ref>of-node:4</node-ref>    1
51
52 Unification Scripting Node
53     [Documentation]    Test unification operation on Network Topology model using scripting
54     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    network-topology-model    node    network-topo:1    network-topo:2
55     ${request}    Insert Target Field    ${request}    0    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    0
56     ${request}    Insert Target Field    ${request}    1    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    0
57     ${request}    Insert Scripting into Request    ${request}    javascript    if (originalItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.1") > -1 && newItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.3") > -1 || originalItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.3") > -1 && newItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.1") > -1) {aggregable.setResult(true);} else { aggregable.setResult(false);}
58     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    9
59     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
60     : FOR    ${index}    IN RANGE    1    11
61     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
62     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
63     ${node}    Element to String    ${node}
64     Should Contain X Times    ${node}    <node-ref>bgp:1</node-ref>    1
65     Should Contain X Times    ${node}    <node-ref>bgp:6</node-ref>    1
66
67 Unification Scripting Node Inventory
68     [Documentation]    Test unification operation on inventory model using scripting
69     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    opendaylight-inventory-model    node    openflow-topo:1    openflow-topo:2
70     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
71     ${request}    Insert Target Field    ${request}    1    flow-node-inventory:ip-address    0
72     ${request}    Insert Scripting into Request    ${request}    javascript    if (originalItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.2") > -1 && newItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.4") > -1 || originalItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.4") > -1 && newItem.getLeafNodes().get(java.lang.Integer.valueOf('0')).getValue().indexOf("192.168.1.2") > -1) {aggregable.setResult(true);} else { aggregable.setResult(false);}
73     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    9
74     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
75     : FOR    ${index}    IN RANGE    1    11
76     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
77     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
78     ${node}    Element to String    ${node}
79     Should Contain X Times    ${node}    <node-ref>of-node:2</node-ref>    1
80     Should Contain X Times    ${node}    <node-ref>of-node:8</node-ref>    1
81
82 Unification Node Inside
83     [Documentation]    Test of unification type of aggregation inside on nodes on Network Topology model
84     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    network-topology-model    node    network-topo:1
85     ${request}    Insert Target Field    ${request}    0    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    0
86     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    4
87     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
88     ${response_xml}    Parse XML    ${resp.content}
89     ${node}    Get Element    ${response_xml}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
90     ${node}    Element To String    ${node}
91     Should Contain X Times    ${node}    <supporting-node>    2
92     Should Contain    ${node}    <supporting-node><node-ref>bgp:3</node-ref>
93     Should Contain    ${node}    <supporting-node><node-ref>bgp:4</node-ref>
94
95 Unification Node Inside Inventory
96     [Documentation]    Test of unification type of aggregation inside on nodes on Inventory model
97     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    opendaylight-inventory-model    node    openflow-topo:2
98     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
99     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    4
100     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
101     ${response_xml}    Parse XML    ${resp.content}
102     ${node}    Get Element    ${response_xml}    xpath=.//node/supporting-node[node-ref='of-node:7']/..
103     ${node}    Element To String    ${node}
104     Should Contain X Times    ${node}    <supporting-node>    2
105     Should Contain    ${node}    <supporting-node><node-ref>of-node:7</node-ref>
106     Should Contain    ${node}    <supporting-node><node-ref>of-node:9</node-ref>
107
108 Unification Termination Point Inside
109     [Documentation]    Test aggregate inside operation on termination points
110     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    network-topology-model    termination-point    network-topo:1
111     ${request}    Insert Target Field    ${request}    0    ovsdb:ofport    0
112     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    5
113     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
114     Should Contain X Times    ${resp.content}    <termination-point>    6
115     # bgp:1
116     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
117     ${node}    Element to String    ${node}
118     Should Contain X Times    ${node}    <termination-point>    2
119     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:3']
120     ${tp}    Element to String    ${tp}
121     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:3</tp-ref>    1
122     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:1']
123     ${tp}    Element to String    ${tp}
124     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:1</tp-ref>    1
125     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:1/termination-point/tp:1:2</tp-ref>    1
126     # bgp:3
127     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
128     ${node}    Element to String    ${node}
129     Should Contain X Times    ${node}    <termination-point>    2
130     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:2']
131     ${tp}    Element to String    ${tp}
132     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:2</tp-ref>    1
133     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:1']
134     ${tp}    Element to String    ${tp}
135     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:3/termination-point/tp:3:1</tp-ref>    1
136     # bgp:4
137     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
138     ${node}    Element to String    ${node}
139     Should Contain X Times    ${node}    <termination-point>    1
140     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1']
141     ${tp}    Element to String    ${tp}
142     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:1</tp-ref>    1
143     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:4/termination-point/tp:4:2</tp-ref>    1
144     # bgp:5
145     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
146     ${node}    Element to String    ${node}
147     Should Contain X Times    ${node}    <termination-point>    1
148     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1']
149     ${tp}    Element to String    ${tp}
150     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/network-topo:1/node/bgp:5/termination-point/tp:5:1</tp-ref>    1
151
152 Unification Termination Point Inside Inventory
153     [Documentation]    Test aggregate inside operation on termination points
154     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    opendaylight-inventory-model    termination-point    openflow-topo:1
155     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:port-number    0
156     ${resp}    Send Basic Request And Test If Contain X Times    ${request}    network-topology:network-topology/topology/topo:1    <node-id>node:    5
157     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
158     Should Contain X Times    ${resp.content}    <termination-point>    8
159     # of-node:1
160     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
161     ${node}    Element to String    ${node}
162     Should Contain X Times    ${node}    <termination-point>    1
163     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
164     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:1/termination-point/tp:1:2</tp-ref>    1
165     # of-node:2
166     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
167     ${node}    Element to String    ${node}
168     Should Contain X Times    ${node}    <termination-point>    3
169     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:2']
170     ${tp}    Element to String    ${tp}
171     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:2</tp-ref>    1
172     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:1']
173     ${tp}    Element to String    ${tp}
174     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:2:1</tp-ref>    1
175     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:3']
176     ${tp}    Element to String    ${tp}
177     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:2/termination-point/tp:3</tp-ref>    1
178     # of-node:3
179     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
180     ${node}    Element to String    ${node}
181     Should Contain X Times    ${node}    <termination-point>    2
182     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:3']
183     ${tp}    Element to String    ${tp}
184     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:3</tp-ref>    1
185     ${tp}    Get Element    ${node}    xpath=.//termination-point[tp-ref='/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:2']
186     ${tp}    Element to String    ${tp}
187     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:2</tp-ref>    1
188     Should Contain X Times    ${tp}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:3/termination-point/tp:3:1</tp-ref>    1
189     # of-node:4
190     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:4']/..
191     ${node}    Element to String    ${node}
192     Should Contain X Times    ${node}    <termination-point>    1
193     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:4/termination-point/tp:4:1</tp-ref>    1
194     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:4/termination-point/tp:4:2</tp-ref>    1
195     Should Contain X Times    ${node}    <tp-ref>/network-topology:network-topology/topology/openflow-topo:1/node/of-node:4/termination-point/tp:4:3</tp-ref>    1
196     # of-node:5
197     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
198     ${node}    Element to String    ${node}
199     Should Contain X Times    ${node}    <termination-point>    1
200     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