7afa0319a9ae00fc8095da013139e8207bf34c34
[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}
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
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 Be Equal As Strings    ${resp.status_code}    200
35     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}    data=${uniDest}
36     Log    ${resp.content}
37     Should Be Equal As Strings    ${resp.status_code}    200
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
42 Update UNI Speed
43     [Documentation]    Update the Unis source and destenation speed
44     [Tags]    UniMgr UNIs Speed
45     ${speedJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/uni_speed.json
46     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}/cl-unimgr-mef:speed    data=${speedJson}
47     Log    ${resp.content}
48     Should Be Equal As Strings    ${resp.status_code}    200
49     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}/cl-unimgr-mef:speed    data=${speedJson}
50     Log    ${resp.content}
51     Should Be Equal As Strings    ${resp.status_code}    200
52     ${elements}    Create List    speed-10G
53     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}
54
55
56 Create EVC tunnel between the Unis
57     [Documentation]    Create EVC between Unis
58     [Tags]    UniMgr EVC Create
59     ${evc}    Get Add Evc Json    ${Mininet1_IP}    ${Mininet2_IP}
60     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}    data=${evc}
61     Log    ${resp.content}
62     Should Be Equal As Strings    ${resp.status_code}    200
63     ${elements}    Create List    evc://1
64     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
65
66 Update EVC Ingress and Egress Speed
67     [Documentation]    Update the EVC connection Ingress and Egress Speed
68     [Tags]    UniMgr EVC Speed
69     ${ingressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_ingress_speed.json
70     ${egressJson}    OperatingSystem.Get File    ${UniMgr_variables_DIR}/evc_egress_speed.json
71     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:ingress-bw    data=${ingressJson}
72     Log    ${resp.content}
73     Should Be Equal As Strings    ${resp.status_code}    200
74     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}/cl-unimgr-mef:egress-bw    data=${egressJson}
75     Log    ${resp.content}
76     Should Be Equal As Strings    ${resp.status_code}    200
77     ${elements}    Create List    speed-1G
78     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:evc/    ${elements}
79
80
81 Delete EVC tunnel between the Unis
82     [Documentation]    Delete EVC
83     [Tags]    UniMgr EVC Delete
84     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Evc_topo_API}
85     Log    ${resp.content}
86     Should Be Equal As Strings    ${resp.status_code}    200
87     ${elements}    Create List    evc://1
88     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/unimgr:evc/    ${elements}
89
90 Delete UNIs source and destination
91     [Documentation]    Delete both UNIs source and destination
92     [Tags]    UniMgr UNI Delete
93     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet1_IP}
94     Log    ${resp.content}
95     Should Be Equal As Strings    ${resp.status_code}    200
96     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/${Uni_topo_API}${Mininet2_IP}
97     Log    ${resp.content}
98     Should Be Equal As Strings    ${resp.status_code}    200
99     ${elements}    Create List    ${Mininet1_IP}    ${Mininet2_IP}
100     Wait Until Keyword Succeeds    16s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/unimgr:uni/    ${elements}