Topoprocessing Basic tests - Link computation
[integration/test.git] / csit / suites / topoprocessing / basic-topology-operations / 060_Link_computation.robot
1 *** Settings ***
2 Documentation     Test suite to verify link computation 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 Link Computation Aggregation Inside
21     [Documentation]    Test of link computation with unification inside on Network Topology model
22     ${request}    Prepare Unification Inside Topology Request    ${UNIFICATION_NT_AGGREGATE_INSIDE}    network-topology-model    node    network-topo:6
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 Link Computation Inside    ${request}    ${LINK_COMPUTATION_INSIDE}    n:network-topology-model    network-topo:6
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:    4
28     Should Contain X Times    ${resp.content}    <link-id>    4
29     #nodes 29 and 28
30     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:28']/..
31     ${node}    Element to String    ${node}
32     Should Contain X Times    ${node}    <node-ref>bgp:29</node-ref>    1
33     Should Contain X Times    ${node}    <node-ref>bgp:28</node-ref>    1
34     ${node_29}    Get Element Text    ${node}    xpath=./node-id
35     ${node_28}    Get Element Text    ${node}    xpath=./node-id
36     #node 26
37     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:26']/..
38     ${node}    Element to String    ${node}
39     Should Contain X Times    ${node}    <node-ref>bgp:26</node-ref>    1
40     ${node_26}    Get Element Text    ${node}    xpath=./node-id
41     #node 30
42     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:30']/..
43     ${node}    Element to String    ${node}
44     Should Contain X Times    ${node}    <node-ref>bgp:30</node-ref>    1
45     ${node_30}    Get Element Text    ${node}    xpath=./node-id
46     #node 27
47     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:27']/..
48     ${node}    Element to String    ${node}
49     Should Contain X Times    ${node}    <node-ref>bgp:27</node-ref>    1
50     ${node_27}    Get Element Text    ${node}    xpath=./node-id
51     #link 28-29
52     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:6/link/link:28:29']/..
53     ${link}    Element to String    ${link}
54     ${source}    Get Element Text    ${link}    xpath=.//source-node
55     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
56     Should Be Equal As Strings    ${source}    ${node_28}
57     Should Be Equal As Strings    ${destination}    ${node_29}
58     #link 26-28
59     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:6/link/link:26:28']/..
60     ${link}    Element to String    ${link}
61     ${source}    Get Element Text    ${link}    xpath=.//source-node
62     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
63     Should Be Equal As Strings    ${source}    ${node_26}
64     Should Be Equal As Strings    ${destination}    ${node_28}
65     #link 29:30-2
66     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:6/link/link:29:30-2']/..
67     ${link}    Element to String    ${link}
68     ${source}    Get Element Text    ${link}    xpath=.//source-node
69     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
70     Should Be Equal As Strings    ${source}    ${node_29}
71     Should Be Equal As Strings    ${destination}    ${node_30}
72     #link 29:30-1
73     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:6/link/link:29:30-1']/..
74     ${link}    Element to String    ${link}
75     ${source}    Get Element Text    ${link}    xpath=.//source-node
76     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
77     Should Be Equal As Strings    ${source}    ${node_29}
78     Should Be Equal As Strings    ${destination}    ${node_30}
79
80 Link Computation Filtration
81     [Documentation]    Test of link computation with filtration on Network Topology model
82     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    node    network-topo:6
83     ${request}    Insert Filter    ${request}    ${FILTER_IPV4}    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4
84     ${request}    Set IPV4 Filter    ${request}    192.168.2.1/32
85     ${request}    Insert Link Computation Inside    ${request}    ${LINK_COMPUTATION_INSIDE}    n:network-topology-model    network-topo:6
86     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
87     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
88     Should Contain X Times    ${resp.content}    <node-id>node:    2
89     Should Contain X Times    ${resp.content}    <node-ref>bgp:28</node-ref>    1
90     Should Contain X Times    ${resp.content}    <node-ref>bgp:29</node-ref>    1
91     Should Contain X Times    ${resp.content}    <link>    1
92     #node 28
93     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:28']/..
94     ${node}    Element to String    ${node}
95     Should Contain X Times    ${node}    <node-ref>bgp:28</node-ref>    1
96     ${node_28}    Get Element Text    ${node}    xpath=./node-id
97     #node 29
98     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:29']/..
99     ${node}    Element to String    ${node}
100     Should Contain X Times    ${node}    <node-ref>bgp:29</node-ref>    1
101     ${node_29}    Get Element Text    ${node}    xpath=./node-id
102     #link 28-29
103     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:6/link/link:28:29']/..
104     ${link}    Element to String    ${link}
105     ${source}    Get Element Text    ${link}    xpath=.//source-node
106     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
107     Should Be Equal As Strings    ${source}    ${node_28}
108     Should Be Equal As Strings    ${destination}    ${node_29}
109
110 Link Computation Aggregation Filtration
111     [Documentation]    Test of link computation with aggregation filtration on Network Topology model
112     ${target_field}    Set Variable    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4
113     ${request}    Prepare Unification Filtration Topology Request    ${UNIFICATION_FILTRATION_NT}    network-topology-model    node    ${target_field}    network-topo:6
114     ...    ${target_field}    network-topo:1
115     ${request}    Insert Filter With ID    ${request}    ${FILTER_IPV4}    l3-unicast-igp-topology:igp-node-attributes/isis-topology:isis-node-attributes/isis-topology:ted/isis-topology:te-router-id-ipv4    1
116     ${request}    Insert Apply Filters    ${request}    1    1
117     ${request}    Insert Apply Filters    ${request}    2    1
118     ${request}    Set IPV4 Filter    ${request}    192.168.1.1/24
119     ${request}    Insert Link Computation    ${request}    ${LINK_COMPUTATION}    n:network-topology-model    network-topo:6    network-topo:1
120     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
121     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
122     Should Contain X Times    ${resp.content}    <node-id>node:    2
123     Should Contain X Times    ${resp.content}    <link>    2
124     #nodes 26 and 1
125     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:26']/..
126     ${node}    Element to String    ${node}
127     Should Contain X Times    ${node}    <node-ref>bgp:26</node-ref>    1
128     Should Contain X Times    ${node}    <node-ref>bgp:1</node-ref>    1
129     ${node_26}    Get Element Text    ${node}    xpath=./node-id
130     ${node_1}    Get Element Text    ${node}    xpath=./node-id
131     #nodes 27 and 2
132     ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='bgp:27']/..
133     ${node}    Element to String    ${node}
134     Should Contain X Times    ${node}    <node-ref>bgp:27</node-ref>    1
135     Should Contain X Times    ${node}    <node-ref>bgp:2</node-ref>    1
136     ${node_27}    Get Element Text    ${node}    xpath=./node-id
137     ${node_2}    Get Element Text    ${node}    xpath=./node-id
138     #link 1:2-1
139     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:1/link/link:1:2-1']/..
140     ${link}    Element to String    ${link}
141     ${source}    Get Element Text    ${link}    xpath=.//source-node
142     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
143     Should Be Equal As Strings    ${source}    ${node_1}
144     Should Be Equal As Strings    ${destination}    ${node_2}
145     #link 1:2-2
146     ${link}    Get Element    ${resp.content}    xpath=.//link/supporting-link[link-ref='/network-topology/topology/network-topo:1/link/link:1:2-2']/..
147     ${link}    Element to String    ${link}
148     ${source}    Get Element Text    ${link}    xpath=.//source-node
149     ${destination}    Get Element Text    ${link}    xpath=.//dest-node
150     Should Be Equal As Strings    ${source}    ${node_26}
151     Should Be Equal As Strings    ${destination}    ${node_27}