Fix BGPCEP test for 409 code and isolate failures
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 070_bgp_functional_l3vpn_mcast.robot
1 *** Settings ***
2 Documentation     Functional test for bgp - l3vpn-mutlicast
3 ...
4 ...               Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distbmution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...               This suite tests advertising l3vpn_mcast routes to odl. For advertising play.py is used,
11 ...               and particular files are stored as *.hex files.
12 ...               There are L3vpn-ipv4-multicast routes and L3vpn-ipv6-multicast routes tested.
13 Suite Setup       Start_Suite
14 Suite Teardown    Stop_Suite
15 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
16 Library           RequestsLibrary
17 Library           SSHLibrary
18 Library           String
19 Library           ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
20 Resource          ../../../libraries/BGPcliKeywords.robot
21 Resource          ../../../libraries/BGPSpeaker.robot
22 Resource          ../../../libraries/BgpOperations.robot
23 Resource          ../../../libraries/SetupUtils.robot
24 Resource          ../../../libraries/SSHKeywords.robot
25 Resource          ../../../libraries/TemplatedRequests.robot
26 Resource          ../../../variables/Variables.robot
27
28 *** Variables ***
29 ${HOLDTIME}       180
30 ${CONFIG_SESSION}    config-session
31 ${L3VPN_MCAST_DIR}    ${CURDIR}/../../../variables/bgpfunctional/l3vpn_mcast
32 ${PLAY_SCRIPT}    ${CURDIR}/../../../../tools/fastbgp/play.py
33 ${RIB_NAME}       example-bgp-rib
34 &{L3VPN_MCAST_APP_PEER}    IP=${ODL_SYSTEM_IP}    BGP_RIB=${RIB_NAME}
35 &{L3VPN_MCAST_ODL_CONFIG}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=true
36
37 *** Test Cases ***
38 Configure_App_Peer
39     [Documentation]    Configures bgp application peer.
40     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
41     TemplatedRequests.Put_As_Xml_Templated    ${L3VPN_MCAST_DIR}/app_peer    mapping=${L3VPN_MCAST_APP_PEER}    session=${CONFIG_SESSION}
42
43 Reconfigure_ODL_To_Accept_Connection
44     [Documentation]    Configures BGP peer module with initiate-connection set to false.
45     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
46     TemplatedRequests.Put_As_Xml_Templated    ${L3VPN_MCAST_DIR}/bgp_peer    mapping=${L3VPN_MCAST_ODL_CONFIG}    session=${CONFIG_SESSION}
47
48 Start_Bgp_Peer
49     [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.
50     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
51     BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
52
53 Odl_To_Play_l3vpn_mcast
54     [Template]    Odl_To_Play_Template
55     l3vpn_mcast    ${L3VPN_MCAST_DIR}
56
57 Play_To_Odl_l3vpn_mcast
58     [Template]    Play_To_Odl_Template
59     l3vpn_mcast    ${L3VPN_MCAST_DIR}
60
61 Odl_To_Play_l3vpn_mcast_ipv6
62     [Template]    Odl_To_Play_Template
63     l3vpn_mcast_ipv6    ${L3VPN_MCAST_DIR}
64
65 Play_To_Odl_l3vpn_mcast_ipv6
66     [Template]    Play_To_Odl_Template
67     l3vpn_mcast_ipv6    ${L3VPN_MCAST_DIR}    ipv6
68
69 Kill_Talking_BGP_Speaker
70     [Documentation]    Abort the Python speaker
71     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
72     BGPSpeaker.Kill_BGP_Speaker
73     BGPcliKeywords.Store_File_To_Workspace    play.py.out    l3vpn_mcast_play.log
74
75 Delete_Bgp_Peer_Configuration
76     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
77     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
78     TemplatedRequests.Delete_Templated    ${L3VPN_MCAST_DIR}/bgp_peer    mapping=${L3VPN_MCAST_ODL_CONFIG}    session=${CONFIG_SESSION}
79
80 Deconfigure_App_Peer
81     [Documentation]    Revert the BGP configuration to the original state: without application peer
82     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
83     TemplatedRequests.Delete_Templated    ${L3VPN_MCAST_DIR}/app_peer    mapping=${L3VPN_MCAST_APP_PEER}    session=${CONFIG_SESSION}
84
85 *** Keywords ***
86 Start_Suite
87     [Documentation]    Initialize SetupUtils. Suite setup keyword.
88     SetupUtils.Setup_Utils_For_Setup_And_Teardown
89     ${mininet_conn_id} =    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
90     Builtin.Set Suite Variable    ${mininet_conn_id}
91     SSHKeywords.Flexible Mininet Login    ${TOOLS_SYSTEM_USER}
92     RequestsLibrary.Create Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
93     SSHLibrary.Put File    ${PLAY_SCRIPT}    .
94     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
95
96 Stop_Suite
97     [Documentation]    Suite teardown keyword
98     SSHLibrary.Close_All_Connections
99     RequestsLibrary.Delete_All_Sessions
100
101 Start_Bgp_Peer
102     [Documentation]    Starts bgp peer and verifies that the peer runs.
103     BGPSpeaker.Start_BGP_Speaker    --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --debug --l3vpn_mcast --wfr 1
104     BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen