fix(docker): fixes when generating the templates for gNB conf files

* The '0x' format was forgetting that an hexadecimal value can have a-f chars
  * If someone wants to use a dedicated NSSAI_SD value, it is possible now
  * For experimental purpose in cluster, SDR addresses can be provided for one config
    - could be expended later on other conf files

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
Raphael Defosseux
2022-09-21 10:52:05 +02:00
parent 18ead40b84
commit 0dff2c9bc3
3 changed files with 20 additions and 22 deletions
+5 -2
View File
@@ -90,7 +90,7 @@ def main():
if templine.find(key["key"]) >= 0:
if re.search(r'preference', templine): # false positive
continue
if re.search(r'sdr_addrs', templine): # false positive
if key["key"] != 'sdr_addrs' and re.search(r'sdr_addrs', templine): # false positive
continue
elif re.search('downlink_frequency', line):
templine = re.sub(r'[0-9]+', key["env"], line)
@@ -106,7 +106,10 @@ def main():
r'\1' + key["env"] + r"\2", templine)
# next: matches key = NUMBER
elif re.search(key["key"] + "\s*=\s*[x0-9]+", templine): # x for "0x" hex start
templine = re.sub("(" + key["key"] + "\s*=\s*(?:0x)?)[x0-9]+", r"\1" + key["env"], templine)
templine = re.sub("(" + key["key"] + "\s*=\s*(?:0x)?)[x0-9a-fA-F]+", r"\1" + key["env"], templine)
# next: special case for sdr_addrs
elif key["key"] == 'sdr_addrs' and re.search(key["key"] + "\s*=\s*", templine):
templine = re.sub("(" + key["key"] + "\s*=\s*.*$)", key["key"] + " = \"" + key["env"] + "\"", templine)
outputfile.write(templine)
if __name__ == "__main__":