topoprocessing unification test suite 91/27391/7
authorMatej Perina <matej.perina@pantheon.sk>
Wed, 21 Oct 2015 13:17:57 +0000 (15:17 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 21 Oct 2015 16:55:13 +0000 (16:55 +0000)
Change-Id: I94e840cd8376d34197ddd74ff88fad03e0c3bb53
Signed-off-by: Matej Perina <matej.perina@pantheon.sk>
csit/suites/topoprocessing/configuration.xml [new file with mode: 0644]
csit/suites/topoprocessing/operational.xml [new file with mode: 0644]
csit/suites/topoprocessing/topology-operations/010_Unifications_Tests.robot [new file with mode: 0644]
csit/testplans/topoprocessing-topology-operations.txt [new file with mode: 0644]
csit/variables/Variables.py
csit/variables/topoprocessing/Requests.py [new file with mode: 0644]

diff --git a/csit/suites/topoprocessing/configuration.xml b/csit/suites/topoprocessing/configuration.xml
new file mode 100644 (file)
index 0000000..0cf1d2b
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v1.0 which accompanies this distribution,
+    and is available at http://www.eclipse.org/legal/epl-v10.html-->
+<snapshot>
+    <required-capabilities>
+        <!-- topoprocessing -->
+        <capability>urn:opendaylight:params:xml:ns:yang:topoprocessing:provider?module=topoprocessing-provider&amp;revision=2015-02-09</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:topoprocessing:provider:impl?module=topoprocessing-provider-impl&amp;revision=2015-02-09</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom?module=opendaylight-md-sal-dom&amp;revision=2013-10-28</capability>
+    </required-capabilities>
+    <configuration>
+
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:topo="urn:opendaylight:params:xml:ns:yang:topoprocessing:provider:impl">topo:topoprocessing-provider-impl</type>
+                    <name>topoprocessing-provider-module</name>
+                    <datastore-type>CONFIGURATION</datastore-type>
+                    <schema-service>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                        <name>yang-schema-service</name>
+                    </schema-service>
+                    <dom-data-broker>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                        <name>pingpong-broker</name>
+                        <!-- <name>inmemory-data-broker</name> -->
+                    </dom-data-broker>
+                    <binding-normalized-node-serializer>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-normalized-node-serializer</type>
+                        <name>runtime-mapping-singleton</name>
+                    </binding-normalized-node-serializer>
+                    <broker>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+                        <name>dom-broker</name>
+                    </broker>
+                </module>
+            </modules>
+
+            <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <service>
+                    <type xmlns:topo="urn:opendaylight:params:xml:ns:yang:topoprocessing:provider">topo:topoprocessing-provider</type>
+                    <instance>
+                        <name>topoprocessing-provider</name>
+                        <provider>/modules/module[type='topoprocessing-provider-impl'][name='topoprocessing-provider-module']</provider>
+                    </instance>
+                </service>
+            </services>
+        </data>
+
+    </configuration>
+</snapshot>
diff --git a/csit/suites/topoprocessing/operational.xml b/csit/suites/topoprocessing/operational.xml
new file mode 100644 (file)
index 0000000..94c58f6
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v1.0 which accompanies this distribution,
+    and is available at http://www.eclipse.org/legal/epl-v10.html-->
+<snapshot>
+    <required-capabilities>
+        <!-- topoprocessing -->
+        <capability>urn:opendaylight:params:xml:ns:yang:topoprocessing:provider?module=topoprocessing-provider&amp;revision=2015-02-09</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:topoprocessing:provider:impl?module=topoprocessing-provider-impl&amp;revision=2015-02-09</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom?module=opendaylight-md-sal-dom&amp;revision=2013-10-28</capability>
+    </required-capabilities>
+    <configuration>
+
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:topo="urn:opendaylight:params:xml:ns:yang:topoprocessing:provider:impl">topo:topoprocessing-provider-impl</type>
+                    <name>topoprocessing-provider-module</name>
+                    <datastore-type>OPERATIONAL</datastore-type>
+                    <schema-service>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                        <name>yang-schema-service</name>
+                    </schema-service>
+                    <dom-data-broker>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                        <name>pingpong-broker</name>
+                        <!-- <name>inmemory-data-broker</name> -->
+                    </dom-data-broker>
+                    <binding-normalized-node-serializer>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-normalized-node-serializer</type>
+                        <name>runtime-mapping-singleton</name>
+                    </binding-normalized-node-serializer>
+                    <broker>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+                        <name>dom-broker</name>
+                    </broker>
+                </module>
+            </modules>
+
+            <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <service>
+                    <type xmlns:topo="urn:opendaylight:params:xml:ns:yang:topoprocessing:provider">topo:topoprocessing-provider</type>
+                    <instance>
+                        <name>topoprocessing-provider</name>
+                        <provider>/modules/module[type='topoprocessing-provider-impl'][name='topoprocessing-provider-module']</provider>
+                    </instance>
+                </service>
+            </services>
+        </data>
+
+    </configuration>
+</snapshot>
diff --git a/csit/suites/topoprocessing/topology-operations/010_Unifications_Tests.robot b/csit/suites/topoprocessing/topology-operations/010_Unifications_Tests.robot
new file mode 100644 (file)
index 0000000..ff45a0e
--- /dev/null
@@ -0,0 +1,79 @@
+*** 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 CONFIGURATION to OPERATIONAL.
+...               Need for this change is also a reason why main feature (odl-topoprocessing-framework) is installed after file change and not during boot.
+...               Tests themselves install feature required for specific model, clear karaf logs for futher synchronization, 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 Enviroment
+Suite Teardown    Test Teardown
+Library           RequestsLibrary
+Library           SSHLibrary
+Variables         ../../../variables/topoprocessing/Requests.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/KarafKeywords.robot
+
+*** Variables ***
+${CONFIGURATION_XML}    ${CURDIR}/../configuration.xml
+${OPERATIONAL_XML}    ${CURDIR}/../operational.xml
+${REMOTE_FILE}    ${WORKSPACE}/${BUNDLEFOLDER}/etc/opendaylight/karaf/80-topoprocessing-config.xml
+${OPERATIONAL}    /restconf/operational
+${CONFIGURATION}    /restconf/config
+
+*** Test Cases ***
+Unification on Network Topology
+    [Documentation]    Test unification operation on Network Topology model
+    Prepare New Feature Installation
+    Install a Feature    odl-topoprocessing-network-topology odl-bgpcep-pcep-all    timeout=30
+    Wait For Karaf Log    Registering Topology Request Listener
+    ${resp}    RequestsLibrary.Put    session    ${CONFIGURATION}/${TOPOLOGY_URL}/unif:1    data=${UNIFICATION_NT}
+    Log    ${CONFIGURATION}/${TOPOLOGY_URL}/unif:1
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Wait For Karaf Log    Correlation configuration successfully read
+    ${resp}    RequestsLibrary.Put    session    ${CONFIGURATION}/${TOPOLOGY_URL}/und-topo:1    data=${UNDERLAY_TOPOLOGY_1}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Issue Command On Karaf Console    log:clear
+    ${resp}    RequestsLibrary.Put    session    ${CONFIGURATION}/${TOPOLOGY_URL}/und-topo:2    data=${UNDERLAY_TOPOLOGY_2}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Wait For Karaf Log    Transaction successfully written
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL}/network-topology:network-topology
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Should Contain    ${resp.content}    <topology-id>unif:1</topology-id>
+    Should Contain X Times    ${resp.content}    <node-id>node:    9
+    Should Match Regexp    ${resp.content}    <node><node-id>node:.?</node-id>((<supporting-node><node-ref>pcep:5</node-ref><topology-ref>und-topo:1</topology-ref></supporting-node>)|(<supporting-node><node-ref>pcep:10</node-ref><topology-ref>und-topo:2</topology-ref></supporting-node>)){2}</node>
+
+*** Keywords ***
+Setup Enviroment
+    [Documentation]    Setup karaf enviroment for following tests
+    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-topoprocessing-framework odl-restconf-noauth    timeout=30
+    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${SEND_ACCEPT_XML_HEADERS}
+
+Test Teardown
+    [Documentation]    Revert startup changes
+    Open Connection    ${CONTROLLER}
+    Flexible Controller Login
+    Put File    ${OPERATIONAL_XML}    ${REMOTE_FILE}
+    Close Connection
+    Delete All Sessions
+
+Wait For Karaf Log
+    [Arguments]    ${message}
+    [Documentation]    Read karaf logs until message appear
+    Open Connection    ${CONTROLLER}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT}    timeout=60
+    Flexible SSH Login    ${KARAF_USER}    ${KARAF_PASSWORD}
+    Write    log:tail
+    Read Until    ${message}
+    Close Connection
+
+Prepare New Feature Installation
+    [Documentation]    Clears karaf logs and CONFIGURATION datastore
+    ${resp}    RequestsLibrary.Delete    session    ${CONFIGURATION}/network-topology:network-topology
+    Issue Command On Karaf Console    log:clear
diff --git a/csit/testplans/topoprocessing-topology-operations.txt b/csit/testplans/topoprocessing-topology-operations.txt
new file mode 100644 (file)
index 0000000..8ff5d8b
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order:
+integration/test/csit/suites/topoprocessing/topology-operations
index a74a61d5e96650261ffbbd729855afe5592107c3..71666a54186fa8ba470809dee9217cc85115be9e 100644 (file)
@@ -31,6 +31,8 @@ MININET_PASSWORD = ''  # empty means use keys
 KEYFILE_PASS = 'any'
 SSH_KEY = 'id_rsa'
 CONTROLLER_STOP_TIMEOUT = 120  # Max number of seconds test will wait for a controller to stop
+TOPOLOGY_URL = 'network-topology:network-topology/topology'
+SEND_ACCEPT_XML_HEADERS = {'Content-Type': 'application/xml', 'Accept': 'application/xml'}
 
 # KARAF Variaable
 KARAF_SHELL_PORT = '8101'
diff --git a/csit/variables/topoprocessing/Requests.py b/csit/variables/topoprocessing/Requests.py
new file mode 100644 (file)
index 0000000..85b05ea
--- /dev/null
@@ -0,0 +1,104 @@
+UNIFICATION_NT = '''<topology xmlns="urn:opendaylight:topology:correlation" xmlns:n="urn:TBD:params:xml:ns:yang:network-topology">
+                        <n:topology-id>unif:1</n:topology-id>
+                        <correlations>
+                            <output-model>network-topology-model</output-model>
+                            <correlation>
+                                <correlation-id>1</correlation-id>
+                                <type>aggregation-only</type>
+                                <correlation-item>node</correlation-item>
+                                <aggregation>
+                                    <aggregation-type>unification</aggregation-type>
+                                    <mapping>
+                                        <input-model>network-topology-model</input-model>
+                                        <underlay-topology>und-topo:1</underlay-topology>
+                                        <target-field>network-topology-pcep:path-computation-client/network-topology-pcep:ip-address</target-field>
+                                        <aggregate-inside>false</aggregate-inside>
+                                    </mapping>
+                                    <mapping>
+                                        <input-model>network-topology-model</input-model>
+                                        <underlay-topology>und-topo:2</underlay-topology>
+                                        <target-field>network-topology-pcep:path-computation-client/network-topology-pcep:ip-address</target-field>
+                                        <aggregate-inside>false</aggregate-inside>
+                                    </mapping>
+                                </aggregation>
+                            </correlation>
+                        </correlations>
+                    </topology>'''
+
+UNDERLAY_TOPOLOGY_1 = '''<topology
+                                xmlns="urn:TBD:params:xml:ns:yang:network-topology"
+                                xmlns:pcep="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+                            <topology-id>und-topo:1</topology-id>
+                            <topology-types>
+                                <pcep:topology-pcep></pcep:topology-pcep>
+                            </topology-types>
+                            <node>
+                                <node-id>pcep:1</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.1.1</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:2</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.1.2</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:3</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.1</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:4</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.2</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:5</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.3</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                        </topology>'''
+
+UNDERLAY_TOPOLOGY_2 = '''<topology
+                                xmlns="urn:TBD:params:xml:ns:yang:network-topology"
+                                xmlns:pcep="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+                            <topology-id>und-topo:2</topology-id>
+                            <topology-types>
+                                <pcep:topology-pcep></pcep:topology-pcep>
+                            </topology-types>
+                            <node>
+                                <node-id>pcep:6</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.1.3</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:7</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.1.4</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:8</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.4</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:9</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.5</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                            <node>
+                                <node-id>pcep:10</node-id>
+                                <pcep:path-computation-client>
+                                    <pcep:ip-address>192.168.2.3</pcep:ip-address>
+                                </pcep:path-computation-client>
+                            </node>
+                        </topology>'''