444fc321b0fec566b599bd5cf270ea7990e3ef24
[integration/test.git] / csit / suites / openflowplugin / Bug_Validation / 6917.robot
1 *** Settings ***
2 Documentation     Test suite for bug 6917 validation.
3 Suite Setup       Initialization Phase
4 Suite Teardown    Final Phase
5 Library           XML
6 Library           RequestsLibrary
7 Resource          ../../../libraries/MininetKeywords.robot
8 Resource          ../../../libraries/FlowLib.robot
9 Variables         ../../../variables/Variables.py
10
11 *** Variables ***
12 ${XmlsDir}        ${CURDIR}/../../../variables/xmls
13 ${flowfile}       f21.xml
14 ${switch_idx}     1
15 ${switch_name}    s${switch_idx}
16 ${iteration}      5
17
18 *** Test Cases ***
19 Bug 6917
20     [Documentation]    Iterate on add and delete flow until alien ID is found in Operational Datastore.
21     : FOR    ${i}    IN RANGE    ${iteration}
22     \    Add And Delete Flow
23     [Teardown]    Report_Failure_Due_To_Bug    6917
24
25 *** Keywords ***
26 Initialization Phase
27     [Documentation]    Starts mininet and verify if topology is in operational datastore.
28     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
29     BuiltIn.Set Suite Variable    ${mininet_conn_id}
30     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
31     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
32
33 Final Phase
34     [Documentation]    Stops mininet.
35     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
36     RequestsLibrary.Delete All Sessions
37
38 Are Switches Connected Topo
39     [Documentation]    Checks wheather switches are connected to controller
40     ${resp}=    RequestsLibrary.Get Request    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
41     Log    ${resp.content}
42     ${count}=    XML.Get Element Count    ${resp.content}    xpath=node
43     BuiltIn.Should Be Equal As Numbers    ${count}    1
44
45 Add And Delete Flow
46     [Documentation]    Add a Delete a Flow and verify presence in Datastore. The 5 sec sleep is required to reproduce the bug.
47     Sleep    5
48     FlowLib.Create Flow Variables For Suite From XML File    ${XmlsDir}/${flowfile}
49     FlowLib.Add Flow Via Restconf    ${switch_idx}    ${table_id}    ${data}
50     BuiltIn.Wait Until Keyword Succeeds    10s    1s    FlowLib.Check Operational Flow    ${True}    ${data}
51     FlowLib.Check Datastore Presence    ${flowfile}    ${True}    ${True}    ${False}    ${True}
52     FlowLib.Delete Flow Via Restconf    ${switch_idx}    ${table_id}    ${flow_id}
53     BuiltIn.Wait Until Keyword Succeeds    10s    1s    FlowLib.Check Operational Flow    ${False}    ${data}
54     FlowLib.Check Datastore Presence    ${flowfile}    ${False}    ${False}    ${True}
55     [Teardown]    BuiltIn.Run Keyword And Ignore Error    FlowLib.Delete Flow Via Restconf    ${switch_idx}    ${table_id}    ${flow_id}