Add module to the augmented node in the URL path
[integration/test.git] / csit / suites / openflowplugin / Bundlebased_Reconciliation / 010_bundle_resync.robot
1 *** Settings ***
2 Documentation     Test suite for verifying Bundle based reconciliation with switch(OVS)
3 Suite Setup       Start Suite
4 Suite Teardown    End Suite
5 Library           XML
6 Library           ${CURDIR}/../../../../csit/libraries/XmlComparator.py
7 Resource          ../../../libraries/Utils.robot
8 Resource          ../../../libraries/OVSDB.robot
9 Resource          ../../../libraries/KarafKeywords.robot
10 Resource          ../../../libraries/FlowLib.robot
11 Resource          ../../../variables/Variables.robot
12 Resource          ../../../variables/netvirt/Variables.robot
13 Resource          ../../../libraries/DataModels.robot
14 Resource          ../../../variables/openflowplugin/Variables.robot
15
16 *** Variables ***
17 ${XMLSDIR}        ${CURDIR}/../../../../csit/variables/openflowplugin
18 @{FLOWFILE}       f279.xml    f280.xml    f281.xml    f282.xml    f283.xml    f284.xml    f278.xml
19 @{GROUPFILE}      g279.xml    g280.xml    g281.xml
20 @{GROUP_ID}       1    2    3
21 ${FLAG_MSG}       "bundle-based-reconciliation-enabled configuration property was changed to 'true'"
22 ${STATIC_FLOW}    table=91
23 @{DATA_MODELS}    data/opendaylight-inventory:nodes?${RFC8040_CONFIG_CONTENT}    data/opendaylight-inventory:nodes?${RFC8040_OPERATIONAL_CONTENT}
24
25 *** Test Cases ***
26 TC01_Reconciliation check after switch restart
27     [Documentation]    Verify the Bundle based reconciliation with switch(OVS) restart scenario
28     Push Static Flow    ${TOOLS_SYSTEM_IP}
29     ${switch_idx}    OVSDB.Get DPID    ${TOOLS_SYSTEM_IP}
30     Push Flow Via Restcall    ${switch_idx}    ${FLOWFILE[6]}
31     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo service openvswitch-switch restart
32     Wait Until Keyword Succeeds    5s    1s    FlowLib.Check Operational Flow    ${True}    ${data}
33     Log    Check if static flow is removed in the switch
34     ${Ovs1Flow}    Utils.Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenflow13
35     Should Not Contain    ${Ovs1Flow}    ${STATIC_FLOW}
36     Log    Check if flows are pushed as bundle messages
37     ${Resyncdone_msg}=    BuiltIn.Set Variable    "Completing bundle based reconciliation for device ID:${switch_idx}"
38     Check_Karaf_Log_Message_Count    ${Resyncdone_msg}    1
39
40 TC02_Reconcilation check with new switch added
41     [Documentation]    Verify the Bundle based reconciliation pushing a group dependent flow in the new switch added
42     Push Static Flow    ${TOOLS_SYSTEM_2_IP}
43     ${switch_idx}    OVSDB.Get DPID    ${TOOLS_SYSTEM_2_IP}
44     Push Groups Via Restcall    ${switch_idx}    0
45     Push Flow Via Restcall    ${switch_idx}    ${FLOWFILE[0]}
46     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_2_IP}    sudo service openvswitch-switch restart
47     Wait Until Keyword Succeeds    5s    1s    FlowLib.Check Operational Flow    ${True}    ${data}
48     Log    Check if static flow is removed in the switch
49     ${Ovs1Flow}    Utils.Run Command On Remote System    ${TOOLS_SYSTEM_2_IP}    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenflow13
50     Should Not Contain    ${Ovs1Flow}    ${STATIC_FLOW}
51     Log    Check if flows are pushed as bundle messages
52     ${Resyncdone_msg}=    BuiltIn.Set Variable    "Completing bundle based reconciliation for device ID:${switch_idx}"
53     Check_Karaf_Log_Message_Count    ${Resyncdone_msg}    1
54
55 TC03_Reconciliation check by pushing group dependent flows
56     [Documentation]    Verify the Bundle based reconciliation by pushing multiple group dependent flows
57     ${switch_idx}    OVSDB.Get DPID    ${TOOLS_SYSTEM_2_IP}
58     FOR    ${index}    IN RANGE    1    3
59         Push Groups Via Restcall    ${switch_idx}    ${index}
60     END
61     FOR    ${index}    IN RANGE    1    6
62         Push Flow Via Restcall    ${switch_idx}    ${FLOWFILE[${index}]}
63         Set Test Variable    ${flowbody[${index}]}    ${data}
64     END
65     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_2_IP}    sudo service openvswitch-switch restart
66     FOR    ${index}    IN RANGE    1    6
67         Wait Until Keyword Succeeds    5s    1s    FlowLib.Check Operational Flow    ${True}    ${flowbody[${index}]}
68     END
69     Log    Check if flows are pushed as bundle messages
70     ${Resyncdone_msg}=    BuiltIn.Set Variable    "Completing bundle based reconciliation for device ID:${switch_idx}"
71     Check_Karaf_Log_Message_Count    ${Resyncdone_msg}    2
72
73 *** Keywords ***
74 Start Suite
75     [Documentation]    Run at start of the suite
76     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
77     KarafKeywords.Issue_Command_On_Karaf_Console    log:set DEBUG org.opendaylight.openflowplugin.applications.frm.impl.FlowNodeReconciliationImpl
78     Check_Karaf_Log_Message_Count    ${FLAG_MSG}    1
79     Configure DPN    ${TOOLS_SYSTEM_IP}
80     Configure DPN    ${TOOLS_SYSTEM_2_IP}
81
82 End Suite
83     [Documentation]    Run at end of the suite
84     RequestsLibrary.Delete Request    session    ${RFC8040_NODES_API}
85     KarafKeywords.Issue_Command_On_Karaf_Console    log:set INFO org.opendaylight.openflowplugin.applications.frm.impl.FlowNodeReconciliationImpl
86     SSHLibrary.Close All Connections
87
88 Configure DPN
89     [Arguments]    ${ip}
90     [Documentation]    Add the bridge in the DPN specified and set manager,controller for the bridge
91     Utils.Run Command On Remote System    ${ip}    sudo ovs-vsctl add-br ${INTEGRATION_BRIDGE}
92     Utils.Run Command On Remote System    ${ip}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
93     Utils.Run Command On Remote System    ${ip}    sudo ovs-vsctl set-controller ${INTEGRATION_BRIDGE} tcp:${ODL_SYSTEM_IP}:6653
94     Utils.Run Command On Remote System    ${ip}    sudo ovs-vsctl set bridge ${INTEGRATION_BRIDGE} protocols=OpenFlow13
95     Wait Until Keyword Succeeds    20s    2s    DataModels.Get Model Dump    ${ODL_SYSTEM_IP}    ${DATA_MODELS}    ${RFC8040_RESTCONF_ROOT}
96
97 Push Static Flow
98     [Arguments]    ${ip}
99     [Documentation]    Add Static Flow in the DPN specified
100     Utils.Run Command On Remote System    ${ip}    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenflow13
101     Utils.Run Command On Remote System    ${ip}    sudo ovs-ofctl add-flow ${INTEGRATION_BRIDGE} table=91,ipv6,actions=dec_ttl -OOpenflow13
102
103 Push Flow Via Restcall
104     [Arguments]    ${switch_idx}    ${flowfile}
105     [Documentation]    Adds Flow to the specified DPN via Restcall
106     FlowLib.Create Flow Variables For Suite From XML File    ${XMLSDIR}/${flowfile}
107     FlowLib.Add Flow Via Restconf    ${switch_idx}    ${table_id}    ${data}
108     BuiltIn.Set Test Variable    ${switch_idx}
109     FlowLib.Check Config Flow    ${True}    ${data}
110     Wait Until Keyword Succeeds    5s    1s    FlowLib.Check Operational Flow    ${True}    ${data}
111
112 Push Groups Via Restcall
113     [Arguments]    ${switch_idx}    ${index}
114     ${GROUP_BODY}    OperatingSystem.Get File    ${XMLSDIR}/${GROUPFILE[${index}]}
115     ${node_id}    BuiltIn.Set Variable    openflow%3A${switch_idx}
116     ${group_id}    BuiltIn.Set Variable    ${GROUP_ID[${index}]}
117     FlowLib.Add Group To Controller And Verify    ${GROUP_BODY}    ${node_id}    ${group_id}
118     Wait Until Keyword Succeeds    5s    1s    Utils.Get URI And Verify    ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=nonconfig