Migrate Get Requests invocations(libraries)
[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
13 Library             SSHLibrary
14 Resource            ${CURDIR}/../../../libraries/ClusterManagement.robot
15 Resource            ${CURDIR}/../../../libraries/ShardStability.robot
16 Resource            ${CURDIR}/../../../libraries/SetupUtils.robot
17 Resource            ${CURDIR}/../../../libraries/controller/DdbCommons.robot
18
19 Suite Setup         SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=125
20 Suite Teardown      SSHLibrary.Close_All_Connections
21
22 Default Tags        critical
23
24
25 *** Variables ***
26 ${DATASTORE_CFG}    /${WORKSPACE}/${BUNDLEFOLDER}/etc/org.opendaylight.controller.cluster.datastore.cfg
27
28
29 *** Test Cases ***
30 Stop_All_Members
31     [Documentation]    Stop every odl node.
32     ClusterManagement.Stop_Members_From_List_Or_All
33
34 Unset_Tell_Based_Protocol_Usage
35     [Documentation]    Comment out the flag usage in config file. Also clean most data except data/log/.
36     DdbCommons.Change_Use_Tell_Based_Protocol    False    ${DATASTORE_CFG}
37     ClusterManagement.Check_Bash_Command_On_List_Or_All    cat ${DATASTORE_CFG}
38     ClusterManagement.Clean_Directories_On_List_Or_All    tmp_dir=/tmp
39
40 Start_All_And_Sync
41     [Documentation]    Start each member and wait for sync.
42     ClusterManagement.Start_Members_From_List_Or_All
43     BuiltIn.Wait_Until_Keyword_Succeeds
44     ...    60s
45     ...    10s
46     ...    ClusterManagement.Run_Bash_Command_On_List_Or_All
47     ...    netstat -punta
48     ${index_list} =    List_Indices_Or_All
49     FOR    ${index}    IN    @{index_list}
50         ${output} =    ClusterManagement.Check_Bash_Command_On_Member
51         ...    command=sudo netstat -punta | grep 2550 | grep LISTEN
52         ...    member_index=${index}
53         ${listening} =    Get Match    ${output}    LISTEN
54         IF    '${listening}' == 'None'
55             ClusterManagement.Check_Bash_Command_On_Member
56             ...    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}
57             ...    member_index=${index}
58         END
59     END
60     BuiltIn.Wait_Until_Keyword_Succeeds
61     ...    60s
62     ...    10s
63     ...    ShardStability.Shards_Stability_Get_Details
64     ...    ${DEFAULT_SHARD_LIST}
65     ...    verify_restconf=True
66
67
68 *** Keywords ***
69 Get Match
70     [Documentation]    Wrapper around String.Get Regexp Matches to return None if not found or the first match if found.
71     [Arguments]    ${text}    ${regexp}    ${index}=0
72     @{matches} =    String.Get Regexp Matches    ${text}    ${regexp}
73     ${matches_length} =    BuiltIn.Get Length    ${matches}
74     BuiltIn.Set Suite Variable    ${OS_MATCH}    None
75     IF    ${matches_length} > ${index}
76         BuiltIn.Set Suite Variable    ${OS_MATCH}    ${matches}[${index}]
77     END
78     RETURN    ${OS_MATCH}