Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / bgpcep / bgpclustering / 005_Cluster_Reset_And_Set_Nonreplicated_Bgp_Rib.robot
1 *** Settings ***
2 Documentation     Kill nodes, delete all data created since boot, change cluster configs,
3 ...               start nodes, wait for sync.
4 ...
5 ...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
6 ...
7 ...               This program and the accompanying materials are made available under the
8 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
9 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
10 Suite Setup       ClusterManagement.ClusterManagement_Setup
11 Default Tags      clustering    critical
12 Library           DateTime
13 Library           OperatingSystem
14 Library           SSHLibrary
15 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
16 Library           ${CURDIR}/../../../libraries/ConfGen.py
17 Library           Collections
18
19 *** Variables ***
20 ${MODULES_FILE}    modules.conf
21 ${MODULE_SHARDS_FILE}    module-shards.conf
22 ${RIB_SHARD_NAME}    bgp_rib
23 ${RIB_SHARD_NAMESPACE}    urn:opendaylight:params:xml:ns:yang:bgp-rib
24
25 *** Test Cases ***
26 Kill_All_Members
27     [Documentation]    Kill every node, download karaf logs.
28     ClusterManagement.Kill_Members_From_List_Or_All
29
30 Store_Karaf_Log_And_Clean_All
31     [Documentation]    Remove various data folders, including ${KARAF_HOME}/data/ on every node.
32     ...    Start each memberand wait for sync.
33     ClusterManagement.Store_Karaf_Log_On_List_Or_All
34     ClusterManagement.Clean_Directories_On_List_Or_All
35     ClusterManagement.Run_Bash_Command_On_List_Or_All    mkdir -p ${KARAF_HOME}/data/log
36     ClusterManagement.Restore_Karaf_Log_On_List_Or_All
37
38 Upload_Initial_Config_Files
39     [Documentation]    Upload config files for non-replicated bgp_rib
40     FOR    ${idx}    IN    @{ClusterManagement__member_index_list}
41         ${idxl}=    BuiltIn.Create_List    ${idx}
42         ClusterManagement.Safe_With_Ssh_To_List_Or_All_Run_Keyword    member_index_list=${idxl}    keyword_name=Set_Config_Files_With_Nonreplicated_Rib    index_list=${idxl}
43     END
44
45 Start_All_And_Sync
46     [Documentation]    Start each memberand wait for sync.
47     ClusterManagement.Start_Members_From_List_Or_All
48     BuiltIn.Comment    Basic synch performed, but waits for specific functionality may still be needed.
49     BuiltIn.Wait_Until_Keyword_Succeeds    2m    5s    Topology_Available
50     ClusterManagement.Run_Bash_Command_On_List_Or_All    ps -ef | grep java
51
52 *** Keywords ***
53 Download_Karaf_Log
54     ${timestamp} =    DateTime.Get_Current_Date    time_zone=UTC    result_format=%Y%m%d%H%M%S%f
55     SSHLibrary.Get_File    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}data${/}log${/}karaf.log    karaf_${timestamp}.log
56
57 Topology_Available
58     ${session}=    ClusterManagement.Resolve_Http_Session_For_Member    1
59     TemplatedRequests.Get_As_Json_From_Uri    /restconf/operational/network-topology:network-topology/topology/example-ipv4-topology    session=${session}
60
61 Set_Config_Files_With_Nonreplicated_Rib
62     [Arguments]    ${index_list}
63     ${modules_file}=    SSHLibrary.Execute_Command    ls ${WORKSPACE}${/}${BUNDLEFOLDER}${/}system${/}org${/}opendaylight${/}controller${/}sal-clustering-config${/}*${/}*-moduleconf.xml
64     ${module_shards_file}=    SSHLibrary.Execute_Command    ls ${WORKSPACE}${/}${BUNDLEFOLDER}${/}system${/}org${/}opendaylight${/}controller${/}sal-clustering-config${/}*${/}*-moduleshardconf.xml
65     SSHLibrary.Get File    ${modules_file}    ${CURDIR}${/}${MODULES_FILE}.tmpl
66     SSHLibrary.Get File    ${module_shards_file}    ${CURDIR}${/}${MODULE_SHARDS_FILE}.tmpl
67     ${modules_content}=    ConfGen.Generate_Modules    ${CURDIR}${/}${MODULES_FILE}.tmpl    name=${RIB_SHARD_NAME}    namespace=${RIB_SHARD_NAMESPACE}
68     ${ms_content}=    ConfGen.Generate_Module_Shards    ${CURDIR}${/}${MODULE_SHARDS_FILE}.tmpl    nodes=${NUM_ODL_SYSTEM}    shard_name=${RIB_SHARD_NAME}    replicas=${index_list}
69     OperatingSystem.Create File    ${CURDIR}${/}${MODULES_FILE}    ${modules_content}
70     OperatingSystem.Create File    ${CURDIR}${/}${MODULE_SHARDS_FILE}    ${ms_content}
71     SSHLibrary.Put File    ${CURDIR}${/}${MODULES_FILE}    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULES_FILE}
72     SSHLibrary.Put File    ${CURDIR}${/}${MODULE_SHARDS_FILE}    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULE_SHARDS_FILE}
73     ${stdout}    ${stderr}=    SSHLibrary.Execute_Command    cat ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULES_FILE}    return_stderr=True
74     BuiltIn.Log    ${stdout}
75     BuiltIn.Should_Be_Empty    ${stderr}
76     ${stdout}    ${stderr}=    SSHLibrary.Execute_Command    cat ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULE_SHARDS_FILE}    return_stderr=True
77     BuiltIn.Log    ${stdout}
78     BuiltIn.Should_Be_Empty    ${stderr}