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