Added "Wait Until Keyword" instead of sleep
[integration/test.git] / test / csit / suites / vtn / VTN_C_OF10 / 020__vtn_coordinator.txt
1 *** Settings ***
2 Documentation     Test suite for VTN Coordinator
3 Suite Setup       Create Session    session    http://${VTNC}:8083  headers=${VTNC_HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           ../../../libraries/RequestsLibrary.py
8 Library           ../../../libraries/Common.py
9 Library           ../../../libraries/Topology.py
10 Variables         ../../../variables/Variables.py
11
12
13
14 *** Test Cases ***
15 Add a ODL Controller
16     [Documentation]    Add a Controller
17     [Tags]    vtnc
18     Add a Controller    odc_test     ${CONTROLLER}
19
20
21 Verify the Controller Status is up
22     [Documentation]    Check Controller status
23     [Tags]   vtnc
24     Wait Until Keyword Succeeds   30s   2s   Check Controller Status   odc_test
25
26
27 Add a Vtn Tenant1
28     [Documentation]   Create Vtn Tenant1
29     [Tags]   vtnc
30     Add a VTN  Tenant1  VTN_TEST
31
32
33 Create VBR in VTN Tenant1
34     [Documentation]   Create a VBR in Tenant1 as Vbridge1
35     [Tags]   vtnc
36     Create VBR in VTN     Tenant1    Vbridge1    odc_test
37
38
39 Create VBRIF in VBRIDGE Vbridge1 Interface1
40     [Documentation]   Create an interface to Vbridge1
41     [Tags]   vtnc
42     Create VBRIF in VBR   Tenant1    Vbridge1   Interface1  Interface1
43
44
45 Create VBRIF in VBRIDGE Vbridge1 Interface2
46     [Documentation]   Create an interface to Vbridge1
47     [Tags]   vtnc
48     Create VBRIF in VBR   Tenant1    Vbridge1   Interface2  Interface2
49
50
51 Define Portmap for Interface1
52     [Documentation]   Map Interface1 to a logical port
53     [Tags]   vtnc
54     Define Portmap for VBRIF    Tenant1    Vbridge1     Interface1    PP-OF:00:00:00:00:00:00:00:03-s3-eth1
55
56
57 Define Portmap for Interface2
58     [Documentation]   Map Interface2 to a logical port
59     [Tags]   vtnc
60     Define Portmap for VBRIF    Tenant1    Vbridge1     Interface2    PP-OF:00:00:00:00:00:00:00:02-s2-eth1
61
62
63 Test Ping for Configuration1
64     [Documentation]   ping between hosts in mininet
65     [Tags]   vtnc
66     Wait Until Keyword Succeeds   30s   2s    Test Ping    h1    h3
67
68
69 Delete a VTN Tenant1
70     [Documentation]   Delete Vtn Tenant1
71     [Tags]   vtnc
72     Delete a VTN  Tenant1
73
74
75 Delete a Controller odc1
76     [Documentation]   Delete Controller odc1
77     [Tags]   vtnc
78     Remove Controller    odc_test
79
80
81
82 *** Keywords ***
83 Add a Controller
84    [Arguments]   ${ctrlname}   ${ctrlip}
85    [Documentation]    Create a controller
86    ${controllerinfo}    Create Dictionary   controller_id   ${ctrlname}   type    odc    ipaddr    ${CONTROLLER}    version    1.0    auditstatus    enable
87    ${controllercreate}    Create Dictionary   controller    ${controllerinfo}
88    ${resp}    PostJson    session    ${VTNWEBAPI}/${CTRLS_CREATE}    data=${controllercreate}
89    Should Be Equal As Strings    ${resp.status_code}    201
90
91
92 Remove Controller
93    [Arguments]   ${ctrlname}
94    [Documentation]   Delete a Controller
95    ${resp}    Delete   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
96    Should Be Equal As Strings    ${resp.status_code}    204
97
98
99 Check Controller Status
100    [Arguments]   ${ctrlname}
101    [Documentation]    Get controller status
102    ${resp}    Get   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
103    ${contents}    To JSON    ${resp.content}
104    ${controllerblock}    Get From Dictionary    ${contents}   controller
105    ${status}    Get From Dictionary    ${controllerblock}     operstatus
106    Should Be Equal As Strings    ${status}    up
107
108
109 Add a VTN
110    [Arguments]   ${vtnname}    ${vtndescription}
111    [Documentation]    Create VTN in Coordinator
112    ${vtninfo}    Create Dictionary    vtn_name    ${vtnname}    description    ${vtndescription}
113    ${vtncreate}    Create Dictionary    vtn    ${vtninfo}
114    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS_CREATE}    data=${vtncreate}
115    Should Be Equal As Strings    ${resp.status_code}    201
116
117
118 Delete a VTN
119    [Arguments]   ${vtnname}
120    [Documentation]  Delete a VTN Created
121    ${resp}    Delete    session    ${VTNWEBAPI}/${VTNS}/${vtnname}.json
122    Should Be Equal As Strings    ${resp.status_code}    204
123
124
125 Create VBR in VTN
126    [Arguments]   ${vtnname}    ${vbrname}    ${ctrlname}
127    [Documentation]    Create VBR for VTN in Coordinator
128    ${vbrinfo}    Create Dictionary   vbr_name    ${vbrname}    controller_id   ${ctrlname}    domain_id    (DEFAULT)
129    ${vbrcreate}   Create Dictionary   vbridge    ${vbrinfo}
130    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS_CREATE}    data=${vbrcreate}
131    Should Be Equal As Strings    ${resp.status_code}    201
132
133
134 Create VBRIF in VBR
135    [Arguments]   ${vtnname}    ${vbrname}    ${vbrifname}    ${ifdescription}
136    [Documentation]    Create VBR Interface in VBR
137    ${vbrifinfo}    Create Dictionary   if_name    ${vbrifname}    description    ${ifdescription}
138    ${vbrifcreate}    Create Dictionary   interface    ${vbrifinfo}
139    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS_CREATE}  data=${vbrifcreate}
140    Should Be Equal As Strings    ${resp.status_code}    201
141
142
143 Define Portmap for VBRIF
144    [Arguments]   ${vtnname}    ${vbrname}    ${vbrifname}   ${logical_port_id}
145    [Documentation]   Map  Interface to a logical port
146    ${logical_port_info}    Create Dictionary    logical_port_id    ${logical_port_id}
147    ${portmapdefine}     Create Dictionary     portmap     ${logical_port_info}
148    ${resp}   Put     session      ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${PORTMAP_CREATE}    data=${portmapdefine}
149    Should Be Equal As Strings    ${resp.status_code}    204
150
151 Test Ping
152    [Arguments]   ${host1}    ${host2}
153    [Documentation]  Ping hosts to check connectivity
154    Write    ${host1} ping -w 10 ${host2}
155    ${result}    Read
156    Should Contain    ${result}    64 bytes