Verify dispatcher flows are cleaned at suite end
[integration/test.git] / csit / libraries / DataModels.robot
1 *** Settings ***
2 Documentation     Library to deal with mdsal data models. Initially, as a common place to show and
3 ...               debug a list of data models.
4 Library           RequestsLibrary
5 Variables         ../variables/netvirt/Variables.py
6
7 *** Variables ***
8 @{data_models}    ${EMPTY}
9
10 *** Keywords ***
11 Get Model Dump
12     [Arguments]    ${controller_ip}    ${data_models}=@{data_models}
13     [Documentation]    Will output a list of mdsal models using ${data_models} list
14     # while feature request in bug 7892 is not done, we will quickly timeout and not retry the model dump get
15     # request. This is because when it's done in a failed cluster state, it could take 20s for the reesponse to
16     # to come back as the internal clustering times out waiting for a leader which will not come. When bug 7892
17     # is resolved, we can remove the timeout=1 and max_retries=0, but likely have to modify the request itself to
18     # pass a timeout to restconf
19     Create Session    model_dump_session    http://${controller_ip}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}    timeout=1    max_retries=0
20     : FOR    ${model}    IN    @{data_models}
21     \    ${resp}=    RequestsLibrary.Get Request    model_dump_session    restconf/${model}
22     \    Log    ${resp.status_code}
23     \    ${pretty_output}=    To Json    ${resp.content}    pretty_print=True
24     \    Log    ${pretty_output}
25
26 Verify No Ingress Dispatcher Non-Default Flow Entries
27     [Arguments]    ${ovs_ip}
28     [Documentation]    Verify the ingress dispatcher table has no non-default flows after neutron was cleaned up
29     ${flow_output}=    Run Command On Remote System    ${ovs_ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int table=${DISPATCHER_TABLE} | grep -v "priority=0"
30     Log    ${flow_output}
31     Should Not Contain    ${flow_output}    table=${DISPATCHER_TABLE}
32
33 Verify Flows Are Cleaned Up On All OpenStack Nodes
34     [Documentation]    Verify flows are cleaned up from all OpenStack nodes
35     Run Keyword And Continue On Failure    Verify No Ingress Dispatcher Non-Default Flow Entries    ${OS_CONTROL_NODE_IP}
36     Run Keyword And Continue On Failure    Verify No Ingress Dispatcher Non-Default Flow Entries    ${OS_COMPUTE_1_IP}
37     Run Keyword And Continue On Failure    Verify No Ingress Dispatcher Non-Default Flow Entries    ${OS_COMPUTE_2_IP}