creating ExaBgpLib and refactoring bgp functional suites to use it
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 030_bgp_functional_evpn.robot
index 656577650d9647e8e26066bcbdb2a1c04d3a8464..f6dc48f23b2c4646ee534d18796a6a97c26461cb 100644 (file)
@@ -14,18 +14,17 @@ Documentation     Functional test for bgp - evpn
 ...               is recevied from odl.
 Suite Setup       Start_Suite
 Suite Teardown    Stop_Suite
-Test Setup        Verify Test Preconditions
+Test Setup        Run Keywords    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+...               AND    Verify Test Preconditions
 Library           RequestsLibrary
 Library           SSHLibrary
 Variables         ${CURDIR}/../../../variables/Variables.py
 Resource          ${CURDIR}/../../../libraries/Utils.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
-Library           ${CURDIR}/../../../libraries/norm_json.py
 Library           ${CURDIR}/../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
 Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
 Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
-Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 
 *** Variables ***
@@ -34,7 +33,6 @@ ${DEVICE_NAME}    controller-config
 ${BGP_PEER_NAME}    example-bgp-peer
 ${RIB_INSTANCE}    example-bgp-rib
 ${APP_PEER_NAME}    example-bgp-peer-app
-${CMD}            env exabgp.tcp.port=1790 exabgp --debug
 ${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional
 ${DEFAUTL_RPC_CFG}    exa.cfg
 ${CONFIG_SESSION}    config-session
@@ -48,20 +46,20 @@ ${LOC_RIB_URL}    /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-
 *** Test Cases ***
 Configure_App_Peer
     [Documentation]    Configures bgp application peer
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    APP_PEER_ID=${ODL_SYSTEM_IP}
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configures BGP peer module with initiate-connection set to false.
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    RIB_INSTANCE_NAME=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Start_Bgp_Peer
     [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
 
 Odl_To_Play_route_es_arb
@@ -298,24 +296,24 @@ Play_To_Odl_route_mac_rou
 
 Kill_Talking_BGP_Speaker
     [Documentation]    Abort the Python speaker
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     BGPSpeaker.Kill_BGP_Speaker
 
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Deconfigure_App_Peer
     [Documentation]    Revert the BGP configuration to the original state: without application peer
-    [Setup]    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 *** Keywords ***
 Start_Suite
-    [Documentation]    Suite setup keyword
+    [Documentation]    Initialize SetupUtils. Suite setup keyword.
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     ${mininet_conn_id}=    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
     Builtin.Set Suite Variable    ${mininet_conn_id}
@@ -336,7 +334,6 @@ Start_Bgp_Peer
 
 Odl_To_Play_Template
     [Arguments]    ${totest}
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
     ${data_xml}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/${totest}.xml
     ${data_json}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/${totest}.json
     ${announce_hex}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/announce_${totest}.hex
@@ -362,7 +359,6 @@ Odl_To_Play_Template
 
 Play_To_Odl_Template
     [Arguments]    ${totest}
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
     ${data_xml}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/${totest}.xml
     ${data_json}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/${totest}.json
     ${announce_hex}=    OperatingSystem.Get_File    ${EVPN_VARIABLES_DIR}/announce_${totest}.hex
@@ -416,9 +412,4 @@ Loc_Rib_Presnece
     [Arguments]    ${exp_content}
     [Documentation]    Verifies if loc-rib contains expected data
     ${rsp}=    RequestsLibrary.Get_Request    ${CONFIG_SESSION}    ${LOC_RIB_URL}    headers=${HEADERS}
-    Log    ${rsp.content}
-    ${received_json}=    norm_json.Normalize_Json_Text    ${rsp.content}
-    BuiltIn.Log    ${received_json}
-    ${expected_json}=    norm_json.Normalize_Json_Text    ${exp_content}
-    BuiltIn.Log    ${expected_json}
-    BuiltIn.Should_Be_Equal    ${received_json}    ${expected_json}
+    TemplatedRequests.Normalize_Jsons_And_Compare    ${exp_content}    ${rsp.content}