forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove alias_map.json (sonic-net#87)
This file was added long time ago and now it is not needed anymore. We can simply get port aliases from DB. This also means that aliases will be now updated from DB once a reinit timeout, instead of beeing static in alias_map.json Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
- Loading branch information
1 parent
b32f3ee
commit 7383cd5
Showing
5 changed files
with
59 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import json | ||
import logging.handlers | ||
|
||
# path where a user may define an alias map | ||
USER_DEFINED_ALIAS_MAP_FILEPATH = '/etc/snmp/alias_map.json' | ||
|
||
# configure logging | ||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.INFO) | ||
logger.addHandler(logging.NullHandler()) | ||
|
||
_if_alias_map = None | ||
|
||
# open user-defined alias map first | ||
try: | ||
with open(USER_DEFINED_ALIAS_MAP_FILEPATH) as f: | ||
_if_alias_map = json.load(f) | ||
_if_alias_map = {k.encode('ascii'): v.encode('ascii') for k, v in _if_alias_map.items()} | ||
except ValueError as e: | ||
logger.error( | ||
"User map contains error(s). Ensure file is well-formed JSON. Falling back to default map. {}".format(str(e)) | ||
) | ||
except OSError: | ||
# No alias map found, error is emitted and handled in mibs/__init__.py | ||
logger.info("No user-defined alias map found, using default map.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.