Step 2: Move test folder to root
[integration/test.git] / tools / Robot_Tool / suites / ha / 035__installed_flow_remains.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
23 The installed flow remains in the bridge after the controller failure
24     Given C1 a controller in cluster of two controllers
25     And C2 a controller in cluster of two controllers
26     And both controllers get provisioned on all OVS bridges
27     And a flow is installed in a bridge
28     And C1 see the flow
29     And C2 see the flow
30     And C1 goes down
31     When C1 recovers
32     Then C1 see the flow
33      
34
35
36 *** Keywords ***
37 C1 a controller in cluster of two controllers
38 #    Open Connection    ${Controller1_IP}    prompt=>
39 #    Login    ${VM USERNAME}    ${VM PASSWORD}
40 #    Write    cd controller-base/opendaylight
41 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
42     Open Connection    ${HOST}
43     Login    ${VM USERNAME}    ${VM PASSWORD}
44     ${stdout}=    Execute Command    sudo ovs-vsctl show
45     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
46     
47
48
49 C2 a controller in cluster of two controllers
50 #    Open Connection    ${Controller2_IP}    prompt=>
51 #    Login    ${VM USERNAME}    ${VM PASSWORD}
52 #    Write    cd controller-base/opendaylight
53 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
54     Open Connection    ${HOST}
55     Login    ${VM USERNAME}    ${VM PASSWORD}
56     ${stdout}=    Execute Command    sudo ovs-vsctl show
57     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
58
59
60 both controllers get provisioned on all OVS bridges
61     Open Connection    ${HOST}
62     Login    ${VM USERNAME}    ${VM PASSWORD}
63 #   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
64 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
65 #   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
66     ${stdout}=    Execute Command   sudo ovs-vsctl show
67     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
68     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
69     Should Contain     ${stdout}    Bridge "s1"
70     Should Contain     ${stdout}    Bridge "s2"
71     Should Contain     ${stdout}    Bridge "s3"
72     Should Contain X Times    ${stdout}    is_connected: true    6
73     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
74     Should Contain     ${stdout}    ${CONTROLLER1}
75     Should Contain     ${stdout}    ${CONTROLLER2}
76     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
77     Should Contain     ${stdout}    ${CONTROLLER1}
78     Should Contain     ${stdout}    ${CONTROLLER2}
79     ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
80     Should Contain     ${stdout}    ${CONTROLLER1}
81     Should Contain     ${stdout}    ${CONTROLLER2}
82                 
83
84 a flow is installed in a bridge
85     ${node}    Create Dictionary    type    OF    id    ${node_id}
86     ${actions}    Create List    OUTPUT=1
87     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
88     ...    ${node}    priority    999    etherType    0x800    nwDst
89     ...    10.0.0.1/32    actions    ${actions}
90     ${headers}    Create Dictionary    Content-Type    application/json
91     Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
92     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
93     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
94     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
95     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
96     ${result}    To JSON    ${resp.content}
97     ${content}    Get From Dictionary    ${result}    ${key}
98     List Should Contain Value    ${content}    ${body}
99
100
101 C1 goes down
102     Open Connection    ${Controller1_IP}    prompt=>
103     Login    ${VM USERNAME}    ${VM PASSWORD}
104     Write    cd controller-base/opendaylight
105     Write    sudo ./run.sh -stop
106     Set Selenium Speed    ${DELAY2}
107     Open Browser    ${LOGIN URL1}    ${BROWSER}
108     Maximize Browser Window
109     Set Selenium Speed    ${DELAY}
110     Location Should Be    ${ERROR URL1}
111     Title Should Be    Problem loading page
112     [Teardown]    Close Browser
113
114
115 C1 recovers
116     Open Connection    ${Controller1_IP}    prompt=>
117     Login    ${VM USERNAME}    ${VM PASSWORD}
118     Write    cd controller-base/opendaylight
119     Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
120
121
122
123 C1 see the flow
124     ${headers}    Create Dictionary    Content-Type    application/json
125     Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
126     ${resp}    Get    session    ${REST_CONTEXT_2}
127     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
128     ${result}    To JSON    ${resp.content}
129     ${content}    Get From Dictionary   ${result}   actions
130     List Should Contain Value   ${content}  OUTPUT=1  
131
132
133
134 C2 see the flow
135     ${headers}    Create Dictionary    Content-Type    application/json
136     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
137     ${resp}    Get    session    ${REST_CONTEXT_2}
138     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
139     ${result}    To JSON    ${resp.content}
140     ${content}    Get From Dictionary   ${result}   actions
141     List Should Contain Value   ${content}  OUTPUT=1  
142
143