2 Variables ../variables/Variables.py
3 Variables ../variables/topoprocessing/Topologies.py
4 Library RequestsLibrary
7 Resource KarafKeywords.robot
11 ${CONFIGURATION_XML} ${CURDIR}/../suites/topoprocessing/configuration.xml
12 ${OPERATIONAL_XML} ${CURDIR}/../suites/topoprocessing/operational.xml
13 ${REMOTE_FILE} ${WORKSPACE}/${BUNDLEFOLDER}/etc/opendaylight/karaf/80-topoprocessing-config.xml
17 [Arguments] ${request} ${overlay_topology_url}
18 [Documentation] Test basic aggregation
19 ${resp} Put Request session ${CONFIG_API}/${overlay_topology_url} data=${request}
20 Log ${CONFIG_API}/${overlay_topology_url}
21 Should Be Equal As Strings ${resp.status_code} 200
22 Wait For Karaf Log Correlation configuration successfully read
23 Wait For Karaf Log Transaction successfully written
24 ${resp} Get Request session ${OPERATIONAL_API}/${overlay_topology_url}
25 Should Be Equal As Strings ${resp.status_code} 200
30 [Documentation] Setup karaf enviroment for following tests
31 Log ---- Setup Environment ----
32 Open Connection ${CONTROLLER}
33 Flexible Controller Login
34 Put File ${CONFIGURATION_XML} ${REMOTE_FILE}
36 Issue Command On Karaf Console log:set DEBUG org.opendaylight.topoprocessing
37 Install a Feature odl-restconf-noauth timeout=30
38 Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${SEND_ACCEPT_XML_HEADERS}
39 ${features} Get Installed Features
40 ${lines} Get Lines Containing String ${features} odl-topoprocessing-framework
41 ${length} Get Length ${lines}
42 Install a Feature odl-openflowplugin-nsf-model-li odl-topoprocessing-framework odl-topoprocessing-network-topology odl-topoprocessing-inventory odl-bgpcep-pcep-all timeout=100
43 Run Keyword If ${length} == 0 Wait For Karaf Log Registering Topology Request Listener 60
44 Prepare New Feature Installation
45 Insert Underlay topologies
48 [Documentation] Revert startup changes
49 Log ---- Clean Environment ----
50 Open Connection ${CONTROLLER}
51 Flexible Controller Login
52 Put File ${OPERATIONAL_XML} ${REMOTE_FILE}
57 [Arguments] ${overlay_topology}
58 [Documentation] Delete overlay topologies from datastore
59 Log ---- Test Teardown ----
60 Log Deleting overlay topology from ${CONFIG_API}/${overlay_topology}
61 ${resp} Delete Request session ${CONFIG_API}/${overlay_topology}
62 Should Be Equal As Strings ${resp.status_code} 200
64 Prepare New Feature Installation
65 [Documentation] Clears karaf logs and CONFIGURATION datastore
66 ${resp} Delete Request session ${CONFIG_API}/network-topology:network-topology
67 ${resp} Delete Request session ${CONFIG_API}/opendaylight-inventory:nodes
68 Issue Command On Karaf Console log:clear
70 Insert Underlay Topologies
71 [Documentation] Insert underlay topologies used by following tests
72 Log Inserting underlay topologies
73 # Network underlay topology 1
74 ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:1 data=${NETWORK_UNDERLAY_TOPOLOGY_1}
76 Should Be Equal As Strings ${resp.status_code} 200
77 # Network underlay topology 2
78 ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:2 data=${NETWORK_UNDERLAY_TOPOLOGY_2}
80 Should Be Equal As Strings ${resp.status_code} 200
81 # Openflow underlay nodes
82 ${resp} Put Request session ${CONFIG_API}/opendaylight-inventory:nodes data=${OPENFLOW_UNDERLAY_NODES}
84 Should Be Equal As Strings ${resp.status_code} 200
85 # Openflow underlay topology 1
86 ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:1 data=${OPENFLOW_UNDERLAY_TOPOLOGY_1}
88 Should Be Equal As Strings ${resp.status_code} 200
89 # Openflow underlay topology 2
90 ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:2 data=${OPENFLOW_UNDERLAY_TOPOLOGY_2}
92 Should Be Equal As Strings ${resp.status_code} 200
93 Issue Command On Karaf Console log:clear
96 Prepare Unification Inside Topology Request
97 [Arguments] ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1}
98 [Documentation] Prepare topology request for unification inside from template
99 ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlations/output-model
100 ${request_template} Set Element Text ${request_template} aggregation-only xpath=.//correlations/correlation/type
101 ${request_template} Set Element Text ${request_template} ${correlation_item} xpath=.//correlation/correlation-item
102 ${request_template} Set Element Text ${request_template} unification xpath=.//correlation/aggregation/aggregation-type
103 ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlation/aggregation/mapping[1]/input-model
104 ${request_template} Set Element Text ${request_template} ${underlay_topo1} xpath=.//correlation/aggregation/mapping[1]/underlay-topology
105 ${request_template} Set Element Text ${request_template} ${target-field} xpath=.//correlation/aggregation/mapping[1]/target-field
106 ${request_template} Element to String ${request_template}
107 [Return] ${request_template}
109 Prepare Unification Topology Request
110 [Arguments] ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1} ${underlay_topo2}
111 [Documentation] Prepare topology request for unification on two topologies from template
112 ${request_template} Prepare Unification Inside Topology Request ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1}
113 ${request_template} Set Element Text ${request_template} ${underlay_topo2} xpath=.//correlation/aggregation/mapping[2]/underlay-topology
114 ${request_template} Set Element Text ${request_template} ${target-field} xpath=.//correlation/aggregation/mapping[2]/target-field
115 ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlation/aggregation/mapping[2]/input-model
116 ${request_template} Element to String ${request_template}
117 [Return] ${request_template}
119 Get Installed Features
120 [Documentation] Returns list of installed features as String
121 Open Connection ${CONTROLLER} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT} timeout=5
122 Flexible SSH Login ${KARAF_USER} ${KARAF_PASSWORD}
123 Write feature:list -i
124 ${features} Read until prompt
126 Log Installed features:
130 Insert Scripting into Request
131 [Arguments] ${request} ${language} ${script}
132 [Documentation] Insert Scripting into Request under aggregation node
133 ${request} Add Element ${request} ${SCRIPTING} xpath=.//correlation/aggregation
134 ${request} Set Element Text ${request} ${script} xpath=.//correlation/aggregation/scripting/script
135 ${request} Set Element Text ${request} ${language} xpath=.//correlation/aggregation/scripting/language
136 ${request} Element to String ${request}