Adapt netconf device configuration in daexim CSIT
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 050_bmp_basic.robot
1 *** Settings ***
2 Documentation       Basic tests for odl-bgpcep-bmp feature
3 ...
4 ...                 Copyright (c) 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 ...                 This is a basic suite for bgp monitoring protocol feature.
11 ...                 After the feature odl-bgpcep-bmp installation the port 12345 should be
12 ...                 bound for listening,
13 ...                 To test this feature bgp-bmp-mock tool is used. It is a part of the
14 ...                 bgpcep project. It is a java tool which simulates more peers and more
15 ...                 routers.
16 ...                 In this particular test suite it simulates 1 peer with 1 router, which
17 ...                 means it advertizes one peer ipv4 address towards odl. As a result one
18 ...                 route should appear in the restconf/operational/bmp-monitor:bmp-monitor.
19
20 Library             SSHLibrary
21 Library             RequestsLibrary
22 Resource            ${CURDIR}/../../../libraries/CompareStream.robot
23 Resource            ${CURDIR}/../../../libraries/NexusKeywords.robot
24 Resource            ${CURDIR}/../../../libraries/RemoteBash.robot
25 Resource            ${CURDIR}/../../../libraries/TemplatedRequests.robot
26
27 Suite Setup         Set_It_Up
28 Suite Teardown      Tear_It_Down
29
30
31 *** Variables ***
32 ${CONFIG_SESSION}       config-session
33 ${BGP_BMP_DIR}          ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/filled_structure
34 ${BGP_BMP_FEAT_DIR}     ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/empty_structure
35 ${BMP_LOG_FILE}         bmpmock.log
36
37
38 *** Test Cases ***
39 Verify BMP Feature
40     [Documentation]    Verifies if feature is up
41     &{mapping}=    BuiltIn.Create_Dictionary    TOOL_IP=${TOOLS_SYSTEM_IP}
42     BuiltIn.Wait_Until_Keyword_Succeeds
43     ...    180s
44     ...    5s
45     ...    TemplatedRequests.Get_As_Json_Templated
46     ...    folder=${BGP_BMP_FEAT_DIR}
47     ...    mapping=${mapping}
48     ...    session=${CONFIG_SESSION}
49     ...    verify=True
50
51 Start_Bmp_Mock
52     [Documentation]    Starts bmp-mock on tools vm
53     ${command}=    NexusKeywords.Compose_Full_Java_Command
54     ...    -jar ${filename} --local_address ${TOOLS_SYSTEM_IP} --remote_address ${ODL_SYSTEM_IP}:12345 --routers_count 1 --peers_count 1 --log_level DEBUG 2>&1 | tee ${BMP_LOG_FILE}
55     BuiltIn.Log    ${command}
56     SSHLibrary.Set_Client_Configuration    timeout=30s
57     SSHLibrary.Write    ${command}
58     ${until_phrase}=    Set Variable    successfully established.
59     SSHLibrary.Read_Until    ${until_phrase}
60
61 Verify Data Reported
62     [Documentation]    Verifies if the tool reported expected data
63     &{mapping}=    BuiltIn.Create_Dictionary    TOOL_IP=${TOOLS_SYSTEM_IP}
64     BuiltIn.Wait_Until_Keyword_Succeeds
65     ...    3x
66     ...    2s
67     ...    TemplatedRequests.Get_As_Json_Templated
68     ...    folder=${BGP_BMP_DIR}
69     ...    mapping=${mapping}
70     ...    session=${CONFIG_SESSION}
71     ...    verify=True
72
73 Stop_Bmp_Mock
74     [Documentation]    Send ctrl+c to bmp-mock to stop it
75     RemoteBash.Write_Bare_Ctrl_C
76     ${output}=    SSHLibrary.Read_Until_Prompt
77     BuiltIn.Log    ${output}
78
79
80 *** Keywords ***
81 Set_It_Up
82     [Documentation]    Create SSH session to ToolsVm, prepare HTTP client session to Controller.
83     ...    Figure out latest pcc-mock version and download it from Nexus to ToolsVm.
84     NexusKeywords.Initialize_Artifact_Deployment_And_Usage
85     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
86     ${name}=    NexusKeywords.Deploy_Test_Tool    bgpcep    bgp-bmp-mock
87     BuiltIn.Set_Suite_Variable    ${filename}    ${name}
88
89 Tear_It_Down
90     [Documentation]    Download bmpmock.log and Log its contents.
91     ...    Compute and Log the diff between expected and actual normalized responses.
92     ...    Close both HTTP client session and SSH connection to Mininet.
93     SSHLibrary.Get_File    ${BMP_LOG_FILE}
94     ${cnt}=    OperatingSystem.Get_File    ${BMP_LOG_FILE}
95     Log    ${cnt}
96     Delete_All_Sessions
97     Close_All_Connections