| 1 |
# Copyright 2016 Huawei Technologies India Pvt. Ltd. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 |
# implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
from unittest import mock |
| 17 |
|
| 18 |
from neutron.tests import base |
| 19 |
from neutron_lib.api.definitions import bgp as bgp_ext |
| 20 |
from neutron_lib.plugins import directory |
| 21 |
|
| 22 |
from neutron_dynamic_routing.api.rpc.handlers import bgp_speaker_rpc |
| 23 |
|
| 24 |
|
| 25 |
class TestBgpSpeakerRpcCallback(base.BaseTestCase): |
| 26 |
|
| 27 |
def setUp(self): |
| 28 |
super().setUp() |
| 29 |
self.plugin = mock.Mock() |
| 30 |
directory.add_plugin(bgp_ext.ALIAS, self.plugin) |
| 31 |
self.callback = bgp_speaker_rpc.BgpSpeakerRpcCallback() |
| 32 |
|
| 33 |
def test_get_bgp_speaker_info(self): |
| 34 |
self.callback.get_bgp_speaker_info(mock.Mock(), |
| 35 |
bgp_speaker_id='id1') |
| 36 |
self.assertIsNotNone(len(self.plugin.mock_calls)) |
| 37 |
|
| 38 |
def test_get_bgp_peer_info(self): |
| 39 |
self.callback.get_bgp_peer_info(mock.Mock(), |
| 40 |
bgp_peer_id='id1') |
| 41 |
self.assertIsNotNone(len(self.plugin.mock_calls)) |
| 42 |
|
| 43 |
def test_get_bgp_speakers(self): |
| 44 |
self.callback.get_bgp_speakers(mock.Mock(), |
| 45 |
host='host') |
| 46 |
self.assertIsNotNone(len(self.plugin.mock_calls)) |