switched core emulator data files from using namedtuples to backported dataclasses
This commit is contained in:
parent
5d9b451b1d
commit
8186c62b19
11 changed files with 240 additions and 242 deletions
|
@ -300,7 +300,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
coreapi.CoreExceptionTlv,
|
||||
[
|
||||
(ExceptionTlvs.NODE, exception_data.node),
|
||||
(ExceptionTlvs.SESSION, exception_data.session),
|
||||
(ExceptionTlvs.SESSION, str(exception_data.session)),
|
||||
(ExceptionTlvs.LEVEL, exception_data.level.value),
|
||||
(ExceptionTlvs.SOURCE, exception_data.source),
|
||||
(ExceptionTlvs.DATE, exception_data.date),
|
||||
|
@ -639,7 +639,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
:return:
|
||||
"""
|
||||
exception_data = ExceptionData(
|
||||
session=str(self.session.id),
|
||||
session=self.session.id,
|
||||
node=node,
|
||||
date=time.ctime(),
|
||||
level=level.value,
|
||||
|
@ -1891,13 +1891,13 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
node = self.session.get_node(node_id)
|
||||
values = ServiceShim.tovaluelist(node, service)
|
||||
config_data = ConfigData(
|
||||
message_type=0,
|
||||
message_type=MessageFlags.NONE,
|
||||
node=node_id,
|
||||
object=self.session.services.name,
|
||||
type=ConfigFlags.UPDATE.value,
|
||||
data_types=data_types,
|
||||
data_values=values,
|
||||
session=str(self.session.id),
|
||||
session=self.session.id,
|
||||
opaque=opaque,
|
||||
)
|
||||
self.session.broadcast_config(config_data)
|
||||
|
|
|
@ -18,6 +18,9 @@ def convert_node(node_data):
|
|||
:param core.emulator.data.NodeData node_data: node data to convert
|
||||
:return: packed node message
|
||||
"""
|
||||
services = None
|
||||
if node_data.services is not None:
|
||||
services = "|".join([x for x in node_data.services])
|
||||
tlv_data = structutils.pack_values(
|
||||
coreapi.CoreNodeTlv,
|
||||
[
|
||||
|
@ -30,12 +33,12 @@ def convert_node(node_data):
|
|||
(NodeTlvs.MODEL, node_data.model),
|
||||
(NodeTlvs.EMULATION_ID, node_data.emulation_id),
|
||||
(NodeTlvs.EMULATION_SERVER, node_data.server),
|
||||
(NodeTlvs.SESSION, node_data.session),
|
||||
(NodeTlvs.SESSION, str(node_data.session)),
|
||||
(NodeTlvs.X_POSITION, int(node_data.x_position)),
|
||||
(NodeTlvs.Y_POSITION, int(node_data.y_position)),
|
||||
(NodeTlvs.CANVAS, node_data.canvas),
|
||||
(NodeTlvs.NETWORK_ID, node_data.network_id),
|
||||
(NodeTlvs.SERVICES, node_data.services),
|
||||
(NodeTlvs.SERVICES, services),
|
||||
(NodeTlvs.LATITUDE, str(node_data.latitude)),
|
||||
(NodeTlvs.LONGITUDE, str(node_data.longitude)),
|
||||
(NodeTlvs.ALTITUDE, str(node_data.altitude)),
|
||||
|
@ -65,7 +68,7 @@ def convert_config(config_data):
|
|||
(ConfigTlvs.BITMAP, config_data.bitmap),
|
||||
(ConfigTlvs.POSSIBLE_VALUES, config_data.possible_values),
|
||||
(ConfigTlvs.GROUPS, config_data.groups),
|
||||
(ConfigTlvs.SESSION, config_data.session),
|
||||
(ConfigTlvs.SESSION, str(config_data.session)),
|
||||
(ConfigTlvs.INTERFACE_NUMBER, config_data.interface_number),
|
||||
(ConfigTlvs.NETWORK_ID, config_data.network_id),
|
||||
(ConfigTlvs.OPAQUE, config_data.opaque),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue