GIT restructure - Adding project folders and features
[integration/test.git] / test / csit / suites / vtn / VTN_C_OF13 / 040__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 *** Test Cases ***
14 Add a ODL Controller
15     [Documentation]    Add a Controller
16     [Tags]    vtnc
17     Add a Controller    odc_test     ${CONTROLLER}
18
19 Verify the Controller Status is up
20     [Documentation]    Check Controller status
21     [Tags]   vtnc
22     Check Controller Status    odc_test   up   20
23
24 Add a Vtn Tenant1
25     [Documentation]   Create Vtn Tenant1
26     [Tags]   vtnc
27     Add a VTN  Tenant1  VTN_TEST
28
29 Create VBR in VTN Tenant1
30     [Documentation]   Create a VBR in Tenant1 as Vbridge1
31     [Tags]   vtnc
32     Create VBR in VTN     Tenant1    Vbridge1    odc_test
33
34 Update controller ip invalid
35     [Documentation]    Update Controller ip to invalid
36     [Tags]    vtnc
37     Update Controller    odc_test     10.0.0.1   invalid_IP
38
39 Verify the Controller State is down
40     [Documentation]    Check Controller status
41     [Tags]   vtnc
42     Check Controller Status    odc_test   down   45
43
44 Create VBRIF in VBRIDGE Vbridge1 Interface1
45     [Documentation]   Create an interface to Vbridge1
46     [Tags]   vtnc
47     Create VBRIF in VBR   Tenant1    Vbridge1   Interface1  Interface1
48
49 Create VBRIF in VBRIDGE Vbridge1 Interface2
50     [Documentation]   Create an interface to Vbridge1
51     [Tags]   vtnc
52     Create VBRIF in VBR   Tenant1    Vbridge1   Interface2  Interface2
53
54 Update controller ip valid
55     [Documentation]    Update Controller ip to valid
56     [Tags]    vtnc
57     Update Controller    odc_test     ${CONTROLLER}   valid_IP
58
59 Verify the Controller State is up
60     [Documentation]    Check Controller status
61     [Tags]   vtnc
62     Check Controller Status    odc_test   up   45
63
64 Define Portmap for Interface1
65     [Documentation]   Map Interface1 to a logical port
66     [Tags]   vtnc
67     Define Portmap for VBRIF    Tenant1    Vbridge1     Interface1    PP-OF:00:00:00:00:00:00:00:02-s2-eth1
68
69 Define Portmap for Interface2
70     [Documentation]   Map Interface2 to a logical port
71     [Tags]   vtnc
72     Define Portmap for VBRIF    Tenant1    Vbridge1     Interface2    PP-OF:00:00:00:00:00:00:00:02-s2-eth2
73
74 Test Ping for Configuration1
75     [Documentation]   ping between hosts in mininet
76     [Tags]   vtnc
77     Test Ping    h1    h2
78
79 Delete a VTN Tenant1
80     [Documentation]   Delete Vtn Tenant1
81     [Tags]   vtnc
82     Delete a VTN  Tenant1
83
84 Delete a Controller odc1
85     [Documentation]   Delete Controller odc1
86     [Tags]   vtnc
87     Remove Controller    odc_test
88
89
90 *** Keywords ***
91 Add a Controller
92    [Arguments]   ${ctrlname}   ${ctrlip}
93    [Documentation]    Create a controller
94    ${controllerinfo}    Create Dictionary   controller_id   ${ctrlname}   type    odc    ipaddr    ${CONTROLLER}    version    1.0    auditstatus    enable
95    ${controllercreate}    Create Dictionary   controller    ${controllerinfo}
96    ${resp}    PostJson    session    ${VTNWEBAPI}/${CTRLS_CREATE}    data=${controllercreate}
97    Should Be Equal As Strings    ${resp.status_code}    201
98
99
100 Remove Controller
101    [Arguments]   ${ctrlname}
102    [Documentation]   Delete a Controller
103    ${resp}    Delete   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
104    Should Be Equal As Strings    ${resp.status_code}    204
105
106
107 Update Controller
108    [Arguments]   ${ctrlname}    ${ctrlip}    ${desc}
109    [Documentation]    Update controller
110    ${controllerinfo}    Create Dictionary    description    ${desc}    ipaddr    ${ctrlip}    version    1.0    auditstatus    enable
111    ${controllerupdate}    Create Dictionary   controller    ${controllerinfo}
112    ${resp}    Put    session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json    data=${controllerupdate}
113    Should Be Equal As Strings    ${resp.status_code}    204
114
115
116 Check Controller Status
117    [Arguments]   ${ctrlname}   ${stat}   ${sec}
118    [Documentation]    Get controller status
119    Sleep    ${sec}
120    ${resp}    Get   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
121    ${contents}    To JSON    ${resp.content}
122    ${controllerblock}    Get From Dictionary    ${contents}   controller
123    ${status}    Get From Dictionary    ${controllerblock}     operstatus
124    Should Be Equal As Strings    ${status}    ${stat}
125
126
127 Add a VTN
128    [Arguments]   ${vtnname}    ${vtndescription}
129    [Documentation]    Create VTN in Coordinator
130    ${vtninfo}    Create Dictionary    vtn_name    ${vtnname}    description    ${vtndescription}
131    ${vtncreate}    Create Dictionary    vtn    ${vtninfo}
132    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS_CREATE}    data=${vtncreate}
133    Should Be Equal As Strings    ${resp.status_code}    201
134
135
136 Delete a VTN
137    [Arguments]   ${vtnname}
138    [Documentation]  Delete a VTN Created
139    ${resp}    Delete    session    ${VTNWEBAPI}/${VTNS}/${vtnname}.json
140    Should Be Equal As Strings    ${resp.status_code}    204
141
142
143 Create VBR in VTN
144    [Arguments]   ${vtnname}    ${vbrname}    ${ctrlname}
145    [Documentation]    Create VBR for VTN in Coordinator
146    ${vbrinfo}    Create Dictionary   vbr_name    ${vbrname}    controller_id   ${ctrlname}    domain_id    (DEFAULT)
147    ${vbrcreate}   Create Dictionary   vbridge    ${vbrinfo}
148    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS_CREATE}    data=${vbrcreate}
149    Should Be Equal As Strings    ${resp.status_code}    201
150
151
152 Create VBRIF in VBR
153    [Arguments]   ${vtnname}    ${vbrname}    ${vbrifname}    ${ifdescription}
154    [Documentation]    Create VBR Interface in VBR
155    ${vbrifinfo}    Create Dictionary   if_name    ${vbrifname}    description    ${ifdescription}
156    ${vbrifcreate}    Create Dictionary   interface    ${vbrifinfo}
157    ${resp}    PostJson    session    ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS_CREATE}  data=${vbrifcreate}
158    Should Be Equal As Strings    ${resp.status_code}    201
159
160
161 Define Portmap for VBRIF
162    [Arguments]   ${vtnname}    ${vbrname}    ${vbrifname}   ${logical_port_id}
163    [Documentation]   Map  Interface to a logical port
164    ${logical_port_info}    Create Dictionary    logical_port_id    ${logical_port_id}
165    ${portmapdefine}     Create Dictionary     portmap     ${logical_port_info}
166    ${resp}   Put     session      ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${PORTMAP_CREATE}    data=${portmapdefine}
167    Should Be Equal As Strings    ${resp.status_code}    204
168
169 Test Ping
170    [Arguments]   ${host1}    ${host2}
171    [Documentation]  Ping hosts to check connectivity
172    Sleep   5
173    Write    ${host1} ping -w 10 ${host2}
174    Sleep    10
175    ${result}    Read
176    Should Contain    ${result}    64 bytes