Upgrade RF syntax for v3.2 compatibility
[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://${ODL_SYSTEM_IP}:${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    ${ODL_SYSTEM_IP}
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    ${ODL_SYSTEM_IP}
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 Request    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    ${ODL_SYSTEM_IP}
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     END
40     Log    ${wtp_ip_list}
41     List Should Contain Value    ${wtp_ip_list}    ${expected_ip_addr}
42
43 Run Test Get Specifc WTP
44     ${expected_ip_addr}    get simulated wtpip    ${ODL_SYSTEM_IP}
45     ${DISC_SPECIFIC_WTP}    catenate    SEPARATOR=    ${DISC_WTP_REST}    discovered-wtps\/    ${expected_ip_addr}    \/
46     Log    ${DISC_SPECIFIC_WTP}
47     ${resp}    RequestsLibrary.Get Request    session    ${DISC_SPECIFIC_WTP}
48     Log    ${resp.content}
49     Should Be Equal As Strings    ${resp.status_code}    200
50     ${result}    TO JSON    ${resp.content}
51     @{wtp_discovered}    Get From Dictionary    ${result}    discovered-wtps
52     ${wtp_ip_list}    Create List    ''
53     FOR    ${wtp}    IN    @{wtp_discovered}
54         ${wtp_ip}    Get From Dictionary    ${wtp}    ipv4-addr
55         Append to List    ${wtp_ip_list}    ${wtp_ip}
56     END
57     Log    ${wtp_ip_list}
58     List Should Contain Value    ${wtp_ip_list}    ${expected_ip_addr}