Topoprocessing - tests correction
[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    ${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:    9
28     : FOR    ${index}    IN RANGE    1    10
29     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
30     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:10']/..
31     ${node}    Element to String    ${node}
32     Should Contain X Times    ${node}    <node-ref>bgp:10</node-ref>    1
33     Should Contain X Times    ${node}    <node-ref>bgp:5</node-ref>    1
34
35 Unification Node Inventory
36     [Documentation]    Test unification operation on inventory model
37     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    opendaylight-inventory-model    node    openflow-topo:1    openflow-topo:2
38     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
39     ${request}    Insert Target Field    ${request}    1    flow-node-inventory:ip-address    0
40     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
41     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
42     Should Contain X Times    ${resp.content}    <node-id>node:    8
43     : FOR    ${index}    IN RANGE    1    11
44     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
45     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
46     ${node}    Element to String    ${node}
47     Should Contain X Times    ${node}    <node-ref>of-node:6</node-ref>    1
48     Should Contain X Times    ${node}    <node-ref>of-node:1</node-ref>    1
49     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:4']/..
50     ${node}    Element to String    ${node}
51     Should Contain X Times    ${node}    <node-ref>of-node:10</node-ref>    1
52     Should Contain X Times    ${node}    <node-ref>of-node:4</node-ref>    1
53
54 Unification Scripting Node
55     [Documentation]    Test unification operation on Network Topology model using scripting
56     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    network-topology-model    node    network-topo:1    network-topo:2
57     ${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
58     ${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
59     ${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);}
60     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
61     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
62     Should Contain X Times    ${resp.content}    <node-id>node:    9
63     : FOR    ${index}    IN RANGE    1    11
64     \    Should Contain X Times    ${resp.content}    <node-ref>bgp:${index}</node-ref>    1
65     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
66     ${node}    Element to String    ${node}
67     Should Contain X Times    ${node}    <node-ref>bgp:1</node-ref>    1
68     Should Contain X Times    ${node}    <node-ref>bgp:6</node-ref>    1
69
70 Unification Scripting Node Inventory
71     [Documentation]    Test unification operation on inventory model using scripting
72     ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    opendaylight-inventory-model    node    openflow-topo:1    openflow-topo:2
73     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
74     ${request}    Insert Target Field    ${request}    1    flow-node-inventory:ip-address    0
75     ${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);}
76     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
77     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
78     Should Contain X Times    ${resp.content}    <node-id>node:    9
79     : FOR    ${index}    IN RANGE    1    11
80     \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
81     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
82     ${node}    Element to String    ${node}
83     Should Contain X Times    ${node}    <node-ref>of-node:2</node-ref>    1
84     Should Contain X Times    ${node}    <node-ref>of-node:8</node-ref>    1
85
86 Unification Node Inside
87     [Documentation]    Test of unification type of aggregation inside on nodes on Network Topology model
88     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    network-topology-model    node    network-topo:1
89     ${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
90     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
91     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
92     Should Contain X Times    ${resp.content}    <node-id>node:    4
93     ${response_xml}    Parse XML    ${resp.content}
94     ${node}    Get Element    ${response_xml}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
95     ${node}    Element To String    ${node}
96     Should Contain X Times    ${node}    <supporting-node>    2
97     Should Contain    ${node}    <supporting-node><node-ref>bgp:3</node-ref>
98     Should Contain    ${node}    <supporting-node><node-ref>bgp:4</node-ref>
99
100 Unification Node Inside Inventory
101     [Documentation]    Test of unification type of aggregation inside on nodes on Inventory model
102     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    opendaylight-inventory-model    node    openflow-topo:2
103     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:ip-address    0
104     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
105     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
106     Should Contain X Times    ${resp.content}    <node-id>node:    4
107     ${response_xml}    Parse XML    ${resp.content}
108     ${node}    Get Element    ${response_xml}    xpath=.//node/supporting-node[node-ref='of-node:7']/..
109     ${node}    Element To String    ${node}
110     Should Contain X Times    ${node}    <supporting-node>    2
111     Should Contain    ${node}    <supporting-node><node-ref>of-node:7</node-ref>
112     Should Contain    ${node}    <supporting-node><node-ref>of-node:9</node-ref>
113
114 Unification Termination Point Inside
115     [Documentation]    Test aggregate inside operation on termination points
116     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    network-topology-model    termination-point    network-topo:1
117     ${request}    Insert Target Field    ${request}    0    ovsdb:ofport    0
118     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
119     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
120     Should Contain X Times    ${resp.content}    <node-id>node:    5
121     Should Contain X Times    ${resp.content}    <termination-point>    6
122     # bgp:1
123     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:1']/..
124     ${node}    Element to String    ${node}
125     Should Contain X Times    ${node}    <termination-point>    2
126     ${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']
127     ${tp}    Element to String    ${tp}
128     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
129     ${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']
130     ${tp}    Element to String    ${tp}
131     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
132     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
133     # bgp:3
134     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:3']/..
135     ${node}    Element to String    ${node}
136     Should Contain X Times    ${node}    <termination-point>    2
137     ${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']
138     ${tp}    Element to String    ${tp}
139     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
140     ${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']
141     ${tp}    Element to String    ${tp}
142     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
143     # bgp:4
144     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:4']/..
145     ${node}    Element to String    ${node}
146     Should Contain X Times    ${node}    <termination-point>    1
147     ${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']
148     ${tp}    Element to String    ${tp}
149     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
150     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
151     # bgp:5
152     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:5']/..
153     ${node}    Element to String    ${node}
154     Should Contain X Times    ${node}    <termination-point>    1
155     ${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']
156     ${tp}    Element to String    ${tp}
157     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
158
159 Unification Termination Point Inside Inventory
160     [Documentation]    Test aggregate inside operation on termination points
161     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    opendaylight-inventory-model    termination-point    openflow-topo:1
162     ${request}    Insert Target Field    ${request}    0    flow-node-inventory:port-number    0
163     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
164     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
165     Should Contain X Times    ${resp.content}    <node-id>node:    5
166     Should Contain X Times    ${resp.content}    <termination-point>    8
167     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:1']/..
168     ${node}    Element to String    ${node}
169     Should Contain X Times    ${node}    <termination-point>    1
170     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
171     ${node}    Element to String    ${node}
172     Should Contain X Times    ${node}    <termination-point>    3
173     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:3']/..
174     ${node}    Element to String    ${node}
175     Should Contain X Times    ${node}    <termination-point>    2
176     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:4']/..
177     ${node}    Element to String    ${node}
178     Should Contain X Times    ${node}    <termination-point>    1
179     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:5']/..
180     ${node}    Element to String    ${node}
181     Should Contain X Times    ${node}    <termination-point>    1
182     [Teardown]    Report_Failure_Due_To_Bug    4674