grpc: added wlan/emane links to grpc calls to allow knowing initial wireless link state, same as before changes
This commit is contained in:
parent
dc9b6adc98
commit
e5e14ad67b
3 changed files with 12 additions and 6 deletions
|
@ -355,6 +355,9 @@ def get_links(session: Session, node: NodeBase) -> List[core_pb2.Link]:
|
||||||
link_protos = []
|
link_protos = []
|
||||||
for core_link in session.link_manager.node_links(node):
|
for core_link in session.link_manager.node_links(node):
|
||||||
link_protos.extend(convert_core_link(core_link))
|
link_protos.extend(convert_core_link(core_link))
|
||||||
|
if isinstance(node, (WlanNode, EmaneNet)):
|
||||||
|
for link_data in node.links():
|
||||||
|
link_protos.append(convert_link_data(link_data))
|
||||||
return link_protos
|
return link_protos
|
||||||
|
|
||||||
|
|
||||||
|
@ -729,13 +732,16 @@ def convert_session(session: Session) -> wrappers.Session:
|
||||||
"""
|
"""
|
||||||
emane_configs = get_emane_model_configs_dict(session)
|
emane_configs = get_emane_model_configs_dict(session)
|
||||||
nodes = []
|
nodes = []
|
||||||
|
links = []
|
||||||
for _id in session.nodes:
|
for _id in session.nodes:
|
||||||
node = session.nodes[_id]
|
node = session.nodes[_id]
|
||||||
if not isinstance(node, (PtpNet, CtrlNet)):
|
if not isinstance(node, (PtpNet, CtrlNet)):
|
||||||
node_emane_configs = emane_configs.get(node.id, [])
|
node_emane_configs = emane_configs.get(node.id, [])
|
||||||
node_proto = get_node_proto(session, node, node_emane_configs)
|
node_proto = get_node_proto(session, node, node_emane_configs)
|
||||||
nodes.append(node_proto)
|
nodes.append(node_proto)
|
||||||
links = []
|
if isinstance(node, (WlanNode, EmaneNet)):
|
||||||
|
for link_data in node.links():
|
||||||
|
links.append(convert_link_data(link_data))
|
||||||
for core_link in session.link_manager.links():
|
for core_link in session.link_manager.links():
|
||||||
links.extend(convert_core_link(core_link))
|
links.extend(convert_core_link(core_link))
|
||||||
default_services = get_default_services(session)
|
default_services = get_default_services(session)
|
||||||
|
|
|
@ -219,7 +219,7 @@ class EmaneNet(CoreNetworkBase):
|
||||||
self.mobility.update_config(config)
|
self.mobility.update_config(config)
|
||||||
|
|
||||||
def links(self, flags: MessageFlags = MessageFlags.NONE) -> List[LinkData]:
|
def links(self, flags: MessageFlags = MessageFlags.NONE) -> List[LinkData]:
|
||||||
links = super().links(flags)
|
links = []
|
||||||
emane_manager = self.session.emane
|
emane_manager = self.session.emane
|
||||||
# gather current emane links
|
# gather current emane links
|
||||||
nem_ids = set()
|
nem_ids = set()
|
||||||
|
@ -240,7 +240,7 @@ class EmaneNet(CoreNetworkBase):
|
||||||
# ignore incomplete links
|
# ignore incomplete links
|
||||||
if (nem2, nem1) not in emane_links:
|
if (nem2, nem1) not in emane_links:
|
||||||
continue
|
continue
|
||||||
link = emane_manager.get_nem_link(nem1, nem2)
|
link = emane_manager.get_nem_link(nem1, nem2, flags)
|
||||||
if link:
|
if link:
|
||||||
links.append(link)
|
links.append(link)
|
||||||
return links
|
return links
|
||||||
|
|
|
@ -781,10 +781,10 @@ class WlanNode(CoreNetwork):
|
||||||
:param flags: message flags
|
:param flags: message flags
|
||||||
:return: list of link data
|
:return: list of link data
|
||||||
"""
|
"""
|
||||||
links = super().links(flags)
|
|
||||||
if self.model:
|
if self.model:
|
||||||
links.extend(self.model.links(flags))
|
return self.model.links(flags)
|
||||||
return links
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
class TunnelNode(GreTapBridge):
|
class TunnelNode(GreTapBridge):
|
||||||
|
|
Loading…
Reference in a new issue