Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASN1Tools Fails to Compile 3GPP Release 16 ASN.1 #156

Open
btsimon97 opened this issue Oct 27, 2022 · 3 comments
Open

ASN1Tools Fails to Compile 3GPP Release 16 ASN.1 #156

btsimon97 opened this issue Oct 27, 2022 · 3 comments

Comments

@btsimon97
Copy link

When trying to compile 3GPP's ASN.1 for S1AP Release 16 using asn1tools version 0.164.0, the compilation fails with the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/compiler.py", line 376, in compile_files
    return compile_dict(parse_files(filenames, encoding),
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/compiler.py", line 308, in compile_dict
    return Specification(codec.compile_dict(specification,
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/ber.py", line 1773, in compile_dict
    return Compiler(specification, numeric_enums).process()
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 210, in process
    self.pre_process()
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 257, in pre_process
    self.pre_process_parameterization_step_1(module['types'],
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 529, in pre_process_parameterization_step_1
    self.pre_process_parameterization_step_1_type(type_descriptor,
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 548, in pre_process_parameterization_step_1_type
    self.pre_process_parameterization_step_1_type(member,
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 590, in pre_process_parameterization_step_1_type
    self.pre_process_parameterization_step_1_dummy_to_actual_type(
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 629, in pre_process_parameterization_step_1_dummy_to_actual_type
    self.pre_process_parameterization_step_1_dummy_to_actual_type(
  File "/asn1_venv/lib/python3.10/site-packages/asn1tools/codecs/compiler.py", line 643, in pre_process_parameterization_step_1_dummy_to_actual_type
    if parameter['type'] == dummy_parameter:
TypeError: string indices must be integers

This occurs either when the various S1AP ASN.1 definitions are in separate files or concatenated into a single file. The S1AP-IEs or S1AP-Containers definitions appears to be the offending definitions as compilation completes okay without including them, although this leaves the compiled ASN1 missing the actual definitions needed to encode/decode S1AP messages.

@btsimon97
Copy link
Author

On further testing this appears to apply with R15 and R14 S1AP as well.

@hyrut
Copy link

hyrut commented May 7, 2023

Is any update?
I have same issue when I use asn1tools to compile 3GPP TS38.413 release v17.4.0 for NGAP decoding.
ans1tools version is 0.166.0

Traceback (most recent call last):
File "/mnt/e/Work/programming/python/testASN1/test.py", line 20, in
ngap_coder = asn1tools.compile_files(["NGAP-PDU-Descriptions.asn","NGAP-CommonDataTypes.asn","NGAP-IEs.asn","NGAP-Containers.asn"], 'per')
File "/usr/local/lib/python3.10/dist-packages/asn1tools/compiler.py", line 380, in compile_files
return compile_dict(parse_files(filenames, encoding),
File "/usr/local/lib/python3.10/dist-packages/asn1tools/compiler.py", line 312, in compile_dict
return Specification(codec.compile_dict(specification,
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/per.py", line 2246, in compile_dict
return Compiler(specification, numeric_enums).process()
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 210, in process
self.pre_process()
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 257, in pre_process
self.pre_process_parameterization_step_1(module['types'],
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 529, in pre_process_parameterization_step_1
self.pre_process_parameterization_step_1_type(type_descriptor,
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 548, in pre_process_parameterization_step_1_type
self.pre_process_parameterization_step_1_type(member,
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 590, in pre_process_parameterization_step_1_type
self.pre_process_parameterization_step_1_dummy_to_actual_type(
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 629, in pre_process_parameterization_step_1_dummy_to_actual_type
self.pre_process_parameterization_step_1_dummy_to_actual_type(
File "/usr/local/lib/python3.10/dist-packages/asn1tools/codecs/compiler.py", line 646, in pre_process_parameterization_step_1_dummy_to_actual_type
if parameter['type'] == dummy_parameter:
TypeError: string indices must be integers

@laf0rge
Copy link

laf0rge commented Dec 9, 2023

I think the README.md clearly states which language features are supported and not.

Most 3GPP (particularly NAS, but also S1AP) specifications make use of information object classes / the CLASS keyword.

The README.md says The CLASS keyword (X.681) and its friends are not yet supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants