Fix for VTN Manager CSIT test failures for Beryllium.
[integration/test.git] / csit / suites / topoprocessing / topology-operations / 010_Unifications_Tests.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 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 Enviroment
8 Suite Teardown    Test Teardown
9 Library           RequestsLibrary
10 Library           SSHLibrary
11 Variables         ../../../variables/topoprocessing/Requests.py
12 Variables         ../../../variables/Variables.py
13 Resource          ../../../libraries/Utils.robot
14 Resource          ../../../libraries/KarafKeywords.robot
15
16 *** Variables ***
17 ${CONFIGURATION_XML}    ${CURDIR}/../configuration.xml
18 ${OPERATIONAL_XML}    ${CURDIR}/../operational.xml
19 ${REMOTE_FILE}    ${WORKSPACE}/${BUNDLEFOLDER}/etc/opendaylight/karaf/80-topoprocessing-config.xml
20 ${OPERATIONAL}    /restconf/operational
21 ${CONFIGURATION}    /restconf/config
22
23 *** Test Cases ***
24 Unification on Network Topology
25     [Documentation]    Test unification operation on Network Topology model
26     Prepare New Feature Installation
27     Install a Feature    odl-topoprocessing-network-topology odl-bgpcep-pcep-all    timeout=30
28     Wait For Karaf Log    Registering Topology Request Listener    300
29     ${resp}    RequestsLibrary.Put Request    session    ${CONFIGURATION}/${TOPOLOGY_URL}/unif:1    data=${UNIFICATION_NT}
30     Log    ${CONFIGURATION}/${TOPOLOGY_URL}/unif:1
31     Should Be Equal As Strings    ${resp.status_code}    200
32     Wait For Karaf Log    Correlation configuration successfully read
33     ${resp}    RequestsLibrary.Put Request    session    ${CONFIGURATION}/${TOPOLOGY_URL}/und-topo:1    data=${UNDERLAY_TOPOLOGY_1}
34     Log    ${resp.content}
35     Should Be Equal As Strings    ${resp.status_code}    200
36     Issue Command On Karaf Console    log:clear
37     ${resp}    RequestsLibrary.Put Request    session    ${CONFIGURATION}/${TOPOLOGY_URL}/und-topo:2    data=${UNDERLAY_TOPOLOGY_2}
38     Log    ${resp.content}
39     Should Be Equal As Strings    ${resp.status_code}    200
40     Wait For Karaf Log    Transaction successfully written
41     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL}/network-topology:network-topology
42     Log    ${resp.content}
43     Should Be Equal As Strings    ${resp.status_code}    200
44     Should Contain    ${resp.content}    <topology-id>unif:1</topology-id>
45     Should Contain X Times    ${resp.content}    <node-id>node:    9
46     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>
47
48 *** Keywords ***
49 Setup Enviroment
50     [Documentation]    Setup karaf enviroment for following tests
51     Open Connection    ${ODL_SYSTEM_IP}
52     Flexible Controller Login
53     Put File    ${CONFIGURATION_XML}    ${REMOTE_FILE}
54     Close Connection
55     Issue Command On Karaf Console    log:set DEBUG org.opendaylight.topoprocessing
56     Install a Feature    odl-topoprocessing-framework odl-restconf-noauth    timeout=30
57     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${SEND_ACCEPT_XML_HEADERS}
58
59 Test Teardown
60     [Documentation]    Revert startup changes
61     Open Connection    ${ODL_SYSTEM_IP}
62     Flexible Controller Login
63     Put File    ${OPERATIONAL_XML}    ${REMOTE_FILE}
64     Close Connection
65     Delete All Sessions
66
67 Wait For Karaf Log
68     [Arguments]    ${message}    ${timeout}=60
69     [Documentation]    Read karaf logs until message appear
70     Open Connection    ${ODL_SYSTEM_IP}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT}    timeout=${timeout}
71     Flexible SSH Login    ${KARAF_USER}    ${KARAF_PASSWORD}
72     Write    log:tail
73     Read Until    ${message}
74     Close Connection
75
76 Prepare New Feature Installation
77     [Documentation]    Clears karaf logs and CONFIGURATION datastore
78     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIGURATION}/network-topology:network-topology
79     Issue Command On Karaf Console    log:clear