157c04950b500f3ef1e98a3402a793aaa9c9a343
[integration/test.git] / tools / Robot_Tool / suites / ha / 005__two_controller_running.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 Two controllers running
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 is up and running
28     And C2 is up and running
29     Then the system is working with C1 and C2
30      
31
32
33 *** Keywords ***
34 C1 is up and running
35     Open Browser To Login Page 1
36     Input Username    admin
37     Input Password    admin
38     Submit Credentials
39     Welcome Page 1 Should Be Open
40     [Teardown]    Close Browser
41
42 C2 is up and running
43     Open Browser To Login Page 2
44     Input Username    admin
45     Input Password    admin
46     Submit Credentials
47     Welcome Page 2 Should Be Open
48     [Teardown]    Close Browser
49
50
51 Open Browser To Login Page 1
52     Set Selenium Speed    ${DELAY2}
53     Open Browser    ${LOGIN URL1}    ${BROWSER}
54     Maximize Browser Window
55     Login Page Should Be Open
56
57 Open Browser To Login Page 2
58     Set Selenium Speed    ${DELAY2}
59     Open Browser    ${LOGIN URL2}    ${BROWSER}
60     Maximize Browser Window
61     Login Page Should Be Open
62
63 Login Page Should Be Open
64     Title Should Be    OpenDaylight - Login
65
66 Input Username
67     [Arguments]    ${username}
68     Input Text    j_username    ${username}
69
70 Input Password
71     [Arguments]    ${password}
72     Input Text    j_password    ${password}
73
74 Submit Credentials
75     Click Button    Log In
76
77 Welcome Page 1 Should Be Open
78     Location Should Be    ${LOGIN URL1}
79     Title Should Be    OpenDaylight
80
81 Welcome Page 2 Should Be Open
82     Location Should Be    ${LOGIN URL2}
83     Title Should Be    OpenDaylight
84
85 C1 a controller in cluster of two controllers
86     Open Connection    ${Controller1_IP}    prompt=>
87     Login    ${VM USERNAME}    ${VM PASSWORD}
88     Write    cd controller-base/opendaylight
89     Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
90     Open Connection    ${HOST}
91     Login    ${VM USERNAME}    ${VM PASSWORD}
92     ${stdout}=    Execute Command    sudo ovs-vsctl show
93     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
94     
95
96
97 C2 a controller in cluster of two controllers
98     Open Connection    ${Controller2_IP}    prompt=>
99     Login    ${VM USERNAME}    ${VM PASSWORD}
100     Write    cd controller-base/opendaylight
101     Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
102     Open Connection    ${HOST}
103     Login    ${VM USERNAME}    ${VM PASSWORD}
104     ${stdout}=    Execute Command    sudo ovs-vsctl show
105     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
106
107
108 all switches are introduced to both controllers
109     Open Connection    ${HOST}
110     Login    ${VM USERNAME}    ${VM PASSWORD}
111 #   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
112 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
113 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
114     ${stdout}=    Execute Command   sudo ovs-vsctl show
115     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
116     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
117     Should Contain     ${stdout}    Bridge "s1"
118     Should Contain     ${stdout}    Bridge "s2"
119     Should Contain     ${stdout}    Bridge "s3"
120     Should Contain X Times    ${stdout}    is_connected: true    6
121     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
122     Should Contain     ${stdout}    ${CONTROLLER1}
123     Should Contain     ${stdout}    ${CONTROLLER2}
124     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
125     Should Contain     ${stdout}    ${CONTROLLER1}
126     Should Contain     ${stdout}    ${CONTROLLER2}
127     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
128     Should Contain     ${stdout}    ${CONTROLLER1}
129     Should Contain     ${stdout}    ${CONTROLLER2}
130                 
131
132 the system is working with C1 and C2
133     ${headers}    Create Dictionary    Content-Type=application/json
134     Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
135     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
136     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
137     Log    ${resp.content}
138     Should Contain X Times  ${resp.content}   ${nodeconn1}   2
139     Should Contain X Times  ${resp.content}   ${nodeconn2}   2
140     Should Contain X Times  ${resp.content}   ${nodeconn3}   2
141     Should Contain X Times  ${resp.content}   ${nodeconn4}   2
142
143     ${headers}    Create Dictionary    Content-Type=application/json
144     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
145     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
146     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
147     Log    ${resp.content}
148     Should Contain X Times  ${resp.content}   ${nodeconn1}   2
149     Should Contain X Times  ${resp.content}   ${nodeconn2}   2
150     Should Contain X Times  ${resp.content}   ${nodeconn3}   2
151     Should Contain X Times  ${resp.content}   ${nodeconn4}   2
152
153
154