Tidy after recent merges
[integration/test.git] / csit / suites / unimgr / uni_operations / 010_unimanager_restconf.robot
1 *** Settings ***
2 Documentation     Test suite for all Uni Manager operations
3 Suite Setup       Setup Unimgr Test Environment
4 Suite Teardown    Delete All Sessions
5 Library           OperatingSystem
6 Library           String
7 Library           Collections
8 Library           SSHLibrary
9 Library           RequestsLibrary
10 Library           ../../../libraries/Common.py
11 Variables         ../../../variables/Variables.py
12 Resource          ../../../libraries/Utils.robot
13 Resource          ../../../libraries/UnimgrKeywords.robot
14 Resource          ../../../libraries/TemplatedRequests.robot
15
16 *** Variables ***
17 ${DEFAULT_LINUX_PROMPT}    ${EMPTY}
18 ${Mininet1_IP}    ${TOOLS_SYSTEM_IP}
19 ${Mininet2_IP}    ${TOOLS_SYSTEM_2_IP}
20 ${UNI1_MAC}       68:5b:35:bb:f8:3e
21 ${UNI2_MAC}       52:7b:25:cb:a7:3c
22 ${Evc_topo_API}    topology/unimgr:evc/link/evc:%2F%2F1
23 ${Uni_topo_API}    topology/unimgr:uni/node/uni:%2F%2F
24 ${UniMgr_variables_DIR}    ${CURDIR}/../../../variables/unimgr
25
26 *** Test Cases ***
27 Create source and destination UNIs at the OVS instances using Restconf API
28     [Documentation]    Create source and destination UNIs
29     [Tags]    UniMgr UNIs Create
30     ${uniSource}    Get Add Uni Json    ${Mininet1_IP}    ${UNI1_MAC}
31     ${uniDest}    Get Add Uni Json    ${Mininet2_IP}    ${UNI2_MAC}
32     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}    data=${uniSource}
33     Log    ${resp.content}
34     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
35     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}    data=${uniDest}
36     Log    ${resp.content}
37     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
38     ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
39     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
40
41 Update UNI Speed
42     [Documentation]    Update the Unis source and destenation speed
43     [Tags]    UniMgr UNIs Speed
44     ${speedJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/uni_speed.json
45     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}/cl-unimgr-mef:speed    data=${speedJson}
46     Log    ${resp.content}
47     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
48     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}/cl-unimgr-mef:speed    data=${speedJson}
49     Log    ${resp.content}
50     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
51     ${elements}    Create List    speed-10G
52     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
53
54 Create EVC tunnel between the Unis
55     [Documentation]    Create EVC between Unis
56     [Tags]    UniMgr EVC Create
57     ${evc}    Get Add Evc Json    ${Mininet1_IP}    ${Mininet2_IP}
58     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}    data=${evc}
59     Log    ${resp.content}
60     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
61     ${elements}    Create List    evc://1
62     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
63
64 Update EVC Ingress and Egress Speed
65     [Documentation]    Update the EVC connection Ingress and Egress Speed
66     [Tags]    UniMgr EVC Speed
67     ${ingressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_ingress_speed.json
68     ${egressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_egress_speed.json
69     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:ingress-bw    data=${ingressJson}
70     Log    ${resp.content}
71     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
72     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:egress-bw    data=${egressJson}
73     Log    ${resp.content}
74     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
75     ${elements}    Create List    speed-1G
76     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
77
78 Delete EVC tunnel between the Unis
79     [Documentation]    Delete EVC
80     [Tags]    UniMgr EVC Delete
81     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}
82     Log    ${resp.content}
83     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
84     ${elements}    Create List    evc://1
85     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/unimgr:evc/    ${elements}
86
87 Delete UNIs source and destination
88     [Documentation]    Delete both UNIs source and destination
89     [Tags]    UniMgr UNI Delete
90     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}
91     Log    ${resp.content}
92     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
93     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}
94     Log    ${resp.content}
95     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
96     ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
97     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}