From f277e96c9a4bd0e01e49d80b3e51cd2caba7a397 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 10 Mar 2020 22:48:05 -0700 Subject: [PATCH] revert logging back to info, removed Rj45Models enum as it was not being used, updated linktypes enum to be used directly --- daemon/core/api/grpc/events.py | 2 +- daemon/core/api/grpc/grpcutils.py | 2 +- daemon/core/api/grpc/server.py | 2 +- daemon/core/api/tlv/corehandlers.py | 2 +- daemon/core/emane/nodes.py | 2 +- daemon/core/emulator/enumerations.py | 10 ---------- daemon/core/emulator/session.py | 2 +- daemon/core/location/mobility.py | 2 +- daemon/core/nodes/base.py | 2 +- daemon/core/nodes/network.py | 2 +- daemon/core/plugins/sdt.py | 2 +- daemon/core/services/quagga.py | 2 +- daemon/data/logging.conf | 2 +- 13 files changed, 12 insertions(+), 22 deletions(-) diff --git a/daemon/core/api/grpc/events.py b/daemon/core/api/grpc/events.py index cf98a9a2..60cb15a9 100644 --- a/daemon/core/api/grpc/events.py +++ b/daemon/core/api/grpc/events.py @@ -80,7 +80,7 @@ def handle_link_event(event: LinkData) -> core_pb2.LinkEvent: unidirectional=event.unidirectional, ) link = core_pb2.Link( - type=event.link_type, + type=event.link_type.value, node_one_id=event.node1_id, node_two_id=event.node2_id, interface_one=interface_one, diff --git a/daemon/core/api/grpc/grpcutils.py b/daemon/core/api/grpc/grpcutils.py index 4ee492b9..d765f4bc 100644 --- a/daemon/core/api/grpc/grpcutils.py +++ b/daemon/core/api/grpc/grpcutils.py @@ -325,7 +325,7 @@ def convert_link(session: Session, link_data: LinkData) -> core_pb2.Link: ) return core_pb2.Link( - type=link_data.link_type, + type=link_data.link_type.value, node_one_id=link_data.node1_id, node_two_id=link_data.node2_id, interface_one=interface_one, diff --git a/daemon/core/api/grpc/server.py b/daemon/core/api/grpc/server.py index 4c8d6640..5c927151 100644 --- a/daemon/core/api/grpc/server.py +++ b/daemon/core/api/grpc/server.py @@ -1501,7 +1501,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer): flag = MessageFlags.DELETE.value link = LinkData( message_type=flag, - link_type=LinkTypes.WIRELESS.value, + link_type=LinkTypes.WIRELESS, node1_id=node_one.id, node2_id=node_two.id, network_id=emane_one.id, diff --git a/daemon/core/api/tlv/corehandlers.py b/daemon/core/api/tlv/corehandlers.py index 09ac2444..1869e275 100644 --- a/daemon/core/api/tlv/corehandlers.py +++ b/daemon/core/api/tlv/corehandlers.py @@ -356,7 +356,7 @@ class CoreHandler(socketserver.BaseRequestHandler): (LinkTlvs.BURST, link_data.burst), (LinkTlvs.SESSION, link_data.session), (LinkTlvs.MBURST, link_data.mburst), - (LinkTlvs.TYPE, link_data.link_type), + (LinkTlvs.TYPE, link_data.link_type.value), (LinkTlvs.GUI_ATTRIBUTES, link_data.gui_attributes), (LinkTlvs.UNIDIRECTIONAL, link_data.unidirectional), (LinkTlvs.EMULATION_ID, link_data.emulation_id), diff --git a/daemon/core/emane/nodes.py b/daemon/core/emane/nodes.py index 3a1834f3..99045c07 100644 --- a/daemon/core/emane/nodes.py +++ b/daemon/core/emane/nodes.py @@ -34,7 +34,7 @@ class EmaneNet(CoreNetworkBase): """ apitype = NodeTypes.EMANE.value - linktype = LinkTypes.WIRED.value + linktype = LinkTypes.WIRED type = "wlan" is_emane = True diff --git a/daemon/core/emulator/enumerations.py b/daemon/core/emulator/enumerations.py index 44f60877..d13c8287 100644 --- a/daemon/core/emulator/enumerations.py +++ b/daemon/core/emulator/enumerations.py @@ -86,16 +86,6 @@ class NodeTypes(Enum): LXC = 16 -class Rj45Models(Enum): - """ - RJ45 model types. - """ - - LINKED = 0 - WIRELESS = 1 - INSTALLED = 2 - - # Link Message TLV Types class LinkTlvs(Enum): """ diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index cd78af8f..a44ba62f 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -577,7 +577,7 @@ class Session: try: # wireless link - if link_options.type == LinkTypes.WIRELESS.value: + if link_options.type == LinkTypes.WIRELESS: raise CoreError("cannot update wireless link") else: if not node_one and not node_two: diff --git a/daemon/core/location/mobility.py b/daemon/core/location/mobility.py index 7b0ec8ac..c6e88611 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -499,7 +499,7 @@ class BasicRangeModel(WirelessModel): node1_id=interface1.node.id, node2_id=interface2.node.id, network_id=self.wlan.id, - link_type=LinkTypes.WIRELESS.value, + link_type=LinkTypes.WIRELESS, ) def sendlinkmsg( diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index 9def7777..9b72df72 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -982,7 +982,7 @@ class CoreNetworkBase(NodeBase): Base class for networks """ - linktype = LinkTypes.WIRED.value + linktype = LinkTypes.WIRED is_emane = False def __init__( diff --git a/daemon/core/nodes/network.py b/daemon/core/nodes/network.py index 67955a38..fdfa87f1 100644 --- a/daemon/core/nodes/network.py +++ b/daemon/core/nodes/network.py @@ -1030,7 +1030,7 @@ class WlanNode(CoreNetwork): """ apitype = NodeTypes.WIRELESS_LAN.value - linktype = LinkTypes.WIRED.value + linktype = LinkTypes.WIRED policy = "DROP" type = "wlan" diff --git a/daemon/core/plugins/sdt.py b/daemon/core/plugins/sdt.py index 658ee1e3..284fe970 100644 --- a/daemon/core/plugins/sdt.py +++ b/daemon/core/plugins/sdt.py @@ -24,7 +24,7 @@ if TYPE_CHECKING: def link_data_params(link_data: LinkData) -> Tuple[int, int, bool]: node_one = link_data.node1_id node_two = link_data.node2_id - is_wireless = link_data.link_type == LinkTypes.WIRELESS.value + is_wireless = link_data.link_type == LinkTypes.WIRELESS return node_one, node_two, is_wireless diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index 11de9c54..7979dd23 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -551,7 +551,7 @@ class Babel(QuaggaService): @classmethod def generatequaggaifcconfig(cls, node, ifc): - if ifc.net and ifc.net.linktype == LinkTypes.WIRELESS.value: + if ifc.net and ifc.net.linktype == LinkTypes.WIRELESS: return " babel wireless\n no babel split-horizon\n" else: return " babel wired\n babel split-horizon\n" diff --git a/daemon/data/logging.conf b/daemon/data/logging.conf index 46de6e92..7f3d496f 100644 --- a/daemon/data/logging.conf +++ b/daemon/data/logging.conf @@ -14,7 +14,7 @@ } }, "root": { - "level": "DEBUG", + "level": "INFO", "handlers": ["console"] } }