000d24db519f83e29a4d33d05ae8545b7313a836
[integration/test.git] / test / csit / suites / controller / AD_SAL_NSF_OF13 / 040__flow_programmer.txt
1 *** Settings ***
2 Documentation     Test suite for Flow Programmer
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTPORT}    auth=${AUTH}    headers=${HEADERS}
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 ${name}           flow1
13 ${key}            flowConfig
14 ${node_id}        00:00:00:00:00:00:00:02
15 ${REST_CONTEXT}    /controller/nb/v2/flowprogrammer
16 ${REST_CONTEXT_ST}    /controller/nb/v2/statistics
17
18 *** Test Cases ***
19 Add a flow
20     [Documentation]    Add a flow, list to validate the result.
21     [Tags]    adsal
22     ${node}    Create Dictionary    type    OF    id    ${node_id}
23     ${actions}    Create List    OUTPUT=1
24     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
25     ...    ${node}    priority    1    etherType    0x800    nwDst
26     ...    10.0.0.1/32    actions    ${actions}
27     ${resp}    RequestsLibrary.Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
28     Should Be Equal As Strings    ${resp.status_code}    201
29     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}
30     Should Be Equal As Strings    ${resp.status_code}    200
31     ${result}    To JSON    ${resp.content}
32     ${content}    Get From Dictionary    ${result}    ${key}
33     List Should Contain Value    ${content}    ${body}
34
35 Check flow in flow stats
36     [Documentation]    Show flow stats and validate result
37     [Tags]    adsal
38     ${elements}=    Create List    10.0.0.1
39     Wait Until Keyword Succeeds    90s    2s    Check For Elements At URI    ${REST_CONTEXT_ST}/${CONTAINER}/flow    ${elements}
40
41 Remove a flow
42     [Documentation]    Remove a flow, list to validate the result.
43     [Tags]    adsal
44     ${node}    Create Dictionary    type    OF    id    ${node_id}
45     ${actions}    Create List    OUTPUT=1
46     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
47     ...    ${node}    priority    1    etherType    0x800    nwDst
48     ...    10.0.0.1/32    actions    ${actions}
49     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}
50     Should Be Equal As Strings    ${resp.status_code}    204
51     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}
52     Should Be Equal As Strings    ${resp.status_code}    200
53     ${result}    To JSON    ${resp.content}
54     ${content}    Get From Dictionary    ${result}    ${key}
55     List Should Not Contain Value    ${content}    ${body}
56
57 Check flow is not in flow stats
58     [Documentation]    Show flow stats and validate result
59     [Tags]    adsal
60     ${elements}=    Create List    10.0.0.1
61     Wait Until Keyword Succeeds    60s    2s    Check For Elements Not At URI    ${REST_CONTEXT_ST}/${CONTAINER}/flow    ${elements}