fixed sendall in sdt, after testing core/sdt3d integration

This commit is contained in:
Blake J. Harnden 2017-08-16 12:03:32 -07:00
parent f9847cef34
commit fc7fb0f76c

View file

@ -7,7 +7,6 @@ from urlparse import urlparse
from core import constants from core import constants
from core import logger from core import logger
from core.api import coreapi
from core.coreobj import PyCoreNet from core.coreobj import PyCoreNet
from core.coreobj import PyCoreObj from core.coreobj import PyCoreObj
from core.enumerations import EventTypes from core.enumerations import EventTypes
@ -344,25 +343,24 @@ class Sdt(object):
r.name, r.type, r.icon) r.name, r.type, r.icon)
for net in nets: for net in nets:
# use tolinkmsgs() to handle various types of links all_links = net.all_link_data(flags=MessageFlags.ADD.value)
messages = net.all_link_data(flags=MessageFlags.ADD.value) for link_data in all_links:
for message in messages: is_wireless = nodeutils.is_node(net, (NodeTypes.WIRELESS_LAN, NodeTypes.EMANE))
msghdr = message[:coreapi.CoreMessage.header_len] wireless_link = link_data.message_type == LinkTypes.WIRELESS.value
flags = coreapi.CoreMessage.unpack_header(msghdr)[1] if is_wireless and link_data.node1_id == net.objid:
m = coreapi.CoreLinkMessage(flags, msghdr, message[coreapi.CoreMessage.header_len:]) continue
n1num = m.get_tlv(LinkTlvs.N1_NUMBER.value)
n2num = m.get_tlv(LinkTlvs.N2_NUMBER.value) self.updatelink(
link_msg_type = m.get_tlv(LinkTlvs.TYPE.value) link_data.node1_id,
if nodeutils.is_node(net, (NodeTypes.WIRELESS_LAN, NodeTypes.EMANE)): link_data.node2_id,
if n1num == net.objid: MessageFlags.ADD.value,
continue wireless_link
wl = link_msg_type == LinkTypes.WIRELESS.value )
self.updatelink(n1num, n2num, MessageFlags.ADD.value, wl)
for n1num in sorted(self.remotes.keys()): for n1num in sorted(self.remotes.keys()):
r = self.remotes[n1num] r = self.remotes[n1num]
for n2num, wl in r.links: for n2num, wireless_link in r.links:
self.updatelink(n1num, n2num, MessageFlags.ADD.value, wl) self.updatelink(n1num, n2num, MessageFlags.ADD.value, wireless_link)
def handle_distributed(self, message): def handle_distributed(self, message):
""" """