Step 1: Move vm scripts to the right place
[integration/test.git] / test / tools / Robot_Tool / suites / ha / 030__two_controller_see_flow.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 Suite Teardown    Delete All Sessions
21
22 *** Test Cases ***
23 The installed flow can be seen in a cluster of two controllers
24     Given C1 a controller in cluster of two controllers
25     And C2 a controller in cluster of two controllers
26     When a flow is installed in a bridge
27     Then C1 see the flow  
28     And C2 see the flow   
29
30
31 *** Keywords ***
32 C1 a controller in cluster of two controllers
33 #    Open Connection    ${Controller1_IP}    prompt=>
34 #    Login    ${VM USERNAME}    ${VM PASSWORD}
35 #    Write    cd controller-base/opendaylight
36 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
37     Open Connection    ${HOST}
38     Login    ${VM USERNAME}    ${VM PASSWORD}
39     ${stdout}=    Execute Command    sudo ovs-vsctl show
40     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
41     
42
43
44 C2 a controller in cluster of two controllers
45 #    Open Connection    ${Controller2_IP}    prompt=>
46 #    Login    ${VM USERNAME}    ${VM PASSWORD}
47 #    Write    cd controller-base/opendaylight
48 #    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
49     Open Connection    ${HOST}
50     Login    ${VM USERNAME}    ${VM PASSWORD}
51     ${stdout}=    Execute Command    sudo ovs-vsctl show
52     Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
53
54
55 a flow is installed in a bridge
56     ${node}    Create Dictionary    type    OF    id    ${node_id}
57     ${actions}    Create List    OUTPUT=1
58     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
59     ...    ${node}    priority    995    etherType    0x800    nwDst
60     ...    10.0.0.1/32    actions    ${actions}
61     ${headers}    Create Dictionary    Content-Type    application/json
62     Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
63     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
64     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
65     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
66     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
67     ${result}    To JSON    ${resp.content}
68     ${content}    Get From Dictionary    ${result}    ${key}
69     List Should Contain Value    ${content}    ${body}
70
71
72 C1 see the flow
73     ${headers}    Create Dictionary    Content-Type    application/json
74     Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
75     ${resp}    Get    session    ${REST_CONTEXT_2}
76     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
77     ${result}    To JSON    ${resp.content}
78     ${content}    Get From Dictionary   ${result}   actions
79     List Should Contain Value   ${content}  OUTPUT=1  
80  
81
82 C2 see the flow
83     ${headers}    Create Dictionary    Content-Type    application/json
84     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
85     ${resp}    Get    session    ${REST_CONTEXT_2}
86     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
87     ${result}    To JSON    ${resp.content}
88     ${content}    Get From Dictionary   ${result}   actions
89     List Should Contain Value   ${content}  OUTPUT=1  
90
91
92