Remove variables.py
[integration/test.git] / csit / suites / bgpcep / bgpuser / ibgp_peer_lsp.robot
1 *** Settings ***
2 Documentation     Basic tests for iBGP peers.
3 ...
4 ...               Copyright (c) 2015-2016 Cisco Systems, Inc. and others. 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 distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...               Test suite performs basic iBGP functional test case for
11 ...               carrying LSP State Information in BGP as described in
12 ...               http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03
13 Suite Setup       Setup_Everything
14 Suite Teardown    BgpOperations.Teardown_Everything
15 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
16 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
17 Library           OperatingSystem
18 Library           RequestsLibrary
19 Library           DateTime
20 Resource          ../../../libraries/BGPcliKeywords.robot
21 Resource          ../../../libraries/BgpOperations.robot
22 Resource          ../../../libraries/KarafKeywords.robot
23 Resource          ../../../libraries/SetupUtils.robot
24 Resource          ../../../libraries/SSHKeywords.robot
25 Resource          ../../../libraries/TemplatedRequests.robot
26 Resource          ../../../libraries/WaitForFailure.robot
27 Resource          ../../../variables/Variables.robot
28
29 *** Variables ***
30 ${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpuser/
31 ${COUNT}          1
32 ${HOLDTIME}       180
33 ${BGP_PEER_LOG_FILE}    bgp_peer.log
34 ${BGP_PEER_COMMAND}    python play.py --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL} --logfile ${BGP_PEER_LOG_FILE} --bgpls True
35 ${BGP_PEER_OPTIONS}    &>${BGP_PEER_LOG_FILE}
36 ${DEFAULT_RIB_CHECK_PERIOD}    1s
37 ${DEFAULT_RIB_CHECK_TIMEOUT}    10s
38 ${BGP_PEER_LOG_LEVEL}    debug
39 ${ODL_LOG_LEVEL}    INFO
40 ${ODL_BGP_LOG_LEVEL}    DEFAULT
41 ${JSONKEYSTR}     "linkstate-route"
42 ${BGP_PEER_NAME}    example-bgp-peer
43 ${DEVICE_NAME}    controller-config
44 ${CONFIG_SESSION}    config-session
45 ${SKIP_PARAMS}    --skipattr
46 ${RIB_INSTANCE}    example-bgp-rib
47 ${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
48
49 *** Test Cases ***
50 TC1_Configure_iBGP_Peer
51     [Documentation]    Configure BGP peer module with initiate-connection set to false.
52     [Tags]    critical
53     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
54     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
55     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
56
57 TC1_Check_Example_Bgp_Rib_Is_Empty
58     [Documentation]    Check RIB for none linkstate-routes
59     [Tags]    critical
60     SSHLibrary.Switch Connection    bgp_peer_console
61     BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain    ${CONFIG_SESSION}    ${JSONKEYSTR}
62
63 TC1_Connect_BGP_Peer
64     [Documentation]    Connect BGP peer with advertising the routes without mandatory params like LOC_PREF.
65     [Tags]    critical
66     SSHLibrary.Switch Connection    bgp_peer_console
67     BuiltIn.Run_Keyword_And_Ignore_Error    KarafKeywords.Log_Message_To_Controller_Karaf    Error = WELL_KNOWN_ATTR_MISSING is EXPECTED in this test case, and should be thrown when missing mandatory attributes.
68     BGPcliKeywords.Start_Console_Tool    ${BGP_PEER_COMMAND} ${SKIP_PARAMS}    ${BGP_PEER_OPTIONS}
69     BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
70
71 TC1_Check_Example_Bgp_Rib
72     [Documentation]    Check RIB for not containig linkstate-route(s), because update messages were not good.
73     [Tags]    critical
74     SSHLibrary.Switch Connection    bgp_peer_console
75     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    ${DEFAULT_RIB_CHECK_TIMEOUT}    ${DEFAULT_RIB_CHECK_PERIOD}    BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain    ${CONFIG_SESSION}    ${JSONKEYSTR}
76
77 TC1_Disconnect_BGP_Peer
78     [Documentation]    Stop BGP peer & store logs
79     [Tags]    critical
80     SSHLibrary.Switch Connection    bgp_peer_console
81     BGPcliKeywords.Stop_Console_Tool
82     BGPcliKeywords.Store_File_To_Workspace    ${BGP_PEER_LOG_FILE}    tc1_${BGP_PEER_LOG_FILE}
83
84 TC1_Deconfigure_iBGP_Peer
85     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
86     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
87     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
88
89 TC2_Configure_iBGP_Peer
90     [Documentation]    Configures BGP peer module with initiate-connection set to false.
91     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
92     ...    INITIATE=false    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
93     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
94
95 TC2_Check_Example_Bgp_Rib_Is_Empty
96     [Documentation]    Check RIB for none linkstate-routes
97     [Tags]    critical
98     SSHLibrary.Switch Connection    bgp_peer_console
99     BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain    ${CONFIG_SESSION}    ${JSONKEYSTR}
100
101 TC2_Connect_BGP_Peer
102     [Documentation]    Connect BGP peer
103     [Tags]    critical
104     SSHLibrary.Switch Connection    bgp_peer_console
105     BGPcliKeywords.Start_Console_Tool    ${BGP_PEER_COMMAND}    ${BGP_PEER_OPTIONS}
106     BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
107
108 TC2_Check_Example_Bgp_Rib
109     [Documentation]    Check RIB for linkstate-route(s)
110     [Tags]    critical
111     SSHLibrary.Switch Connection    bgp_peer_console
112     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_RIB_CHECK_TIMEOUT}    ${DEFAULT_RIB_CHECK_PERIOD}    BgpOperations.Check_Example_Bgp_Rib_Content    ${CONFIG_SESSION}    ${JSONKEYSTR}
113
114 TC2_Disconnect_BGP_Peer
115     [Documentation]    Stop BGP peer & store logs
116     [Tags]    critical
117     SSHLibrary.Switch Connection    bgp_peer_console
118     BGPcliKeywords.Stop_Console_Tool
119     BGPcliKeywords.Store_File_To_Workspace    ${BGP_PEER_LOG_FILE}    tc2_${BGP_PEER_LOG_FILE}
120
121 TC2_Deconfigure_iBGP_Peer
122     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
123     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
124     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
125
126 *** Keywords ***
127 Setup_Everything
128     [Documentation]    Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
129     ...    prepare directories for responses, put Python tool to mininet machine, setup imported resources.
130     SetupUtils.Setup_Utils_For_Setup_And_Teardown
131     SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
132     SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}    alias=bgp_peer_console
133     SSHKeywords.Flexible_Mininet_Login
134     SSHKeywords.Require_Python
135     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
136     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
137     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
138     KarafKeywords.Setup_Karaf_Keywords
139     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_LOG_LEVEL}
140     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.bgpcep
141     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.protocol