updated emane tests to use mdr models for the nodes, add a couple extra logs

This commit is contained in:
Blake J. Harnden 2017-07-11 10:35:08 -07:00
parent 777e19de93
commit 336702a056
4 changed files with 16 additions and 12 deletions

View file

@ -607,8 +607,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
self.session.options, "enablerj45") and self.session.options.enablerj45 == "0": self.session.options, "enablerj45") and self.session.options.enablerj45 == "0":
class_args["start"] = False class_args["start"] = False
# this instantiates an object of class nodecls, # this instantiates an object of class nodecls, creating the node or network
# creating the node or network
node = self.session.add_object(cls=node_class, objid=node_id, name=node_name, **class_args) node = self.session.add_object(cls=node_class, objid=node_id, name=node_name, **class_args)
if x_position is not None and y_position is not None: if x_position is not None and y_position is not None:
node.setposition(x_position, y_position, None) node.setposition(x_position, y_position, None)
@ -628,6 +627,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
model = "router" model = "router"
node.type = model node.type = model
services_str = message.get_tlv(NodeTlvs.SERVICES.value) services_str = message.get_tlv(NodeTlvs.SERVICES.value)
logger.info("setting model (%s) with services (%s)", model, services_str)
self.session.services.addservicestonode(node, model, services_str) self.session.services.addservicestonode(node, model, services_str)
# boot nodes if they are added after runtime (like # boot nodes if they are added after runtime (like

View file

@ -228,6 +228,7 @@ class CoreServices(ConfigurableManager):
:return: nothing :return: nothing
""" """
if services_str is not None: if services_str is not None:
logger.info("setting node specific services: %s", services_str)
services = services_str.split("|") services = services_str.split("|")
for name in services: for name in services:
s = ServiceManager.get(name) s = ServiceManager.get(name)
@ -238,6 +239,7 @@ class CoreServices(ConfigurableManager):
s = self.getcustomservice(node.objid, s) s = self.getcustomservice(node.objid, s)
node.addservice(s) node.addservice(s)
else: else:
logger.info("setting default services for node (%s) type (%s)", node.objid, nodetype)
services = self.getdefaultservices(nodetype) services = self.getdefaultservices(nodetype)
for s in services: for s in services:
logger.info("adding default service %s to node %s", s._name, node.name) logger.info("adding default service %s to node %s", s._name, node.name)

View file

@ -21,12 +21,14 @@ class Core(object):
self.nodes = {} self.nodes = {}
self.node_ips = {} self.node_ips = {}
def create_node(self, name, cls=nodes.CoreNode, objid=None, position=None, services=None): def create_node(self, name, cls=nodes.CoreNode, objid=None, position=None, services=None, model=""):
node = self.session.add_object(cls=cls, name=name, objid=objid) node = self.session.add_object(cls=cls, name=name, objid=objid)
if model:
node.type = model
if position: if position:
node.setposition(*position) node.setposition(*position)
if services: if services:
self.session.services.addservicestonode(node, "", services) self.session.services.addservicestonode(node, model, services)
self.nodes[name] = node self.nodes[name] = node
def add_interface(self, network, name): def add_interface(self, network, name):

View file

@ -27,8 +27,8 @@ class TestGui:
core_emane.set_emane_model(emane_node, EmaneIeee80211abgModel) core_emane.set_emane_model(emane_node, EmaneIeee80211abgModel)
# create nodes # create nodes
core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES) core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES, model="mdr")
core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES) core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES, model="mdr")
# add interfaces to nodes # add interfaces to nodes
core_emane.add_interface(emane_node, "n1") core_emane.add_interface(emane_node, "n1")
@ -59,8 +59,8 @@ class TestGui:
core_emane.set_emane_model(emane_node, EmaneRfPipeModel) core_emane.set_emane_model(emane_node, EmaneRfPipeModel)
# create nodes # create nodes
core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES) core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES, model="mdr")
core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES) core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES, model="mdr")
# add interfaces to nodes # add interfaces to nodes
core_emane.add_interface(emane_node, "n1") core_emane.add_interface(emane_node, "n1")
@ -91,8 +91,8 @@ class TestGui:
core_emane.set_emane_model(emane_node, EmaneCommEffectModel) core_emane.set_emane_model(emane_node, EmaneCommEffectModel)
# create nodes # create nodes
core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES) core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES, model="mdr")
core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES) core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES, model="mdr")
# add interfaces to nodes # add interfaces to nodes
core_emane.add_interface(emane_node, "n1") core_emane.add_interface(emane_node, "n1")
@ -123,8 +123,8 @@ class TestGui:
core_emane.set_emane_model(emane_node, EmaneBypassModel) core_emane.set_emane_model(emane_node, EmaneBypassModel)
# create nodes # create nodes
core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES) core_emane.create_node("n1", objid=1, position=(150, 150), services=_EMANE_SERVICES, model="mdr")
core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES) core_emane.create_node("n2", objid=2, position=(300, 150), services=_EMANE_SERVICES, model="mdr")
# add interfaces to nodes # add interfaces to nodes
core_emane.add_interface(emane_node, "n1") core_emane.add_interface(emane_node, "n1")