def update(self):
"""
Tells RideD to update itself by getting the latest subscribers, publishers,
publication routes, and topology. It rebuilds and reinstalls the multicast
trees if necessary.
:return:
"""
# ENHANCE: extend the REST APIs to support updating the topology rather than getting a whole new one.
self.topology_manager.build_topology(from_scratch=True)
# TODO: need to invalidate outstanding alerts if the MDMTs change! or at least invalidate their changed MDMTs...
# XXX: during lots of failures, the updated topology won't see a lot of the nodes so we'll be catching errors...
trees = None
try:
trees = self.build_mdmts()
# TODO: maybe we should only save the built MDMTs as we add their flow rules? this could ensure that any MDMT we try to use will at least be fully-installed...
# could even use a thread lock to block until the first one is installed
self.mdmts = trees
except nx.NetworkXError as e:
log.error("failed to create MDMTs (likely due to topology disconnect) due to error: \n%s" % e)
if trees:
# ENHANCE: error checking/handling esp. for the multicast address pool that must be shared across all topics!
for mdmts in trees.values():
try:
self.install_mdmts(mdmts)
except nx.NetworkXError as e:
log.error("failed to install_mdmts due to error: %s" % e)
elif self.subscribers:
log.error("empty return value from build_mdmts() when we do have subscribers!")
# ENHANCE: retrieve publication routes rather than rely on them being manually set...
评论列表
文章目录