changes to support better type checking for retrieving an arbitrary node from a session, get_node now requires an expected class that the node would be an instance of, if the returned node is not an instance a CoreError is thrown, this also helps editors pick up expected types to account for variable/function usage better as well

This commit is contained in:
Blake Harnden 2020-05-20 14:44:34 -07:00
parent 19ee367dc5
commit d5254e6a91
21 changed files with 149 additions and 126 deletions

View file

@ -1,4 +1,5 @@
from core.emane.nodes import EmaneNet
from core.errors import CoreError
from core.services.coreservices import CoreService
from core.xml import emanexml
@ -20,8 +21,8 @@ class EmaneTransportService(CoreService):
if filename == cls.configs[0]:
transport_commands = []
for interface in node.netifs(sort=True):
network_node = node.session.get_node(interface.net.id)
if isinstance(network_node, EmaneNet):
try:
network_node = node.session.get_node(interface.net.id, EmaneNet)
config = node.session.emane.get_configs(
network_node.id, network_node.model.name
)
@ -32,6 +33,8 @@ class EmaneTransportService(CoreService):
% nem_id
)
transport_commands.append(command)
except CoreError:
pass
transport_commands = "\n".join(transport_commands)
return """
emanegentransportxml -o ../ ../platform%s.xml