Prepare for Dynamic Rule Changes
Change the name of the rules read from the file, then copy it to “RULES” after processing. This will allow us to modify RULES on the fly, while keeping the “original” - This is a hook to add dynamic rule changes.
This commit is contained in:
parent
b7f6b62993
commit
d4b51fd08f
10
bridge.py
10
bridge.py
@ -64,7 +64,7 @@ TS_CLEAR_TIME = .2
|
|||||||
# but it has to exist.
|
# but it has to exist.
|
||||||
#
|
#
|
||||||
try:
|
try:
|
||||||
from bridge_rules import RULES
|
from bridge_rules import RULES as RULES_FILE
|
||||||
logger.info('Bridge rules file found and rules imported')
|
logger.info('Bridge rules file found and rules imported')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sys.exit('Bridging rules file not found or invalid')
|
sys.exit('Bridging rules file not found or invalid')
|
||||||
@ -73,8 +73,8 @@ except ImportError:
|
|||||||
# we need to send in the actual data packets.
|
# we need to send in the actual data packets.
|
||||||
#
|
#
|
||||||
|
|
||||||
for _ipsc in RULES:
|
for _ipsc in RULES_FILE:
|
||||||
for _rule in RULES[_ipsc]['GROUP_VOICE']:
|
for _rule in RULES_FILE[_ipsc]['GROUP_VOICE']:
|
||||||
_rule['SRC_GROUP'] = hex_str_3(_rule['SRC_GROUP'])
|
_rule['SRC_GROUP'] = hex_str_3(_rule['SRC_GROUP'])
|
||||||
_rule['DST_GROUP'] = hex_str_3(_rule['DST_GROUP'])
|
_rule['DST_GROUP'] = hex_str_3(_rule['DST_GROUP'])
|
||||||
_rule['SRC_TS'] = _rule['SRC_TS'] - 1
|
_rule['SRC_TS'] = _rule['SRC_TS'] - 1
|
||||||
@ -82,9 +82,11 @@ for _ipsc in RULES:
|
|||||||
if _ipsc not in NETWORK:
|
if _ipsc not in NETWORK:
|
||||||
sys.exit('ERROR: Bridge rules found for an IPSC network not configured in main configuration')
|
sys.exit('ERROR: Bridge rules found for an IPSC network not configured in main configuration')
|
||||||
for _ipsc in NETWORK:
|
for _ipsc in NETWORK:
|
||||||
if _ipsc not in RULES:
|
if _ipsc not in RULES_FILE:
|
||||||
sys.exit('ERROR: Bridge rules not found for all IPSC network configured')
|
sys.exit('ERROR: Bridge rules not found for all IPSC network configured')
|
||||||
|
|
||||||
|
RULES = RULES_FILE
|
||||||
|
|
||||||
# Import List of Bridges
|
# Import List of Bridges
|
||||||
# This is how we identify known bridges. If one of these is present
|
# This is how we identify known bridges. If one of these is present
|
||||||
# and it's mode byte is set to bridge, we don't
|
# and it's mode byte is set to bridge, we don't
|
||||||
|
Loading…
x
Reference in New Issue
Block a user