Correctly space expected_status
[integration/test.git] / csit / suites / controller / NETCONF / 010__netconf_inventory.robot
1 *** Settings ***
2 Documentation       Test suite for NETCONF client
3
4 Library             Collections
5 Library             OperatingSystem
6 Library             String
7 Library             RequestsLibrary
8 Library             ../../../libraries/Common.py
9 Variables           ../../../variables/Variables.py
10
11 Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
12 Suite Teardown      Delete All Sessions
13
14
15 *** Variables ***
16 ${NETOPEER}             ${TOOLS_SYSTEM_IP}
17 ${NETOPEER_USER}        ${TOOLS_SYSTEM_USER}
18 ${FILE}                 ${CURDIR}/../../../variables/xmls/netconf.xml
19 ${REST_CONT_CONF}       /restconf/config/network-topology:network-topology/topology/topology-netconf
20 ${REST_CONT_OPER}       /restconf/operational/network-topology:network-topology/topology/topology-netconf
21 ${REST_NTPR_CONF}       node/controller-config/yang-ext:mount/config:modules
22 ${REST_NTPR_MOUNT}      node/netopeer/yang-ext:mount/
23
24
25 *** Test Cases ***
26 Add NetConf device
27     [Documentation]    Add NetConf device using REST
28     [Tags]    netconf
29     ${XML1}    Get File    ${FILE}
30     ${XML2}    Replace String    ${XML1}    127.0.0.1    ${NETOPEER}
31     ${body}    Replace String    ${XML2}    mininet    ${NETOPEER_USER}
32     Log    ${body}
33     ${resp}    Post Request    session    ${REST_CONT_CONF}/${REST_NTPR_CONF}    data=${body}
34     Log    ${resp.content}
35     Should Be Equal As Strings    ${resp.status_code}    204
36
37 Get Controller Inventory
38     [Documentation]    Get Controller operational inventory
39     [Tags]    netconf
40     Wait Until Keyword Succeeds    30s    2s    Get Inventory
41
42 Pull External Device configuration
43     [Documentation]    Pull Netopeer configuration
44     [Tags]    netconf
45     ${resp}    Get Request    session    ${REST_CONT_CONF}/${REST_NTPR_MOUNT}
46     Log    ${resp.content}
47     Should Be Equal As Strings    ${resp.status_code}    200
48     Should Contain    ${resp.content}    {}
49
50 Verify Device Operational data
51     [Documentation]    Verify Netopeer operational data
52     [Tags]    exclude
53     ${resp}    Get Request    session    ${REST_CONT_OPER}/${REST_NTPR_MOUNT}
54     Log    ${resp.content}
55     Should Be Equal As Strings    ${resp.status_code}    200
56     Should Contain    ${resp.content}    schema
57     Should Contain    ${resp.content}    statistics
58     Should Contain    ${resp.content}    datastores
59
60
61 *** Keywords ***
62 Get Inventory
63     ${resp}    Get Request    session    ${REST_CONT_OPER}/node/netopeer
64     Log    ${resp.content}
65     Should Be Equal As Strings    ${resp.status_code}    200
66     Should Contain    ${resp.content}    "node-id":"netopeer"
67     Should Contain    ${resp.content}    "netconf-node-topology:connection-status":"connected"
68     Should Contain    ${resp.content}    "netconf-node-topology:available-capabilities"