315e76da6f70c4de3fe0d48c0a5ed897f1915135
[integration/test.git] / test / csit / suites / vtn-of10 / 010__AD_SAL_NSF / 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
10 *** Variables ***
11 ${name}           flow1
12 ${key}            flowConfig
13 ${node_id}        00:00:00:00:00:00:00:02
14 ${REST_CONTEXT}    /controller/nb/v2/flowprogrammer
15 ${REST_CONTEXT_ST}    /controller/nb/v2/statistics
16 ${FLOW}           "10.0.0.1"
17
18 *** Test Cases ***
19 Add a flow
20     [Documentation]    Add a flow, list to validate the result.
21     [Tags]    add
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}    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}    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 Check flow in flow stats
35     [Documentation]    Show flow stats and validate result
36     [Tags]   get
37     Sleep   10
38     ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
39     Should Be Equal As Strings    ${resp.status_code}    200 
40     Log    ${resp.content}
41     Should Contain    ${resp.content}    ${FLOW}
42 Remove a flow
43     [Documentation]    Remove a flow, list to validate the result.
44     [Tags]    remove
45     ${node}    Create Dictionary    type    OF    id    ${node_id}
46     ${actions}    Create List    OUTPUT=1
47     ${body}    Create Dictionary    name    ${name}    installInHw    true    node
48     ...    ${node}    priority    1    etherType    0x800    nwDst
49     ...    10.0.0.1/32    actions    ${actions}
50     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}
51     Should Be Equal As Strings    ${resp.status_code}    204
52     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
53     Should Be Equal As Strings    ${resp.status_code}    200
54     ${result}    To JSON    ${resp.content}
55     ${content}    Get From Dictionary    ${result}    ${key}
56     List Should Not Contain Value    ${content}    ${body}
57 Check flow is not in flow stats
58     [Documentation]    Show flow stats and validate result
59     [Tags]    get
60     Sleep   10
61     ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
62     Should Be Equal As Strings    ${resp.status_code}    200 
63     Log    ${resp.content}
64     Should Not Contain    ${resp.content}    ${FLOW}
65