removed issue with double loading services from core-daemon, fixed exceptions noted as not an error previously and updated code to more gracefully handle those cases, fixed issue with add_node when setting node.ype for all nodes
This commit is contained in:
parent
dc751dde2b
commit
4a2810e9b2
5 changed files with 22 additions and 32 deletions
|
@ -487,7 +487,6 @@ class FutureSession(Session):
|
|||
node = self.add_object(cls=node_class, objid=_id, name=name, start=start)
|
||||
|
||||
# set node attributes
|
||||
node.type = node_options.model
|
||||
node.icon = node_options.icon
|
||||
node.canvas = node_options.canvas
|
||||
node.opaque = node_options.opaque
|
||||
|
@ -497,6 +496,8 @@ class FutureSession(Session):
|
|||
|
||||
# add services to default and physical nodes only
|
||||
if _type in [NodeTypes.DEFAULT, NodeTypes.PHYSICAL]:
|
||||
node.type = node_options.model
|
||||
logger.debug("set node type: %s", node.type)
|
||||
logger.info("setting model (%s) with services (%s)", node.type, node_options.services)
|
||||
services = "|".join(node_options.services) or None
|
||||
self.services.addservicestonode(node, node.type, services)
|
||||
|
|
|
@ -12,7 +12,7 @@ class NodeOptions(object):
|
|||
Create a NodeOptions object.
|
||||
|
||||
:param str name: name of node, defaults to node class name postfix with its id
|
||||
:param str model: model to use for this node, defines services, defaults to "router"
|
||||
:param str model: defines services for default and physical nodes, defaults to "router"
|
||||
"""
|
||||
self.name = name
|
||||
self.model = model
|
||||
|
|
|
@ -1152,11 +1152,7 @@ class Ns2ScriptedMobility(WayPointMobility):
|
|||
:rtype: int
|
||||
"""
|
||||
nodenum = int(nodenum)
|
||||
try:
|
||||
return self.nodemap[nodenum]
|
||||
except KeyError:
|
||||
logger.exception("error finding value in node map, ignored and returns node id")
|
||||
return nodenum
|
||||
return self.nodemap.get(nodenum, nodenum)
|
||||
|
||||
def startup(self):
|
||||
"""
|
||||
|
|
|
@ -213,7 +213,7 @@ class ScenarioPlan(XmlElement):
|
|||
self.setAttribute('xmlns:CORE', 'coreSpecific')
|
||||
self.setAttribute('compiled', 'true')
|
||||
|
||||
self.all_channel_members = dict()
|
||||
self.all_channel_members = {}
|
||||
self.last_network_id = 0
|
||||
self.addNetworks()
|
||||
self.addDevices()
|
||||
|
@ -795,8 +795,9 @@ class InterfaceElement(NamedXmlElement):
|
|||
"""
|
||||
Add a reference to the channel that uses this interface
|
||||
"""
|
||||
try:
|
||||
cm = self.scenPlan.all_channel_members[self.id]
|
||||
# cm is None when an interface belongs to a switch
|
||||
# or a hub within a network and the channel is yet to be defined
|
||||
cm = self.scenPlan.all_channel_members.get(self.id)
|
||||
if cm is not None:
|
||||
ch = cm.base_element.parentNode
|
||||
if ch is not None:
|
||||
|
@ -811,10 +812,6 @@ class InterfaceElement(NamedXmlElement):
|
|||
self,
|
||||
referenced_type=MembType.NETWORK,
|
||||
referenced_id=net.getAttribute("id"))
|
||||
except KeyError:
|
||||
# Not an error. This occurs when an interface belongs to a switch
|
||||
# or a hub within a network and the channel is yet to be defined
|
||||
logger.exception("noted as not an error, add channel reference error")
|
||||
|
||||
def addAddresses(self, interface_object):
|
||||
"""
|
||||
|
|
|
@ -13,7 +13,6 @@ import time
|
|||
from core import constants
|
||||
from core import enumerations
|
||||
from core import logger
|
||||
from core import services
|
||||
from core.legacy.corehandler import CoreHandler
|
||||
from core.legacy.coreserver import CoreServer
|
||||
from core.misc import nodeutils
|
||||
|
@ -139,7 +138,4 @@ if __name__ == "__main__":
|
|||
|
||||
nodeutils.update_node_map(OVS_NODES)
|
||||
|
||||
# load default services
|
||||
services.load()
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Reference in a new issue