2341f3dcf80b9b861a62280104f4d0cdb26c3a91
[functest.git] / testcases / Controllers / ODL / custom_tests / neutron / 010__networks.robot
1 *** Settings ***
2 Documentation     Checking Network 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/networks
11 ${OSREST}         /v2.0/networks
12 ${postNet}        {"network":{"name":"odl_network","admin_state_up":true}}
13
14 *** Test Cases ***
15 Check OpenStack Networks
16     [Documentation]    Checking OpenStack Neutron for known networks
17     [Tags]    Network 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     Set Suite Variable    ${OSResult}
23     Log    ${OSResult}
24
25 Check OpenDaylight Networks
26     [Documentation]    Checking OpenDaylight Neutron API for known networks
27     [Tags]    Network Neutron OpenDaylight
28     Create Session    ODLSession    http://${CONTROLLER}:${PORT}    headers=${HEADERS}    auth=${AUTH}
29     ${resp}    get request    ODLSession    ${ODLREST}
30     Should be Equal As Strings    ${resp.status_code}    200
31     ${ODLResult}    To Json    ${resp.content}
32     Set Suite Variable    ${ODLResult}
33     Log    ${ODLResult}
34
35 Create Network
36     [Documentation]    Create new network in OpenStack
37     [Tags]    Create Network OpenStack Neutron
38     Log    ${postNet}
39     ${resp}    post request    OSSession    ${OSREST}    data=${postNet}
40     Should be Equal As Strings    ${resp.status_code}    201
41     ${result}    To JSON    ${resp.content}
42     ${result}    Get From Dictionary    ${result}    network
43     ${NETID}    Get From Dictionary    ${result}    id
44     Log    ${result}
45     Log    ${NETID}
46     Set Global Variable    ${NETID}
47     sleep    2
48
49 Check Network
50     [Documentation]    Check network created in OpenDaylight
51     [Tags]    Check    Network OpenDaylight
52     ${resp}    get request    ODLSession    ${ODLREST}/${NetID}
53     Should be Equal As Strings    ${resp.status_code}    200