WIP - Adding epl and eplan service tests
[integration/test.git] / csit / suites / unimgr / uni_legato / 020_unimanager_eplan.robot
1 *** Settings ***
2 Documentation     Test suite for legato topology of 1 switch
3 Suite Setup       Setup Test Environment
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Library           SSHLibrary
7 Library           Collections
8 Library           OperatingSystem
9 Resource          ../../../libraries/Utils.robot
10 Resource          ../../../libraries/MininetKeywords.robot
11 Resource          ../../../libraries/TemplatedRequests.robot
12 Resource          ../../../variables/Variables.robot
13
14 *** Variables ***
15 ${UniMgr_variables_DIR}    ${CURDIR}/../../../variables/unimgr
16 ${options}        --topo single,5 --switch ovsk,protocols=OpenFlow13
17
18 *** Test Cases ***
19 Check no connectivity before creating service
20     [Documentation]    Verify packet loss before creating the service between h3 to h4
21     MininetKeywords.Verify Mininet No Ping    h3    h4
22
23 Create device
24     ${device}=    OperatingSystem.Get File    ${UniMgr_variables_DIR}/add_device.json
25     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_API}/mef-topology:mef-topology/devices/    headers=${HEADERS_YANG_JSON}    data=${device}
26     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
27     ${el}    Create List    1
28     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${CONFIG_API}/mef-topology:mef-topology/devices/    ${el}
29
30 Create tenant
31     ${ten}=    OperatingSystem.Get File    ${UniMgr_variables_DIR}/add_tenant.json
32     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_API}/mef-global:mef-global/tenants-instances/    headers=${HEADERS_YANG_JSON}    data=${ten}
33     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
34     ${ten}    Create List    tenant
35     Wait Until Keyword Succeeds    16s    2s    Check For Elements At URI    ${CONFIG_API}/mef-global:mef-global/tenants-instances    ${ten}
36
37 Create linkUni
38     ${link}=    OperatingSystem.Get File    ${UniMgr_variables_DIR}/eplan_uni_link.json
39     ${resp}    RequestsLibrary.Post Request    session    ${CONFIG_API}/mef-interfaces:mef-interfaces/unis/    headers=${HEADERS_YANG_JSON}    data=${link}
40     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
41     ${aa}    Create List    eth3    eth4    eth5
42     Wait Until Keyword Succeeds    56s    2s    Check For Elements At URI    ${CONFIG_API}/mef-interfaces:mef-interfaces/unis/    ${aa}
43
44 Create epl service
45     [Documentation]    Create multi point to multi point service between the eth ports
46     ${interface}    Create List    s1-eth3    s1-eth4    s1-eth5
47     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_API}/mef-interfaces:mef-interfaces/    ${interface}
48     ${body}=    OperatingSystem.Get File    ${UniMgr_variables_DIR}/add_eplan.json
49     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_API}/mef-services:mef-services/    headers=${HEADERS_YANG_JSON}    data=${body}
50     Log    ${resp.content}
51     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
52     ${elements}    Create List    eth3    eth4    eth5
53     Wait Until Keyword Succeeds    56s    8s    Check For Elements At URI    ${CONFIG_API}/mef-services:mef-services/    ${elements}
54
55 Check ping between h3-h4 after service creation
56     [Documentation]    Verify ping between the hosts h3 - h4
57     MininetKeywords.Verify Mininet Ping    h3    h4
58     Wait Until Keyword Succeeds    8s    2s    MininetKeywords.Verify Mininet Ping    h3    h4
59
60 Check ping between h4-h5 after service creation
61     [Documentation]    Verify ping between the hosts h4 - h5
62     MininetKeywords.Verify Mininet Ping    h4    h5
63     Wait Until Keyword Succeeds    8s    2s    MininetKeywords.Verify Mininet Ping    h4    h5
64
65 Check ping between h3-h5 after service creation
66     [Documentation]    Verify ping between the hosts h3 - h5
67     MininetKeywords.Verify Mininet Ping    h3    h5
68     Wait Until Keyword Succeeds    8s    2s    MininetKeywords.Verify Mininet Ping    h3    h5
69
70 Delete epl service
71     [Documentation]    Delete the evc multi point to multi point & verify no ping
72     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_API}/mef-services:mef-services/    headers=${HEADERS_YANG_JSON}
73     Log    ${resp.content}
74     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
75
76 Check no connectivity after deleting service
77     [Documentation]    Verify no ping after deleteing the eplan service
78     Wait Until Keyword Succeeds    8s    2s    MininetKeywords.Verify Mininet No Ping    h3    h4
79
80 *** Keywords ***
81 Setup Test Environment
82     [Documentation]    Establish the Opendayligh session and prepair 1 Mininet VMs
83     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
84     Mininetkeywords.Start Mininet Single Controller    options=${options}