Fix robot syntax with robot.tidy tool
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 060_bgp_functional_mvpn.robot
1 *** Settings ***
2 Documentation     Functional test for bgp - mvpn
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 mvpn routes to odl. For advertising play.py is used,
11 ...               and particular files are stored as *.hex files. There are 7 different
12 ...               types of routes used for auto-discovery of multicast network. Also 4 more routes
13 ...               with new attributes specific for mvpn.
14 Suite Setup       Start_Suite
15 Suite Teardown    Stop_Suite
16 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Library           RequestsLibrary
18 Library           SSHLibrary
19 Library           String
20 Library           ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
21 Resource          ../../../libraries/BGPcliKeywords.robot
22 Resource          ../../../libraries/BGPSpeaker.robot
23 Resource          ../../../libraries/BgpOperations.robot
24 Resource          ../../../libraries/SetupUtils.robot
25 Resource          ../../../libraries/SSHKeywords.robot
26 Resource          ../../../libraries/TemplatedRequests.robot
27 Resource          ../../../variables/Variables.robot
28
29 *** Variables ***
30 ${HOLDTIME}       180
31 ${CONFIG_SESSION}    config-session
32 ${MVPN_DIR}       ${CURDIR}/../../../variables/bgpfunctional/mvpn
33 ${PLAY_SCRIPT}    ${CURDIR}/../../../../tools/fastbgp/play.py
34 ${RIB_NAME}       example-bgp-rib
35 &{MVPN_APP_PEER}    IP=${ODL_SYSTEM_IP}    BGP_RIB=${RIB_NAME}
36 &{MVPN_ODL_CONFIG}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=true
37
38 *** Test Cases ***
39 Configure_App_Peer
40     [Documentation]    Configures bgp application peer.
41     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
42     TemplatedRequests.Put_As_Xml_Templated    ${MVPN_DIR}/app_peer    mapping=${MVPN_APP_PEER}    session=${CONFIG_SESSION}
43
44 Reconfigure_ODL_To_Accept_Connection
45     [Documentation]    Configures BGP peer module with initiate-connection set to false.
46     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
47     TemplatedRequests.Put_As_Xml_Templated    ${MVPN_DIR}/bgp_peer    mapping=${MVPN_ODL_CONFIG}    session=${CONFIG_SESSION}
48
49 Start_Bgp_Peer
50     [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.
51     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
52     BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
53
54 Odl_To_Play_intra_as_ipmsi_ad
55     [Template]    Odl_To_Play_Template
56     intra_as_ipmsi_ad    ${MVPN_DIR}
57
58 Play_To_Odl_intra_as_ipmsi_ad
59     [Template]    Play_To_Odl_Template
60     intra_as_ipmsi_ad    ${MVPN_DIR}
61
62 Odl_To_Play_inter_as_ipmsi_ad
63     [Template]    Odl_To_Play_Template
64     inter_as_ipmsi_ad    ${MVPN_DIR}
65
66 Play_To_Odl_inter_as_ipmsi_ad
67     [Template]    Play_To_Odl_Template
68     inter_as_ipmsi_ad    ${MVPN_DIR}
69
70 Odl_To_Play_spmsi_ad
71     [Template]    Odl_To_Play_Template
72     spmsi_ad    ${MVPN_DIR}
73
74 Play_To_Odl_spmsi_ad
75     [Template]    Play_To_Odl_Template
76     spmsi_ad    ${MVPN_DIR}
77
78 Odl_To_Play_leaf_ad
79     [Template]    Odl_To_Play_Template
80     leaf_ad    ${MVPN_DIR}
81
82 Play_To_Odl_leaf_ad
83     [Template]    Play_To_Odl_Template
84     leaf_ad    ${MVPN_DIR}
85
86 Odl_To_Play_source_active_ad
87     [Template]    Odl_To_Play_Template
88     source_active_ad    ${MVPN_DIR}
89
90 Play_To_Odl_source_active_ad
91     [Template]    Play_To_Odl_Template
92     source_active_ad    ${MVPN_DIR}
93
94 Odl_To_Play_shared_tree_join
95     [Template]    Odl_To_Play_Template
96     shared_tree_join    ${MVPN_DIR}
97
98 Play_To_Odl_shared_tree_join
99     [Template]    Play_To_Odl_Template
100     shared_tree_join    ${MVPN_DIR}
101
102 Odl_To_Play_source_tree_join
103     [Template]    Odl_To_Play_Template
104     source_tree_join    ${MVPN_DIR}
105
106 Play_To_Odl_source_tree_join
107     [Template]    Play_To_Odl_Template
108     source_tree_join    ${MVPN_DIR}
109
110 Odl_To_Play_intra_pe_distinguisher
111     [Template]    Odl_To_Play_Template
112     intra_pe_distinguisher    ${MVPN_DIR}
113
114 Play_To_Odl_intra_pe_distinguisher
115     [Template]    Play_To_Odl_Template
116     intra_pe_distinguisher    ${MVPN_DIR}
117
118 Odl_To_Play_intra_vrf
119     [Template]    Odl_To_Play_Template
120     intra_vrf    ${MVPN_DIR}
121
122 Play_To_Odl_intra_vrf
123     [Template]    Play_To_Odl_Template
124     intra_vrf    ${MVPN_DIR}
125
126 Odl_To_Play_intra_source_as
127     [Template]    Odl_To_Play_Template
128     intra_source_as    ${MVPN_DIR}
129
130 Play_To_Odl_intra_source_as
131     [Template]    Play_To_Odl_Template
132     intra_source_as    ${MVPN_DIR}
133
134 Odl_To_Play_intra_source_as_4
135     [Template]    Odl_To_Play_Template
136     intra_source_as_4    ${MVPN_DIR}
137
138 Play_To_Odl_intra_source_as_4
139     [Template]    Play_To_Odl_Template
140     intra_source_as_4    ${MVPN_DIR}
141
142 Play_To_Odl_intra_ipv6
143     [Template]    Play_To_Odl_Template
144     intra_ipv6    ${MVPN_DIR}    ipv6
145
146 Kill_Talking_BGP_Speaker
147     [Documentation]    Abort the Python speaker
148     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
149     BGPSpeaker.Kill_BGP_Speaker
150     BGPcliKeywords.Store_File_To_Workspace    play.py.out    mvpn_play.log
151
152 Delete_Bgp_Peer_Configuration
153     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
154     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
155     TemplatedRequests.Delete_Templated    ${MVPN_DIR}/bgp_peer    mapping=${MVPN_ODL_CONFIG}    session=${CONFIG_SESSION}
156
157 Deconfigure_App_Peer
158     [Documentation]    Revert the BGP configuration to the original state: without application peer
159     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
160     TemplatedRequests.Delete_Templated    ${MVPN_DIR}/app_peer    mapping=${MVPN_APP_PEER}    session=${CONFIG_SESSION}
161
162 *** Keywords ***
163 Start_Suite
164     [Documentation]    Initialize SetupUtils. Suite setup keyword.
165     SetupUtils.Setup_Utils_For_Setup_And_Teardown
166     ${mininet_conn_id} =    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
167     Builtin.Set Suite Variable    ${mininet_conn_id}
168     SSHKeywords.Flexible Mininet Login    ${TOOLS_SYSTEM_USER}
169     RequestsLibrary.Create Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
170     SSHLibrary.Put File    ${PLAY_SCRIPT}    .
171     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
172
173 Stop_Suite
174     [Documentation]    Suite teardown keyword
175     SSHLibrary.Close_All_Connections
176     RequestsLibrary.Delete_All_Sessions
177
178 Start_Bgp_Peer
179     [Documentation]    Starts bgp peer and verifies that the peer runs.
180     BGPSpeaker.Start_BGP_Speaker    --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --debug --mvpn --wfr 1
181     BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen