Add GENERATOR: N in MASTER deifnition

If GENERATOR is set to more than 1, the master definiton
is used as a template to generate N systems with sequential ports,
starting at the port listed in the defintion.

For example:

for N = 2:

G7RZU-0 - port 54000
G7RZU-1 - port 54001
This commit is contained in:
Simon 2021-02-21 14:33:53 +00:00
parent 2e3806cf4e
commit b719a55e4c
3 changed files with 23 additions and 1 deletions

View File

@ -184,3 +184,4 @@ VOICE_IDENT: True
TS1_STATIC:
TS2_STATIC:
DEFAULT_REFLECTOR: 0
GENERATOR: 1

View File

@ -1888,6 +1888,26 @@ if __name__ == '__main__':
listeningPorts = {}
generator = {}
systemdelete = []
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' and (CONFIG['SYSTEMS'][system]['GENERATOR'] > 1):
for count in range(CONFIG['SYSTEMS'][system]['GENERATOR']):
_systemname = system+'-'+str(count)
generator[_systemname] = CONFIG['SYSTEMS'][system].copy()
generator[_systemname]['PORT'] = generator[_systemname]['PORT'] + count
logger.debug('(GLOBAL) Generator - generated system %s',_systemname)
systemdelete.append(system)
for _system in generator:
CONFIG['SYSTEMS'][_system] = generator[_system]
for _system in systemdelete:
CONFIG['SYSTEMS'].pop(_system)
del generator
del systemdelete
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':

View File

@ -283,6 +283,7 @@ def build_config(_config_file):
'TS1_STATIC': config.get(section,'TS1_STATIC'),
'TS2_STATIC': config.get(section,'TS2_STATIC'),
'DEFAULT_REFLECTOR': config.getint(section, 'DEFAULT_REFLECTOR'),
'GENERATOR': config.getint(section, 'GENERATOR')
}})
CONFIG['SYSTEMS'][section].update({'PEERS': {}})