dabe1218dbaf5129533bd2a698c13d0238820d9d
[integration/test.git] / csit / suites / openflowplugin / Bug_Validation / 7335.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 ${flowfile1}      f162.xml
14 ${flowfile2}      f163.xml
15 ${switch_idx}     1
16 ${switch_name}    s${switch_idx}
17
18 *** Test Cases ***
19 Add Flow And Check It Is In Operational DS
20     [Documentation]    Add flow match IP and Ethertype IP
21     FlowLib.Create Flow Variables For Suite From XML File    ${XmlsDir}/${flowfile1}
22     FlowLib.Add Flow Via Restconf    ${switch_idx}    ${table_id}    ${data}
23     BuiltIn.Wait Until Keyword Succeeds    10s    1s    FlowLib.Check Datastore Presence    ${flowfile1}    ${True}    ${True}
24     ...    ${False}    ${True}
25
26 Update Flow With Invalid Match And Check It Is Not In Operational DS
27     [Documentation]    Update flow removing Ethertype, this should remove flow from switch and operational DS
28     FlowLib.Create Flow Variables For Suite From XML File    ${XmlsDir}/${flowfile2}
29     FlowLib.Update Flow Via Restconf    ${switch_idx}    ${table_id}    285    ${data}
30     FlowLib.Check Config Flow    ${True}    ${data}
31     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Utils.No Content From URI    session    ${OPERATIONAL_NODES_API}/node/openflow:${switch_idx}/table/0/flow/285
32     [Teardown]    Report_Failure_Due_To_Bug    7335
33
34 *** Keywords ***
35 Initialization Phase
36     [Documentation]    Starts mininet and verify if topology is in operational datastore.
37     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
38     BuiltIn.Set Suite Variable    ${mininet_conn_id}
39     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
40     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
41
42 Final Phase
43     [Documentation]    Stops mininet.
44     BuiltIn.Run Keyword And Ignore Error    RequestsLibrary.Delete Request    session    ${CONFIG_NODES_API}
45     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
46     RequestsLibrary.Delete All Sessions
47
48 Are Switches Connected Topo
49     [Documentation]    Checks wheather switches are connected to controller
50     ${resp}=    RequestsLibrary.Get Request    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
51     Log    ${resp.content}
52     ${count}=    XML.Get Element Count    ${resp.content}    xpath=node
53     BuiltIn.Should Be Equal As Numbers    ${count}    1