Tidied updated tests.
[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
15 *** Variables ***
16 ${DEFAULT_LINUX_PROMPT}    ${EMPTY}
17 ${Mininet1_IP}    ${TOOLS_SYSTEM_IP}
18 ${Mininet2_IP}    ${TOOLS_SYSTEM_2_IP}
19 ${UNI1_MAC}       68:5b:35:bb:f8:3e
20 ${UNI2_MAC}       52:7b:25:cb:a7:3c
21 ${Evc_topo_API}    topology/unimgr:evc/link/evc:%2F%2F1
22 ${Uni_topo_API}    topology/unimgr:uni/node/uni:%2F%2F
23 ${UniMgr_variables_DIR}    ${CURDIR}/../../../variables/unimgr
24
25 *** Test Cases ***
26 Create source and destination UNIs at the OVS instances using Restconf API
27     [Documentation]    Create source and destination UNIs
28     [Tags]    UniMgr UNIs Create
29     ${uniSource}    Get Add Uni Json    ${Mininet1_IP}    ${UNI1_MAC}
30     ${uniDest}    Get Add Uni Json    ${Mininet2_IP}    ${UNI2_MAC}
31     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}    data=${uniSource}
32     Log    ${resp.content}
33     Should Be Equal As Strings    ${resp.status_code}    200
34     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}    data=${uniDest}
35     Log    ${resp.content}
36     Should Be Equal As Strings    ${resp.status_code}    200
37     ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
38     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
39
40 Update UNI Speed
41     [Documentation]    Update the Unis source and destenation speed
42     [Tags]    UniMgr UNIs Speed
43     ${speedJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/uni_speed.json
44     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}/cl-unimgr-mef:speed    data=${speedJson}
45     Log    ${resp.content}
46     Should Be Equal As Strings    ${resp.status_code}    200
47     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}/cl-unimgr-mef:speed    data=${speedJson}
48     Log    ${resp.content}
49     Should Be Equal As Strings    ${resp.status_code}    200
50     ${elements}    Create List    speed-10G
51     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
52
53 Create EVC tunnel between the Unis
54     [Documentation]    Create EVC between Unis
55     [Tags]    UniMgr EVC Create
56     ${evc}    Get Add Evc Json    ${Mininet1_IP}    ${Mininet2_IP}
57     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}    data=${evc}
58     Log    ${resp.content}
59     Should Be Equal As Strings    ${resp.status_code}    200
60     ${elements}    Create List    evc://1
61     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
62
63 Update EVC Ingress and Egress Speed
64     [Documentation]    Update the EVC connection Ingress and Egress Speed
65     [Tags]    UniMgr EVC Speed
66     ${ingressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_ingress_speed.json
67     ${egressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_egress_speed.json
68     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:ingress-bw    data=${ingressJson}
69     Log    ${resp.content}
70     Should Be Equal As Strings    ${resp.status_code}    200
71     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:egress-bw    data=${egressJson}
72     Log    ${resp.content}
73     Should Be Equal As Strings    ${resp.status_code}    200
74     ${elements}    Create List    speed-1G
75     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
76
77 Delete EVC tunnel between the Unis
78     [Documentation]    Delete EVC
79     [Tags]    UniMgr EVC Delete
80     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}
81     Log    ${resp.content}
82     Should Be Equal As Strings    ${resp.status_code}    200
83     ${elements}    Create List    evc://1
84     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/unimgr:evc/    ${elements}
85
86 Delete UNIs source and destination
87     [Documentation]    Delete both UNIs source and destination
88     [Tags]    UniMgr UNI Delete
89     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}
90     Log    ${resp.content}
91     Should Be Equal As Strings    ${resp.status_code}    200
92     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}
93     Log    ${resp.content}
94     Should Be Equal As Strings    ${resp.status_code}    200
95     ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
96     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}