large rework to optimize test code.
[integration/test.git] / test / csit / suites / karaf-compatible / 020__MD_SAL_NSF_OF13 / 040__restconf_frm.txt
1 *** Settings ***
2 Documentation     Test suite for RESTCONF FRM
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           ../../../libraries/RequestsLibrary.py
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.txt
10
11 *** Variables ***
12 ${REST_CON}       /restconf/config/opendaylight-inventory:nodes
13 ${REST_OPR}       /restconf/operational/opendaylight-inventory:nodes
14 ${BODY1}          <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.10.1/32</ipv4-destination></match><id>139</id><table_id>2</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><dec-nw-ttl/></action></apply-actions></instruction></instructions></flow>
15 ${BODY2}          <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.20.1/32</ipv4-destination></match><id>152</id><table_id>2</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><output-action><output-node-connector>1</output-node-connector><max-length>60</max-length></output-action></action></apply-actions></instruction></instructions></flow>
16
17 *** Test Cases ***
18 Add a flow - Sending IPv4 Dest Address and Eth type
19     [Documentation]    Push a flow through REST-API
20     [Tags]    Push
21     ${resp}    Putxml    session    ${REST_CON}/node/openflow:1/table/2/flow/139    data=${BODY1}
22     Should Be Equal As Strings    ${resp.status_code}    200
23
24 Verify after adding flow config - Sending IPv4 Dest Address and Eth type
25     [Documentation]    Verify the flow
26     [Tags]    Get
27     ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/2
28     Should Be Equal As Strings    ${resp.status_code}    200
29     Should Contain    ${resp.content}    139
30
31 Verify after adding flow operational - Sending IPv4 Dest Address and Eth type
32     [Documentation]    Verify the flow
33     [Tags]    Get
34     ${elements}=    Create List    10.0.10.1
35     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_OPR}/node/openflow:1/table/2    ${elements}
36
37 Remove a flow - - Sending IPv4 Dest Address and Eth type
38     [Documentation]    Remove a flow
39     [Tags]    remove
40     ${resp}    Delete    session    ${REST_CON}/node/openflow:1/table/2/flow/139
41     Should Be Equal As Strings    ${resp.status_code}    200
42
43 Verify after deleting flow config - Sending IPv4 Dest Address and Eth type
44     [Documentation]    Verify the flow
45     [Tags]    Get
46     ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/2
47     Should Be Equal As Strings    ${resp.status_code}    200
48     Should Not Contain    ${resp.content}    139
49     # Reason in using high time is, I used STOPWATCH to check the timer after deleting the flow config
50
51 Verify after deleting flow operational - Sending IPv4 Dest Address and Eth type
52     [Documentation]    Verify the flow
53     [Tags]    Get
54     ${elements}=    Create List    10.0.10.1
55     Wait Until Keyword Succeeds    40s    2s    Check For Elements Not At URI    ${REST_OPR}/node/openflow:1/table/2    ${elements}
56
57 Add a flow - Output to physical port#
58     [Documentation]    Push a flow through REST-API
59     [Tags]    Push
60     ${resp}    Putxml    session    ${REST_CON}/node/openflow:1/table/2/flow/152    data=${BODY2}
61     Should Be Equal As Strings    ${resp.status_code}    200
62
63 Verify after adding flow config - Output to physical port#
64     [Documentation]    Verify the flow
65     [Tags]    Get
66     ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/2
67     Should Be Equal As Strings    ${resp.status_code}    200
68     Should Contain    ${resp.content}    152
69
70 Verify after adding flow operational - Output to physical port#
71     [Documentation]    Verify the flow
72     [Tags]    Get
73     ${elements}=    Create List    10.0.20.1
74     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_OPR}/node/openflow:1/table/2    ${elements}
75
76 Remove a flow - Output to physical port#
77     [Documentation]    Remove a flow
78     [Tags]    remove
79     ${resp}    Delete    session    ${REST_CON}/node/openflow:1/table/2/flow/152
80     Should Be Equal As Strings    ${resp.status_code}    200
81
82 Verify after deleting flow config - Output to physical port#
83     [Documentation]    Verify the flow
84     [Tags]    Get
85     ${resp}    Get    session    ${REST_CON}/node/openflow:1/table/2
86     Should Be Equal As Strings    ${resp.status_code}    200
87     Should Not Contain    ${resp.content}    152
88
89 Verify after deleting flow operational - Output to physical port#
90     [Documentation]    Verify the flow
91     [Tags]    Get
92     ${elements}=    Create List    10.0.20.1
93     Wait Until Keyword Succeeds    40s    2s    Check For Elements Not At URI    ${REST_OPR}/node/openflow:1/table/2    ${elements}