Merge "removing failing tests"
[integration/test.git] / test / csit / suites / karaf-compatible / 010__MD_SAL_NSF / 020__restconf_topology.txt
1 *** Settings ***
2 Documentation     Test suite for RESTCONF Topology
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           ../../../libraries/RequestsLibrary.py
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.txt
10
11 *** Variables ***
12 ${topology1}      "flow:1"
13 ${node1}          "openflow:1"
14 ${node2}          "openflow:2"
15 ${node3}          "openflow:3"
16 @{node_list}      openflow:1    openflow:2    openflow:3
17 ${key}            link
18 ${REST_CONTEXT_1}    /restconf/operational/network-topology:network-topology
19 ${REST_CONTEXT_2}    /restconf/operational/network-topology:network-topology/topology/flow:1
20 ${REST_CONTEXT_3}    /restconf/config/network-topology:network-topology/topology/flow:1/link/userlink
21
22 *** Test Cases ***
23 Get RESTCONF Topology
24     [Documentation]    Get RESTCONF Topology and validate the result.
25     [Tags]    get
26     Wait Until Keyword Succeeds    30s    2s    Ensure All Nodes Are In Response    ${REST_CONTEXT_1}    ${node_list}
27     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_1}
28     Should Be Equal As Strings    ${resp.status_code}    200
29     Log    ${resp.content}
30     Should Contain    ${resp.content}    ${topology1}
31
32 List all the links
33     [Documentation]    List all the links in the topology.
34     [Tags]    get
35     ${body1}    Create Dictionary    dest-node=openflow:1    dest-tp=openflow:1:2
36     ${body2}    Create Dictionary    source-node=openflow:3    source-tp=openflow:3:3
37     ${link2}    Create Dictionary    link-id=openflow:3:3    destination=${body1}    source=${body2}
38     ${body1}    Create Dictionary    dest-node=openflow:1    dest-tp=openflow:1:1
39     ${body2}    Create Dictionary    source-node=openflow:2    source-tp=openflow:2:3
40     ${link1}    Create Dictionary    link-id=openflow:2:3    destination=${body1}    source=${body2}
41     ${body1}    Create Dictionary    dest-node=openflow:3    dest-tp=openflow:3:3
42     ${body2}    Create Dictionary    source-node=openflow:1    source-tp=openflow:1:2
43     ${link4}    Create Dictionary    link-id=openflow:1:2    destination=${body1}    source=${body2}
44     ${body1}    Create Dictionary    dest-node=openflow:2    dest-tp=openflow:2:3
45     ${body2}    Create Dictionary    source-node=openflow:1    source-tp=openflow:1:1
46     ${link3}    Create Dictionary    link-id=openflow:1:1    destination=${body1}    source=${body2}
47     ${links}    Create List    ${link1}    ${link2}    ${link3}    ${link4}
48     Wait Until Keyword Succeeds    30s    2s    Verify Links    ${links}
49
50 Add a link
51     [Documentation]    Add a link, list to validate the result.
52     [Tags]    add
53     ${body1}    Create Dictionary    dest-node=openflow:3    dest-tp=openflow:3:1
54     ${body2}    Create Dictionary    source-node=openflow:2    source-tp=openflow:2:1
55     ${body3}    Create Dictionary    link-id=userlink    destination=${body1}    source=${body2}
56     ${links}    Create List    ${body3}
57     ${body}    Create Dictionary    link=${links}
58     ${resp}    RequestsLibrary.Put    session    ${REST_CONTEXT_3}    data=${body}
59     Should Be Equal As Strings    ${resp.status_code}    200
60     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_3}
61     Should Be Equal As Strings    ${resp.status_code}    200
62     ${result}    To JSON    ${resp.content}
63     ${link}    Get From Dictionary    ${result}    link
64     Lists Should be Equal    ${link}    ${links}
65
66 Remove a link
67     [Documentation]    Remove a link, list to validate the result.
68     [Tags]    remove
69     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_3}
70     Should Be Equal As Strings    ${resp.status_code}    200
71     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_3}
72     Should Be Equal As Strings    ${resp.status_code}    404
73
74 *** Keywords ***
75 Verify Links
76     [Arguments]    ${expected_links}
77     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_2}
78     Log    ${resp.content}
79     Should Be Equal As Strings    ${resp.status_code}    200
80     ${result}    To JSON    ${resp.content}
81     Log    ${result}
82     ${content}    Get From Dictionary    ${result}    topology
83     ${topology}    Get From List    ${content}    0
84     ${link}    Get From Dictionary    ${topology}    link
85     Sort List    ${link}
86     Lists Should be Equal    ${link}    ${expected_links}