old_contents: """
  Event handling system.
  
  Author: Henrik Thostrup Jensen <htj@nordu.net>
  Copyright: NORDUnet (2012)
  """
  
  
  DISCOVER                = 'discover'
  
  RESERVE                 = 'reserve'
  RESERVE_RESPONSE        = 'reserve_response'
  RESERVE_COMMIT          = 'reserve_commit'
  RESERVE_COMMIT_RESPONSE = 'reserve_commit_response'
  RESERVE_ABORT           = 'reserve_abort'
  RESERVE_ABORT_RESPONSE  = 'reserve_abort_response'
  RESERVE_TIMEOUT         = 'reserve_timeout'
  
  PROVISION               = 'provision'
  PROVISION_RESPONSE      = 'provision_response'
  RELEASE                 = 'release'
  RELEASE_RESPONSE        = 'release_response'
  
  TERMINATE               = 'terminate'
  TERMINATE_RESPONSE      = 'terminate_response'
  
  QUERY                   = 'query'
  QUERY_RESPONSE          = 'query_response'
  
  DATA_PLANE_CHANGE       = 'data_plane_change'
  ERROR_EVENT             = 'error_event'
  
  
  SYSTEM_SERVICE          = 'service'
  NSI2_REMOTE             = 'nsi2-remote'
  NSI2_LOCAL              = 'nsi2-local'
  
  
  
  class ServiceRegistry:
  
      def __init__(self):
          self.handlers = {}
  
  
      def getHandler(self, event, system):
  
          es = (event, system)
          return self.handlers[es]
  
  
      def registerEventHandler(self, event, handler, system):
  
          if event in self.handlers:
              raise ValueError('Handler for event %s already registered' % event)
  
          es = (event, system)
          self.handlers[es] = handler
  
  
      def deregisterEventHandler(self, event, system):
  
          es = (event, system)
          self.handlers.pop(es)
  
  
new_contents: """
  Event handling system.
  
  Author: Henrik Thostrup Jensen <htj@nordu.net>
  Copyright: NORDUnet (2012)
  """
  
  
  DISCOVER                = 'discover'
  
  RESERVE                 = 'reserve'
  RESERVE_RESPONSE        = 'reserve_response'
  RESERVE_COMMIT          = 'reserve_commit'
  RESERVE_COMMIT_RESPONSE = 'reserve_commit_response'
  RESERVE_ABORT           = 'reserve_abort'
  RESERVE_ABORT_RESPONSE  = 'reserve_abort_response'
  RESERVE_TIMEOUT         = 'reserve_timeout'
  
  PROVISION               = 'provision'
  PROVISION_RESPONSE      = 'provision_response'
  RELEASE                 = 'release'
  RELEASE_RESPONSE        = 'release_response'
  
  TERMINATE               = 'terminate'
  TERMINATE_RESPONSE      = 'terminate_response'
  
  QUERY                   = 'query'
  QUERY_RESPONSE          = 'query_response'
  
  DATA_PLANE_CHANGE       = 'data_plane_change'
  ERROR_EVENT             = 'error_event'
  
  SYSTEM_SERVICE          = 'service'
  NSI2_AGGREGATOR         = 'nsi2-aggregator'
  NSI2_REMOTE             = 'nsi2-remote'
  NSI2_LOCAL              = 'nsi2-local'
  
  
  
  class ServiceRegistry:
  
      def __init__(self):
          self.handlers = {}
  
  
      def getHandler(self, event, system):
  
          es = (event, system)
          return self.handlers[es]
  
  
      def registerEventHandler(self, event, handler, system):
  
          if event in self.handlers:
              raise ValueError('Handler for event %s already registered' % event)
  
          es = (event, system)
          self.handlers[es] = handler
  
  
      def deregisterEventHandler(self, event, system):
  
          es = (event, system)
          self.handlers.pop(es)
  
  
subject: add aggregator as registry subsystem, though not entirely sure how it is distinct from system service