basic bmp suite added 89/40589/8
authorPeter Gubka <pgubka@cisco.com>
Tue, 21 Jun 2016 09:30:42 +0000 (11:30 +0200)
committerVratko Polák <vrpolak@cisco.com>
Wed, 22 Jun 2016 15:01:33 +0000 (15:01 +0000)
Change-Id: I7fc85a71df43c22ca72977fdefcb86f10b6b5390
Signed-off-by: Peter Gubka <pgubka@cisco.com>
csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot [new file with mode: 0644]
csit/testplans/bgpcep-userfeatures.txt
csit/variables/bgpfunctional/bmp_basic/data.json [new file with mode: 0644]
csit/variables/bgpfunctional/bmp_basic/location.uri [new file with mode: 0644]

diff --git a/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot b/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
new file mode 100644 (file)
index 0000000..4fb11c0
--- /dev/null
@@ -0,0 +1,70 @@
+*** Settings ***
+Documentation     Basic tests for odl-bgpcep-bmp feature
+...
+...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+...
+...               This program and the accompanying materials are made available under the
+...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
+...               and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+...               This is a basic suite for bgp monitoring protocol feature.
+...               After the feature odl-bgpcep-bmp installation the port 12345 should be
+...               bound for listening,
+...               To test this feature bgp-bmp-mock tool is used. It is a part of the
+...               bgpcep project. It is a java tool which simulates more peers and more
+...               routers.
+...               In this particular test suite it simulates 1 peer with 1 router, which
+...               means it advertizes one peer ipv4 address towards odl. As a result one
+...               route should appear in the restconf/operational/bmp-monitor:bmp-monitor.
+Suite Setup       Set_It_Up
+Suite Teardown    Tear_It_Down
+Library           SSHLibrary
+Library           RequestsLibrary
+Resource          ${CURDIR}/../../../libraries/NexusKeywords.robot
+Resource          ${CURDIR}/../../../libraries/Utils.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+
+*** Variables ***
+${CONFIG_SESSION}    config-session
+${BGP_BMP_DIR}    ${CURDIR}/../../../variables/bgpfunctional/bmp_basic
+${BMP_LOG_FILE}    bmpmock.log
+
+*** Test Cases ***
+Start_Bmp_Mock
+    [Documentation]    Starts bmp-mock on tools vm
+    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --local_address ${TOOLS_SYSTEM_IP} --remote_address ${ODL_SYSTEM_IP} --routers_count 1 --peers_count 1 --log_level DEBUG 2>&1 | tee ${BMP_LOG_FILE}
+    BuiltIn.Log    ${command}
+    SSHLibrary.Set_Client_Configuration    timeout=30s
+    SSHLibrary.Write    ${command}
+    SSHLibrary.Read_Until    successfully established.
+
+Verify Data Reported
+    [Documentation]    Verifies if the tool reported expected data
+    &{mapping}    BuiltIn.Create_Dictionary    TOOL_IP=${TOOLS_SYSTEM_IP}
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    2s    TemplatedRequests.Get_As_Json_Templated    folder=${BGP_BMP_DIR}    mapping=${mapping}    session=${CONFIG_SESSION}
+    ...    verify=True
+
+Stop_Bmp_Mock
+    [Documentation]    Send ctrl+c to bmp-mock to stop it
+    Utils.Write_Bare_Ctrl_C
+    ${output}=    SSHLibrary.Read_Until_Prompt
+    BuiltIn.Log    ${output}
+
+*** Keywords ***
+Set_It_Up
+    [Documentation]    Create SSH session to ToolsVm, prepare HTTP client session to Controller.
+    ...    Figure out latest pcc-mock version and download it from Nexus to ToolsVm.
+    NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
+    ${name}=    NexusKeywords.Deploy_Test_Tool    bgpcep    bgp-bmp-mock
+    BuiltIn.Set_Suite_Variable    ${filename}    ${name}
+
+Tear_It_Down
+    [Documentation]    Download pccmock.log and Log its contents.
+    ...    Compute and Log the diff between expected and actual normalized responses.
+    ...    Close both HTTP client session and SSH connection to Mininet.
+    SSHLibrary.Get_File    ${BMP_LOG_FILE}
+    ${cnt}=    OperatingSystem.Get_File    ${BMP_LOG_FILE}
+    Log    ${cnt}
+    Delete_All_Sessions
+    Close_All_Connections
index 501c050969efbbb52b5ace79bdfa2376aca1665a..b4d1806683b68bb55f606289aeb2bffff8f808ff 100644 (file)
@@ -6,6 +6,7 @@
 
 # Place the suites in run order:
 integration/test/csit/suites/netconf/ready/netconfready.robot
+integration/test/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
 integration/test/csit/suites/bgpcep/pcepuser/pcepuser.robot
 integration/test/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot
 integration/test/csit/suites/bgpcep/bgpuser/cases.robot
@@ -14,3 +15,4 @@ integration/test/csit/suites/bgpcep/bgpuser/ibgp_peers_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ebgp_peers_basic.robot
 integration/test/csit/suites/bgpcep/bgpflowspec/010_bgp_flowspec.robot
 integration/test/csit/suites/bgpcep/bgpuser/ibgp_peer_lsp.robot
+
diff --git a/csit/variables/bgpfunctional/bmp_basic/data.json b/csit/variables/bgpfunctional/bmp_basic/data.json
new file mode 100644 (file)
index 0000000..ccbeb8c
--- /dev/null
@@ -0,0 +1,68 @@
+{
+    "bmp-monitor": {
+        "monitor": [
+            {
+                "monitor-id": "example-bmp-monitor",
+                "router": [
+                    {
+                        "router-id": "$TOOL_IP",
+                        "peer": [
+                            {
+                                "peer-id": "1.1.1.1",
+                                "as": 65431,
+                                "address": "1.1.1.1",
+                                "bgp-id": "1.1.1.1",
+                                "pre-policy-rib": {
+                                    "tables": [
+                                        {
+                                            "afi": "bgp-types:ipv4-address-family",
+                                            "safi": "bgp-types:unicast-subsequent-address-family",
+                                            "bgp-inet:ipv4-routes": {},
+                                            "attributes": {
+                                                "uptodate": false
+                                            }
+                                        }
+                                    ]
+                                },
+                                "peer-session": {
+                                    "received-open": {
+                                        "hold-timer": 180,
+                                        "bgp-identifier": "1.1.1.1",
+                                        "my-as-number": 65431
+                                    },
+                                    "remote-port": 179,
+                                    "status": "up",
+                                    "local-address": "$TOOL_IP",
+                                    "timestamp-sec": 0,
+                                    "sent-open": {
+                                        "hold-timer": 180,
+                                        "bgp-identifier": "$TOOL_IP",
+                                        "my-as-number": 65431
+                                    },
+                                    "local-port": 179
+                                },
+                                "post-policy-rib": {
+                                    "tables": [
+                                        {
+                                            "afi": "bgp-types:ipv4-address-family",
+                                            "safi": "bgp-types:unicast-subsequent-address-family",
+                                            "bgp-inet:ipv4-routes": {},
+                                            "attributes": {
+                                                "uptodate": false
+                                            }
+                                        }
+                                    ]
+                                },
+                                "type": "global"
+                            }
+                        ],
+                        "status": "up",
+                        "info": "",
+                        "description": "OpenDaylight",
+                        "name": "BMP mock"
+                    }
+                ]
+            }
+        ]
+    }
+}
diff --git a/csit/variables/bgpfunctional/bmp_basic/location.uri b/csit/variables/bgpfunctional/bmp_basic/location.uri
new file mode 100644 (file)
index 0000000..513abc0
--- /dev/null
@@ -0,0 +1 @@
+/restconf/operational/bmp-monitor:bmp-monitor