added reconfigure event type, for re-generating service config files
added new Event Message handling for starting mobility model or reconfiguring a service during runtime (Boeing r1806)
This commit is contained in:
parent
c1c71bb33a
commit
a9ea208a08
4 changed files with 42 additions and 6 deletions
|
@ -282,6 +282,7 @@ event_types = dict(enumerate([
|
|||
"CORE_EVENT_FILE_OPEN",
|
||||
"CORE_EVENT_FILE_SAVE",
|
||||
"CORE_EVENT_SCHEDULED",
|
||||
"CORE_EVENT_RECONFIGURE",
|
||||
]))
|
||||
|
||||
enumdict(event_types)
|
||||
|
|
|
@ -36,18 +36,25 @@ class MobilityManager(ConfigurableManager):
|
|||
self.session.broker.handlers += (self.physnodehandlelink, )
|
||||
self.register()
|
||||
|
||||
def startup(self):
|
||||
def startup(self, nodenums=None):
|
||||
''' Session is transitioning from instantiation to runtime state.
|
||||
Instantiate any mobility models that have been configured for a WLAN.
|
||||
'''
|
||||
for nodenum in self.configs:
|
||||
v = self.configs[nodenum]
|
||||
if nodenums is None:
|
||||
nodenums = self.configs.keys()
|
||||
|
||||
for nodenum in nodenums:
|
||||
try:
|
||||
n = self.session.obj(nodenum)
|
||||
except KeyError:
|
||||
self.session.warn("Skipping mobility configuration for unknown"
|
||||
"node %d." % nodenum)
|
||||
continue
|
||||
if nodenum not in self.configs:
|
||||
self.session.warn("Missing mobility configuration for node "
|
||||
"%d." % nodenum)
|
||||
continue
|
||||
v = self.configs[nodenum]
|
||||
for model in v:
|
||||
try:
|
||||
cls = self._modelclsmap[model[0]]
|
||||
|
@ -60,6 +67,7 @@ class MobilityManager(ConfigurableManager):
|
|||
self.installphysnodes(n)
|
||||
if n.mobility:
|
||||
self.session.evq.add_event(0.0, n.mobility.startup)
|
||||
return ()
|
||||
|
||||
|
||||
def reset(self):
|
||||
|
|
|
@ -626,6 +626,18 @@ class CoreServices(ConfigurableManager):
|
|||
node.warn("error starting command %s" % cmd)
|
||||
if eventtype == coreapi.CORE_EVENT_PAUSE:
|
||||
self.validatenodeservice(node, s, services)
|
||||
if eventtype == coreapi.CORE_EVENT_RECONFIGURE:
|
||||
if s._custom:
|
||||
cfgfiles = s._configs
|
||||
else:
|
||||
cfgfiles = s.getconfigfilenames(node.objid, services)
|
||||
for filename in cfgfiles:
|
||||
if filename[:7] == "file:///":
|
||||
raise NotImplementedError # TODO
|
||||
cfg = self.getservicefiledata(s, filename)
|
||||
if cfg is None:
|
||||
cfg = s.generateconfig(node, filename, services)
|
||||
node.nodefile(filename, cfg)
|
||||
|
||||
|
||||
class CoreService(object):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue