Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldpsyncd] remove dbsyncd logic which is moved to lldpmgr #15

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/lldp_syncd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
logger.addHandler(logging.NullHandler())

from .daemon import LldpSyncDaemon
from .dbsyncd import DBSyncDaemon
79 changes: 0 additions & 79 deletions src/lldp_syncd/dbsyncd.py

This file was deleted.

4 changes: 0 additions & 4 deletions src/lldp_syncd/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from . import logger
from .daemon import LldpSyncDaemon
from .dbsyncd import DBSyncDaemon

DEFAULT_UPDATE_FREQUENCY = 10

Expand All @@ -9,11 +8,8 @@ def main(update_frequency=None):
try:
lldp_syncd = LldpSyncDaemon(update_frequency or DEFAULT_UPDATE_FREQUENCY)
logger.info('Starting SONiC LLDP sync daemon...')
dbsyncd = DBSyncDaemon()
lldp_syncd.start()
dbsyncd.start()
lldp_syncd.join()
dbsyncd.join()
except KeyboardInterrupt:
logger.info("ctrl-C captured, shutting down.")
except Exception:
Expand Down
42 changes: 0 additions & 42 deletions tests/test_lldpSyncDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import lldp_syncd
import lldp_syncd.conventions
import lldp_syncd.daemon
import lldp_syncd.dbsyncd
from swsssdk import SonicV2Connector, ConfigDBConnector

INPUT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'subproc_outputs')
Expand Down Expand Up @@ -88,44 +87,3 @@ def test_sync_roundtrip(self):
def test_timeparse(self):
self.assertEquals(lldp_syncd.daemon.parse_time("0 day, 05:09:02"), make_seconds(0, 5, 9, 2))
self.assertEquals(lldp_syncd.daemon.parse_time("2 days, 05:59:02"), make_seconds(2, 5, 59, 2))


class TestLldpSyncDaemonDBSync(TestCase):

def setUp(self):
self.daemon = lldp_syncd.DBSyncDaemon()
with mock.patch.object(lldp_syncd.DBSyncDaemon, "run_command", mock.Mock()):
self.daemon.port_table_init()

def test_port_handler_descr(self):
"""
test handling update of description of port
"""
with mock.patch.object(lldp_syncd.DBSyncDaemon, "run_command", mock.Mock()):
self.daemon.port_handler("Ethernet4", {"description": "black door", "speed": '50000'})
self.daemon.run_command.assert_called_once_with(
"lldpcli configure lldp portidsubtype local Ethernet4 description 'black door'")

def test_port_handler_speed(self):
"""
test updating port speed(no action expected)
"""
with mock.patch.object(lldp_syncd.DBSyncDaemon, "run_command", mock.Mock()):
self.daemon.port_handler("Ethernet0", {"speed": '100000', "description": "hedgehog"})
self.daemon.run_command.assert_not_called()

def test_port_handler_delete_descr(self):
"""
test handling update when description field is removed
"""
with mock.patch.object(lldp_syncd.DBSyncDaemon, "run_command", mock.Mock()):
self.daemon.port_handler("Ethernet4", {"speed": '50000'})
self.daemon.run_command.assert_called_once_with(
"lldpcli configure lldp portidsubtype local Ethernet4 description ' '")

def test_man_addr_init(self):

with mock.patch.object(lldp_syncd.DBSyncDaemon, "run_command", mock.Mock()):
self.daemon.mgmt_addr_init()
self.daemon.run_command.assert_called_once_with(
"lldpcli configure system ip management pattern 10.210.25.41")