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":
class_args["start"] = False
# this instantiates an object of class nodecls,
# creating the node or network
# this instantiates an object of class nodecls, creating the node or network
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:
node.setposition(x_position, y_position, None)
@ -628,6 +627,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
model = "router"
node.type = model
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)
# boot nodes if they are added after runtime (like

View file

@ -228,6 +228,7 @@ class CoreServices(ConfigurableManager):
:return: nothing
"""
if services_str is not None:
logger.info("setting node specific services: %s", services_str)
services = services_str.split("|")
for name in services:
s = ServiceManager.get(name)
@ -238,6 +239,7 @@ class CoreServices(ConfigurableManager):
s = self.getcustomservice(node.objid, s)
node.addservice(s)
else:
logger.info("setting default services for node (%s) type (%s)", node.objid, nodetype)
services = self.getdefaultservices(nodetype)
for s in services:
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.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)
if model:
node.type = model
if position:
node.setposition(*position)
if services:
self.session.services.addservicestonode(node, "", services)
self.session.services.addservicestonode(node, model, services)
self.nodes[name] = node
def add_interface(self, network, name):

View file

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