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