Update Robot Framework format - step 13
[integration/test.git] / csit / suites / openstack / neutron / 020__subnets.robot
1 *** Settings ***
2 Documentation       Checking Subnets created in OpenStack are pushed to OpenDaylight
3
4 Library             Collections
5 Library             RequestsLibrary
6 Resource            ../../../variables/Variables.robot
7
8 Suite Setup         Create Session    OSSession    ${NEUTRONURL}    headers=${X-AUTH}
9 Suite Teardown      Delete All Sessions
10
11
12 *** Variables ***
13 ${OSREST}       /v2.0/subnets
14 ${data}
15 ...             {"subnet":{"network_id":"${NETID}","ip_version":4,"cidr":"172.16.64.0/24","allocation_pools":[{"start":"172.16.64.20","end":"172.16.64.120"}]}}
16
17
18 *** Test Cases ***
19 Check OpenStack Subnets
20     [Documentation]    Checking OpenStack Neutron for known subnets
21     [Tags]    subnets neutron openstack
22     Log    ${X-AUTH}
23     ${resp}    get request    OSSession    ${OSREST}
24     Should be Equal As Strings    ${resp.status_code}    200
25     ${OSResult}    To Json    ${resp.text}
26     Log    ${OSResult}
27
28 Check OpenDaylight subnets
29     [Documentation]    Checking OpenDaylight Neutron API for known subnets
30     [Tags]    subnets neutron opendaylight
31     Create Session    ODLSession    http://${ODL_SYSTEM_IP}:${PORT}    headers=${HEADERS}    auth=${AUTH}
32     ${resp}    get request    ODLSession    ${NEUTRON_SUBNETS_API}
33     Should be Equal As Strings    ${resp.status_code}    200
34     ${ODLResult}    To Json    ${resp.text}
35     Log    ${ODLResult}
36
37 Create New subnet
38     [Documentation]    Create new subnet in OpenStack
39     [Tags]    create subnet openstack neutron
40     Log    ${data}
41     ${resp}    post request    OSSession    ${OSREST}    data=${data}
42     Should be Equal As Strings    ${resp.status_code}    201
43     ${result}    To JSON    ${resp.text}
44     ${result}    Get From Dictionary    ${result}    subnet
45     ${SUBNETID}    Get From Dictionary    ${result}    id
46     Log    ${result}
47     Log    ${SUBNETID}
48     Set Global Variable    ${SUBNETID}
49     sleep    2
50
51 Check New subnet
52     [Documentation]    Check new subnet created in OpenDaylight
53     [Tags]    check    subnet opendaylight
54     ${resp}    get request    ODLSession    ${NEUTRON_SUBNETS_API}/${SUBNETID}
55     Should be Equal As Strings    ${resp.status_code}    200