cd081581cd7cd096535f628816920a4879c6f660
[integration/test.git] / csit / suites / openstack / neutron / 030__ports.robot
1 *** Settings ***
2 Documentation     Checking Port created in OpenStack are pushed to OpenDaylight
3 Suite Setup       Create Session    OSSession    http://${NEUTRON}:9696    headers=${X-AUTH}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Variables         ../../../variables/Variables.py
8
9 *** Variables ***
10 ${ODLREST}        /controller/nb/v2/neutron/ports
11 ${OSREST}         /v2.0/ports
12 ${data}           {"port":{"network_id":"${NETID}","admin_state_up": true}}
13
14 *** Test Cases ***
15 Check OpenStack ports
16     [Documentation]    Checking OpenStack Neutron for known ports
17     [Tags]    Ports Neutron OpenStack
18     Log    ${X-AUTH}
19     ${resp}    get request    OSSession    ${OSREST}
20     Should be Equal As Strings    ${resp.status_code}    200
21     ${OSResult}    To Json    ${resp.content}
22     Log    ${OSResult}
23
24 Check OpenDaylight ports
25     [Documentation]    Checking OpenDaylight Neutron API for known ports
26     [Tags]    Ports Neutron OpenDaylight
27     Create Session    ODLSession    http://${ODL_SYSTEM_IP}:${PORT}    headers=${HEADERS}    auth=${AUTH}
28     ${resp}    get request    ODLSession    ${ODLREST}
29     Should be Equal As Strings    ${resp.status_code}    200
30     ${ODLResult}    To Json    ${resp.content}
31     Log    ${ODLResult}
32
33 Create New Port
34     [Documentation]    Create new port in OpenStack
35     [Tags]    Create port OpenStack Neutron
36     Log    ${data}
37     ${resp}    post request    OSSession    ${OSREST}    data=${data}
38     Should be Equal As Strings    ${resp.status_code}    201
39     ${result}    To JSON    ${resp.content}
40     ${result}    Get From Dictionary    ${result}    port
41     ${PORTID}    Get From Dictionary    ${result}    id
42     Log    ${result}
43     Log    ${PORTID}
44     Set Global Variable    ${PORTID}
45     sleep    2
46
47 Check New Port
48     [Documentation]    Check new port created in OpenDaylight
49     [Tags]    Check subnet OpenDaylight
50     ${resp}    get request    ODLSession    ${ODLREST}/${PORTID}
51     Should be Equal As Strings    ${resp.status_code}    200