cc10eea7024c6776824e5c0bdce42fe2c7ad4485
[integration/test.git] / test / csit / suites / karaf-vtn / 050__VTN / 030__vtn_coordinator.txt
1
2 *** Settings ***
3 Documentation     Test suite for VTN Coordinator
4 Suite Setup       Create Session    session    http://${VTNC}:8083  headers=${VTNC_HEADERS}
5 Suite Teardown    Delete All Sessions
6 Library           SSHLibrary
7 Library           Collections
8 Library           ../../../libraries/RequestsLibrary.py
9 Library           ../../../libraries/Common.py
10 Library           ../../../libraries/Topology.py
11 Variables         ../../../variables/Variables.py
12
13
14 *** Test Cases ***
15 Add a ODL Controller
16     [Documentation]    Add a Controller odc1
17     [Tags]    vtnc
18     Add a Controller    odc_test     ${CONTROLLER}
19
20 Verify the Controller Status is up
21     [Documentation]    Check Controller status
22     [Tags]   vtnc
23     Check Controller Status    odc_test  up   20
24
25 Verify switch1
26     [Documentation]    Get switch1
27     [Tags]   vtnc
28     Verify Switch    odc_test     00:00:00:00:00:00:00:01  30
29
30 Verify switch2
31     [Documentation]    Get switch2
32     [Tags]   vtnc
33     Verify Switch    odc_test     00:00:00:00:00:00:00:02  1
34
35 Verify switch3
36     [Documentation]    Get switch3
37     [Tags]   vtnc
38     Verify Switch    odc_test     00:00:00:00:00:00:00:03  1
39
40 Verify switchPort switch1
41     [Documentation]   Get switchport/switch1
42     [Tags]   vtnc
43     Verify SwitchPort    odc_test     00:00:00:00:00:00:00:01  15
44
45 Verify switchPort switch2
46     [Documentation]   Get switchport/switch2
47     [Tags]   vtnc
48     Verify SwitchPort    odc_test     00:00:00:00:00:00:00:02  1
49
50 Verify switchPort switch3
51     [Documentation]   Get switchport/switch3
52     [Tags]   vtnc
53     Verify SwitchPort    odc_test     00:00:00:00:00:00:00:03  1
54
55 Delete a Controller
56     [Documentation]   Delete Controller odc1
57     [Tags]   vtnc
58     Remove Controller    odc_test
59
60
61 *** Keywords ***
62 Add a Controller
63    [Arguments]   ${ctrlname}   ${ctrlip}
64    [Documentation]    Create a controller
65    ${controllerinfo}    Create Dictionary   controller_id   ${ctrlname}   type    odc    ipaddr    ${CONTROLLER}    version    1.0    auditstatus    enable
66    ${controllercreate}    Create Dictionary   controller    ${controllerinfo}
67    ${resp}    PostJson    session    ${VTNWEBAPI}/${CTRLS_CREATE}    data=${controllercreate}
68    Should Be Equal As Strings    ${resp.status_code}    201
69
70
71 Remove Controller
72    [Arguments]   ${ctrlname}
73    [Documentation]   Delete a Controller
74    ${resp}    Delete   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
75    Should Be Equal As Strings    ${resp.status_code}    204
76
77 Check Controller Status
78    [Arguments]   ${ctrlname}   ${stat}   ${sec}
79    [Documentation]    Get controller status
80    Sleep    ${sec}
81    ${resp}    Get   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
82    ${contents}    To JSON    ${resp.content}
83    ${controllerblock}    Get From Dictionary    ${contents}   controller
84    ${status}    Get From Dictionary    ${controllerblock}     operstatus
85    Should Be Equal As Strings    ${status}    ${stat}
86
87 Verify Switch
88    [Arguments]   ${ctrlname}  ${switch_id}  ${sec}
89    [Documentation]    Get switch
90    Sleep    ${sec}
91    ${resp}    Get   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}.json
92    ${contents}    To JSON    ${resp.content}
93    ${switchblock}    Get From Dictionary    ${contents}   switch
94    ${status}    Get From Dictionary    ${switchblock}     switch_id
95    Should Be Equal As Strings    ${status}     ${switch_id}
96
97 Verify SwitchPort
98    [Arguments]   ${ctrlname}  ${switch_id}  ${sec}
99    [Documentation]    Get switch
100    Sleep    ${sec}
101    ${resp}    Get   session    ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}/${PORTS}
102    Should Be Equal As Strings    ${resp.status_code}    200