Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / controller / NETCONF / 010__netconf_inventory.robot
1 *** Settings ***
2 Documentation       Test suite for NETCONF client
3 ...                 FIXME: this test suite is based on the config subsystem, which has been long gone.
4 ...                 Currently this test suite is not used and hence should be fixed when added back.
5
6 Library             Collections
7 Library             OperatingSystem
8 Library             RequestsLibrary
9 Library             String
10 Library             ../../../libraries/Common.py
11 Variables           ../../../variables/Variables.py
12
13 Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
14 Suite Teardown      Delete All Sessions
15
16
17 *** Variables ***
18 ${NETOPEER}                 ${TOOLS_SYSTEM_IP}
19 ${NETOPEER_USER}            ${TOOLS_SYSTEM_USER}
20 ${FILE}                     ${CURDIR}/../../../variables/xmls/netconf.xml
21 ${REST_TOPOLOGY_NETCONF}    /rests/data/network-topology:network-topology/topology=topology-netconf
22 ${REST_NTPR_CONF}           node=controller-config/yang-ext:mount/config:modules
23 ${REST_NTPR_MOUNT}          node=netopeer/yang-ext:mount
24
25
26 *** Test Cases ***
27 Add NetConf device
28     [Documentation]    Add NetConf device using REST
29     [Tags]    netconf
30     ${XML1}    Get File    ${FILE}
31     ${XML2}    Replace String    ${XML1}    127.0.0.1    ${NETOPEER}
32     ${body}    Replace String    ${XML2}    mininet    ${NETOPEER_USER}
33     Log    ${body}
34     ${resp}    RequestsLibrary.POST On Session
35     ...    session
36     ...    url=${REST_TOPOLOGY_NETCONF}/${REST_NTPR_CONF}
37     ...    data=${body}
38     ...    expected_status=204
39     Log    ${resp.content}
40
41 Get Controller Inventory
42     [Documentation]    Get Controller operational inventory
43     [Tags]    netconf
44     Wait Until Keyword Succeeds    30s    2s    Get Inventory
45
46 Pull External Device configuration
47     [Documentation]    Pull Netopeer configuration
48     [Tags]    netconf
49     ${resp}    RequestsLibrary.GET On Session
50     ...    session
51     ...    url=${REST_TOPOLOGY_NETCONF}/${REST_NTPR_MOUNT}?content=config
52     ...    expected_status=200
53     Log    ${resp.content}
54     Should Contain    ${resp.content}    {}
55
56 Verify Device Operational data
57     [Documentation]    Verify Netopeer operational data
58     [Tags]    exclude
59     ${resp}    RequestsLibrary.GET On Session
60     ...    session
61     ...    url=${REST_TOPOLOGY_NETCONF}/${REST_NTPR_MOUNT}?content=nonconfig
62     ...    expected_status=200
63     Log    ${resp.content}
64     Should Contain    ${resp.content}    schema
65     Should Contain    ${resp.content}    statistics
66     Should Contain    ${resp.content}    datastores
67
68
69 *** Keywords ***
70 Get Inventory
71     ${resp}    RequestsLibrary.GET On Session
72     ...    session
73     ...    url=${REST_TOPOLOGY_NETCONF}/node=netopeer?content=nonconfig
74     ...    expected_status=200
75     Log    ${resp.content}
76     Should Contain    ${resp.content}    "node-id":"netopeer"
77     Should Contain    ${resp.content}    "netconf-node-topology:connection-status":"connected"
78     Should Contain    ${resp.content}    "netconf-node-topology:available-capabilities"