73a519eab0db6e0c5e0c3c4ee4cfbf17ae75e1f3
[integration/test.git] / test / csit / suites / openflowplugin / Groups_Meters_OF13 / 005__openflow_group.robot
1 *** Settings ***
2 Documentation     Test suite for OpenFlow group
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           OperatingSystem
8 Library           ../../../libraries/RequestsLibrary.py
9 Library           ../../../libraries/Common.py
10 Variables         ../../../variables/Variables.py
11 Resource          ../../../libraries/Utils.txt
12
13 *** Variables ***
14 ${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes/
15 ${REST_CONTEXT_CF}    /restconf/config/opendaylight-inventory:nodes/node/openflow:1
16 ${REST_CONTEXT_OP}    /restconf/operational/opendaylight-inventory:nodes/node/openflow:1
17 ${GROUP}          ${CURDIR}/../../../variables/xmls/g4.xml
18 ${FLOW}           ${CURDIR}/../../../variables/xmls/f50.xml
19 ${GROUP_NAME}     Foo
20 ${FLOW_NAME}      forward
21
22 *** Test Cases ***
23 Get list of nodes
24     [Documentation]    Get the inventory to make sure openflow:1 comes up
25     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
26     Log    ${resp.content}
27     Should Be Equal As Strings    ${resp.status_code}    200
28     Should Contain    ${resp.content}    openflow:1
29
30 Add a group
31     [Documentation]    Add a group using RESTCONF
32     [Tags]    Push
33     ${body}    OperatingSystem.Get File    ${GROUP}
34     Set Suite Variable    ${body}
35     ${resp}    Putxml    session    ${REST_CONTEXT_CF}/group/1    data=${body}
36     Log    ${resp.content}
37     Should Be Equal As Strings    ${resp.status_code}    200
38
39 Verify after adding group config
40     [Documentation]    Get the group stat in config
41     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/group/1
42     Log    ${resp.content}
43     Should Be Equal As Strings    ${resp.status_code}    200
44     Should Contain    ${resp.content}    ${GROUP_NAME}
45
46 Verify after adding group operational
47     [Documentation]    Get the group stat in operational
48     ${elements}=    Create List    group-statistics    group-desc
49     Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/group/1    ${elements}
50
51 Add a flow that includes a group
52     [Documentation]    Push a flow through RESTCONF
53     [Tags]    Push
54     ${body}    OperatingSystem.Get File    ${FLOW}
55     Set Suite Variable    ${body}
56     ${resp}    Putxml    session    ${REST_CONTEXT_CF}/table/0/flow/1    data=${body}
57     Log    ${resp.content}
58     Should Be Equal As Strings    ${resp.status_code}    200
59
60 Verify after adding flow config
61     [Documentation]    Verify the flow
62     [Tags]    Get
63     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/1
64     Log    ${resp.content}
65     Should Be Equal As Strings    ${resp.status_code}    200
66     Should Contain    ${resp.content}    ${FLOW_NAME}
67
68 Verify after adding flow operational
69     [Documentation]    Verify the flow
70     ${elements}=    Create List    group-action    group-id
71     Wait Until Keyword Succeeds    60s    2s    Check For Elements At URI    ${REST_CONTEXT_OP}/table/0/flow/1    ${elements}
72
73 Remove the flow
74     [Documentation]    Remove the flow
75     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/table/0/flow/1
76     Should Be Equal As Strings    ${resp.status_code}    200
77
78 Verify after deleting flow
79     [Documentation]    Verify the flow removal
80     [Tags]    Get
81     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/table/0/flow/1
82     Should Not Contain    ${resp.content}    ${FLOW_NAME}
83
84 Delete the group
85     [Documentation]    Remove the group
86     [Tags]    Delete
87     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT_CF}/group/1
88     Log    ${resp.content}
89     Should Be Equal As Strings    ${resp.status_code}    200
90
91 Verify after deleting group
92     [Documentation]    Verify the flow removal
93     [Tags]    Get
94     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_CF}/group/1
95     Should Not Contain    ${resp.content}    ${GROUP_NAME}