Step 1: Move vm scripts to the right place
[integration/test.git] / tools / Robot_Tool / suites / ha / 010__c1_fails.txt
1 *** Settings ***
2 Documentation     ODL controller clustering test case using the gherkin syntax.
3 ...
4 ...               This test has a workflow similar to the keyword-driven
5 ...               examples. The difference is that the keywords use higher
6 ...               abstraction level and their arguments are embedded into
7 ...               the keyword names.
8 ...
9 ...               This kind of _gherkin_ syntax has been made popular by
10 ...               [http://cukes.info|Cucumber]. It works well especially when
11 ...               tests act as examples that need to be easily understood also
12 ...               by the business people.
13 Resource          resource.txt
14 Library           Selenium2Library
15 Library           SSHLibrary
16 Library           Collections
17 Library           RequestsLibrary
18 Library           ../../libraries/Common.py
19 Variables         ../../variables/Variables.py
20
21
22 *** Test Cases ***
23 Controller1 fails
24     Given C1 a controller in cluster of two controllers
25     And C2 a controller in cluster of two controllers
26     And all switches are introduced to both controllers
27     When C1 goes down
28     Then C2 takes over 
29     And the system is working with C2
30
31
32 *** Keywords ***
33 C1 goes down
34     Open Connection    ${Controller1_IP}    prompt=>
35     Login    ${VM USERNAME}    ${VM PASSWORD}
36     Write    cd controller-base/opendaylight
37     Write    sudo ./run.sh -stop
38     Set Selenium Speed    ${DELAY2}
39     Open Browser    ${LOGIN URL1}    ${BROWSER}
40     Maximize Browser Window
41     Set Selenium Speed    ${DELAY}
42     Location Should Be    ${ERROR URL1}
43     Title Should Be    Problem loading page
44     [Teardown]    Close Browser
45
46
47 C1 a controller in cluster of two controllers
48 #    Open Connection    ${Controller1_IP}    prompt=>
49 #    Login    ${VM USERNAME}    ${VM PASSWORD}
50 #    Write    cd controller-base/opendaylight
51 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
52     Open Connection    ${HOST}
53     Login    ${VM USERNAME}    ${VM PASSWORD}
54     ${stdout}=    Execute Command    sudo ovs-vsctl show
55     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
56     
57
58
59 C2 a controller in cluster of two controllers
60 #    Open Connection    ${Controller2_IP}    prompt=>
61 #    Login    ${VM USERNAME}    ${VM PASSWORD}
62 #    Write    cd controller-base/opendaylight
63 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
64     Open Connection    ${HOST}
65     Login    ${VM USERNAME}    ${VM PASSWORD}
66     ${stdout}=    Execute Command    sudo ovs-vsctl show
67     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
68
69
70 all switches are introduced to both controllers
71     Open Connection    ${HOST}
72     Login    ${VM USERNAME}    ${VM PASSWORD}
73 #   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
74 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
75 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
76     ${stdout}=    Execute Command   sudo ovs-vsctl show
77     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
78     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
79     Should Contain     ${stdout}    Bridge "s1"
80     Should Contain     ${stdout}    Bridge "s2"
81     Should Contain     ${stdout}    Bridge "s3"
82     Should Contain X Times    ${stdout}    is_connected: true    6
83     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
84     Should Contain     ${stdout}    ${CONTROLLER1}
85     Should Contain     ${stdout}    ${CONTROLLER2}
86     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
87     Should Contain     ${stdout}    ${CONTROLLER1}
88     Should Contain     ${stdout}    ${CONTROLLER2}
89     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
90     Should Contain     ${stdout}    ${CONTROLLER1}
91     Should Contain     ${stdout}    ${CONTROLLER2}
92                 
93
94 the system is working with C2
95     ${headers}    Create Dictionary    Content-Type    application/json
96     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
97     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
98     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
99     Log    ${resp.content}
100     Should Contain X Times  ${resp.content}   ${nodeconn1}   2
101     Should Contain X Times  ${resp.content}   ${nodeconn2}   2
102     Should Contain X Times  ${resp.content}   ${nodeconn3}   2
103     Should Contain X Times  ${resp.content}   ${nodeconn4}   2
104
105
106 C2 takes over 
107     Open Connection    ${HOST}
108     Login    ${VM USERNAME}    ${VM PASSWORD}
109     ${stdout}=    Execute Command   sudo ovs-vsctl show
110     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
111     Should Contain X Times    ${stdout}    is_connected: true    3
112
113
114
115