Closed Onikauz closed 10 months ago
As you can read from the error message, your privateIEs
value is out of size constraint. This is because you provide actually a value of size 0, while the NGAP spec requires a value of size at least 1:
PrivateIE-Container {NGAP-PRIVATE-IES : IEsSetParam } ::= SEQUENCE (SIZE (1..maxPrivateIEs)) OF PrivateIE-Field {{IEsSetParam}}
Thank you for your reply, have you got any example of a PrivateIEs payload ? If I wan't to modify my PrivateIEs in which file I need to change that in order to be take into account by Pycrate ?
Thanks !
You need to declare some specific structures, into privateIEs
as part of the NGAP ASN.1 specification in the pycrate_asn1dir
directory, then recompile the specification. Without this, you will only be able to set raw buffers into this sequence, in my recollection.
Here is an example. The prototype for the privateIEs
object is:
In [10]: NGAP_PDU_Contents.PrivateMessage.get_proto()
Out[10]:
('SEQUENCE',
{
privateIEs: ('SEQUENCE OF', ('SEQUENCE', {
id: ('CHOICE', {
local: 'INTEGER',
global: 'OBJECT IDENTIFIER'
}),
criticality: 'ENUMERATED',
value: ('OPEN_TYPE', {})
}))
})
With a minimum length of 1 for the SEQUENCE OF. So, here is a possible (dummy boolean) value for such a Private NGAP PDU:
PDU = NGAP_PDU_Descriptions.NGAP_PDU
v = ('initiatingMessage', {'procedureCode': 31, 'criticality': 'ignore', 'value': ('PrivateMessage', {'privateIEs': [{'id': ('local', 1), 'criticality': 'ignore', 'value': (TYPE_BOOL, False)}]})})
PDU.set_val(v)
print(PDU.to_asn1())
enc = PDU.to_aper()
Hello,
I have some other questions to understand well. To compile NGAP ASN1 specification I need to modify only .txt file or .asn file also ?
I also test your example and it dosen't works, I got the same prototype, do I need to add this specification and compile ?
>>> import pycrate_asn1dir.NGAP
>>> pdu = pycrate_asn1dir.NGAP.NGAP_PDU_Descriptions.NGAP_PDU
>>> v = ('initiatingMessage', {'procedureCode': 31, 'criticality': 'ignore', 'value': ('PrivateMessage', {'privateIEs': [{'id': ('local', 1), 'criticality': 'ignore', 'value': (pycrate_asn1dir.NGAP.TYPE_BOOL, False)}]})})
>>> pdu.set_val(v)
ENUM._safechk_bnd: criticality, unable to retrieve a defined object
Other question => open another issue, but please ensure first you don't have enough information from the README and the wiki.
Regarding the example provided, what doesn't work exactly ? You say you "got the same prototype", what does it mean ?
Hello,
I got an error when I create a NGAP PDU with a PrivateMessageIE.
Just below the Traceback:
Here a code to reproduce the issue:
Thanks