fixed issue with grpc server saving mac addresses on links
This commit is contained in:
parent
3c8b4ab0a5
commit
747c2792a1
3 changed files with 24 additions and 17 deletions
|
@ -1761,15 +1761,17 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
|||
self.session.broadcast_config(config_data)
|
||||
|
||||
# send session metadata
|
||||
data_values = "|".join(["%s=%s" % item for item in self.session.metadata.get_configs().iteritems()])
|
||||
data_types = tuple(ConfigDataTypes.STRING.value for _ in self.session.metadata.get_configs())
|
||||
config_data = ConfigData(
|
||||
message_type=0,
|
||||
object=self.session.metadata.name,
|
||||
type=ConfigFlags.NONE.value,
|
||||
data_types=data_types,
|
||||
data_values=data_values
|
||||
)
|
||||
self.session.broadcast_config(config_data)
|
||||
metadata_configs = self.session.metadata.get_configs()
|
||||
if metadata_configs:
|
||||
data_values = "|".join(["%s=%s" % item for item in metadata_configs.iteritems()])
|
||||
data_types = tuple(ConfigDataTypes.STRING.value for _ in self.session.metadata.get_configs())
|
||||
config_data = ConfigData(
|
||||
message_type=0,
|
||||
object=self.session.metadata.name,
|
||||
type=ConfigFlags.NONE.value,
|
||||
data_types=data_types,
|
||||
data_values=data_values
|
||||
)
|
||||
self.session.broadcast_config(config_data)
|
||||
|
||||
logging.info("informed GUI about %d nodes and %d links", len(nodes_data), len(links_data))
|
||||
|
|
|
@ -183,13 +183,13 @@ class InterfaceData(object):
|
|||
"""
|
||||
Creates an InterfaceData object.
|
||||
|
||||
:param int _id:
|
||||
:param str name:
|
||||
:param str mac:
|
||||
:param str ip4:
|
||||
:param int ip4_mask:
|
||||
:param str ip6:
|
||||
:param int ip6_mask:
|
||||
:param int _id: interface id
|
||||
:param str name: name for interface
|
||||
:param core.misc.ipaddress.MacAddress mac: mac address
|
||||
:param str ip4: ipv4 address
|
||||
:param int ip4_mask: ipv4 bit mask
|
||||
:param str ip6: ipv6 address
|
||||
:param int ip6_mask: ipv6 bit mask
|
||||
"""
|
||||
self.id = _id
|
||||
self.name = name
|
||||
|
|
|
@ -13,6 +13,7 @@ from core.enumerations import NodeTypes, EventTypes, LinkTypes
|
|||
from core.grpc import core_pb2
|
||||
from core.grpc import core_pb2_grpc
|
||||
from core.misc import nodeutils
|
||||
from core.misc.ipaddress import MacAddress
|
||||
from core.mobility import BasicRangeModel, Ns2ScriptedMobility
|
||||
from core.service import ServiceManager
|
||||
|
||||
|
@ -533,6 +534,8 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
mac = interface_one_data.mac
|
||||
if mac == "":
|
||||
mac = None
|
||||
else:
|
||||
mac = MacAddress.from_string(mac)
|
||||
interface_one = InterfaceData(
|
||||
_id=interface_one_data.id,
|
||||
name=name,
|
||||
|
@ -552,6 +555,8 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
mac = interface_two_data.mac
|
||||
if mac == "":
|
||||
mac = None
|
||||
else:
|
||||
mac = MacAddress.from_string(mac)
|
||||
interface_two = InterfaceData(
|
||||
_id=interface_two_data.id,
|
||||
name=name,
|
||||
|
|
Loading…
Reference in a new issue