Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / controller / dom_data_broker / restart_odl_with_tell_based_false.robot
1 *** Settings ***
2 Documentation     Unset tell-based protocol usage
3 ...
4 ...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...               Suite stops all odl nodes, outcomment usage of tell-based protocol in
11 ...               config file (means make it false by default) and starts all nodes again.
12 Suite Setup       SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=125
13 Suite Teardown    SSHLibrary.Close_All_Connections
14 Default Tags      critical
15 Library           SSHLibrary
16 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
17 Resource          ${CURDIR}/../../../libraries/ShardStability.robot
18 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
19 Resource          ${CURDIR}/../../../libraries/controller/DdbCommons.robot
20
21 *** Variables ***
22 ${DATASTORE_CFG}    /${WORKSPACE}/${BUNDLEFOLDER}/etc/org.opendaylight.controller.cluster.datastore.cfg
23
24 *** Test Cases ***
25 Stop_All_Members
26     [Documentation]    Stop every odl node.
27     ClusterManagement.Stop_Members_From_List_Or_All
28
29 Unset_Tell_Based_Protocol_Usage
30     [Documentation]    Comment out the flag usage in config file. Also clean most data except data/log/.
31     DdbCommons.Change_Use_Tell_Based_Protocol    False    ${DATASTORE_CFG}
32     ClusterManagement.Check_Bash_Command_On_List_Or_All    cat ${DATASTORE_CFG}
33     ClusterManagement.Clean_Directories_On_List_Or_All    tmp_dir=/tmp
34
35 Start_All_And_Sync
36     [Documentation]    Start each member and wait for sync.
37     ClusterManagement.Start_Members_From_List_Or_All
38     BuiltIn.Wait_Until_Keyword_Succeeds    60s    10s    ClusterManagement.Run_Bash_Command_On_List_Or_All    netstat -punta
39     ${index_list} =    List_Indices_Or_All
40     FOR    ${index}    IN    @{index_list}
41         ${output} =    ClusterManagement.Check_Bash_Command_On_Member    command=sudo netstat -punta | grep 2550 | grep LISTEN    member_index=${index}
42         ${listening} =    Get Match    ${output}    LISTEN
43         BuiltIn.Run Keyword If    '${listening}' == 'None'    ClusterManagement.Check_Bash_Command_On_Member    command=pid=$(grep org.apache.karaf.main.Main | grep -v grep | tr -s ' ' | cut -f2 -d' '); sudo /usr/lib/jvm/java-1.8.0/bin/jstack -l ${pid}    member_index=${index}
44     END
45     BuiltIn.Wait_Until_Keyword_Succeeds    60s    10s    ShardStability.Shards_Stability_Get_Details    ${DEFAULT_SHARD_LIST}    verify_restconf=True
46
47 *** Keywords ***
48 Get Match
49     [Arguments]    ${text}    ${regexp}    ${index}=0
50     [Documentation]    Wrapper around String.Get Regexp Matches to return None if not found or the first match if found.
51     @{matches} =    String.Get Regexp Matches    ${text}    ${regexp}
52     ${matches_length} =    BuiltIn.Get Length    ${matches}
53     BuiltIn.Set Suite Variable    ${OS_MATCH}    None
54     BuiltIn.Run Keyword If    ${matches_length} > ${index}    BuiltIn.Set Suite Variable    ${OS_MATCH}    @{matches}[${index}]
55     [Return]    ${OS_MATCH}