Add test for bug 7349 validation
[integration/test.git] / csit / suites / openflowplugin / Bug_Validation / 7258.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 Resource          ../../../variables/Variables.robot
10
11 *** Variables ***
12 ${XmlsDir}        ${CURDIR}/../../../variables/xmls
13 ${flowfile}       f161.xml
14 ${switch_idx}     1
15 ${switch_name}    s${switch_idx}
16
17 *** Test Cases ***
18 Add Alien Flow And Verify It Is In Operational DS
19     [Documentation]    Add flow with incorrect in-port format to generate alien ID
20     FlowLib.Create Flow Variables For Suite From XML File    ${XmlsDir}/${flowfile}
21     FlowLib.Add Flow Via Restconf    ${switch_idx}    ${table_id}    ${data}
22     BuiltIn.Wait Until Keyword Succeeds    10s    1s    FlowLib.Check Datastore Presence    ${flowfile}    ${True}    ${True}
23     ...    ${False}    ${False}
24     [Teardown]    Report_Failure_Due_To_Bug    7258
25
26 *** Keywords ***
27 Initialization Phase
28     [Documentation]    Starts mininet and verify if topology is in operational datastore.
29     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
30     BuiltIn.Set Suite Variable    ${mininet_conn_id}
31     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
32     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
33
34 Final Phase
35     [Documentation]    Stops mininet.
36     BuiltIn.Run Keyword And Ignore Error    RequestsLibrary.Delete Request    session    ${CONFIG_NODES_API}
37     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
38     RequestsLibrary.Delete All Sessions
39
40 Are Switches Connected Topo
41     [Documentation]    Checks wheather switches are connected to controller
42     ${resp}=    RequestsLibrary.Get Request    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
43     Log    ${resp.content}
44     ${count}=    XML.Get Element Count    ${resp.content}    xpath=node
45     BuiltIn.Should Be Equal As Numbers    ${count}    1