Skip to content
Merged
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
6 changes: 4 additions & 2 deletions DatabaseServer/moxa_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
AbstractSQLCommands,
ParamsSequenceOrDictType,
)

from server_common.snmpWalker import walk
from server_common.utilities import SEVERITY, print_and_log

Expand Down Expand Up @@ -112,10 +111,14 @@ def _delete_all(self) -> None:
def insert_mappings(self, moxa_ip_name_dict: dict, moxa_ports_dict: dict) -> None:
print_and_log("inserting moxa mappings to SQL")
self._delete_all()
if len(moxa_ip_name_dict) == 0:
print_and_log("No Moxa names defined in registry - was that expected?")
for moxa_name, moxa_ip in moxa_ip_name_dict.items():
print_and_log(f"moxa name: {moxa_name} - IP: {moxa_ip}")
self.mysql_abstraction_layer.update(INSERT_TO_IPS, (moxa_name, moxa_ip))

if len(moxa_ports_dict) == 0:
print_and_log("No Moxa COM mappings found in registry - was that expected?")
for moxa_name, ports in moxa_ports_dict.items():
for phys_port, com_port in ports:
# phys_port = ports[0]
Expand Down Expand Up @@ -256,7 +259,6 @@ def _get_mappings(self) -> Tuple[Dict[str, str], Dict[str, List[Tuple[int, int]]
moxa_ports_dict[hostname].append((port_num_respective + 1, com_num))
except FileNotFoundError:
print_and_log("using old style registry for moxas", severity=SEVERITY.MINOR)
else:
try:
# This is what Nport Administrator uses. It lays out each Moxa that is added to
# "Servers" which contains a few bytes and lays things out in a subkey for each.
Expand Down
Loading