refactored how services are loaded to be more dynamic

This commit is contained in:
Blake J. Harnden 2017-08-03 16:33:54 -07:00
parent 35c48e67a3
commit 850cc599c8
4 changed files with 53 additions and 68 deletions

View file

@ -4,17 +4,20 @@ Services
Services available to nodes can be put in this directory. Everything listed in
__all__ is automatically loaded by the main core module.
"""
import os
__all__ = [
"quagga",
"nrl",
"xorp",
"bird",
"utility",
"security",
"ucarp",
"dockersvc",
"OvsService",
"RyuService",
"startup"
]
from core.misc import log
from core.service import ServiceManager
logger = log.get_logger(__name__)
_PATH = os.path.abspath(os.path.dirname(__file__))
def load():
"""
Loads all services from the modules that reside under core.services.
:return: nothing
"""
ServiceManager.add_services(_PATH)