Change URI to specific ovsdb node
[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=${node}
88     ...    priority=999    etherType=0x800    nwDst=10.0.0.1/32    actions=${actions}
89     ${headers}    Create Dictionary    Content-Type=application/json
90     Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
91     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
92     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
93     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
94     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
95     ${result}    To JSON    ${resp.content}
96     ${content}    Get From Dictionary    ${result}    ${key}
97     List Should Contain Value    ${content}    ${body}
98
99
100 C1 goes down
101     Open Connection    ${Controller1_IP}    prompt=>
102     Login    ${VM USERNAME}    ${VM PASSWORD}
103     Write    cd controller-base/opendaylight
104     Write    sudo ./run.sh -stop
105     Set Selenium Speed    ${DELAY2}
106     Open Browser    ${LOGIN URL1}    ${BROWSER}
107     Maximize Browser Window
108     Set Selenium Speed    ${DELAY}
109     Location Should Be    ${ERROR URL1}
110     Title Should Be    Problem loading page
111     [Teardown]    Close Browser
112
113
114 C1 recovers
115     Open Connection    ${Controller1_IP}    prompt=>
116     Login    ${VM USERNAME}    ${VM PASSWORD}
117     Write    cd controller-base/opendaylight
118     Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
119
120
121
122 C1 see the flow
123     ${headers}    Create Dictionary    Content-Type    application/json
124     Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
125     ${resp}    Get    session    ${REST_CONTEXT_2}
126     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
127     ${result}    To JSON    ${resp.content}
128     ${content}    Get From Dictionary   ${result}   actions
129     List Should Contain Value   ${content}  OUTPUT=1  
130
131
132
133 C2 see the flow
134     ${headers}    Create Dictionary    Content-Type    application/json
135     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
136     ${resp}    Get    session    ${REST_CONTEXT_2}
137     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
138     ${result}    To JSON    ${resp.content}
139     ${content}    Get From Dictionary   ${result}   actions
140     List Should Contain Value   ${content}  OUTPUT=1  
141
142