add SAIP template handling + v3.1 definitions

This adds classes for describing profile templates as well
as derived classes defining the profile templates of the
"Profile Interoperability Technical Specification", specifically
it's "ANNEX A (Normative): File Structure Templates Definition"

We need a machine-readable definition of those templates, so
we can fully interpret an unprotected profile package (UPP),
as the UPP usually only contains the increment/difference to
a given teplate.

Change-Id: I79bc0a480450ca2de4b687ba6f11d0a4ea4f14c8
This commit is contained in:
Harald Welte
2024-01-28 14:03:21 +01:00
parent 263e3094ba
commit 3f3fd1a841
2 changed files with 680 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ class OID:
def intlist_from_str(instr: str) -> List[int]:
return [int(x) for x in instr.split('.')]
@staticmethod
def str_from_intlist(intlist: List[int]) -> str:
return '.'.join([str(x) for x in intlist])
def __init__(self, initializer: Union[List[int], str]):
if type(initializer) == str:
self.intlist = self.intlist_from_str(initializer)
@@ -29,7 +33,7 @@ class OID:
self.intlist = initializer
def __str__(self) -> str:
return '.'.join([str(x) for x in self.intlist])
return self.str_from_intlist(self.intlist)
def __repr__(self) -> str:
return 'OID(%s)' % (str(self))