bug cleanup pass from sonarqube
This commit is contained in:
parent
5920a09aae
commit
1caa6ab8c9
3 changed files with 7 additions and 23 deletions
|
@ -73,8 +73,6 @@ class NetgraphNet(PyCoreNet):
|
|||
PyCoreNet.attach(self, netif)
|
||||
|
||||
def detach(self, netif):
|
||||
if self.up:
|
||||
pass
|
||||
PyCoreNet.detach(self, netif)
|
||||
|
||||
def linked(self, netif1, netif2):
|
||||
|
|
|
@ -927,14 +927,10 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
|||
netif1 = tmp1
|
||||
netif2 = tmp2
|
||||
break
|
||||
if netif1 is None or netif2 is None:
|
||||
pass
|
||||
elif netif1.net or netif2.net:
|
||||
if netif1.net != netif2.net:
|
||||
if not netif1.up or not netif2.up:
|
||||
pass
|
||||
else:
|
||||
raise ValueError("no common network found")
|
||||
|
||||
if all([netif1, netif2]) and any([netif1.net, netif2.net]):
|
||||
if netif1.net != netif2.net and all([netif1.up, netif2.up]):
|
||||
raise ValueError("no common network found")
|
||||
net = netif1.net
|
||||
netif1.detachnet()
|
||||
netif2.detachnet()
|
||||
|
@ -1334,8 +1330,6 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
|||
self.session.delete_objects()
|
||||
self.session.del_hooks()
|
||||
self.session.broker.reset()
|
||||
elif event_type == EventTypes.CONFIGURATION_STATE.value:
|
||||
pass
|
||||
elif event_type == EventTypes.INSTANTIATION_STATE.value:
|
||||
if len(self.handler_threads) > 1:
|
||||
# TODO: sync handler threads here before continuing
|
||||
|
|
|
@ -591,23 +591,15 @@ class DeviceElement(NamedXmlElement):
|
|||
core_device_type = None
|
||||
if hasattr(device_object, "type") and device_object.type:
|
||||
core_device_type = device_object.type
|
||||
if device_object.type == NodeType.ROUTER:
|
||||
if device_object.type in [NodeType.ROUTER, NodeType.MDR]:
|
||||
device_type = DevType.ROUTER
|
||||
elif device_object.type == NodeType.MDR:
|
||||
device_type = DevType.ROUTER
|
||||
elif device_object.type == NodeType.HOST:
|
||||
device_type = DevType.HOST
|
||||
elif device_object.type == NodeType.PC:
|
||||
device_type = DevType.HOST
|
||||
elif device_object.type == NodeType.RJ45:
|
||||
device_type = DevType.HOST
|
||||
node_id = "EMULATOR-HOST"
|
||||
elif device_object.type == NodeType.HUB:
|
||||
device_type = DevType.HUB
|
||||
elif device_object.type == NodeType.SWITCH:
|
||||
device_type = DevType.SWITCH
|
||||
# includes known node types (HOST, PC, RJ45)
|
||||
# Default custom types (defined in ~/.core/nodes.conf) to HOST
|
||||
else:
|
||||
# Default custom types (defined in ~/.core/nodes.conf) to HOST
|
||||
device_type = DevType.HOST
|
||||
|
||||
if device_type is None:
|
||||
|
|
Loading…
Reference in a new issue