-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pimd daemon #92
base: master
Are you sure you want to change the base?
Pimd daemon #92
Changes from all commits
56c63db
4edd170
05efce6
a70a25c
5f53baa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from .base import RouterDaemon | ||
|
||
class Pimd(RouterDaemon): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename this something less ambiguous, given that 'PIMD' already exists... |
||
""" This class configure the pim Daemon which can be found here: | ||
https://github.com/troglobit/pimd | ||
""" | ||
NAME = 'pimd' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same than above, define a more specific name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue here is that if I put a more specific name, for example 'pimd_troglobit' I got the following error: |
||
KILL_PATTERNS = (NAME,) | ||
|
||
def __init__(self,node,*args,**kwargs): | ||
super().__init__(node=node,*args,**kwargs) | ||
# add some custom attr | ||
if "cfg" in kwargs: | ||
self.custom_config = kwargs["cfg"] | ||
if "log_file" in kwargs: | ||
self.logfile = kwargs["log_file"] | ||
|
||
|
||
@property | ||
def startup_line(self): | ||
if hasattr(self,'custom_config'): | ||
return '{name} -f --config={cfg}'.format(name=self.NAME,cfg=self.custom_config) | ||
else: | ||
return '{name} -f --config={cfg}'.format(name=self.NAME,cfg=self.cfg_filename) | ||
|
||
@property | ||
def dry_run(self): | ||
return 'echo 2BeOrNot2Be > /dev/null' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A more general solution would be to make this return an empty string/None, and then update the global dry_run callsite to check for these empty/None string (i;e., "if d.dry_run: ... else: log.warning('Cannot check the config validity of daemon %s', d.Name')) This problem is bound to happen on more than one daemon... |
||
|
||
def set_defaults(self,defaults): | ||
super().set_defaults(defaults) | ||
|
||
def build(self): | ||
cfg = super().build() | ||
return cfg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +0,0 @@ | ||
hostname ${node.name} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this. This file configures the FRR pimd, and as such cannot be erased by this commit. |
||
password ${node.password} | ||
|
||
% if node.pimd.logfile: | ||
log file ${node.pimd.logfile} | ||
% endif | ||
|
||
% for section in node.pimd.debug: | ||
debug pimd ${section} | ||
% endfor | ||
! | ||
ip multicast-routing | ||
! | ||
% for itf in node.pimd.interfaces: | ||
interface ${itf.name} | ||
% if itf.ssm: | ||
ip pim ssm | ||
% endif | ||
% if itf.igmp: | ||
ip igmp | ||
% endif | ||
! | ||
% endfor | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature should always be there, and not only for the daemons have a logfile attribute.
I'd suggest to always log stderr/stdout of all daemons, e.g.,