Update filter-rules
This commit is contained in:
Florian 2016-12-22 22:36:35 +01:00 committed by GitHub
parent d37935bbf5
commit 7a636ceeae

View file

@ -35,8 +35,8 @@ def isAllowed(poc_id):
allowed = 0
# 1.) Allow
# If RIC is allowed, return true; otherwise go on
# 1.) If allowed RICs is set, only they will path,
# If RIC is the right one return True, else False
if globalVars.config.get("POC", "allow_ric"):
if poc_id in globalVars.config.get("POC", "allow_ric"):
logging.info("RIC %s is allowed", poc_id)
@ -44,20 +44,24 @@ def isAllowed(poc_id):
else:
logging.info("RIC %s is not in the allowed list", poc_id)
allowed = 0
# 2.) Deny
# If RIC is denied, mark as not allowed
# 2.) If denied RIC, return False
if poc_id in globalVars.config.get("POC", "deny_ric"):
logging.info("RIC %s is denied by config.ini", poc_id)
allowed = 0
# 3.) Check Range, return true if in between
if globalVars.config.getint("POC", "filter_range_start") <= int(poc_id) <= globalVars.config.getint("POC", "filter_range_end"):
# 3.) Check Range, return False if outside def. range
if globalVars.config.getint("POC", "filter_range_start") < int(poc_id) < globalVars.config.getint("POC", "filter_range_end"):
logging.info("RIC %s in between filter range", poc_id)
return True
else:
logging.info("RIC %s out of filter range", poc_id)
allowed = 0
allowed =
# 4.) Implementation for net identifiers
if globalVars.config.get("POC", "netIdent_ric"):
if poc_id in globalVars.config.get("POC", "netIdent_ric"):
logging.info("RIC %s as net identifier", poc_id)
return True
else:
allowed = 0
if allowed == 0:
return False