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:
		
							parent
							
								
									2e3806cf4e
								
							
						
					
					
						commit
						b719a55e4c
					
				@ -184,3 +184,4 @@ VOICE_IDENT: True
 | 
			
		||||
TS1_STATIC:
 | 
			
		||||
TS2_STATIC:
 | 
			
		||||
DEFAULT_REFLECTOR: 0
 | 
			
		||||
GENERATOR: 1
 | 
			
		||||
 | 
			
		||||
@ -1888,10 +1888,30 @@ 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':
 | 
			
		||||
                systems[system] = routerOBP(system, CONFIG, report_server)
 | 
			
		||||
                systems[system] = routerOBP(system, CONFIG, report_server)                
 | 
			
		||||
            else:
 | 
			
		||||
                systems[system] = routerHBP(system, CONFIG, report_server)
 | 
			
		||||
            listeningPorts[system] = reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
 | 
			
		||||
 | 
			
		||||
@ -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': {}})
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user