Step 1: Move vm scripts to the right place
[integration/test.git] / csit / suites / capwap / basic / capwap_session.robot
1 *** Settings ***
2 Documentation     Test suite for capwap discover functionality
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Library           ../../../libraries/Common.py
7 Variables         ../../../variables/Variables.py
8 Resource          ../../../libraries/Utils.robot
9 Library           Collections
10 Library           ../../../libraries/CapwapLibrary.py
11
12 *** Variables ***
13 ${DISC_WTP_REST}    /restconf/operational/capwap-impl:capwap-ac-root/
14
15 *** Test Cases ***
16 Get Discovered WTPs
17     [Documentation]    Get the WTP Discoverd
18     send discover    ${CONTROLLER}
19     Wait Until Keyword Succeeds    10s    5s    Run Test Get Discovered WTP
20
21 Get Specific WTP
22     [Documentation]    Get the details of specific WTP.
23     send discover    ${CONTROLLER}
24     Wait Until Keyword Succeeds    10s    5s    Run Test Get Specifc WTP
25
26 *** Keywords ***
27 Run Test Get Discovered WTP
28     ${resp}    RequestsLibrary.Get    session    ${DISC_WTP_REST}
29     Log    ${resp.content}
30     Should Be Equal As Strings    ${resp.status_code}    200
31     ${result}    TO JSON    ${resp.content}
32     ${ac_Root}    Get From Dictionary    ${result}    capwap-ac-root
33     @{wtp_discovered}    Get From Dictionary    ${ac_Root}    discovered-wtps
34     ${expected_ip_addr}    get simulated wtpip    ${CONTROLLER}
35     ${wtp_ip_list}    Create List    ''
36     : FOR    ${wtp}    IN    @{wtp_discovered}
37     \    ${wtp_ip}    Get From Dictionary    ${wtp}    ipv4-addr
38     \    Append to List    ${wtp_ip_list}    ${wtp_ip}
39     Log    ${wtp_ip_list}
40     List Should Contain Value    ${wtp_ip_list}    ${expected_ip_addr}
41
42 Run Test Get Specifc WTP
43     ${expected_ip_addr}    get simulated wtpip    ${CONTROLLER}
44     ${DISC_SPECIFIC_WTP}    catenate    SEPARATOR=    ${DISC_WTP_REST}    discovered-wtps\/    ${expected_ip_addr}    \/
45     Log    ${DISC_SPECIFIC_WTP}
46     ${resp}    RequestsLibrary.Get    session    ${DISC_SPECIFIC_WTP}
47     Log    ${resp.content}
48     Should Be Equal As Strings    ${resp.status_code}    200
49     ${result}    TO JSON    ${resp.content}
50     @{wtp_discovered}    Get From Dictionary    ${result}    discovered-wtps
51     ${wtp_ip_list}    Create List    ''
52     : FOR    ${wtp}    IN    @{wtp_discovered}
53     \    ${wtp_ip}    Get From Dictionary    ${wtp}    ipv4-addr
54     \    Append to List    ${wtp_ip_list}    ${wtp_ip}
55     Log    ${wtp_ip_list}
56     List Should Contain Value    ${wtp_ip_list}    ${expected_ip_addr}