From: Andrej Záň Date: Wed, 18 Nov 2015 12:12:38 +0000 (+0100) Subject: add aggregation basic keywords and testcase X-Git-Tag: release/beryllium-sr1~264 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F29913%2F13;p=integration%2Ftest.git add aggregation basic keywords and testcase Change-Id: Iddc89e194bc842e52d72b3c8c5340c62d3e97484 Signed-off-by: Andrej Záň Signed-off-by: Samuel Kontriš --- diff --git a/csit/libraries/KarafKeywords.robot b/csit/libraries/KarafKeywords.robot index 84e62513f9..303213b9c2 100644 --- a/csit/libraries/KarafKeywords.robot +++ b/csit/libraries/KarafKeywords.robot @@ -168,3 +168,13 @@ Set Bgpcep Log Levels # FIXME: Move to appropriate Resource Execute Controller Karaf Command On Background log:set ${bgpcep_level} org.opendaylight.bgpcep Execute Controller Karaf Command On Background log:set ${protocol_level} org.opendaylight.protocol + +Wait For Karaf Log + [Arguments] ${message} ${timeout}=60 + [Documentation] Read karaf logs until message appear + Log Waiting for '${message}' in karaf log + Open Connection ${CONTROLLER} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT} timeout=${timeout} + Flexible SSH Login ${KARAF_USER} ${KARAF_PASSWORD} + Write log:tail + Read Until ${message} + Close Connection diff --git a/csit/libraries/TopoprocessingKeywords.robot b/csit/libraries/TopoprocessingKeywords.robot new file mode 100644 index 0000000000..476a5fa08e --- /dev/null +++ b/csit/libraries/TopoprocessingKeywords.robot @@ -0,0 +1,128 @@ +*** Settings *** +Variables ../variables/Variables.py +Variables ../variables/topoprocessing/Topologies.py +Library RequestsLibrary +Library SSHLibrary +Library XML +Resource KarafKeywords.robot +Resource Utils.robot + +*** Variables *** +${CONFIGURATION_XML} ${CURDIR}/../suites/topoprocessing/configuration.xml +${OPERATIONAL_XML} ${CURDIR}/../suites/topoprocessing/operational.xml +${REMOTE_FILE} ${WORKSPACE}/${BUNDLEFOLDER}/etc/opendaylight/karaf/80-topoprocessing-config.xml + +*** Keywords *** +Send Basic Request + [Arguments] ${request} ${overlay_topology_url} + [Documentation] Test basic aggregation + ${resp} Put Request session ${CONFIG_API}/${overlay_topology_url} data=${request} + Log ${CONFIG_API}/${overlay_topology_url} + Should Be Equal As Strings ${resp.status_code} 200 + Wait For Karaf Log Correlation configuration successfully read + Wait For Karaf Log Transaction successfully written + ${resp} Get Request session ${OPERATIONAL_API}/${overlay_topology_url} + Should Be Equal As Strings ${resp.status_code} 200 + Log ${resp.content} + [Return] ${resp} + +Setup Environment + [Documentation] Setup karaf enviroment for following tests + Log ---- Setup Environment ---- + Open Connection ${CONTROLLER} + Flexible Controller Login + Put File ${CONFIGURATION_XML} ${REMOTE_FILE} + Close Connection + Issue Command On Karaf Console log:set DEBUG org.opendaylight.topoprocessing + Install a Feature odl-restconf-noauth timeout=30 + Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${SEND_ACCEPT_XML_HEADERS} + ${features} Get Installed Features + ${lines} Get Lines Containing String ${features} odl-topoprocessing-framework + ${length} Get Length ${lines} + Install a Feature odl-openflowplugin-nsf-model-li odl-topoprocessing-framework odl-topoprocessing-network-topology odl-topoprocessing-inventory odl-bgpcep-pcep-all timeout=100 + Run Keyword If ${length} == 0 Wait For Karaf Log Registering Topology Request Listener 60 + Prepare New Feature Installation + Insert Underlay topologies + +Clean Environment + [Documentation] Revert startup changes + Log ---- Clean Environment ---- + Open Connection ${CONTROLLER} + Flexible Controller Login + Put File ${OPERATIONAL_XML} ${REMOTE_FILE} + Close Connection + Delete All Sessions + +Test Teardown + [Arguments] ${overlay_topology} + [Documentation] Delete overlay topologies from datastore + Log ---- Test Teardown ---- + Log Deleting overlay topology from ${CONFIG_API}/${overlay_topology} + ${resp} Delete Request session ${CONFIG_API}/${overlay_topology} + Should Be Equal As Strings ${resp.status_code} 200 + +Prepare New Feature Installation + [Documentation] Clears karaf logs and CONFIGURATION datastore + ${resp} Delete Request session ${CONFIG_API}/network-topology:network-topology + ${resp} Delete Request session ${CONFIG_API}/opendaylight-inventory:nodes + Issue Command On Karaf Console log:clear + +Insert Underlay Topologies + [Documentation] Insert underlay topologies used by following tests + Log Inserting underlay topologies + # Network underlay topology 1 + ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:1 data=${NETWORK_UNDERLAY_TOPOLOGY_1} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + # Network underlay topology 2 + ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:2 data=${NETWORK_UNDERLAY_TOPOLOGY_2} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + # Openflow underlay nodes + ${resp} Put Request session ${CONFIG_API}/opendaylight-inventory:nodes data=${OPENFLOW_UNDERLAY_NODES} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + # Openflow underlay topology 1 + ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:1 data=${OPENFLOW_UNDERLAY_TOPOLOGY_1} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + # Openflow underlay topology 2 + ${resp} Put Request session ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:2 data=${OPENFLOW_UNDERLAY_TOPOLOGY_2} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + Issue Command On Karaf Console log:clear + Log ${resp.content} + +Prepare Unification Inside Topology Request + [Arguments] ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1} + [Documentation] Prepare topology request for unification inside from template + ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlations/output-model + ${request_template} Set Element Text ${request_template} aggregation-only xpath=.//correlations/correlation/type + ${request_template} Set Element Text ${request_template} ${correlation_item} xpath=.//correlation/correlation-item + ${request_template} Set Element Text ${request_template} unification xpath=.//correlation/aggregation/aggregation-type + ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlation/aggregation/mapping[1]/input-model + ${request_template} Set Element Text ${request_template} ${underlay_topo1} xpath=.//correlation/aggregation/mapping[1]/underlay-topology + ${request_template} Set Element Text ${request_template} ${target-field} xpath=.//correlation/aggregation/mapping[1]/target-field + ${request_template} Element to String ${request_template} + [Return] ${request_template} + +Prepare Unification Topology Request + [Arguments] ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1} ${underlay_topo2} + [Documentation] Prepare topology request for unification on two topologies from template + ${request_template} Prepare Unification Inside Topology Request ${request_template} ${model} ${correlation_item} ${target-field} ${underlay_topo1} + ${request_template} Set Element Text ${request_template} ${underlay_topo2} xpath=.//correlation/aggregation/mapping[2]/underlay-topology + ${request_template} Set Element Text ${request_template} ${target-field} xpath=.//correlation/aggregation/mapping[2]/target-field + ${request_template} Set Element Text ${request_template} ${model} xpath=.//correlation/aggregation/mapping[2]/input-model + ${request_template} Element to String ${request_template} + [Return] ${request_template} + +Get Installed Features + [Documentation] Returns list of installed features as String + Open Connection ${CONTROLLER} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT} timeout=5 + Flexible SSH Login ${KARAF_USER} ${KARAF_PASSWORD} + Write feature:list -i + ${features} Read until prompt + Close Connection + Log Installed features: + Log ${features} + [Return] ${features} diff --git a/csit/suites/topoprocessing/basic-topology-operations/010_Aggregation.robot b/csit/suites/topoprocessing/basic-topology-operations/010_Aggregation.robot new file mode 100644 index 0000000000..f8e441e862 --- /dev/null +++ b/csit/suites/topoprocessing/basic-topology-operations/010_Aggregation.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Test suite to verify unification operation on different models. +... Before test starts, configurational file have to be rewriten to change listners registration datastore type from CONFIG_API to OPERATIONAL_API. +... Need for this change is also a reason why main feature (odl-topoprocessing-framework) is installed after file change and not during boot. +... Suite setup also install features required for tested models, clear karaf logs for further synchronization. Tests themselves send configurational +... 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. +Suite Setup Setup Environment +Suite Teardown Clean Environment +Test Teardown Test Teardown network-topology:network-topology/topology/topo:1 +Library RequestsLibrary +Library SSHLibrary +Library XML +Variables ../../../variables/topoprocessing/TopologyRequests.py +Variables ../../../variables/Variables.py +Resource ../../../libraries/KarafKeywords.robot +Resource ../../../libraries/Utils.robot +Resource ../../../libraries/TopoprocessingKeywords.robot + +*** Test Cases *** +Unification Node + [Documentation] Test unification operation on Network Topology model + ${request} Prepare Unification Topology Request ${UNIFICATION_NT} network-topology-model node network-topology-pcep:path-computation-client/network-topology-pcep:ip-address network-topo:1 + ... network-topo:2 + ${resp} Send Basic Request ${request} network-topology:network-topology/topology/topo:1 + Should Contain ${resp.content} topo:1 + Should Contain X Times ${resp.content} node: 9 + : FOR ${index} IN RANGE 1 9 + \ Should Contain X Times ${resp.content} pcep:${index} 1 + ${node} Get Element ${resp.content} xpath=.//node/supporting-node[node-ref='pcep:10']/.. + ${node} Element to String ${node} + Should Contain X Times ${node} pcep:10 1 + Should Contain X Times ${node} pcep:5 1 + +Unification Node Inventory + [Documentation] Test unification operation on inventory model + ${request} Prepare Unification Topology Request ${UNIFICATION_NT} opendaylight-inventory-model node flow-node-inventory:ip-address openflow-topo:1 + ... openflow-topo:2 + ${resp} Send Basic Request ${request} network-topology:network-topology/topology/topo:1 + Should Contain ${resp.content} topo:1 + Should Contain X Times ${resp.content} node: 8 + : FOR ${index} IN RANGE 1 10 + \ Should Contain X Times ${resp.content} of-node:${index} 1 + ${node} Get Element ${resp.content} xpath=.//node/supporting-node[node-ref='of-node:1']/.. + ${node} Element to String ${node} + Should Contain X Times ${node} of-node:6 1 + Should Contain X Times ${node} of-node:1 1 + ${node} Get Element ${resp.content} xpath=.//node/supporting-node[node-ref='of-node:4']/.. + ${node} Element to String ${node} + Should Contain X Times ${node} of-node:10 1 + Should Contain X Times ${node} of-node:4 1 diff --git a/csit/variables/topoprocessing/Topologies.py b/csit/variables/topoprocessing/Topologies.py new file mode 100644 index 0000000000..427074d8d1 --- /dev/null +++ b/csit/variables/topoprocessing/Topologies.py @@ -0,0 +1,192 @@ +NETWORK_UNDERLAY_TOPOLOGY_1 = ''' + network-topo:1 + + + + + pcep:1 + + 192.168.1.1 + + + + pcep:2 + + 192.168.1.2 + + + + pcep:3 + + 192.168.2.1 + + + + pcep:4 + + 192.168.2.2 + + + + pcep:5 + + 192.168.2.3 + + + ''' + +NETWORK_UNDERLAY_TOPOLOGY_2 = ''' + network-topo:2 + + + + + pcep:6 + + 192.168.1.3 + + + + pcep:7 + + 192.168.1.4 + + + + pcep:8 + + 192.168.2.4 + + + + pcep:9 + + 192.168.2.5 + + + + pcep:10 + + 192.168.2.3 + + + ''' + +OPENFLOW_UNDERLAY_NODES = ''' + + + openflow:1 + Pantheon Technologies + 192.168.1.1 + + + openflow:2 + Pantheon Technologies + 192.168.1.2 + + + openflow:3 + Pantheon Technologies + 192.168.1.3 + + + openflow:4 + Cisco + 192.168.2.1 + + + openflow:5 + Cisco + 192.168.2.2 + + + openflow:6 + Pantheon Technologies + 192.168.1.1 + + + openflow:7 + Pantheon Technologies + 192.168.2.3 + + + openflow:8 + Cisco + 192.168.1.4 + + + openflow:9 + Cisco + 192.168.1.5 + + + openflow:10 + Cisco + 192.168.2.1 + + +''' + +OPENFLOW_UNDERLAY_TOPOLOGY_1 = ''' + + openflow-topo:1 + + of-node:1 + /inventory:nodes/inventory:node[inventory:id="openflow:1"] + + + of-node:2 + /inventory:nodes/inventory:node[inventory:id="openflow:2"] + + + of-node:3 + /inventory:nodes/inventory:node[inventory:id="openflow:3"] + + + of-node:4 + /inventory:nodes/inventory:node[inventory:id="openflow:4"] + + + of-node:5 + /inventory:nodes/inventory:node[inventory:id="openflow:5"] + + +''' + +OPENFLOW_UNDERLAY_TOPOLOGY_2 = ''' + + openflow-topo:2 + + of-node:6 + /inventory:nodes/inventory:node[inventory:id="openflow:6"] + + + of-node:7 + /inventory:nodes/inventory:node[inventory:id="openflow:7"] + + + of-node:8 + /inventory:nodes/inventory:node[inventory:id="openflow:8"] + + + of-node:9 + /inventory:nodes/inventory:node[inventory:id="openflow:9"] + + + of-node:10 + /inventory:nodes/inventory:node[inventory:id="openflow:10"] + + +''' diff --git a/csit/variables/topoprocessing/TopologyRequests.py b/csit/variables/topoprocessing/TopologyRequests.py new file mode 100644 index 0000000000..163f0de801 --- /dev/null +++ b/csit/variables/topoprocessing/TopologyRequests.py @@ -0,0 +1,73 @@ +UNIFICATION_NT = ''' + topo:1 + + {output-model} + + 1 + {type} + {correlation-item} + + {aggregation-type} + + {input-model} + {underlay-topology-id} + {target-field} + false + + + {input-model} + {underlay-topology-id} + {target-field} + false + + + + + ''' + +UNIFICATION_NT_AGREGATE_INSIDE = ''' + topo:1 + + {output-model} + + 1 + {type} + {correlation-item} + + {aggregation-type} + + {input-model} + {underlay-topology-id} + {target-field} + true + + + + + ''' + +FILTRATION_NT = ''' + topo:1 + + {output-model} + + 1 + filtration-only + {correlation-item} + + {underlay-topology-id} + + + + + ''' + +FILTER_IPV4 = ''' + {input-model} + 1 + {target-field} + ipv4-address + + {ipv4} + + '''