refactored service interaction use names with a _, and cleanup up some of the CoreServices methods

This commit is contained in:
Blake J. Harnden 2018-06-15 14:03:27 -07:00
parent 0bf9c99910
commit e80736061f
27 changed files with 958 additions and 885 deletions

View file

@ -11,15 +11,15 @@ class XorpRtrmgr(CoreService):
XORP router manager service builds a config.boot file based on other
enabled XORP services, and launches necessary daemons upon startup.
"""
_name = "xorp_rtrmgr"
_group = "XORP"
_depends = ()
_dirs = ("/etc/xorp",)
_configs = ("/etc/xorp/config.boot",)
_startindex = 35
_startup = ("xorp_rtrmgr -d -b %s -l /var/log/%s.log -P /var/run/%s.pid" % (_configs[0], _name, _name),)
_shutdown = ("killall xorp_rtrmgr",)
_validate = ("pidof xorp_rtrmgr",)
name = "xorp_rtrmgr"
group = "XORP"
depends = ()
dirs = ("/etc/xorp",)
configs = ("/etc/xorp/config.boot",)
startindex = 35
startup = ("xorp_rtrmgr -d -b %s -l /var/log/%s.log -P /var/run/%s.pid" % (configs[0], name, name),)
shutdown = ("killall xorp_rtrmgr",)
validate = ("pidof xorp_rtrmgr",)
@classmethod
def generateconfig(cls, node, filename, services):
@ -40,10 +40,10 @@ class XorpRtrmgr(CoreService):
for s in services:
try:
s._depends.index(cls._name)
s.depends.index(cls.name)
cfg += s.generatexorpconfig(node)
except ValueError:
logger.exception("error getting value from service: %s", cls._name)
logger.exception("error getting value from service: %s", cls.name)
return cfg
@ -74,15 +74,15 @@ class XorpService(CoreService):
Parent class for XORP services. Defines properties and methods
common to XORP's routing daemons.
"""
_name = None
_group = "XORP"
_depends = ("xorp_rtrmgr",)
_dirs = ()
_configs = ()
_startindex = 40
_startup = ()
_shutdown = ()
_meta = "The config file for this service can be found in the xorp_rtrmgr service."
name = None
group = "XORP"
depends = ("xorp_rtrmgr",)
dirs = ()
configs = ()
startindex = 40
startup = ()
shutdown = ()
meta = "The config file for this service can be found in the xorp_rtrmgr service."
@staticmethod
def fea(forwarding):
@ -165,7 +165,7 @@ class XorpOspfv2(XorpService):
not build its own configuration file but has hooks for adding to the
unified XORP configuration file.
"""
_name = "XORP_OSPFv2"
name = "XORP_OSPFv2"
@classmethod
def generatexorpconfig(cls, node):
@ -200,7 +200,7 @@ class XorpOspfv3(XorpService):
not build its own configuration file but has hooks for adding to the
unified XORP configuration file.
"""
_name = "XORP_OSPFv3"
name = "XORP_OSPFv3"
@classmethod
def generatexorpconfig(cls, node):
@ -227,8 +227,8 @@ class XorpBgp(XorpService):
"""
IPv4 inter-domain routing. AS numbers and peers must be customized.
"""
_name = "XORP_BGP"
_custom_needed = True
name = "XORP_BGP"
custom_needed = True
@classmethod
def generatexorpconfig(cls, node):
@ -257,7 +257,7 @@ class XorpRip(XorpService):
RIP IPv4 unicast routing.
"""
_name = "XORP_RIP"
name = "XORP_RIP"
@classmethod
def generatexorpconfig(cls, node):
@ -289,7 +289,7 @@ class XorpRipng(XorpService):
"""
RIP NG IPv6 unicast routing.
"""
_name = "XORP_RIPNG"
name = "XORP_RIPNG"
@classmethod
def generatexorpconfig(cls, node):
@ -324,7 +324,7 @@ class XorpPimSm4(XorpService):
"""
PIM Sparse Mode IPv4 multicast routing.
"""
_name = "XORP_PIMSM4"
name = "XORP_PIMSM4"
@classmethod
def generatexorpconfig(cls, node):
@ -383,7 +383,7 @@ class XorpPimSm6(XorpService):
"""
PIM Sparse Mode IPv6 multicast routing.
"""
_name = "XORP_PIMSM6"
name = "XORP_PIMSM6"
@classmethod
def generatexorpconfig(cls, node):
@ -442,7 +442,7 @@ class XorpOlsr(XorpService):
"""
OLSR IPv4 unicast MANET routing.
"""
_name = "XORP_OLSR"
name = "XORP_OLSR"
@classmethod
def generatexorpconfig(cls, node):