def __init__(self, *args, **kwargs): super(MupiMcastProxy, self).__init__(*args, **kwargs) self.logger.info('--------------------------------------') self.logger.info('-- MupiMcastProxy.__init__ called') # Variable initialization self.mac_to_port = {} self._to_hosts = {} self.murt = McastUpstreamRoutingTable.MURT(self.logger) # Read config params from DEFAULT section cfg.CONF.register_opts([ #cfg.StrOpt('mac_to_port', default='Not configured', help = ('A string')), #cfg.StrOpt('to_hosts', default='Not configured', help = ('A string')), cfg.IntOpt('test_param1', default='0', help=('A integer')) ]) #self.mac_to_port = json.loads(cfg.CONF.mac_to_port) #self._to_hosts = json.loads(cfg.CONF.to_hosts) test_param1 = cfg.CONF.test_param1 #print('mac_to_port={}'.format(self.mac_to_port)) #print('to_hosts={}'.format(self._to_hosts)) self.logger.debug(f'test_param1={test_param1}') # Create and configure murt (Multicast Upstream Routing Table) # by reading murt_entry lines from config file murt_group = cfg.oslo_config.cfg.OptGroup(name='murt') murt_opts = [ cfg.MultiStrOpt('murt_entry', default='', help='Multicast upstream routing table') ] cfg.CONF.register_group(murt_group) cfg.CONF.register_opts(murt_opts, group=murt_group) murt_cfg = cfg.CONF.murt.murt_entry for l in murt_cfg: #print(f'{l}') f = l.split(',') #print( '{:17} {:17} {:17} {:12} {:8}'.format(f[0].strip(), f[1].strip(), f[2].strip(), f[3].strip(), f[4].strip()) ) e = [ f[0].strip(), f[1].strip(), f[2].strip(), int(f[3].strip()), int(f[4].strip()) ] #print (e) id = self.murt.add_entry(e) if id: self.logger.debug('Added entry {}'.format(id)) self.logger.info('--------------------------------------') self.murt.print_mcast_table(self.murt.mcast_upstream_routing, False)
from ryu.lib import hub from ryu.app import wsgi from ryu.base.app_manager import AppManager from ryu.controller import controller from ryu.topology import switches LOG = logging.getLogger('dragon_knight') CONF = cfg.CONF CONF.set_override('observe_links', True) CONF.register_cli_opts([ cfg.ListOpt('app-lists', default=[], help='application module name to run'), cfg.MultiStrOpt('app', positional=True, default=[], help='application module name to run'), cfg.StrOpt('pid-file', default=None, help='pid file name'), cfg.BoolOpt('enable-debugger', default=False, help='don\'t overwrite Python standard threading library' '(use only for debugging)') ]) def main(args=None, prog=None): try: CONF(args=args, prog=prog, project='ryu', version='ryu-manager {}'.format(version),