Move 'Create Dictionary' calls from tab format to '=' format
[integration/test.git] / 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=${node}
59     ...     priority=995    etherType=0x800    nwDst=10.0.0.1/32    actions=${actions}
60     ${headers}    Create Dictionary    Content-Type=application/json
61     Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
62     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
63     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
64     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
65     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
66     ${result}    To JSON    ${resp.content}
67     ${content}    Get From Dictionary    ${result}    ${key}
68     List Should Contain Value    ${content}    ${body}
69
70
71 C1 see the flow
72     ${headers}    Create Dictionary    Content-Type=application/json
73     Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
74     ${resp}    Get    session    ${REST_CONTEXT_2}
75     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
76     ${result}    To JSON    ${resp.content}
77     ${content}    Get From Dictionary   ${result}   actions
78     List Should Contain Value   ${content}  OUTPUT=1  
79  
80
81 C2 see the flow
82     ${headers}    Create Dictionary    Content-Type=application/json
83     Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
84     ${resp}    Get    session    ${REST_CONTEXT_2}
85     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
86     ${result}    To JSON    ${resp.content}
87     ${content}    Get From Dictionary   ${result}   actions
88     List Should Contain Value   ${content}  OUTPUT=1  
89
90
91