From 1b4229639562ff4eaa1e776385ff0de40016218b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 31 Oct 2016 16:26:22 +0100 Subject: asn1 test suite: Suppress warnings for -compile(export_all) --- lib/asn1/test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index 0716d79291..40575e8a2f 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -134,7 +134,7 @@ RELSYSDIR = $(RELEASE_PATH)/asn1_test # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warnings_as_errors +ERL_COMPILE_FLAGS += +warnings_as_errors +nowarn_export_all EBIN = . # ---------------------------------------------------- -- cgit v1.2.3 From c82bbd8f28f3e0ce00f5db44f7a6cef75653eee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 10 Sep 2015 16:10:31 +0200 Subject: asn1: Remove deprecated functions Remove the entire asn1rt module. All functions in it were deprecated in OTP 17. In asn1ct, remove the deprecated functions asn1ct:encode/3 and asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been formally deprecated but is undocumented. --- .../asn1_SUITE_data/extensionAdditionGroup.erl | 4 ++-- lib/asn1/test/asn1_SUITE_data/testobj.erl | 10 ++++------ lib/asn1/test/testPrimStrings.erl | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 19 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl index 6cf8ecf451..cd6c74b995 100644 --- a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl +++ b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl @@ -120,10 +120,10 @@ run3(Erule) -> asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, asn1_NOVALUE,asn1_NOVALUE}}}}}}}, io:format("~p:~p~n",[Erule,Val]), - {ok,List}= asn1rt:encode('EUTRA-RRC-Definitions','DL-DCCH-Message',Val), + {ok,List}= 'EUTRA-RRC-Definitions':encode('DL-DCCH-Message',Val), Enc = iolist_to_binary(List), io:format("Result from encode:~n~p~n",[Enc]), - {ok,Val2} = asn1rt:decode('EUTRA-RRC-Definitions','DL-DCCH-Message',Enc), + {ok,Val2} = 'EUTRA-RRC-Definitions':decode('DL-DCCH-Message', Enc), io:format("Result from decode:~n~p~n",[Val2]), case Val2 of Val -> ok; diff --git a/lib/asn1/test/asn1_SUITE_data/testobj.erl b/lib/asn1/test/asn1_SUITE_data/testobj.erl index a0e00f8314..e547ea4572 100644 --- a/lib/asn1/test/asn1_SUITE_data/testobj.erl +++ b/lib/asn1/test/asn1_SUITE_data/testobj.erl @@ -1410,16 +1410,14 @@ int2bin(Int) -> %%%%%%%%%%%%%%%%% wrappers %%%%%%%%%%%%%%%%%%%%%%%% wrapper_encode(Module,Type,Value) -> - case asn1rt:encode(Module,Type,Value) of - {ok,X} when binary(X) -> + case Module:encode(Type, Value) of + {ok,X} when is_binary(X) -> {ok, binary_to_list(X)}; - {ok,X} -> - {ok, binary_to_list(list_to_binary(X))}; Error -> Error end. wrapper_decode(Module, Type, Bytes) when is_binary(Bytes) -> - asn1rt:decode(Module, Type, Bytes); + Module:decode(Type, Bytes); wrapper_decode(Module, Type, Bytes) when is_list(Bytes) -> - asn1rt:decode(Module, Type, list_to_binary(Bytes)). + Module:decode(Type, list_to_binary(Bytes)). diff --git a/lib/asn1/test/testPrimStrings.erl b/lib/asn1/test/testPrimStrings.erl index cb97655c15..b7f0323301 100644 --- a/lib/asn1/test/testPrimStrings.erl +++ b/lib/asn1/test/testPrimStrings.erl @@ -19,8 +19,6 @@ %% %% -module(testPrimStrings). --compile([{nowarn_deprecated_function,{asn1rt,utf8_list_to_binary,1}}, - {nowarn_deprecated_function,{asn1rt,utf8_binary_to_list,1}}]). -export([bit_string/2]). -export([octet_string/1]). @@ -756,19 +754,21 @@ utf8_string(_Rules) -> 16#800, 16#ffff, 16#10000, - 16#1fffff, - 16#200000, - 16#3ffffff, - 16#4000000, - 16#7fffffff], + 16#1ffff, + 16#20000, + 16#2ffff, + 16#e0000, + 16#effff, + 16#F0000, + 16#10ffff], [begin - {ok,UTF8} = asn1rt:utf8_list_to_binary([Char]), - {ok,[Char]} = asn1rt:utf8_binary_to_list(UTF8), + UTF8 = unicode:characters_to_binary([Char]), + [Char] = unicode:characters_to_list([UTF8]), roundtrip('UTF', UTF8) end || Char <- AllRanges], - {ok,UTF8} = asn1rt:utf8_list_to_binary(AllRanges), - {ok,AllRanges} = asn1rt:utf8_binary_to_list(UTF8), + UTF8 = unicode:characters_to_binary(AllRanges), + AllRanges = unicode:characters_to_list(UTF8), roundtrip('UTF', UTF8), ok. -- cgit v1.2.3 From c6c01899e81412edace1ac96d7eef1eb4cbfd655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 25 Jan 2017 07:02:54 +0100 Subject: Correct spelling of NBAP-PDU-Descriptions --- .../nbapsystem/NBAP-PDU-Descriptions.asn | 916 +++++++++++++++++++++ .../nbapsystem/NBAP-PDU-Discriptions.asn | 916 --------------------- lib/asn1/test/asn1_SUITE_data/test_records.erl | 2 +- lib/asn1/test/testNBAPsystem.erl | 14 +- 4 files changed, 924 insertions(+), 924 deletions(-) create mode 100644 lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Descriptions.asn delete mode 100644 lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Descriptions.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Descriptions.asn new file mode 100644 index 0000000000..12a4475422 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Descriptions.asn @@ -0,0 +1,916 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +NBAP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +umts-Access (20) modules (3) nbap (2) version1 (1) nbap-PDU-Descriptions (0) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureID, + MessageDiscriminator, + TransactionID +FROM NBAP-CommonDataTypes + + CommonTransportChannelSetupRequestFDD, + CommonTransportChannelSetupRequestTDD, + CommonTransportChannelSetupResponse, + CommonTransportChannelSetupFailure, + CommonTransportChannelReconfigurationRequestFDD, + CommonTransportChannelReconfigurationRequestTDD, + CommonTransportChannelReconfigurationResponse, + CommonTransportChannelReconfigurationFailure, + CommonTransportChannelDeletionRequest, + CommonTransportChannelDeletionResponse, + BlockResourceRequest, + BlockResourceResponse, + BlockResourceFailure, + UnblockResourceIndication, + AuditFailure, + AuditRequiredIndication, + AuditRequest, + AuditResponse, + CommonMeasurementInitiationRequest, + CommonMeasurementInitiationResponse, + CommonMeasurementInitiationFailure, + CommonMeasurementReport, + CommonMeasurementTerminationRequest, + CommonMeasurementFailureIndication, + CellSetupRequestFDD, + CellSetupRequestTDD, + CellSetupResponse, + CellSetupFailure, + CellReconfigurationRequestFDD, + CellReconfigurationRequestTDD, + CellReconfigurationResponse, + CellReconfigurationFailure, + CellDeletionRequest, + CellDeletionResponse, + InformationExchangeInitiationRequest, + InformationExchangeInitiationResponse, + InformationExchangeInitiationFailure, + InformationReport, + InformationExchangeTerminationRequest, + InformationExchangeFailureIndication, + BearerRearrangementIndication, + ResourceStatusIndication, + SystemInformationUpdateRequest, + SystemInformationUpdateResponse, + SystemInformationUpdateFailure, + ResetRequest, + ResetResponse, + RadioLinkActivationCommandFDD, + RadioLinkActivationCommandTDD, + RadioLinkPreemptionRequiredIndication, + RadioLinkSetupRequestFDD, + RadioLinkSetupRequestTDD, + RadioLinkSetupResponseFDD, + RadioLinkSetupResponseTDD, + RadioLinkSetupFailureFDD, + RadioLinkSetupFailureTDD, + RadioLinkAdditionRequestFDD, + RadioLinkAdditionRequestTDD, + RadioLinkAdditionResponseFDD, + RadioLinkAdditionResponseTDD, + RadioLinkAdditionFailureFDD, + RadioLinkAdditionFailureTDD, + RadioLinkParameterUpdateIndicationFDD, + RadioLinkParameterUpdateIndicationTDD, + RadioLinkReconfigurationPrepareFDD, + RadioLinkReconfigurationPrepareTDD, + RadioLinkReconfigurationReady, + RadioLinkReconfigurationFailure, + RadioLinkReconfigurationCommit, + RadioLinkReconfigurationCancel, + RadioLinkReconfigurationRequestFDD, + RadioLinkReconfigurationRequestTDD, + RadioLinkReconfigurationResponse, + RadioLinkDeletionRequest, + RadioLinkDeletionResponse, + DL-PowerControlRequest, + DL-PowerTimeslotControlRequest, + DedicatedMeasurementInitiationRequest, + DedicatedMeasurementInitiationResponse, + DedicatedMeasurementInitiationFailure, + DedicatedMeasurementReport, + DedicatedMeasurementTerminationRequest, + DedicatedMeasurementFailureIndication, + RadioLinkFailureIndication, + RadioLinkRestoreIndication, + CompressedModeCommand, + ErrorIndication, + PrivateMessage, + PhysicalSharedChannelReconfigurationRequestTDD, + PhysicalSharedChannelReconfigurationRequestFDD, + PhysicalSharedChannelReconfigurationResponse, + PhysicalSharedChannelReconfigurationFailure, + CellSynchronisationInitiationRequestTDD, + CellSynchronisationInitiationResponseTDD, + CellSynchronisationInitiationFailureTDD, + CellSynchronisationReconfigurationRequestTDD, + CellSynchronisationReconfigurationResponseTDD, + CellSynchronisationReconfigurationFailureTDD, + CellSynchronisationAdjustmentRequestTDD, + CellSynchronisationAdjustmentResponseTDD, + CellSynchronisationAdjustmentFailureTDD, + CellSynchronisationReportTDD, + CellSynchronisationTerminationRequestTDD, + CellSynchronisationFailureIndicationTDD +FROM NBAP-PDU-Contents + + id-audit, + id-auditRequired, + id-blockResource, + id-cellDeletion, + id-cellReconfiguration, + id-cellSetup, + id-cellSynchronisationInitiation, + id-cellSynchronisationReconfiguration, + id-cellSynchronisationReporting, + id-cellSynchronisationTermination, + id-cellSynchronisationFailure, + id-commonMeasurementFailure, + id-commonMeasurementInitiation, + id-commonMeasurementReport, + id-commonMeasurementTermination, + id-commonTransportChannelDelete, + id-commonTransportChannelReconfigure, + id-commonTransportChannelSetup, + id-compressedModeCommand, + id-dedicatedMeasurementFailure, + id-dedicatedMeasurementInitiation, + id-dedicatedMeasurementReport, + id-dedicatedMeasurementTermination, + id-downlinkPowerControl, + id-downlinkPowerTimeslotControl, + id-errorIndicationForDedicated, + id-errorIndicationForCommon, + id-informationExchangeFailure, + id-informationExchangeInitiation, + id-informationReporting, + id-informationExchangeTermination, + id-BearerRearrangement, + id-physicalSharedChannelReconfiguration, + id-privateMessageForDedicated, + id-privateMessageForCommon, + id-radioLinkActivation, + id-radioLinkAddition, + id-radioLinkDeletion, + id-radioLinkFailure, + id-radioLinkParameterUpdate, + id-radioLinkPreemption, + id-radioLinkRestoration, + id-radioLinkSetup, + id-reset, + id-resourceStatusIndication, + id-cellSynchronisationAdjustment, + id-synchronisedRadioLinkReconfigurationCancellation, + id-synchronisedRadioLinkReconfigurationCommit, + id-synchronisedRadioLinkReconfigurationPreparation, + id-systemInformationUpdate, + id-unblockResource, + id-unSynchronisedRadioLinkReconfiguration +FROM NBAP-Constants; + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +NBAP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &Outcome OPTIONAL, + &messageDiscriminator MessageDiscriminator, + &procedureID ProcedureID UNIQUE, + &criticality Criticality DEFAULT ignore +} + +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + [OUTCOME &Outcome] + MESSAGE DISCRIMINATOR &messageDiscriminator + PROCEDURE ID &procedureID + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +NBAP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + succesfulOutcome SuccessfulOutcome, + unsuccesfulOutcome UnsuccessfulOutcome, + outcome Outcome, + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), + criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + transactionID TransactionID, + value NBAP-ELEMENTARY-PROCEDURE.&InitiatingMessage({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), + criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + transactionID TransactionID, + value NBAP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), + criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + transactionID TransactionID, + value NBAP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) +} + +Outcome ::= SEQUENCE { + procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), + criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), + transactionID TransactionID, + value NBAP-ELEMENTARY-PROCEDURE.&Outcome ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +NBAP-ELEMENTARY-PROCEDURES NBAP-ELEMENTARY-PROCEDURE ::= { + NBAP-ELEMENTARY-PROCEDURES-CLASS-1 | + NBAP-ELEMENTARY-PROCEDURES-CLASS-2 , + ... +} + +NBAP-ELEMENTARY-PROCEDURES-CLASS-1 NBAP-ELEMENTARY-PROCEDURE ::= { + cellSetupFDD | + cellSetupTDD | + cellReconfigurationFDD | + cellReconfigurationTDD | + cellDeletion | + commonTransportChannelSetupFDD | + commonTransportChannelSetupTDD | + commonTransportChannelReconfigureFDD | + commonTransportChannelReconfigureTDD | + commonTransportChannelDelete | + audit | + blockResource | + radioLinkSetupFDD | + radioLinkSetupTDD | + systemInformationUpdate | + commonMeasurementInitiation | + radioLinkAdditionFDD | + radioLinkAdditionTDD | + radioLinkDeletion | + reset | + synchronisedRadioLinkReconfigurationPreparationFDD | + synchronisedRadioLinkReconfigurationPreparationTDD | + unSynchronisedRadioLinkReconfigurationFDD | + unSynchronisedRadioLinkReconfigurationTDD | + dedicatedMeasurementInitiation | + physicalSharedChannelReconfigurationTDD , + ..., + informationExchangeInitiation | + cellSynchronisationInitiationTDD | + cellSynchronisationReconfigurationTDD | + cellSynchronisationAdjustmentTDD | + physicalSharedChannelReconfigurationFDD +} + +NBAP-ELEMENTARY-PROCEDURES-CLASS-2 NBAP-ELEMENTARY-PROCEDURE ::= { + resourceStatusIndication | + auditRequired | + commonMeasurementReport | + commonMeasurementTermination | + commonMeasurementFailure | + synchronisedRadioLinkReconfigurationCommit | + synchronisedRadioLinkReconfigurationCancellation | + radioLinkFailure | + radioLinkPreemption | + radioLinkRestoration | + dedicatedMeasurementReport | + dedicatedMeasurementTermination | + dedicatedMeasurementFailure | + downlinkPowerControlFDD | + downlinkPowerTimeslotControl | + compressedModeCommand | + unblockResource | + errorIndicationForDedicated | + errorIndicationForCommon | + privateMessageForDedicated | + privateMessageForCommon , + ..., + informationReporting | + informationExchangeTermination | + informationExchangeFailure | + cellSynchronisationReportingTDD | + cellSynchronisationTerminationTDD | + cellSynchronisationFailureTDD | + bearerRearrangement | + radioLinkActivationFDD | + radioLinkActivationTDD | + radioLinkParameterUpdateFDD | + radioLinkParameterUpdateTDD +} + +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +-- Class 1 + +-- *** CellSetup (FDD) *** +cellSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSetupRequestFDD + SUCCESSFUL OUTCOME CellSetupResponse + UNSUCCESSFUL OUTCOME CellSetupFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSetup, ddMode fdd } + CRITICALITY reject +} + +-- *** CellSetup (TDD) *** +cellSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSetupRequestTDD + SUCCESSFUL OUTCOME CellSetupResponse + UNSUCCESSFUL OUTCOME CellSetupFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSetup, ddMode tdd } + CRITICALITY reject +} + +-- *** CellReconfiguration(FDD) *** +cellReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellReconfigurationRequestFDD + SUCCESSFUL OUTCOME CellReconfigurationResponse + UNSUCCESSFUL OUTCOME CellReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellReconfiguration, ddMode fdd } + CRITICALITY reject +} + +-- *** CellReconfiguration(TDD) *** +cellReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellReconfigurationRequestTDD + SUCCESSFUL OUTCOME CellReconfigurationResponse + UNSUCCESSFUL OUTCOME CellReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellReconfiguration, ddMode tdd } + CRITICALITY reject +} + +-- *** CellDeletion *** +cellDeletion NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellDeletionRequest + SUCCESSFUL OUTCOME CellDeletionResponse + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellDeletion, ddMode common } + CRITICALITY reject +} + +-- *** CommonTransportChannelSetup (FDD) *** +commonTransportChannelSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonTransportChannelSetupRequestFDD + SUCCESSFUL OUTCOME CommonTransportChannelSetupResponse + UNSUCCESSFUL OUTCOME CommonTransportChannelSetupFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonTransportChannelSetup, ddMode fdd } + CRITICALITY reject +} + +-- *** CommonTransportChannelSetup (TDD) *** +commonTransportChannelSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonTransportChannelSetupRequestTDD + SUCCESSFUL OUTCOME CommonTransportChannelSetupResponse + UNSUCCESSFUL OUTCOME CommonTransportChannelSetupFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonTransportChannelSetup, ddMode tdd } + CRITICALITY reject +} + +-- *** CommonTransportChannelReconfigure (FDD) *** +commonTransportChannelReconfigureFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonTransportChannelReconfigurationRequestFDD + SUCCESSFUL OUTCOME CommonTransportChannelReconfigurationResponse + UNSUCCESSFUL OUTCOME CommonTransportChannelReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonTransportChannelReconfigure, ddMode fdd } + CRITICALITY reject +} + +-- *** CommonTransportChannelReconfigure (TDD) *** +commonTransportChannelReconfigureTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonTransportChannelReconfigurationRequestTDD + SUCCESSFUL OUTCOME CommonTransportChannelReconfigurationResponse + UNSUCCESSFUL OUTCOME CommonTransportChannelReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonTransportChannelReconfigure, ddMode tdd } + CRITICALITY reject +} + +-- *** CommonTransportChannelDelete *** +commonTransportChannelDelete NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonTransportChannelDeletionRequest + SUCCESSFUL OUTCOME CommonTransportChannelDeletionResponse + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonTransportChannelDelete, ddMode common } + CRITICALITY reject +} + +-- *** Audit *** +audit NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AuditRequest + SUCCESSFUL OUTCOME AuditResponse + UNSUCCESSFUL OUTCOME AuditFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-audit, ddMode common } + CRITICALITY reject +} + +-- *** BlockResourceRequest *** +blockResource NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BlockResourceRequest + SUCCESSFUL OUTCOME BlockResourceResponse + UNSUCCESSFUL OUTCOME BlockResourceFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-blockResource, ddMode common } + CRITICALITY reject +} + +-- *** RadioLinkSetup (FDD) *** +radioLinkSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkSetupRequestFDD + SUCCESSFUL OUTCOME RadioLinkSetupResponseFDD + UNSUCCESSFUL OUTCOME RadioLinkSetupFailureFDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-radioLinkSetup, ddMode fdd } + CRITICALITY reject +} + +-- *** RadioLinkSetup (TDD) *** +radioLinkSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkSetupRequestTDD + SUCCESSFUL OUTCOME RadioLinkSetupResponseTDD + UNSUCCESSFUL OUTCOME RadioLinkSetupFailureTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-radioLinkSetup, ddMode tdd } + CRITICALITY reject +} + +-- *** SystemInformationUpdate *** +systemInformationUpdate NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationUpdateRequest + SUCCESSFUL OUTCOME SystemInformationUpdateResponse + UNSUCCESSFUL OUTCOME SystemInformationUpdateFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-systemInformationUpdate, ddMode common } + CRITICALITY reject +} + +-- *** Reset *** +reset NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResetRequest + SUCCESSFUL OUTCOME ResetResponse + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-reset, ddMode common } + CRITICALITY reject +} + +-- *** CommonMeasurementInitiation *** +commonMeasurementInitiation NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonMeasurementInitiationRequest + SUCCESSFUL OUTCOME CommonMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME CommonMeasurementInitiationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonMeasurementInitiation, ddMode common } + CRITICALITY reject +} + +-- *** RadioLinkAddition (FDD) *** +radioLinkAdditionFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkAdditionRequestFDD + SUCCESSFUL OUTCOME RadioLinkAdditionResponseFDD + UNSUCCESSFUL OUTCOME RadioLinkAdditionFailureFDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkAddition, ddMode fdd } + CRITICALITY reject +} + +-- *** RadioLinkAddition (TDD) *** +radioLinkAdditionTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkAdditionRequestTDD + SUCCESSFUL OUTCOME RadioLinkAdditionResponseTDD + UNSUCCESSFUL OUTCOME RadioLinkAdditionFailureTDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkAddition, ddMode tdd } + CRITICALITY reject +} + +-- *** RadioLinkDeletion *** +radioLinkDeletion NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkDeletionRequest + SUCCESSFUL OUTCOME RadioLinkDeletionResponse + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkDeletion, ddMode common } + CRITICALITY reject +} + +-- *** SynchronisedRadioLinkReconfigurationPreparation (FDD) *** +synchronisedRadioLinkReconfigurationPreparationFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationPrepareFDD + SUCCESSFUL OUTCOME RadioLinkReconfigurationReady + UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationPreparation, ddMode fdd } + CRITICALITY reject +} + +-- *** SynchronisedRadioLinkReconfigurationPreparation (TDD) *** +synchronisedRadioLinkReconfigurationPreparationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationPrepareTDD + SUCCESSFUL OUTCOME RadioLinkReconfigurationReady + UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationPreparation, ddMode tdd } + CRITICALITY reject +} + +-- *** UnSynchronisedRadioLinkReconfiguration (FDD) *** +unSynchronisedRadioLinkReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationRequestFDD + SUCCESSFUL OUTCOME RadioLinkReconfigurationResponse + UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-unSynchronisedRadioLinkReconfiguration, ddMode fdd } + CRITICALITY reject +} + +-- *** UnSynchronisedRadioLinkReconfiguration (TDD) *** +unSynchronisedRadioLinkReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationRequestTDD + SUCCESSFUL OUTCOME RadioLinkReconfigurationResponse + UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-unSynchronisedRadioLinkReconfiguration, ddMode tdd } + CRITICALITY reject +} + +-- *** DedicatedMeasurementInitiation *** +dedicatedMeasurementInitiation NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DedicatedMeasurementInitiationRequest + SUCCESSFUL OUTCOME DedicatedMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME DedicatedMeasurementInitiationFailure + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-dedicatedMeasurementInitiation, ddMode common } + CRITICALITY reject +} + +-- *** PhysicalSharedChannelReconfiguration (FDD) *** +physicalSharedChannelReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PhysicalSharedChannelReconfigurationRequestFDD + SUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationResponse + UNSUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-physicalSharedChannelReconfiguration, ddMode fdd } + CRITICALITY reject +} + +-- *** PhysicalSharedChannelReconfiguration (TDD) *** +physicalSharedChannelReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PhysicalSharedChannelReconfigurationRequestTDD + SUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationResponse + UNSUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-physicalSharedChannelReconfiguration, ddMode tdd } + CRITICALITY reject +} + +-- *** InformationExchangeInitiation *** +informationExchangeInitiation NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InformationExchangeInitiationRequest + SUCCESSFUL OUTCOME InformationExchangeInitiationResponse + UNSUCCESSFUL OUTCOME InformationExchangeInitiationFailure + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-informationExchangeInitiation, ddMode common } + CRITICALITY reject +} + +-- *** CellSynchronisationInitiation (TDD only) *** +cellSynchronisationInitiationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationInitiationRequestTDD + SUCCESSFUL OUTCOME CellSynchronisationInitiationResponseTDD + UNSUCCESSFUL OUTCOME CellSynchronisationInitiationFailureTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationInitiation, ddMode tdd } + CRITICALITY reject +} + +-- *** CellSynchronisationReconfiguration (TDD only) *** +cellSynchronisationReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationReconfigurationRequestTDD + SUCCESSFUL OUTCOME CellSynchronisationReconfigurationResponseTDD + UNSUCCESSFUL OUTCOME CellSynchronisationReconfigurationFailureTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationReconfiguration, ddMode tdd } + CRITICALITY reject +} + +-- *** CellSynchronisationAdjustment (TDD only) *** +cellSynchronisationAdjustmentTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationAdjustmentRequestTDD + SUCCESSFUL OUTCOME CellSynchronisationAdjustmentResponseTDD + UNSUCCESSFUL OUTCOME CellSynchronisationAdjustmentFailureTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationAdjustment, ddMode tdd } + CRITICALITY reject +} + +-- Class 2 + +-- *** ResourceStatusIndication *** +resourceStatusIndication NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-resourceStatusIndication, ddMode common } + CRITICALITY ignore +} + +-- *** AuditRequired *** +auditRequired NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AuditRequiredIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-auditRequired, ddMode common } + CRITICALITY ignore +} + +-- *** CommonMeasurementReport *** +commonMeasurementReport NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonMeasurementReport + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonMeasurementReport, ddMode common } + CRITICALITY ignore +} + +-- *** CommonMeasurementTermination *** +commonMeasurementTermination NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonMeasurementTerminationRequest + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonMeasurementTermination, ddMode common } + CRITICALITY ignore +} + +-- *** CommonMeasurementFailure *** +commonMeasurementFailure NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CommonMeasurementFailureIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-commonMeasurementFailure, ddMode common } + CRITICALITY ignore +} + +-- *** SynchronisedRadioLinkReconfigurationCommit *** +synchronisedRadioLinkReconfigurationCommit NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationCommit + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationCommit, ddMode common } + CRITICALITY ignore +} + +-- *** SynchronisedRadioReconfigurationCancellation *** +synchronisedRadioLinkReconfigurationCancellation NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkReconfigurationCancel + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationCancellation, ddMode common } + CRITICALITY ignore +} + +-- *** RadioLinkFailure *** +radioLinkFailure NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkFailureIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkFailure, ddMode common } + CRITICALITY ignore +} + +-- *** RadioLinkPreemption *** +radioLinkPreemption NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkPreemptionRequiredIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkPreemption, ddMode common } + CRITICALITY ignore +} + +-- *** RadioLinkRestoration *** +radioLinkRestoration NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkRestoreIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkRestoration, ddMode common } + CRITICALITY ignore +} + +-- *** DedicatedMeasurementReport *** +dedicatedMeasurementReport NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DedicatedMeasurementReport + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-dedicatedMeasurementReport, ddMode common } + CRITICALITY ignore +} + +-- *** DedicatedMeasurementTermination *** +dedicatedMeasurementTermination NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DedicatedMeasurementTerminationRequest + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-dedicatedMeasurementTermination, ddMode common } + CRITICALITY ignore +} + +-- *** DedicatedMeasurementFailure *** +dedicatedMeasurementFailure NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DedicatedMeasurementFailureIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-dedicatedMeasurementFailure, ddMode common } + CRITICALITY ignore +} + +-- *** DLPowerControl (FDD only) *** +downlinkPowerControlFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DL-PowerControlRequest + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-downlinkPowerControl, ddMode fdd } + CRITICALITY ignore +} + +-- *** DLPowerTimeslotControl (TDD only) *** +downlinkPowerTimeslotControl NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DL-PowerTimeslotControlRequest + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-downlinkPowerTimeslotControl, ddMode tdd } + CRITICALITY ignore +} + +-- *** CompressedModeCommand (FDD only) *** +compressedModeCommand NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CompressedModeCommand + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-compressedModeCommand, ddMode fdd } + CRITICALITY ignore +} + +-- *** UnblockResourceIndication *** +unblockResource NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UnblockResourceIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-unblockResource, ddMode common } + CRITICALITY ignore +} + +-- *** ErrorIndication for Dedicated procedures *** +errorIndicationForDedicated NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-errorIndicationForDedicated, ddMode common } + CRITICALITY ignore +} + +-- *** ErrorIndication for Common procedures *** +errorIndicationForCommon NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-errorIndicationForCommon, ddMode common } + CRITICALITY ignore +} + +-- *** CellSynchronisationReporting (TDD only) *** +cellSynchronisationReportingTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationReportTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationReporting, ddMode tdd } + CRITICALITY ignore +} + +-- *** CellSynchronisationTermination (TDD only) *** +cellSynchronisationTerminationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationTerminationRequestTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationTermination, ddMode tdd } + CRITICALITY ignore +} + +-- *** CellSynchronisationFailure (TDD only) *** +cellSynchronisationFailureTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellSynchronisationFailureIndicationTDD + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-cellSynchronisationFailure, ddMode tdd } + CRITICALITY ignore +} + +-- *** PrivateMessage for Dedicated procedures *** +privateMessageForDedicated NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-privateMessageForDedicated, ddMode common } + CRITICALITY ignore +} + +-- *** PrivateMessage for Common procedures *** +privateMessageForCommon NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-privateMessageForCommon, ddMode common } + CRITICALITY ignore +} + +-- *** InformationReporting *** +informationReporting NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InformationReport + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-informationReporting, ddMode common } + CRITICALITY ignore +} + +-- *** InformationExchangeTermination *** +informationExchangeTermination NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InformationExchangeTerminationRequest + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-informationExchangeTermination, ddMode common } + CRITICALITY ignore +} + +-- *** InformationExchangeFailure *** +informationExchangeFailure NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InformationExchangeFailureIndication + MESSAGE DISCRIMINATOR common + PROCEDURE ID { procedureCode id-informationExchangeFailure, ddMode common } + CRITICALITY ignore +} + +-- *** BearerRearrangement *** +bearerRearrangement NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BearerRearrangementIndication + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-BearerRearrangement, ddMode common } + CRITICALITY ignore +} + +-- *** RadioLinkActivation (FDD) *** +radioLinkActivationFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkActivationCommandFDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkActivation, ddMode fdd } + CRITICALITY ignore +} + +-- *** RadioLinkActivation (TDD) *** +radioLinkActivationTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkActivationCommandTDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkActivation, ddMode tdd } + CRITICALITY ignore +} + +-- *** RadioLinkParameterUpdate (FDD) *** +radioLinkParameterUpdateFDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkParameterUpdateIndicationFDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkParameterUpdate, ddMode fdd } + CRITICALITY ignore +} + +-- *** RadioLinkParameterUpdate (TDD) *** +radioLinkParameterUpdateTDD NBAP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RadioLinkParameterUpdateIndicationTDD + MESSAGE DISCRIMINATOR dedicated + PROCEDURE ID { procedureCode id-radioLinkParameterUpdate, ddMode tdd } + CRITICALITY ignore +} + +END + diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn deleted file mode 100644 index b9be9934e4..0000000000 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn +++ /dev/null @@ -1,916 +0,0 @@ --- ************************************************************** --- --- Elementary Procedure definitions --- --- ************************************************************** - -NBAP-PDU-Discriptions { -itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) -umts-Access (20) modules (3) nbap (2) version1 (1) nbap-PDU-Descriptions (0) } - -DEFINITIONS AUTOMATIC TAGS ::= - -BEGIN - --- ************************************************************** --- --- IE parameter types from other modules. --- --- ************************************************************** - -IMPORTS - Criticality, - ProcedureID, - MessageDiscriminator, - TransactionID -FROM NBAP-CommonDataTypes - - CommonTransportChannelSetupRequestFDD, - CommonTransportChannelSetupRequestTDD, - CommonTransportChannelSetupResponse, - CommonTransportChannelSetupFailure, - CommonTransportChannelReconfigurationRequestFDD, - CommonTransportChannelReconfigurationRequestTDD, - CommonTransportChannelReconfigurationResponse, - CommonTransportChannelReconfigurationFailure, - CommonTransportChannelDeletionRequest, - CommonTransportChannelDeletionResponse, - BlockResourceRequest, - BlockResourceResponse, - BlockResourceFailure, - UnblockResourceIndication, - AuditFailure, - AuditRequiredIndication, - AuditRequest, - AuditResponse, - CommonMeasurementInitiationRequest, - CommonMeasurementInitiationResponse, - CommonMeasurementInitiationFailure, - CommonMeasurementReport, - CommonMeasurementTerminationRequest, - CommonMeasurementFailureIndication, - CellSetupRequestFDD, - CellSetupRequestTDD, - CellSetupResponse, - CellSetupFailure, - CellReconfigurationRequestFDD, - CellReconfigurationRequestTDD, - CellReconfigurationResponse, - CellReconfigurationFailure, - CellDeletionRequest, - CellDeletionResponse, - InformationExchangeInitiationRequest, - InformationExchangeInitiationResponse, - InformationExchangeInitiationFailure, - InformationReport, - InformationExchangeTerminationRequest, - InformationExchangeFailureIndication, - BearerRearrangementIndication, - ResourceStatusIndication, - SystemInformationUpdateRequest, - SystemInformationUpdateResponse, - SystemInformationUpdateFailure, - ResetRequest, - ResetResponse, - RadioLinkActivationCommandFDD, - RadioLinkActivationCommandTDD, - RadioLinkPreemptionRequiredIndication, - RadioLinkSetupRequestFDD, - RadioLinkSetupRequestTDD, - RadioLinkSetupResponseFDD, - RadioLinkSetupResponseTDD, - RadioLinkSetupFailureFDD, - RadioLinkSetupFailureTDD, - RadioLinkAdditionRequestFDD, - RadioLinkAdditionRequestTDD, - RadioLinkAdditionResponseFDD, - RadioLinkAdditionResponseTDD, - RadioLinkAdditionFailureFDD, - RadioLinkAdditionFailureTDD, - RadioLinkParameterUpdateIndicationFDD, - RadioLinkParameterUpdateIndicationTDD, - RadioLinkReconfigurationPrepareFDD, - RadioLinkReconfigurationPrepareTDD, - RadioLinkReconfigurationReady, - RadioLinkReconfigurationFailure, - RadioLinkReconfigurationCommit, - RadioLinkReconfigurationCancel, - RadioLinkReconfigurationRequestFDD, - RadioLinkReconfigurationRequestTDD, - RadioLinkReconfigurationResponse, - RadioLinkDeletionRequest, - RadioLinkDeletionResponse, - DL-PowerControlRequest, - DL-PowerTimeslotControlRequest, - DedicatedMeasurementInitiationRequest, - DedicatedMeasurementInitiationResponse, - DedicatedMeasurementInitiationFailure, - DedicatedMeasurementReport, - DedicatedMeasurementTerminationRequest, - DedicatedMeasurementFailureIndication, - RadioLinkFailureIndication, - RadioLinkRestoreIndication, - CompressedModeCommand, - ErrorIndication, - PrivateMessage, - PhysicalSharedChannelReconfigurationRequestTDD, - PhysicalSharedChannelReconfigurationRequestFDD, - PhysicalSharedChannelReconfigurationResponse, - PhysicalSharedChannelReconfigurationFailure, - CellSynchronisationInitiationRequestTDD, - CellSynchronisationInitiationResponseTDD, - CellSynchronisationInitiationFailureTDD, - CellSynchronisationReconfigurationRequestTDD, - CellSynchronisationReconfigurationResponseTDD, - CellSynchronisationReconfigurationFailureTDD, - CellSynchronisationAdjustmentRequestTDD, - CellSynchronisationAdjustmentResponseTDD, - CellSynchronisationAdjustmentFailureTDD, - CellSynchronisationReportTDD, - CellSynchronisationTerminationRequestTDD, - CellSynchronisationFailureIndicationTDD -FROM NBAP-PDU-Contents - - id-audit, - id-auditRequired, - id-blockResource, - id-cellDeletion, - id-cellReconfiguration, - id-cellSetup, - id-cellSynchronisationInitiation, - id-cellSynchronisationReconfiguration, - id-cellSynchronisationReporting, - id-cellSynchronisationTermination, - id-cellSynchronisationFailure, - id-commonMeasurementFailure, - id-commonMeasurementInitiation, - id-commonMeasurementReport, - id-commonMeasurementTermination, - id-commonTransportChannelDelete, - id-commonTransportChannelReconfigure, - id-commonTransportChannelSetup, - id-compressedModeCommand, - id-dedicatedMeasurementFailure, - id-dedicatedMeasurementInitiation, - id-dedicatedMeasurementReport, - id-dedicatedMeasurementTermination, - id-downlinkPowerControl, - id-downlinkPowerTimeslotControl, - id-errorIndicationForDedicated, - id-errorIndicationForCommon, - id-informationExchangeFailure, - id-informationExchangeInitiation, - id-informationReporting, - id-informationExchangeTermination, - id-BearerRearrangement, - id-physicalSharedChannelReconfiguration, - id-privateMessageForDedicated, - id-privateMessageForCommon, - id-radioLinkActivation, - id-radioLinkAddition, - id-radioLinkDeletion, - id-radioLinkFailure, - id-radioLinkParameterUpdate, - id-radioLinkPreemption, - id-radioLinkRestoration, - id-radioLinkSetup, - id-reset, - id-resourceStatusIndication, - id-cellSynchronisationAdjustment, - id-synchronisedRadioLinkReconfigurationCancellation, - id-synchronisedRadioLinkReconfigurationCommit, - id-synchronisedRadioLinkReconfigurationPreparation, - id-systemInformationUpdate, - id-unblockResource, - id-unSynchronisedRadioLinkReconfiguration -FROM NBAP-Constants; - --- ************************************************************** --- --- Interface Elementary Procedure Class --- --- ************************************************************** - -NBAP-ELEMENTARY-PROCEDURE ::= CLASS { - &InitiatingMessage , - &SuccessfulOutcome OPTIONAL, - &UnsuccessfulOutcome OPTIONAL, - &Outcome OPTIONAL, - &messageDiscriminator MessageDiscriminator, - &procedureID ProcedureID UNIQUE, - &criticality Criticality DEFAULT ignore -} - -WITH SYNTAX { - INITIATING MESSAGE &InitiatingMessage - [SUCCESSFUL OUTCOME &SuccessfulOutcome] - [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] - [OUTCOME &Outcome] - MESSAGE DISCRIMINATOR &messageDiscriminator - PROCEDURE ID &procedureID - [CRITICALITY &criticality] -} - --- ************************************************************** --- --- Interface PDU Definition --- --- ************************************************************** - -NBAP-PDU ::= CHOICE { - initiatingMessage InitiatingMessage, - succesfulOutcome SuccessfulOutcome, - unsuccesfulOutcome UnsuccessfulOutcome, - outcome Outcome, - ... -} - -InitiatingMessage ::= SEQUENCE { - procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), - criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - transactionID TransactionID, - value NBAP-ELEMENTARY-PROCEDURE.&InitiatingMessage({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) -} - -SuccessfulOutcome ::= SEQUENCE { - procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), - criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - transactionID TransactionID, - value NBAP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) -} - -UnsuccessfulOutcome ::= SEQUENCE { - procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), - criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - transactionID TransactionID, - value NBAP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) -} - -Outcome ::= SEQUENCE { - procedureID NBAP-ELEMENTARY-PROCEDURE.&procedureID ({NBAP-ELEMENTARY-PROCEDURES}), - criticality NBAP-ELEMENTARY-PROCEDURE.&criticality ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - messageDiscriminator NBAP-ELEMENTARY-PROCEDURE.&messageDiscriminator({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}), - transactionID TransactionID, - value NBAP-ELEMENTARY-PROCEDURE.&Outcome ({NBAP-ELEMENTARY-PROCEDURES}{@procedureID}) -} - --- ************************************************************** --- --- Interface Elementary Procedure List --- --- ************************************************************** - -NBAP-ELEMENTARY-PROCEDURES NBAP-ELEMENTARY-PROCEDURE ::= { - NBAP-ELEMENTARY-PROCEDURES-CLASS-1 | - NBAP-ELEMENTARY-PROCEDURES-CLASS-2 , - ... -} - -NBAP-ELEMENTARY-PROCEDURES-CLASS-1 NBAP-ELEMENTARY-PROCEDURE ::= { - cellSetupFDD | - cellSetupTDD | - cellReconfigurationFDD | - cellReconfigurationTDD | - cellDeletion | - commonTransportChannelSetupFDD | - commonTransportChannelSetupTDD | - commonTransportChannelReconfigureFDD | - commonTransportChannelReconfigureTDD | - commonTransportChannelDelete | - audit | - blockResource | - radioLinkSetupFDD | - radioLinkSetupTDD | - systemInformationUpdate | - commonMeasurementInitiation | - radioLinkAdditionFDD | - radioLinkAdditionTDD | - radioLinkDeletion | - reset | - synchronisedRadioLinkReconfigurationPreparationFDD | - synchronisedRadioLinkReconfigurationPreparationTDD | - unSynchronisedRadioLinkReconfigurationFDD | - unSynchronisedRadioLinkReconfigurationTDD | - dedicatedMeasurementInitiation | - physicalSharedChannelReconfigurationTDD , - ..., - informationExchangeInitiation | - cellSynchronisationInitiationTDD | - cellSynchronisationReconfigurationTDD | - cellSynchronisationAdjustmentTDD | - physicalSharedChannelReconfigurationFDD -} - -NBAP-ELEMENTARY-PROCEDURES-CLASS-2 NBAP-ELEMENTARY-PROCEDURE ::= { - resourceStatusIndication | - auditRequired | - commonMeasurementReport | - commonMeasurementTermination | - commonMeasurementFailure | - synchronisedRadioLinkReconfigurationCommit | - synchronisedRadioLinkReconfigurationCancellation | - radioLinkFailure | - radioLinkPreemption | - radioLinkRestoration | - dedicatedMeasurementReport | - dedicatedMeasurementTermination | - dedicatedMeasurementFailure | - downlinkPowerControlFDD | - downlinkPowerTimeslotControl | - compressedModeCommand | - unblockResource | - errorIndicationForDedicated | - errorIndicationForCommon | - privateMessageForDedicated | - privateMessageForCommon , - ..., - informationReporting | - informationExchangeTermination | - informationExchangeFailure | - cellSynchronisationReportingTDD | - cellSynchronisationTerminationTDD | - cellSynchronisationFailureTDD | - bearerRearrangement | - radioLinkActivationFDD | - radioLinkActivationTDD | - radioLinkParameterUpdateFDD | - radioLinkParameterUpdateTDD -} - --- ************************************************************** --- --- Interface Elementary Procedures --- --- ************************************************************** - --- Class 1 - --- *** CellSetup (FDD) *** -cellSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSetupRequestFDD - SUCCESSFUL OUTCOME CellSetupResponse - UNSUCCESSFUL OUTCOME CellSetupFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSetup, ddMode fdd } - CRITICALITY reject -} - --- *** CellSetup (TDD) *** -cellSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSetupRequestTDD - SUCCESSFUL OUTCOME CellSetupResponse - UNSUCCESSFUL OUTCOME CellSetupFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSetup, ddMode tdd } - CRITICALITY reject -} - --- *** CellReconfiguration(FDD) *** -cellReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellReconfigurationRequestFDD - SUCCESSFUL OUTCOME CellReconfigurationResponse - UNSUCCESSFUL OUTCOME CellReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellReconfiguration, ddMode fdd } - CRITICALITY reject -} - --- *** CellReconfiguration(TDD) *** -cellReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellReconfigurationRequestTDD - SUCCESSFUL OUTCOME CellReconfigurationResponse - UNSUCCESSFUL OUTCOME CellReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellReconfiguration, ddMode tdd } - CRITICALITY reject -} - --- *** CellDeletion *** -cellDeletion NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellDeletionRequest - SUCCESSFUL OUTCOME CellDeletionResponse - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellDeletion, ddMode common } - CRITICALITY reject -} - --- *** CommonTransportChannelSetup (FDD) *** -commonTransportChannelSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonTransportChannelSetupRequestFDD - SUCCESSFUL OUTCOME CommonTransportChannelSetupResponse - UNSUCCESSFUL OUTCOME CommonTransportChannelSetupFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonTransportChannelSetup, ddMode fdd } - CRITICALITY reject -} - --- *** CommonTransportChannelSetup (TDD) *** -commonTransportChannelSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonTransportChannelSetupRequestTDD - SUCCESSFUL OUTCOME CommonTransportChannelSetupResponse - UNSUCCESSFUL OUTCOME CommonTransportChannelSetupFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonTransportChannelSetup, ddMode tdd } - CRITICALITY reject -} - --- *** CommonTransportChannelReconfigure (FDD) *** -commonTransportChannelReconfigureFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonTransportChannelReconfigurationRequestFDD - SUCCESSFUL OUTCOME CommonTransportChannelReconfigurationResponse - UNSUCCESSFUL OUTCOME CommonTransportChannelReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonTransportChannelReconfigure, ddMode fdd } - CRITICALITY reject -} - --- *** CommonTransportChannelReconfigure (TDD) *** -commonTransportChannelReconfigureTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonTransportChannelReconfigurationRequestTDD - SUCCESSFUL OUTCOME CommonTransportChannelReconfigurationResponse - UNSUCCESSFUL OUTCOME CommonTransportChannelReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonTransportChannelReconfigure, ddMode tdd } - CRITICALITY reject -} - --- *** CommonTransportChannelDelete *** -commonTransportChannelDelete NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonTransportChannelDeletionRequest - SUCCESSFUL OUTCOME CommonTransportChannelDeletionResponse - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonTransportChannelDelete, ddMode common } - CRITICALITY reject -} - --- *** Audit *** -audit NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE AuditRequest - SUCCESSFUL OUTCOME AuditResponse - UNSUCCESSFUL OUTCOME AuditFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-audit, ddMode common } - CRITICALITY reject -} - --- *** BlockResourceRequest *** -blockResource NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE BlockResourceRequest - SUCCESSFUL OUTCOME BlockResourceResponse - UNSUCCESSFUL OUTCOME BlockResourceFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-blockResource, ddMode common } - CRITICALITY reject -} - --- *** RadioLinkSetup (FDD) *** -radioLinkSetupFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkSetupRequestFDD - SUCCESSFUL OUTCOME RadioLinkSetupResponseFDD - UNSUCCESSFUL OUTCOME RadioLinkSetupFailureFDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-radioLinkSetup, ddMode fdd } - CRITICALITY reject -} - --- *** RadioLinkSetup (TDD) *** -radioLinkSetupTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkSetupRequestTDD - SUCCESSFUL OUTCOME RadioLinkSetupResponseTDD - UNSUCCESSFUL OUTCOME RadioLinkSetupFailureTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-radioLinkSetup, ddMode tdd } - CRITICALITY reject -} - --- *** SystemInformationUpdate *** -systemInformationUpdate NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE SystemInformationUpdateRequest - SUCCESSFUL OUTCOME SystemInformationUpdateResponse - UNSUCCESSFUL OUTCOME SystemInformationUpdateFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-systemInformationUpdate, ddMode common } - CRITICALITY reject -} - --- *** Reset *** -reset NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE ResetRequest - SUCCESSFUL OUTCOME ResetResponse - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-reset, ddMode common } - CRITICALITY reject -} - --- *** CommonMeasurementInitiation *** -commonMeasurementInitiation NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonMeasurementInitiationRequest - SUCCESSFUL OUTCOME CommonMeasurementInitiationResponse - UNSUCCESSFUL OUTCOME CommonMeasurementInitiationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonMeasurementInitiation, ddMode common } - CRITICALITY reject -} - --- *** RadioLinkAddition (FDD) *** -radioLinkAdditionFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkAdditionRequestFDD - SUCCESSFUL OUTCOME RadioLinkAdditionResponseFDD - UNSUCCESSFUL OUTCOME RadioLinkAdditionFailureFDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkAddition, ddMode fdd } - CRITICALITY reject -} - --- *** RadioLinkAddition (TDD) *** -radioLinkAdditionTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkAdditionRequestTDD - SUCCESSFUL OUTCOME RadioLinkAdditionResponseTDD - UNSUCCESSFUL OUTCOME RadioLinkAdditionFailureTDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkAddition, ddMode tdd } - CRITICALITY reject -} - --- *** RadioLinkDeletion *** -radioLinkDeletion NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkDeletionRequest - SUCCESSFUL OUTCOME RadioLinkDeletionResponse - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkDeletion, ddMode common } - CRITICALITY reject -} - --- *** SynchronisedRadioLinkReconfigurationPreparation (FDD) *** -synchronisedRadioLinkReconfigurationPreparationFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationPrepareFDD - SUCCESSFUL OUTCOME RadioLinkReconfigurationReady - UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationPreparation, ddMode fdd } - CRITICALITY reject -} - --- *** SynchronisedRadioLinkReconfigurationPreparation (TDD) *** -synchronisedRadioLinkReconfigurationPreparationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationPrepareTDD - SUCCESSFUL OUTCOME RadioLinkReconfigurationReady - UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationPreparation, ddMode tdd } - CRITICALITY reject -} - --- *** UnSynchronisedRadioLinkReconfiguration (FDD) *** -unSynchronisedRadioLinkReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationRequestFDD - SUCCESSFUL OUTCOME RadioLinkReconfigurationResponse - UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-unSynchronisedRadioLinkReconfiguration, ddMode fdd } - CRITICALITY reject -} - --- *** UnSynchronisedRadioLinkReconfiguration (TDD) *** -unSynchronisedRadioLinkReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationRequestTDD - SUCCESSFUL OUTCOME RadioLinkReconfigurationResponse - UNSUCCESSFUL OUTCOME RadioLinkReconfigurationFailure - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-unSynchronisedRadioLinkReconfiguration, ddMode tdd } - CRITICALITY reject -} - --- *** DedicatedMeasurementInitiation *** -dedicatedMeasurementInitiation NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DedicatedMeasurementInitiationRequest - SUCCESSFUL OUTCOME DedicatedMeasurementInitiationResponse - UNSUCCESSFUL OUTCOME DedicatedMeasurementInitiationFailure - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-dedicatedMeasurementInitiation, ddMode common } - CRITICALITY reject -} - --- *** PhysicalSharedChannelReconfiguration (FDD) *** -physicalSharedChannelReconfigurationFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE PhysicalSharedChannelReconfigurationRequestFDD - SUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationResponse - UNSUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-physicalSharedChannelReconfiguration, ddMode fdd } - CRITICALITY reject -} - --- *** PhysicalSharedChannelReconfiguration (TDD) *** -physicalSharedChannelReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE PhysicalSharedChannelReconfigurationRequestTDD - SUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationResponse - UNSUCCESSFUL OUTCOME PhysicalSharedChannelReconfigurationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-physicalSharedChannelReconfiguration, ddMode tdd } - CRITICALITY reject -} - --- *** InformationExchangeInitiation *** -informationExchangeInitiation NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE InformationExchangeInitiationRequest - SUCCESSFUL OUTCOME InformationExchangeInitiationResponse - UNSUCCESSFUL OUTCOME InformationExchangeInitiationFailure - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-informationExchangeInitiation, ddMode common } - CRITICALITY reject -} - --- *** CellSynchronisationInitiation (TDD only) *** -cellSynchronisationInitiationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationInitiationRequestTDD - SUCCESSFUL OUTCOME CellSynchronisationInitiationResponseTDD - UNSUCCESSFUL OUTCOME CellSynchronisationInitiationFailureTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationInitiation, ddMode tdd } - CRITICALITY reject -} - --- *** CellSynchronisationReconfiguration (TDD only) *** -cellSynchronisationReconfigurationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationReconfigurationRequestTDD - SUCCESSFUL OUTCOME CellSynchronisationReconfigurationResponseTDD - UNSUCCESSFUL OUTCOME CellSynchronisationReconfigurationFailureTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationReconfiguration, ddMode tdd } - CRITICALITY reject -} - --- *** CellSynchronisationAdjustment (TDD only) *** -cellSynchronisationAdjustmentTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationAdjustmentRequestTDD - SUCCESSFUL OUTCOME CellSynchronisationAdjustmentResponseTDD - UNSUCCESSFUL OUTCOME CellSynchronisationAdjustmentFailureTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationAdjustment, ddMode tdd } - CRITICALITY reject -} - --- Class 2 - --- *** ResourceStatusIndication *** -resourceStatusIndication NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE ResourceStatusIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-resourceStatusIndication, ddMode common } - CRITICALITY ignore -} - --- *** AuditRequired *** -auditRequired NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE AuditRequiredIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-auditRequired, ddMode common } - CRITICALITY ignore -} - --- *** CommonMeasurementReport *** -commonMeasurementReport NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonMeasurementReport - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonMeasurementReport, ddMode common } - CRITICALITY ignore -} - --- *** CommonMeasurementTermination *** -commonMeasurementTermination NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonMeasurementTerminationRequest - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonMeasurementTermination, ddMode common } - CRITICALITY ignore -} - --- *** CommonMeasurementFailure *** -commonMeasurementFailure NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CommonMeasurementFailureIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-commonMeasurementFailure, ddMode common } - CRITICALITY ignore -} - --- *** SynchronisedRadioLinkReconfigurationCommit *** -synchronisedRadioLinkReconfigurationCommit NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationCommit - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationCommit, ddMode common } - CRITICALITY ignore -} - --- *** SynchronisedRadioReconfigurationCancellation *** -synchronisedRadioLinkReconfigurationCancellation NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkReconfigurationCancel - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-synchronisedRadioLinkReconfigurationCancellation, ddMode common } - CRITICALITY ignore -} - --- *** RadioLinkFailure *** -radioLinkFailure NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkFailureIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkFailure, ddMode common } - CRITICALITY ignore -} - --- *** RadioLinkPreemption *** -radioLinkPreemption NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkPreemptionRequiredIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkPreemption, ddMode common } - CRITICALITY ignore -} - --- *** RadioLinkRestoration *** -radioLinkRestoration NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkRestoreIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkRestoration, ddMode common } - CRITICALITY ignore -} - --- *** DedicatedMeasurementReport *** -dedicatedMeasurementReport NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DedicatedMeasurementReport - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-dedicatedMeasurementReport, ddMode common } - CRITICALITY ignore -} - --- *** DedicatedMeasurementTermination *** -dedicatedMeasurementTermination NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DedicatedMeasurementTerminationRequest - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-dedicatedMeasurementTermination, ddMode common } - CRITICALITY ignore -} - --- *** DedicatedMeasurementFailure *** -dedicatedMeasurementFailure NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DedicatedMeasurementFailureIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-dedicatedMeasurementFailure, ddMode common } - CRITICALITY ignore -} - --- *** DLPowerControl (FDD only) *** -downlinkPowerControlFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DL-PowerControlRequest - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-downlinkPowerControl, ddMode fdd } - CRITICALITY ignore -} - --- *** DLPowerTimeslotControl (TDD only) *** -downlinkPowerTimeslotControl NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE DL-PowerTimeslotControlRequest - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-downlinkPowerTimeslotControl, ddMode tdd } - CRITICALITY ignore -} - --- *** CompressedModeCommand (FDD only) *** -compressedModeCommand NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CompressedModeCommand - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-compressedModeCommand, ddMode fdd } - CRITICALITY ignore -} - --- *** UnblockResourceIndication *** -unblockResource NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE UnblockResourceIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-unblockResource, ddMode common } - CRITICALITY ignore -} - --- *** ErrorIndication for Dedicated procedures *** -errorIndicationForDedicated NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE ErrorIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-errorIndicationForDedicated, ddMode common } - CRITICALITY ignore -} - --- *** ErrorIndication for Common procedures *** -errorIndicationForCommon NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE ErrorIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-errorIndicationForCommon, ddMode common } - CRITICALITY ignore -} - --- *** CellSynchronisationReporting (TDD only) *** -cellSynchronisationReportingTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationReportTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationReporting, ddMode tdd } - CRITICALITY ignore -} - --- *** CellSynchronisationTermination (TDD only) *** -cellSynchronisationTerminationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationTerminationRequestTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationTermination, ddMode tdd } - CRITICALITY ignore -} - --- *** CellSynchronisationFailure (TDD only) *** -cellSynchronisationFailureTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE CellSynchronisationFailureIndicationTDD - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-cellSynchronisationFailure, ddMode tdd } - CRITICALITY ignore -} - --- *** PrivateMessage for Dedicated procedures *** -privateMessageForDedicated NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE PrivateMessage - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-privateMessageForDedicated, ddMode common } - CRITICALITY ignore -} - --- *** PrivateMessage for Common procedures *** -privateMessageForCommon NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE PrivateMessage - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-privateMessageForCommon, ddMode common } - CRITICALITY ignore -} - --- *** InformationReporting *** -informationReporting NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE InformationReport - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-informationReporting, ddMode common } - CRITICALITY ignore -} - --- *** InformationExchangeTermination *** -informationExchangeTermination NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE InformationExchangeTerminationRequest - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-informationExchangeTermination, ddMode common } - CRITICALITY ignore -} - --- *** InformationExchangeFailure *** -informationExchangeFailure NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE InformationExchangeFailureIndication - MESSAGE DISCRIMINATOR common - PROCEDURE ID { procedureCode id-informationExchangeFailure, ddMode common } - CRITICALITY ignore -} - --- *** BearerRearrangement *** -bearerRearrangement NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE BearerRearrangementIndication - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-BearerRearrangement, ddMode common } - CRITICALITY ignore -} - --- *** RadioLinkActivation (FDD) *** -radioLinkActivationFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkActivationCommandFDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkActivation, ddMode fdd } - CRITICALITY ignore -} - --- *** RadioLinkActivation (TDD) *** -radioLinkActivationTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkActivationCommandTDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkActivation, ddMode tdd } - CRITICALITY ignore -} - --- *** RadioLinkParameterUpdate (FDD) *** -radioLinkParameterUpdateFDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkParameterUpdateIndicationFDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkParameterUpdate, ddMode fdd } - CRITICALITY ignore -} - --- *** RadioLinkParameterUpdate (TDD) *** -radioLinkParameterUpdateTDD NBAP-ELEMENTARY-PROCEDURE ::= { - INITIATING MESSAGE RadioLinkParameterUpdateIndicationTDD - MESSAGE DISCRIMINATOR dedicated - PROCEDURE ID { procedureCode id-radioLinkParameterUpdate, ddMode tdd } - CRITICALITY ignore -} - -END - diff --git a/lib/asn1/test/asn1_SUITE_data/test_records.erl b/lib/asn1/test/asn1_SUITE_data/test_records.erl index 9fd07c1449..afb1c8c80b 100644 --- a/lib/asn1/test/asn1_SUITE_data/test_records.erl +++ b/lib/asn1/test/asn1_SUITE_data/test_records.erl @@ -25,7 +25,7 @@ -define(line,put(test_server_loc,{?MODULE,?LINE}),). --include("NBAP-PDU-Discriptions.hrl"). +-include("NBAP-PDU-Descriptions.hrl"). -include("NBAP-PDU-Contents.hrl"). -include("NBAP-Containers.hrl"). -include("NBAP-CommonDataTypes.hrl"). diff --git a/lib/asn1/test/testNBAPsystem.erl b/lib/asn1/test/testNBAPsystem.erl index 1af283af42..8d61ca18ce 100644 --- a/lib/asn1/test/testNBAPsystem.erl +++ b/lib/asn1/test/testNBAPsystem.erl @@ -84,7 +84,7 @@ compile(Config, Options) -> M <- ["NBAP-CommonDataTypes.asn", "NBAP-IEs.asn", "NBAP-PDU-Contents.asn", - "NBAP-PDU-Discriptions.asn", + "NBAP-PDU-Descriptions.asn", "NBAP-Constants.asn", "NBAP-Containers.asn"]], asn1_test_lib:compile_all(Fs, Config, Options), @@ -98,16 +98,16 @@ test(_Erule,Config) -> ticket_5812(Config) -> Msg = v_5812(), - {ok,B2} = 'NBAP-PDU-Discriptions':encode('NBAP-PDU', Msg), + {ok,B2} = 'NBAP-PDU-Descriptions':encode('NBAP-PDU', Msg), V = <<0,28,74,0,3,48,0,0,1,0,123,64,41,0,0,0,126,64,35,95,208,2,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,145,0,1,205,0,0,0,0,2,98,64,1,128>>, ok = compare(V,B2), - {ok,Msg2} = 'NBAP-PDU-Discriptions':decode('NBAP-PDU', B2), + {ok,Msg2} = 'NBAP-PDU-Descriptions':decode('NBAP-PDU', B2), ok = check_record_names(Msg2,Config). enc_audit_req_msg() -> Msg = {initiatingMessage, audit_req_msg()}, - {ok,B} = 'NBAP-PDU-Discriptions':encode('NBAP-PDU', Msg), - {ok,_Msg} = 'NBAP-PDU-Discriptions':decode('NBAP-PDU', B), + {ok,B} = 'NBAP-PDU-Descriptions':encode('NBAP-PDU', Msg), + {ok,_Msg} = 'NBAP-PDU-Descriptions':decode('NBAP-PDU', B), {initiatingMessage, #'InitiatingMessage'{value=#'AuditRequest'{protocolIEs=[{_,114,ignore,_}], protocolExtensions = asn1_NOVALUE}}} = _Msg, @@ -116,8 +116,8 @@ enc_audit_req_msg() -> cell_setup_req_msg_test() -> Msg = {initiatingMessage, cell_setup_req_msg()}, - {ok,B} = 'NBAP-PDU-Discriptions':encode('NBAP-PDU', Msg), - {ok,_Msg} = 'NBAP-PDU-Discriptions':decode('NBAP-PDU', B), + {ok,B} = 'NBAP-PDU-Descriptions':encode('NBAP-PDU', Msg), + {ok,_Msg} = 'NBAP-PDU-Descriptions':decode('NBAP-PDU', B), io:format("Msg: ~P~n~n_Msg: ~P~n",[Msg,15,_Msg,15]), ok. -- cgit v1.2.3 From 13b6d01213c9ff39deafc3dd7672cc96dd6e8ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 25 Jan 2017 07:26:33 +0100 Subject: testMultipleLevels: Use asn1_test_lib:roundtrip() --- lib/asn1/test/testMultipleLevels.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/testMultipleLevels.erl b/lib/asn1/test/testMultipleLevels.erl index c610e59f3d..e9d83665aa 100644 --- a/lib/asn1/test/testMultipleLevels.erl +++ b/lib/asn1/test/testMultipleLevels.erl @@ -24,5 +24,7 @@ main(_) -> Data = {'Top',{short,"abc"},{long,"a long string follows here"}}, - {ok,B} = 'MultipleLevels':encode('Top', Data), - {ok,Data} = 'MultipleLevels':decode('Top', iolist_to_binary(B)). + roundtrip('Top', Data). + +roundtrip(T, V) -> + asn1_test_lib:roundtrip('MultipleLevels', T, V). -- cgit v1.2.3 From 90d2c1140409dec7f28c66922b69a16b7463139b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 25 Jan 2017 14:48:31 +0100 Subject: Refactor h323test.erl to simplify debugging --- lib/asn1/test/h323test.erl | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/h323test.erl b/lib/asn1/test/h323test.erl index 935af0ba09..41a9159335 100644 --- a/lib/asn1/test/h323test.erl +++ b/lib/asn1/test/h323test.erl @@ -27,6 +27,8 @@ run(per) -> run(); run(_Rules) -> ok. run() -> + roundtrip('EndpointType', endpoint()), + roundtrip('Alerting-UUIE', alerting_uuie()), roundtrip('H323-UserInformation', alerting_val(), alerting_enc()), roundtrip('H323-UserInformation', connect_val(), connect_enc()), general_string(), @@ -36,18 +38,24 @@ alerting_val() -> {'H323-UserInformation', {'H323-UU-PDU', {alerting, - {'Alerting-UUIE', - {0,0,8,2250,0,2}, - {'EndpointType',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, - asn1_NOVALUE,asn1_NOVALUE, - {'TerminalInfo',asn1_NOVALUE}, - false,false}, - asn1_NOVALUE, - {'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}, - asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}}, + alerting_uuie()}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, asn1_NOVALUE}. +endpoint() -> + {'EndpointType',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE,asn1_NOVALUE, + {'TerminalInfo',asn1_NOVALUE}, + false,false}. + +alerting_uuie() -> + {'Alerting-UUIE', + {0,0,8,2250,0,2}, + endpoint(), + asn1_NOVALUE, + {'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}. + alerting_enc() -> "0380060008914a0002020120110000000000000000000000000000000000". @@ -82,6 +90,9 @@ general_string() -> UI = <<109,64,1,57>>, {ok, _V} = 'MULTIMEDIA-SYSTEM-CONTROL':decode(Type, UI). +roundtrip(T, V) -> + asn1_test_lib:roundtrip('H323-MESSAGES', T, V). + roundtrip(T, V, HexString) -> Enc = asn1_test_lib:hex_to_bin(HexString), Enc = asn1_test_lib:roundtrip_enc('H323-MESSAGES', T, V), -- cgit v1.2.3 From 63ac33729f3df5b7cb1789f78365777d0a6034ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 26 Jan 2017 07:40:30 +0100 Subject: Add additional tests of Extension Addition Groups --- lib/asn1/test/asn1_SUITE_data/SeqExtension.asn1 | 11 +++++++ lib/asn1/test/testSeqExtension.erl | 38 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/SeqExtension.asn1 b/lib/asn1/test/asn1_SUITE_data/SeqExtension.asn1 index 5fda19303a..e866ef2f4f 100644 --- a/lib/asn1/test/asn1_SUITE_data/SeqExtension.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/SeqExtension.asn1 @@ -48,6 +48,17 @@ SeqExt6 ::= SEQUENCE [[ i6 [106] INTEGER, i7 [107] INTEGER ]] } +SeqExt7 ::= SEQUENCE +{ + -- The spaces between the ellipsis and the comma will prevent them + -- from being removed. + ... , + [[ a INTEGER (0..65535) OPTIONAL, + b OCTET STRING OPTIONAL, + c BOOLEAN + ]] +} + SeqExt1X ::= XSeqExt1 SeqExt2X ::= XSeqExt2 diff --git a/lib/asn1/test/testSeqExtension.erl b/lib/asn1/test/testSeqExtension.erl index f7885cb002..be1d1c2490 100644 --- a/lib/asn1/test/testSeqExtension.erl +++ b/lib/asn1/test/testSeqExtension.erl @@ -31,6 +31,7 @@ -record('SeqExt4',{bool, int}). -record('SeqExt5',{name, shoesize}). -record('SeqExt6',{i1,i2,i3,i4,i5,i6,i7}). +-record('SeqExt7',{a=asn1_NOVALUE,b=asn1_NOVALUE,c}). -record('SuperSeq',{s1,s2,s3,s4,s5,s6,i}). main(Erule, DataDir, Opts) -> @@ -45,8 +46,35 @@ main(Erule, DataDir, Opts) -> roundtrip('SeqExt4', #'SeqExt4'{bool=true,int=12345}), roundtrip('SeqExt4', #'SeqExt4'{bool=false,int=123456}), + case Erule of + ber -> + %% BER currently does not handle Extension Addition Groups + %% correctly. + ok; + _ -> + v_roundtrip3('SeqExt5', #'SeqExt5'{name=asn1_NOVALUE, + shoesize=asn1_NOVALUE}, + Erule, #{per=>"00", + uper=>"00"}), + v_roundtrip3('SeqExt7', #'SeqExt7'{c=asn1_NOVALUE}, + Erule, #{per=>"00", + uper=>"00"}) + end, roundtrip('SeqExt5', #'SeqExt5'{name = <<"Arne">>,shoesize=47}), + v_roundtrip3('SeqExt7', #'SeqExt7'{c=false}, + Erule, #{per=>"80800100", + uper=>"80808000"}), + v_roundtrip3('SeqExt7', #'SeqExt7'{c=true}, + Erule, #{per=>"80800120", + uper=>"80809000"}), + v_roundtrip3('SeqExt7', #'SeqExt7'{a=777,b = <<16#AA>>,c=false}, + Erule, #{per=>"808006C0 030901AA 00", + uper=>"8082E061 20354000"}), + v_roundtrip3('SeqExt7', #'SeqExt7'{a=8888,c=false}, + Erule, #{per=>"80800480 22B800", + uper=>"8081C457 0000"}), + %% Encode a value with this version of the specification. BigInt = 128638468966, SuperSeq = #'SuperSeq'{s1=#'SeqExt1'{}, @@ -106,6 +134,7 @@ main(Erule, DataDir, Opts) -> v_roundtrip2(Erule, 'SeqExt130', list_to_tuple(['SeqExt130'| lists:duplicate(129, asn1_NOVALUE)++[199]])), + ok. roundtrip(Type, Value) -> @@ -118,6 +147,15 @@ v_roundtrip2(Erule, Type, Value) -> roundtrip2(Type, Value) -> asn1_test_lib:roundtrip_enc('SeqExtension2', Type, Value). +v_roundtrip3(Type, Value, Erule, Map) -> + case maps:find(Erule, Map) of + {ok,Hex} -> + Encoded = asn1_test_lib:hex_to_bin(Hex), + Encoded = asn1_test_lib:roundtrip_enc('SeqExtension', Type, Value); + error -> + asn1_test_lib:roundtrip('SeqExtension', Type, Value) + end. + v(ber, 'SeqExt66') -> "30049F41 017D"; v(per, 'SeqExt66') -> "C0420000 00000000 00004001 FA"; v(uper, 'SeqExt66') -> "D0800000 00000000 00101FA0"; -- cgit v1.2.3 From 8a7f914affce3102e4889c2973ea2d2e99ad633d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 16 Jan 2017 16:47:58 +0100 Subject: Teach the ASN.1 compiler the 'maps' option When the 'maps' option is given, the SEQUENCE and SET types are represented as maps instead of as records. Optional and default values must be not be given as asn1_NOVALUE or asn1_DEFAULT in a map passed to the M:encode/2 function; they must be omitted from the map. Similarly, when decoding missing values will be omitted from the map. No .hrl files will be generated when the 'maps' options is used. That means values in an ASN.1 module must be retrieved by calling the appropriate function in generated module. Since we one day hope to get rid of the options 'compact_bit_string', 'legacy_bit_string', and 'legacy_erlang_types', we will not allow them to be combined with the 'maps' option. --- lib/asn1/test/Makefile | 1 + lib/asn1/test/asn1_SUITE.erl | 76 ++++++++++++---- lib/asn1/test/asn1_SUITE_data/Maps.asn1 | 17 ++++ lib/asn1/test/asn1_test_lib.erl | 105 +++++++++++++++++++--- lib/asn1/test/testContextSwitchingTypes.erl | 1 + lib/asn1/test/testInfObj.erl | 1 + lib/asn1/test/testMaps.erl | 50 +++++++++++ lib/asn1/test/testRfcs.erl | 50 ++++++----- lib/asn1/test/testTCAP.erl | 1 + lib/asn1/test/testTimer.erl | 131 +++++++++++++++++++++------- lib/asn1/test/testUniqueObjectSets.erl | 1 + lib/asn1/test/test_compile_options.erl | 28 +++++- 12 files changed, 377 insertions(+), 85 deletions(-) create mode 100644 lib/asn1/test/asn1_SUITE_data/Maps.asn1 create mode 100644 lib/asn1/test/testMaps.erl (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index 40575e8a2f..d346bb9e12 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -82,6 +82,7 @@ MODULES= \ testInfObjExtract \ testParameterizedInfObj \ testFragmented \ + testMaps \ testMergeCompile \ testMultipleLevels \ testDeepTConstr \ diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index b6430134ab..6769a38b12 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -21,6 +21,9 @@ -module(asn1_SUITE). +%% Suppress compilation of an addititional module compiled for maps. +-define(NO_MAPS_MODULE, asn1_test_lib_no_maps). + -define(only_ber(Func), if Rule =:= ber -> Func; true -> ok @@ -102,6 +105,7 @@ groups() -> testMultipleLevels, testOpt, testSeqDefault, + testMaps, % Uses 'External' {group, [], [testExternal, testSeqExtension]}, @@ -176,8 +180,11 @@ groups() -> {performance, [], [testTimer_ber, + testTimer_ber_maps, testTimer_per, - testTimer_uper]}]. + testTimer_per_maps, + testTimer_uper, + testTimer_uper_maps]}]. %%------------------------------------------------------------------------------ %% Init/end @@ -441,6 +448,16 @@ testDEFAULT(Config, Rule, Opts) -> testDef:main(Rule), testSeqSetDefaultVal:main(Rule, Opts). +testMaps(Config) -> + test(Config, fun testMaps/3, + [{ber,[maps,no_ok_wrapper]}, + {ber,[maps,der,no_ok_wrapper]}, + {per,[maps,no_ok_wrapper]}, + {uper,[maps,no_ok_wrapper]}]). +testMaps(Config, Rule, Opts) -> + asn1_test_lib:compile_all(['Maps'], Config, [Rule|Opts]), + testMaps:main(Rule). + testOpt(Config) -> test(Config, fun testOpt/3). testOpt(Config, Rule, Opts) -> asn1_test_lib:compile("Opt", Config, [Rule|Opts]), @@ -614,12 +631,12 @@ parse(Config) -> [asn1_test_lib:compile(M, Config, [abs]) || M <- test_modules()]. per(Config) -> - test(Config, fun per/3, [per,uper]). + test(Config, fun per/3, [per,uper,{per,[maps]},{uper,[maps]}]). per(Config, Rule, Opts) -> [module_test(M, Config, Rule, Opts) || M <- per_modules()]. ber_other(Config) -> - test(Config, fun ber_other/3, [ber]). + test(Config, fun ber_other/3, [ber,{ber,[maps]}]). ber_other(Config, Rule, Opts) -> [module_test(M, Config, Rule, Opts) || M <- ber_modules()]. @@ -628,7 +645,7 @@ der(Config) -> asn1_test_lib:compile_all(ber_modules(), Config, [der]). module_test(M0, Config, Rule, Opts) -> - asn1_test_lib:compile(M0, Config, [Rule|Opts]), + asn1_test_lib:compile(M0, Config, [Rule,?NO_MAPS_MODULE|Opts]), case list_to_atom(M0) of 'LDAP' -> %% Because of the recursive definition of 'Filter' in @@ -995,7 +1012,9 @@ testS1AP(Config, Rule, Opts) -> testRfcs() -> [{timetrap,{minutes,90}}]. -testRfcs(Config) -> test(Config, fun testRfcs/3, [{ber,[der]}]). +testRfcs(Config) -> test(Config, fun testRfcs/3, + [{ber,[der,?NO_MAPS_MODULE]}, + {ber,[der,maps]}]). testRfcs(Config, Rule, Opts) -> case erlang:system_info(system_architecture) of "sparc-sun-solaris2.10" -> @@ -1010,7 +1029,8 @@ test_compile_options(Config) -> ok = test_compile_options:path(Config), ok = test_compile_options:noobj(Config), ok = test_compile_options:record_name_prefix(Config), - ok = test_compile_options:verbose(Config). + ok = test_compile_options:verbose(Config), + ok = test_compile_options:maps(Config). testDoubleEllipses(Config) -> test(Config, fun testDoubleEllipses/3). testDoubleEllipses(Config, Rule, Opts) -> @@ -1069,7 +1089,7 @@ test_x691(Config, Rule, Opts) -> ok. ticket_6143(Config) -> - ok = test_compile_options:ticket_6143(Config). + asn1_test_lib:compile("AA1", Config, [?NO_MAPS_MODULE]). testExtensionAdditionGroup(Config) -> test(Config, fun testExtensionAdditionGroup/3). @@ -1157,20 +1177,33 @@ END ok = asn1ct:compile(File, [{outdir, PrivDir}]). -timer_compile(Config, Rule) -> - asn1_test_lib:compile_all(["H235-SECURITY-MESSAGES", "H323-MESSAGES"], - Config, [no_ok_wrapper,Rule]). +timer_compile(Config, Opts0) -> + Files = ["H235-SECURITY-MESSAGES", "H323-MESSAGES"], + Opts = [no_ok_wrapper,?NO_MAPS_MODULE|Opts0], + asn1_test_lib:compile_all(Files, Config, Opts). testTimer_ber(Config) -> - timer_compile(Config, ber), + timer_compile(Config, [ber]), testTimer:go(). testTimer_per(Config) -> - timer_compile(Config, per), + timer_compile(Config, [per]), testTimer:go(). testTimer_uper(Config) -> - timer_compile(Config, uper), + timer_compile(Config, [uper]), + testTimer:go(). + +testTimer_ber_maps(Config) -> + timer_compile(Config, [ber,maps]), + testTimer:go(). + +testTimer_per_maps(Config) -> + timer_compile(Config, [per,maps]), + testTimer:go(). + +testTimer_uper_maps(Config) -> + timer_compile(Config, [uper,maps]), testTimer:go(). %% Test of multiple-line comment, OTP-8043 @@ -1179,9 +1212,11 @@ testComment(Config) -> asn1_test_lib:roundtrip('Comment', 'Seq', {'Seq',12,true}). testName2Number(Config) -> - N2NOptions = [{n2n,Type} || Type <- ['CauseMisc', 'CauseProtocol', - 'CauseRadioNetwork', - 'CauseTransport','CauseNas']], + N2NOptions0 = [{n2n,Type} || + Type <- ['CauseMisc', 'CauseProtocol', + 'CauseRadioNetwork', + 'CauseTransport','CauseNas']], + N2NOptions = [?NO_MAPS_MODULE|N2NOptions0], asn1_test_lib:compile("S1AP-IEs", Config, N2NOptions), 0 = 'S1AP-IEs':name2num_CauseMisc('control-processing-overload'), @@ -1191,8 +1226,9 @@ testName2Number(Config) -> %% Test that n2n option generates name2num and num2name functions supporting %% values not within the extension root if the enumeration type has an %% extension marker. - N2NOptionsExt = [{n2n, 'NoExt'}, {n2n, 'Ext'}, {n2n, 'Ext2'}], + N2NOptionsExt = [?NO_MAPS_MODULE,{n2n,'NoExt'},{n2n,'Ext'},{n2n,'Ext2'}], asn1_test_lib:compile("EnumN2N", Config, N2NOptionsExt), + %% Previously, name2num and num2name was not generated if the type didn't %% have an extension marker: 0 = 'EnumN2N':name2num_NoExt('blue'), @@ -1210,9 +1246,11 @@ testName2Number(Config) -> ok. ticket_7407(Config) -> - asn1_test_lib:compile("EUTRA-extract-7407", Config, [uper]), + Opts = [uper,?NO_MAPS_MODULE], + asn1_test_lib:compile("EUTRA-extract-7407", Config, Opts), ticket_7407_code(true), - asn1_test_lib:compile("EUTRA-extract-7407", Config, [uper,no_final_padding]), + asn1_test_lib:compile("EUTRA-extract-7407", Config, + [no_final_padding|Opts]), ticket_7407_code(false). ticket_7407_code(FinalPadding) -> diff --git a/lib/asn1/test/asn1_SUITE_data/Maps.asn1 b/lib/asn1/test/asn1_SUITE_data/Maps.asn1 new file mode 100644 index 0000000000..fd5f373e45 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/Maps.asn1 @@ -0,0 +1,17 @@ +Maps DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +XY ::= SEQUENCE { x INTEGER DEFAULT 0, y INTEGER DEFAULT 0 } + +xy1 XY ::= { x 42, y 17 } +xy2 XY ::= { } +xy3 XY ::= { y 999 } + +S ::= SEQUENCE { + xy XY DEFAULT { x 100, y 100 }, + os OCTET STRING OPTIONAL +} + +s1 S ::= {} + +END diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl index dc614db4f2..a79958d229 100644 --- a/lib/asn1/test/asn1_test_lib.erl +++ b/lib/asn1/test/asn1_test_lib.erl @@ -25,7 +25,8 @@ hex_to_bin/1, match_value/2, parallel/0, - roundtrip/3,roundtrip/4,roundtrip_enc/3,roundtrip_enc/4]). + roundtrip/3,roundtrip/4,roundtrip_enc/3,roundtrip_enc/4, + map_roundtrip/3]). -include_lib("common_test/include/ct.hrl"). @@ -94,15 +95,58 @@ module(F0) -> list_to_atom(F). %% filename:join(CaseDir, F ++ ".beam"). -compile_file(File, Options) -> +compile_file(File, Options0) -> + Options = [warnings_as_errors|Options0], try - ok = asn1ct:compile(File, [warnings_as_errors|Options]) + ok = asn1ct:compile(File, Options), + ok = compile_maps(File, Options) catch _:Reason -> ct:print("Failed to compile ~s\n~p", [File,Reason]), error end. +compile_maps(File, Options) -> + unload_map_mod(File), + Incompat = [abs,compact_bit_string,legacy_bit_string, + legacy_erlang_types,maps,asn1_test_lib_no_maps], + case lists:any(fun(E) -> lists:member(E, Incompat) end, Options) of + true -> + ok; + false -> + compile_maps_1(File, Options) + end. + +compile_maps_1(File, Options) -> + ok = asn1ct:compile(File, [maps,no_ok_wrapper,noobj|Options]), + OutDir = proplists:get_value(outdir, Options), + Base0 = filename:rootname(filename:basename(File)), + Base = case filename:extension(Base0) of + ".set" -> + filename:rootname(Base0); + _ -> + Base0 + end, + ErlBase = Base ++ ".erl", + ErlFile = filename:join(OutDir, ErlBase), + {ok,Erl0} = file:read_file(ErlFile), + Erl = re:replace(Erl0, <<"-module\\('">>, "&maps_"), + MapsErlFile = filename:join(OutDir, "maps_" ++ ErlBase), + ok = file:write_file(MapsErlFile, Erl), + {ok,_} = compile:file(MapsErlFile, [report,{outdir,OutDir},{i,OutDir}]), + ok. + +unload_map_mod(File0) -> + File1 = filename:basename(File0), + File2 = filename:rootname(File1, ".asn"), + File3 = filename:rootname(File2, ".asn1"), + File4 = filename:rootname(File3, ".py"), + File = filename:rootname(File4, ".set"), + MapMod = list_to_atom("maps_"++File), + code:delete(MapMod), + code:purge(MapMod), + ok. + compile_erlang(Mod, Config, Options) -> DataDir = proplists:get_value(data_dir, Config), CaseDir = proplists:get_value(case_dir, Config), @@ -147,24 +191,60 @@ roundtrip(Mod, Type, Value) -> roundtrip(Mod, Type, Value, Value). roundtrip(Mod, Type, Value, ExpectedValue) -> - {ok,Encoded} = Mod:encode(Type, Value), - {ok,ExpectedValue} = Mod:decode(Type, Encoded), - test_ber_indefinite(Mod, Type, Encoded, ExpectedValue), - ok. + roundtrip_enc(Mod, Type, Value, ExpectedValue). roundtrip_enc(Mod, Type, Value) -> roundtrip_enc(Mod, Type, Value, Value). roundtrip_enc(Mod, Type, Value, ExpectedValue) -> - {ok,Encoded} = Mod:encode(Type, Value), - {ok,ExpectedValue} = Mod:decode(Type, Encoded), + case Mod:encode(Type, Value) of + {ok,Encoded} -> + {ok,ExpectedValue} = Mod:decode(Type, Encoded); + Encoded when is_binary(Encoded) -> + ExpectedValue = Mod:decode(Type, Encoded) + end, + map_roundtrip(Mod, Type, Encoded), test_ber_indefinite(Mod, Type, Encoded, ExpectedValue), Encoded. +map_roundtrip(Mod, Type, Encoded) -> + MapMod = list_to_atom("maps_"++atom_to_list(Mod)), + try MapMod:maps() of + true -> + map_roundtrip_1(MapMod, Type, Encoded) + catch + error:undef -> + ok + end. + %%% %%% Internal functions. %%% +map_roundtrip_1(Mod, Type, Encoded) -> + Decoded = Mod:decode(Type, Encoded), + case Mod:encode(Type, Decoded) of + Encoded -> + ok; + OtherEncoding -> + case is_named_bitstring(Decoded) of + true -> + %% In BER, named BIT STRINGs with different number of + %% trailing zeroes decode to the same value. + ok; + false -> + error({encode_mismatch,Decoded,Encoded,OtherEncoding}) + end + end, + ok. + +is_named_bitstring([H|T]) -> + is_atom(H) andalso is_named_bitstring(T); +is_named_bitstring([]) -> + true; +is_named_bitstring(_) -> + false. + hex2num(C) when $0 =< C, C =< $9 -> C - $0; hex2num(C) when $A =< C, C =< $F -> C - $A + 10; hex2num(C) when $a =< C, C =< $f -> C - $a + 10. @@ -179,7 +259,12 @@ test_ber_indefinite(Mod, Type, Encoded, ExpectedValue) -> case Mod:encoding_rule() of ber -> Indefinite = iolist_to_binary(ber_indefinite(Encoded)), - {ok,ExpectedValue} = Mod:decode(Type, Indefinite); + case Mod:decode(Type, Indefinite) of + {ok,ExpectedValue} -> + ok; + ExpectedValue -> + ok + end; _ -> ok end. diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl index 10012908a9..5688d8afd6 100644 --- a/lib/asn1/test/testContextSwitchingTypes.erl +++ b/lib/asn1/test/testContextSwitchingTypes.erl @@ -90,5 +90,6 @@ check_object_identifier(Tuple) when is_tuple(Tuple) -> enc_dec(T, V0) -> M = 'ContextSwitchingTypes', {ok,Enc} = M:encode(T, V0), + asn1_test_lib:map_roundtrip(M, T, Enc), {ok,V} = M:decode(T, Enc), V. diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl index 5a9f47d865..c519c70cdf 100644 --- a/lib/asn1/test/testInfObj.erl +++ b/lib/asn1/test/testInfObj.erl @@ -197,5 +197,6 @@ roundtrip(M, T, V) -> enc_dec(M, T, V0) -> {ok,Enc} = M:encode(T, V0), + asn1_test_lib:map_roundtrip(M, T, Enc), {ok,V} = M:decode(T, Enc), V. diff --git a/lib/asn1/test/testMaps.erl b/lib/asn1/test/testMaps.erl new file mode 100644 index 0000000000..45dd2255ba --- /dev/null +++ b/lib/asn1/test/testMaps.erl @@ -0,0 +1,50 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2017. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%% +%% +-module(testMaps). + +-export([main/1]). + +main(_) -> + M = 'Maps', + true = M:maps(), + + true = M:xy1() =:= #{x=>42,y=>17}, + true = M:xy2() =:= #{x=>0,y=>0}, + true = M:xy3() =:= #{x=>0,y=>999}, + true = M:s1() =:= #{xy=>#{x=>100,y=>100}}, + + roundtrip('XY', M:xy1()), + roundtrip('XY', M:xy2()), + roundtrip('XY', M:xy3()), + roundtrip('XY', #{}, #{x=>0,y=>0}), + + roundtrip('S', M:s1()), + roundtrip('S', #{}, #{xy=>#{x=>100,y=>100}}), + roundtrip('S', #{os=><<1,2,3>>}, #{xy=>#{x=>100,y=>100}, + os=><<1,2,3>>}), + + ok. + +roundtrip(Type, Value) -> + roundtrip(Type, Value, Value). + +roundtrip(Type, Value, Expected) -> + asn1_test_lib:roundtrip('Maps', Type, Value, Expected). diff --git a/lib/asn1/test/testRfcs.erl b/lib/asn1/test/testRfcs.erl index da7333ef98..20176e35eb 100644 --- a/lib/asn1/test/testRfcs.erl +++ b/lib/asn1/test/testRfcs.erl @@ -35,22 +35,27 @@ compile(Config, Erules, Options0) -> asn1_test_lib:compile_all(Specs, Config, [Erules,{i,CaseDir}|Options]). test() -> - {1,3,6,1,5,5,7,48,1,2} = - IdPkixOcspNonce = - 'OCSP-2009':'id-pkix-ocsp-nonce'(), - roundtrip('OCSP-2009', 'OCSPRequest', - {'OCSPRequest', - {'TBSRequest', - 0, - {rfc822Name,"name string"}, - [{'Request', - {'CertID',{'_',{2,9,3,4,5},asn1_NOVALUE}, - <<"POTATOHASH">>,<<"HASHBROWN">>,42}, - [{'_',IdPkixOcspNonce,true,<<34,159,16,57,199>>}]}], - asn1_NOVALUE}, - asn1_NOVALUE}), - otp_7759(), - ok. + M = 'OCSP-2009', + case M:maps() of + false -> + {1,3,6,1,5,5,7,48,1,2} = + IdPkixOcspNonce = + 'OCSP-2009':'id-pkix-ocsp-nonce'(), + roundtrip('OCSP-2009', 'OCSPRequest', + {'OCSPRequest', + {'TBSRequest', + 0, + {rfc822Name,"name string"}, + [{'Request', + {'CertID',{'_',{2,9,3,4,5},asn1_NOVALUE}, + <<"POTATOHASH">>,<<"HASHBROWN">>,42}, + [{'_',IdPkixOcspNonce,true,<<34,159,16,57,199>>}]}], + asn1_NOVALUE}, + asn1_NOVALUE}), + otp_7759(records); + true -> + otp_7759(maps) + end. roundtrip(Module, Type, Value0) -> Enc = Module:encode(Type, Value0), @@ -58,7 +63,7 @@ roundtrip(Module, Type, Value0) -> asn1_test_lib:match_value(Value0, Value1), ok. -otp_7759() -> +otp_7759(Pack) -> %% The release note for asn-1.6.6 says: %% Decode of an open_type when the value was empty tagged %% type encoded with indefinite length failed. @@ -66,10 +71,15 @@ otp_7759() -> Encoded = encoded_msg(), ContentInfo = Mod:decode('ContentInfo', Encoded), io:format("~p\n", [ContentInfo]), - {'ContentInfo',_Id,PKCS7_content} = ContentInfo, - X = Mod:decode('SignedData', PKCS7_content), + Content = case ContentInfo of + {'ContentInfo',_Id,Content0} when Pack =:= records -> + Content0; + #{'content-type':=_,'pkcs7-content':=Content0} + when Pack =:= maps -> + Content0 + end, + X = Mod:decode('SignedData', Content), io:format("~p\n", [X]), - io:nl(), ok. encoded_msg() -> diff --git a/lib/asn1/test/testTCAP.erl b/lib/asn1/test/testTCAP.erl index 422ae1f0fc..a6f0f9fad7 100644 --- a/lib/asn1/test/testTCAP.erl +++ b/lib/asn1/test/testTCAP.erl @@ -92,5 +92,6 @@ test_asn1config() -> enc_dec(T, V0) -> M = 'TCAPPackage', {ok,Enc} = M:encode(T, V0), + asn1_test_lib:map_roundtrip(M, T, Enc), {ok,V} = M:decode(T, Enc), V. diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index bd8da85735..3edeb1b712 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -25,7 +25,42 @@ -define(times, 5000). -val() -> +go() -> + Module = 'H323-MESSAGES', + Type = 'H323-UserInformation', + Value = case Module:maps() of + false -> val_records(); + true -> val_maps() + end, + Bytes = Module:encode(Type, Value), + Value = Module:decode(Type, Bytes), + + {ValWr,done} = timer:tc(fun() -> encode(?times, Module, Type, Value) end), + io:format("ASN.1 encoding: ~p micro~n", [ValWr / ?times]), + + done = decode(2, Module, Type, Bytes), + + {ValRead,done} = timer:tc(fun() -> decode(?times, Module, Type, Bytes) end), + io:format("ASN.1 decoding: ~p micro~n", [ValRead /?times]), + + Comment = "encode: "++integer_to_list(round(ValWr/?times)) ++ + " micro, decode: "++integer_to_list(round(ValRead /?times)) ++ + " micro. [" ++ atom_to_list(Module:encoding_rule()) ++ "]", + {comment,Comment}. + +encode(0, _Module,_Type,_Value) -> + done; +encode(N, Module,Type,Value) -> + Module:encode(Type, Value), + encode(N-1, Module, Type, Value). + +decode(0, _Module, _Type, _Value) -> + done; +decode(N, Module, Type, Value) -> + Module:decode(Type, Value), + decode(N-1, Module, Type, Value). + +val_records() -> {'H323-UserInformation',{'H323-UU-PDU', {callProceeding, {'CallProceeding-UUIE', @@ -126,34 +161,66 @@ val() -> {'H323-UserInformation_user-data',24,<<"O">>}}. -go() -> - Module = 'H323-MESSAGES', - Type = 'H323-UserInformation', - Value = val(), - Bytes = Module:encode(Type, Value), - Value = Module:decode(Type, Bytes), - - {ValWr,done} = timer:tc(fun() -> encode(?times, Module, Type, Value) end), - io:format("ASN.1 encoding: ~p micro~n", [ValWr / ?times]), - - done = decode(2, Module, Type, Bytes), - - {ValRead,done} = timer:tc(fun() -> decode(?times, Module, Type, Bytes) end), - io:format("ASN.1 decoding: ~p micro~n", [ValRead /?times]), - - Comment = "encode: "++integer_to_list(round(ValWr/?times)) ++ - " micro, decode: "++integer_to_list(round(ValRead /?times)) ++ - " micro. [" ++ atom_to_list(Module:encoding_rule()) ++ "]", - {comment,Comment}. - -encode(0, _Module,_Type,_Value) -> - done; -encode(N, Module,Type,Value) -> - Module:encode(Type, Value), - encode(N-1, Module, Type, Value). - -decode(0, _Module, _Type, _Value) -> - done; -decode(N, Module, Type, Value) -> - Module:decode(Type, Value), - decode(N-1, Module, Type, Value). +val_maps() -> +#{'h323-uu-pdu' => #{h245Control => [], + h245Tunneling => true, + 'h323-message-body' => {callProceeding,#{callIdentifier => #{guid => <<"OCTET STRINGOCTE">>}, + cryptoTokens => [{cryptoGKPwdEncr,#{algorithmOID => {1,18,467,467}, + encryptedData => <<"OC">>, + paramS => #{iv8 => <<"OCTET ST">>, + ranInt => -7477016}}}, + {cryptoGKPwdEncr,#{algorithmOID => {1,19,486,486}, + encryptedData => <<>>, + paramS => #{iv8 => <<"OCTET ST">>, + ranInt => -2404513}}}], + destinationInfo => #{gatekeeper => #{nonStandardData => #{data => <<"O">>, + nonStandardIdentifier => {object,{0,10,260}}}}, + gateway => #{nonStandardData => #{data => <<"O">>, + nonStandardIdentifier => {object,{0,13,326}}}, + protocol => [{h320,#{dataRatesSupported => [#{channelMultiplier => 78, + channelRate => 1290470518, + nonStandardData => #{data => <<"O">>, + nonStandardIdentifier => {object,{0,11,295}}}}], + nonStandardData => #{data => <<"O">>, + nonStandardIdentifier => {object,{0,11,282}}}, + supportedPrefixes => [#{nonStandardData => #{data => <<"O">>, + nonStandardIdentifier => {object,{0,12,312}}}, + prefix => {'h323-ID',"BM"}}]}}]}, + mc => true, + mcu => #{nonStandardData => #{data => <<"OC">>, + nonStandardIdentifier => {object,{1,13,340,340}}}}, + nonStandardData => #{data => <<"O">>,nonStandardIdentifier => {object,{0,9,237}}}, + terminal => #{nonStandardData => #{data => <<"OC">>, + nonStandardIdentifier => {object,{1,14,353,354}}}}, + undefinedNode => true, + vendor => #{productId => <<"OC">>, + vendor => #{manufacturerCode => 16282, + t35CountryCode => 62, + t35Extension => 63}, + versionId => <<"OC">>}}, + fastStart => [], + h245Address => {ipxAddress,#{netnum => <<"OCTE">>, + node => <<"OCTET ">>, + port => <<"OC">>}}, + h245SecurityMode => {noSecurity,'NULL'}, + protocolIdentifier => {0,8,222}, + tokens => [#{certificate => #{certificate => <<"OC">>,type => {1,16,405,406}}, + challenge => <<"OCTET STR">>, + dhkey => #{generator => <<1:1>>,halfkey => <<1:1>>,modSize => <<1:1>>}, + generalID => "BMP", + nonStandard => #{data => <<"OC">>,nonStandardIdentifier => {1,16,414,415}}, + password => "BM", + random => -26430296, + timeStamp => 1667517741}, + #{certificate => #{certificate => <<"OC">>,type => {1,17,442,443}}, + challenge => <<"OCTET STRI">>, + dhkey => #{generator => <<1:1>>,halfkey => <<1:1>>,modSize => <<1:1>>}, + generalID => "BMP", + nonStandard => #{data => <<"OC">>,nonStandardIdentifier => {1,18,452,452}}, + password => "BMP", + random => -16356110, + timeStamp => 1817656756}]}}, + h4501SupplementaryService => [], + nonStandardControl => [], + nonStandardData => #{data => <<>>,nonStandardIdentifier => {object,{0,3,84}}}}, + 'user-data' => #{'protocol-discriminator' => 24,'user-information' => <<"O">>}}. diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index 4d3ec94391..30cbceb577 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -27,6 +27,7 @@ seq_roundtrip(I, D0) -> M = 'UniqueObjectSets', try {ok,Enc} = M:encode('Seq', {'Seq',I,D0}), + asn1_test_lib:map_roundtrip(M, 'Seq', Enc), {ok,{'Seq',I,D}} = M:decode('Seq', Enc), D catch C:E -> diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl index ac74470537..c15e61550c 100644 --- a/lib/asn1/test/test_compile_options.erl +++ b/lib/asn1/test/test_compile_options.erl @@ -24,8 +24,8 @@ -include_lib("common_test/include/ct.hrl"). --export([wrong_path/1,comp/2,path/1,ticket_6143/1,noobj/1, - record_name_prefix/1,verbose/1]). +-export([wrong_path/1,comp/2,path/1,noobj/1, + record_name_prefix/1,verbose/1,maps/1]). %% OTP-5689 wrong_path(Config) -> @@ -64,8 +64,6 @@ path(Config) -> file:set_cwd(CWD), ok. -ticket_6143(Config) -> asn1_test_lib:compile("AA1", Config, []). - noobj(Config) -> DataDir = proplists:get_value(data_dir,Config), OutDir = proplists:get_value(priv_dir,Config), @@ -130,6 +128,28 @@ verbose(Config) when is_list(Config) -> [] = test_server:capture_get(), ok. +maps(Config) -> + DataDir = proplists:get_value(data_dir, Config), + OutDir = proplists:get_value(case_dir, Config), + InFile = filename:join(DataDir, "P-Record"), + + do_maps(ber, InFile, OutDir), + do_maps(per, InFile, OutDir), + do_maps(uper, InFile, OutDir). + +do_maps(Erule, InFile, OutDir) -> + Opts = [Erule,maps,{outdir,OutDir}], + ok = asn1ct:compile(InFile, Opts), + + %% Make sure that no .hrl files are generated. + [] = filelib:wildcard(filename:join(OutDir, "*.hrl")), + + %% Remove all generated files. + All = filelib:wildcard(filename:join(OutDir, "*")), + _ = [file:delete(N) || N <- All], + + ok. + outfiles_check(OutDir) -> outfiles_check(OutDir,outfiles1()). -- cgit v1.2.3 From a952ef15cc20249b3111565cbba7d6727f2a0012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 7 Feb 2017 12:00:56 +0100 Subject: asn1_SUITE: Remove unused functions In 8a39672af4d9, the testX420/1 test case is no longer run. Remove the unused functions. --- lib/asn1/test/asn1_SUITE.erl | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index b6430134ab..92e637617e 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1027,18 +1027,6 @@ test_modified_x420(Config, Rule, Opts) -> test_modified_x420:test(Config). -testX420() -> - [{timetrap,{minutes,90}}]. -testX420(Config) -> - case erlang:system_info(system_architecture) of - "sparc-sun-solaris2.10" -> - {skip,"Too slow for an old Sparc"}; - _ -> - Rule = ber, - testX420:compile(Rule, [der], Config), - ok = testX420:ticket7759(Rule, Config) - end. - test_x691(Config) -> test(Config, fun test_x691/3, [per, uper]). test_x691(Config, Rule, Opts) -> -- cgit v1.2.3 From 142969f0860067c73af4b1e8db04d59255edf25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 8 Feb 2017 07:26:29 +0100 Subject: Simplify running of asn1 app tests Instead of initiating running of the app tests for asn1 from asn1_SUITE, put the tests in asn1_app_SUITE and let it take care of itself. While we are it, eliminate 'export_all' in the new module and use lists:keyfind/3 instead of lists:keysearch/3. --- lib/asn1/test/Makefile | 3 +- lib/asn1/test/asn1_SUITE.erl | 8 +- lib/asn1/test/asn1_app_SUITE.erl | 229 ++++++++++++++++++++++++++++++++++++++ lib/asn1/test/asn1_app_test.erl | 229 -------------------------------------- lib/asn1/test/asn1_appup_test.erl | 58 ---------- 5 files changed, 231 insertions(+), 296 deletions(-) create mode 100644 lib/asn1/test/asn1_app_SUITE.erl delete mode 100644 lib/asn1/test/asn1_app_test.erl delete mode 100644 lib/asn1/test/asn1_appup_test.erl (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index 40575e8a2f..278c80852b 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -114,8 +114,7 @@ MODULES= \ testImporting \ testExtensibilityImplied \ asn1_test_lib \ - asn1_app_test \ - asn1_appup_test \ + asn1_app_SUITE \ asn1_SUITE \ error_SUITE \ syntax_SUITE diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 92e637617e..00e9871aca 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -41,8 +41,6 @@ suite() -> all() -> [{group, compile}, {group, parallel}, - {group, app_test}, - {group, appup_test}, % TODO: Investigate parallel running of these: testComment, @@ -64,10 +62,6 @@ groups() -> ber_optional, tagdefault_automatic]}, - {app_test, [], [{asn1_app_test, all}]}, - - {appup_test, [], [{asn1_appup_test, all}]}, - {parallel, Parallel, [cover, xref, @@ -1280,7 +1274,7 @@ xref(_Config) -> xref:set_default(s, [{verbose,false},{warnings,false},{builtins,true}]), Test = filename:dirname(code:which(?MODULE)), {ok,_PMs} = xref:add_directory(s, Test), - UnusedExports = "X - XU - asn1_appup_test - asn1_app_test - \".*_SUITE\" : Mod", + UnusedExports = "X - XU - \".*_SUITE\" : Mod", case xref:q(s, UnusedExports) of {ok,[]} -> ok; diff --git a/lib/asn1/test/asn1_app_SUITE.erl b/lib/asn1/test/asn1_app_SUITE.erl new file mode 100644 index 0000000000..c089a7267c --- /dev/null +++ b/lib/asn1/test/asn1_app_SUITE.erl @@ -0,0 +1,229 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% Purpose: Verify the application specifics of the asn1 application +%%---------------------------------------------------------------------- +-module(asn1_app_SUITE). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1,end_per_suite/1, + appup/1,fields/1,modules/1,export_all/1,app_depend/1]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +all() -> + [appup, fields, modules, export_all, app_depend]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +init_per_suite(Config) when is_list(Config) -> + case is_app(asn1) of + {ok, AppFile} -> + io:format("AppFile: ~n~p~n", [AppFile]), + [{app_file, AppFile}|Config]; + {error, Reason} -> + fail(Reason) + end. + +is_app(App) -> + LibDir = code:lib_dir(App), + File = filename:join([LibDir, "ebin", atom_to_list(App) ++ ".app"]), + case file:consult(File) of + {ok, [{application, App, AppFile}]} -> + {ok, AppFile}; + Error -> + {error, {invalid_format, Error}} + end. + + +end_per_suite(Config) when is_list(Config) -> + Config. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +appup(Config) when is_list(Config) -> + ok = test_server:appup_test(asn1). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +fields(Config) when is_list(Config) -> + AppFile = key1find(app_file, Config), + Fields = [vsn, description, modules, registered, applications], + case check_fields(Fields, AppFile, []) of + [] -> + ok; + Missing -> + fail({missing_fields, Missing}) + end. + +check_fields([], _AppFile, Missing) -> + Missing; +check_fields([Field|Fields], AppFile, Missing) -> + check_fields(Fields, AppFile, check_field(Field, AppFile, Missing)). + +check_field(Name, AppFile, Missing) -> + io:format("checking field: ~p~n", [Name]), + case lists:keymember(Name, 1, AppFile) of + true -> + Missing; + false -> + [Name|Missing] + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +modules(Config) when is_list(Config) -> + AppFile = key1find(app_file, Config), + Mods = key1find(modules, AppFile), + EbinList = get_ebin_mods(asn1), + case missing_modules(Mods, EbinList, []) of + [] -> + ok; + Missing -> + throw({error, {missing_modules, Missing}}) + end, + case extra_modules(Mods, EbinList, []) of + [] -> + ok; + Extra -> + check_asn1ct_modules(Extra) + end, + {ok, Mods}. + +get_ebin_mods(App) -> + LibDir = code:lib_dir(App), + EbinDir = filename:join([LibDir,"ebin"]), + {ok, Files0} = file:list_dir(EbinDir), + Files1 = [lists:reverse(File) || File <- Files0], + [list_to_atom(lists:reverse(Name)) || [$m,$a,$e,$b,$.|Name] <- Files1]. + +check_asn1ct_modules(Extra) -> + ASN1CTMods = [asn1ct,asn1ct_check,asn1_db,asn1ct_pretty_format, + asn1ct_gen,asn1ct_gen_check,asn1ct_gen_per, + asn1ct_name,asn1ct_constructed_per,asn1ct_constructed_ber, + asn1ct_gen_ber,asn1ct_constructed_ber_bin_v2, + asn1ct_gen_ber_bin_v2,asn1ct_value, + asn1ct_tok,asn1ct_parser2,asn1ct_table, + asn1ct_imm,asn1ct_func,asn1ct_rtt, + asn1ct_eval_ext], + case Extra -- ASN1CTMods of + [] -> + ok; + Extra2 -> + throw({error, {extra_modules, Extra2}}) + end. + +missing_modules([], _Ebins, Missing) -> + Missing; +missing_modules([Mod|Mods], Ebins, Missing) -> + case lists:member(Mod, Ebins) of + true -> + missing_modules(Mods, Ebins, Missing); + false -> + io:format("missing module: ~p~n", [Mod]), + missing_modules(Mods, Ebins, [Mod|Missing]) + end. + + +extra_modules(_Mods, [], Extra) -> + Extra; +extra_modules(Mods, [Mod|Ebins], Extra) -> + case lists:member(Mod, Mods) of + true -> + extra_modules(Mods, Ebins, Extra); + false -> + io:format("supefluous module: ~p~n", [Mod]), + extra_modules(Mods, Ebins, [Mod|Extra]) + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +export_all(Config) when is_list(Config) -> + AppFile = key1find(app_file, Config), + Mods = key1find(modules, AppFile), + check_export_all(Mods). + + +check_export_all([]) -> + ok; +check_export_all([Mod|Mods]) -> + case (catch apply(Mod, module_info, [compile])) of + {'EXIT', {undef, _}} -> + check_export_all(Mods); + O -> + case lists:keyfind(options, 1, O) of + false -> + check_export_all(Mods); + {options, List} -> + case lists:member(export_all, List) of + true -> + throw({error, {export_all, Mod}}); + false -> + check_export_all(Mods) + end + end + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +app_depend(Config) when is_list(Config) -> + AppFile = key1find(app_file, Config), + Apps = key1find(applications, AppFile), + check_apps(Apps). + + +check_apps([]) -> + ok; +check_apps([App|Apps]) -> + case is_app(App) of + {ok, _} -> + check_apps(Apps); + Error -> + throw({error, {missing_app, {App, Error}}}) + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +fail(Reason) -> + exit({suite_failed, Reason}). + +key1find(Key, L) -> + case lists:keyfind(Key, 1, L) of + false -> + fail({not_found, Key, L}); + {Key, Value} -> + Value + end. diff --git a/lib/asn1/test/asn1_app_test.erl b/lib/asn1/test/asn1_app_test.erl deleted file mode 100644 index 028322f555..0000000000 --- a/lib/asn1/test/asn1_app_test.erl +++ /dev/null @@ -1,229 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% Purpose: Verify the application specifics of the asn1 application -%%---------------------------------------------------------------------- --module(asn1_app_test). - --compile(export_all). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -all() -> - [fields, modules, exportall, app_depend]. - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -init_per_suite(Config) when is_list(Config) -> - case is_app(asn1) of - {ok, AppFile} -> - io:format("AppFile: ~n~p~n", [AppFile]), - [{app_file, AppFile}|Config]; - {error, Reason} -> - fail(Reason) - end. - -is_app(App) -> - LibDir = code:lib_dir(App), - File = filename:join([LibDir, "ebin", atom_to_list(App) ++ ".app"]), - case file:consult(File) of - {ok, [{application, App, AppFile}]} -> - {ok, AppFile}; - Error -> - {error, {invalid_format, Error}} - end. - - -end_per_suite(Config) when is_list(Config) -> - Config. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% . -fields(Config) when is_list(Config) -> - AppFile = key1search(app_file, Config), - Fields = [vsn, description, modules, registered, applications], - case check_fields(Fields, AppFile, []) of - [] -> - ok; - Missing -> - fail({missing_fields, Missing}) - end. - -check_fields([], _AppFile, Missing) -> - Missing; -check_fields([Field|Fields], AppFile, Missing) -> - check_fields(Fields, AppFile, check_field(Field, AppFile, Missing)). - -check_field(Name, AppFile, Missing) -> - io:format("checking field: ~p~n", [Name]), - case lists:keymember(Name, 1, AppFile) of - true -> - Missing; - false -> - [Name|Missing] - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% . -modules(Config) when is_list(Config) -> - AppFile = key1search(app_file, Config), - Mods = key1search(modules, AppFile), - EbinList = get_ebin_mods(asn1), - case missing_modules(Mods, EbinList, []) of - [] -> - ok; - Missing -> - throw({error, {missing_modules, Missing}}) - end, - case extra_modules(Mods, EbinList, []) of - [] -> - ok; - Extra -> - check_asn1ct_modules(Extra) -% throw({error, {extra_modules, Extra}}) - end, - {ok, Mods}. - -get_ebin_mods(App) -> - LibDir = code:lib_dir(App), - EbinDir = filename:join([LibDir,"ebin"]), - {ok, Files0} = file:list_dir(EbinDir), - Files1 = [lists:reverse(File) || File <- Files0], - [list_to_atom(lists:reverse(Name)) || [$m,$a,$e,$b,$.|Name] <- Files1]. - -check_asn1ct_modules(Extra) -> - ASN1CTMods = [asn1ct,asn1ct_check,asn1_db,asn1ct_pretty_format, - asn1ct_gen,asn1ct_gen_check,asn1ct_gen_per, - asn1ct_name,asn1ct_constructed_per,asn1ct_constructed_ber, - asn1ct_gen_ber,asn1ct_constructed_ber_bin_v2, - asn1ct_gen_ber_bin_v2,asn1ct_value, - asn1ct_tok,asn1ct_parser2,asn1ct_table, - asn1ct_imm,asn1ct_func,asn1ct_rtt, - asn1ct_eval_ext], - case Extra -- ASN1CTMods of - [] -> - ok; - Extra2 -> - throw({error, {extra_modules, Extra2}}) - end. - -missing_modules([], _Ebins, Missing) -> - Missing; -missing_modules([Mod|Mods], Ebins, Missing) -> - case lists:member(Mod, Ebins) of - true -> - missing_modules(Mods, Ebins, Missing); - false -> - io:format("missing module: ~p~n", [Mod]), - missing_modules(Mods, Ebins, [Mod|Missing]) - end. - - -extra_modules(_Mods, [], Extra) -> - Extra; -extra_modules(Mods, [Mod|Ebins], Extra) -> - case lists:member(Mod, Mods) of - true -> - extra_modules(Mods, Ebins, Extra); - false -> - io:format("supefluous module: ~p~n", [Mod]), - extra_modules(Mods, Ebins, [Mod|Extra]) - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -%% . -exportall(Config) when is_list(Config) -> - AppFile = key1search(app_file, Config), - Mods = key1search(modules, AppFile), - check_export_all(Mods). - - -check_export_all([]) -> - ok; -check_export_all([Mod|Mods]) -> - case (catch apply(Mod, module_info, [compile])) of - {'EXIT', {undef, _}} -> - check_export_all(Mods); - O -> - case lists:keysearch(options, 1, O) of - false -> - check_export_all(Mods); - {value, {options, List}} -> - case lists:member(export_all, List) of - true -> - throw({error, {export_all, Mod}}); - false -> - check_export_all(Mods) - end - end - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% . -app_depend(Config) when is_list(Config) -> - AppFile = key1search(app_file, Config), - Apps = key1search(applications, AppFile), - check_apps(Apps). - - -check_apps([]) -> - ok; -check_apps([App|Apps]) -> - case is_app(App) of - {ok, _} -> - check_apps(Apps); - Error -> - throw({error, {missing_app, {App, Error}}}) - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -fail(Reason) -> - exit({suite_failed, Reason}). - -key1search(Key, L) -> - case lists:keysearch(Key, 1, L) of - undefined -> - fail({not_found, Key, L}); - {value, {Key, Value}} -> - Value - end. diff --git a/lib/asn1/test/asn1_appup_test.erl b/lib/asn1/test/asn1_appup_test.erl deleted file mode 100644 index 54540e53cc..0000000000 --- a/lib/asn1/test/asn1_appup_test.erl +++ /dev/null @@ -1,58 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% Purpose: Verify the application specifics of the asn1 application -%%---------------------------------------------------------------------- --module(asn1_appup_test). --compile(export_all). --include_lib("common_test/include/ct.hrl"). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -all() -> - [appup]. - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -init_per_suite(Config) when is_list(Config) -> - Config. - - -end_per_suite(Config) when is_list(Config) -> - Config. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -appup() -> - [{doc, "perform a simple check of the asn1 appup file"}]. -appup(Config) when is_list(Config) -> - ok = ?t:appup_test(asn1). -- cgit v1.2.3 From 1af5b82466124e4aa32e8b232b915935071a2a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 7 Feb 2017 11:58:04 +0100 Subject: asn1_SUITE: Make sure that there are no unused functions Add xref_export_all/1 to make sure that all functions in the asn1_SUITE module are actually called (directly or indirectly). --- lib/asn1/test/asn1_SUITE.erl | 72 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 7 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 00e9871aca..88b50e07d9 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -39,7 +39,10 @@ suite() -> {timetrap,{minutes,60}}]. all() -> - [{group, compile}, + [xref, + xref_export_all, + + {group, compile}, {group, parallel}, % TODO: Investigate parallel running of these: @@ -64,7 +67,6 @@ groups() -> {parallel, Parallel, [cover, - xref, {group, ber}, % Uses 'P-Record', 'Constraints', 'MEDIA-GATEWAY-CONTROL'... {group, [], [parse, @@ -1269,16 +1271,72 @@ ticket7904(Config) -> {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1), {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1). + +%% Make sure that functions exported from other modules are +%% actually used. + xref(_Config) -> - xref:start(s), - xref:set_default(s, [{verbose,false},{warnings,false},{builtins,true}]), + S = ?FUNCTION_NAME, + xref:start(S), + xref:set_default(S, [{verbose,false},{warnings,false},{builtins,true}]), Test = filename:dirname(code:which(?MODULE)), - {ok,_PMs} = xref:add_directory(s, Test), - UnusedExports = "X - XU - \".*_SUITE\" : Mod", - case xref:q(s, UnusedExports) of + {ok,_PMs} = xref:add_directory(S, Test), + Q = "X - XU - \".*_SUITE\" : Mod", + UnusedExports = xref:q(S, Q), + xref:stop(S), + case UnusedExports of {ok,[]} -> ok; {ok,[_|_]=Res} -> io:format("Exported, but unused: ~p\n", [Res]), ?t:fail() end. + +%% Ensure that all functions that are implicitly exported by +%% 'export_all' in this module are actually used. + +xref_export_all(_Config) -> + S = ?FUNCTION_NAME, + xref:start(S), + xref:set_default(S, [{verbose,false},{warnings,false},{builtins,true}]), + {ok,_PMs} = xref:add_module(S, code:which(?MODULE)), + AllCalled = all_called(), + Def = "Called := " ++ lists:flatten(io_lib:format("~p", [AllCalled])), + {ok,_} = xref:q(S, Def), + {ok,Unused} = xref:q(S, "X - Called - range (closure E | Called)"), + xref:stop(S), + case Unused of + [] -> + ok; + [_|_] -> + S = [io_lib:format("~p:~p/~p\n", [M,F,A]) || {M,F,A} <- Unused], + io:format("There are unused functions:\n\n~s\n", [S]), + ?t:fail(unused_functions) + end. + +%% Collect all functions that common_test will call in this module. + +all_called() -> + [{?MODULE,end_per_group,2}, + {?MODULE,end_per_suite,1}, + {?MODULE,end_per_testcase,2}, + {?MODULE,init_per_group,2}, + {?MODULE,init_per_suite,1}, + {?MODULE,init_per_testcase,2}, + {?MODULE,suite,0}] ++ + all_called_1(all() ++ groups()). + +all_called_1([{_,_}|T]) -> + all_called_1(T); +all_called_1([{_Name,_Flags,Fs}|T]) -> + all_called_1(Fs ++ T); +all_called_1([F|T]) when is_atom(F) -> + L = case erlang:function_exported(?MODULE, F, 0) of + false -> + [{?MODULE,F,1}]; + true -> + [{?MODULE,F,0},{?MODULE,F,1}] + end, + L ++ all_called_1(T); +all_called_1([]) -> + []. -- cgit v1.2.3 From 2a206d87470fc61656dcfc67e428fd61cb8ee39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 15 Feb 2017 14:04:25 +0100 Subject: PER: Slightly improve error reporting for encoding Generate slightly better error reasons when encoding of INTEGER, ENUMERATED, or BOOLEAN fails. --- lib/asn1/test/asn1_SUITE_data/Prim.asn1 | 2 ++ lib/asn1/test/testPrim.erl | 46 +++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 16 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 index 4fe0901683..91c8696e61 100644 --- a/lib/asn1/test/asn1_SUITE_data/Prim.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/Prim.asn1 @@ -18,6 +18,8 @@ BEGIN IntExpPri ::= [PRIVATE 51] EXPLICIT INTEGER IntExpApp ::= [APPLICATION 52] EXPLICIT INTEGER + IntConstrained ::= INTEGER (0..255) + IntEnum ::= INTEGER {first(1),last(31)} Enum ::= ENUMERATED {monday(1),tuesday(2),wednesday(3),thursday(4), diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index 96a2dd6c79..14546ff41c 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.erl @@ -34,15 +34,12 @@ bool(Rules) -> Types = ['Bool','BoolCon','BoolPri','BoolApp', 'BoolExpCon','BoolExpPri','BoolExpApp'], [roundtrip(T, V) || T <- Types, V <- [true,false]], - case Rules of - ber -> - [begin - {error,{asn1,{encode_boolean,517}}} = enc_error(T, 517) - end || T <- Types], - ok; - _ -> - ok - end. + Tag = case Rules of + ber -> encode_boolean; + _ -> illegal_boolean + end, + [{Tag,517} = enc_error(T, 517) || T <- Types], + ok. int(Rules) -> @@ -60,10 +57,22 @@ int(Rules) -> 123456789,12345678901234567890, -1,-2,-3,-4,-100,-127,-255,-256,-257, -1234567890,-2147483648], - [roundtrip(T, V) || - T <- ['Int','IntCon','IntPri','IntApp', - 'IntExpCon','IntExpPri','IntExpApp'], - V <- [1|Values]], + Types = ['Int','IntCon','IntPri','IntApp', + 'IntExpCon','IntExpPri','IntExpApp'], + _ = [roundtrip(T, V) || T <- Types, V <- [1|Values]], + Tag = case Rules of + ber -> encode_integer; + _ -> illegal_integer + end, + _ = [{Tag,V} = enc_error(T, V) || + T <- Types, V <- [atom,42.0,{a,b,c}]], + case Rules of + ber -> + ok; + _ -> + _ = [{Tag,V} = enc_error('IntConstrained', V) || + V <- [atom,-1,256,42.0]] + end, %%========================================================== %% IntEnum ::= INTEGER {first(1),last(31)} @@ -119,7 +128,11 @@ enum(Rules) -> roundtrip('Enum', monday), roundtrip('Enum', thursday), - {error,{asn1,{_,4}}} = enc_error('Enum', 4), + Tag = case Rules of + ber -> enumerated_not_in_range; + _ -> illegal_enumerated + end, + {Tag,4} = enc_error('Enum', 4), case Rules of Per when Per =:= per; Per =:= uper -> @@ -182,13 +195,14 @@ roundtrip(Type, Value, ExpectedValue) -> enc_error(T, V) -> case get(no_ok_wrapper) of false -> - 'Prim':encode(T, V); + {error,{asn1,Reason}} = 'Prim':encode(T, V), + Reason; true -> try 'Prim':encode(T, V) of _ -> ?t:fail() catch - _:Reason -> + _:{error,{asn1,Reason}} -> Reason end end. -- cgit v1.2.3 From 3f7d4324c7b99f93a6ad36015071276692534fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 15 Feb 2017 14:23:59 +0100 Subject: encode/decode: Include the stack trace in error returns The generated encode/2 and decode/2 functions can return cryptic error messages. Consider this ASN.1 spec: T DEFINITIONS AUTOMATIC TAGS ::= BEGIN S ::= SEQUENCE { b BOOLEAN, i INTEGER (1..100), j INTEGER (0..7), s OCTET STRING } END In OTP 19, the error terms will look like this: Eshell V8.2 (abort with ^G) 1> asn1ct:compile('T', [ber]). ok 2> rr('T'). ['S'] 3> 'T':encode('S', #'S'{}). {error,{asn1,{encode_boolean,undefined}}} 4> 'T':encode('S', #'S'{b=false}). {error,{asn1,{encode_integer,undefined}}} 5> 'T':encode('S', #'S'{b=false,i=7,j=0}). {error,{asn1,function_clause}} Some error terms are clearer than other. In the first error term, it is clear that the error refers to the 'b' field, since there is only one BOOLEAN in 'S'. The second error term could refer to either 'i' or 'j'. The last error term... well... in this case we can infer that it must refer to 's'. The easiest way to provide more information is to include the stack trace with line numbers in the error term: 3> 'T':encode('S', #'S'{b=false}). {error,{asn1,{{encode_integer,undefined}, [{'T',encode_integer,2,[{file,"T.erl"},{line,240}]}, {'T',enc_S,2,[{file,"T.erl"},{line,102}]}, {'T',encode,2,[{file,"T.erl"},{line,36}]}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {shell,exprs,7,[{file,"shell.erl"},{line,686}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,641}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,626}]}]}}} By looking at the generated Erlang code, we can see that encoding failed for 'i'. This is an compatible change. All that the documentation says is that the format of the error tuple is: {error,{asn1,Description}} With this change, Description is always a tuple: {ErrorDescription,StackTrace} Alternatives considered: Providing more information in the error term itself and make sure there can be no 'function_clause', 'badarg', or 'badmatch' exceptions. That would be possible, but it would require a lot of work and it would increase the size of the generated code and make it slower. Therefore, this solution was rejected. --- lib/asn1/test/ber_decode_error.erl | 39 +++++++++++++++--------------------- lib/asn1/test/testChoPrim.erl | 8 ++++---- lib/asn1/test/testInfObjectClass.erl | 22 ++++++++++++++------ lib/asn1/test/testPrim.erl | 3 ++- 4 files changed, 38 insertions(+), 34 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/ber_decode_error.erl b/lib/asn1/test/ber_decode_error.erl index c0840e02d7..c45d130ff4 100644 --- a/lib/asn1/test/ber_decode_error.erl +++ b/lib/asn1/test/ber_decode_error.erl @@ -26,48 +26,41 @@ run([]) -> {ok,B} = 'Constructed':encode('S3', {'S3',17}), [T,L|V] = binary_to_list(B), Bytes = list_to_binary([T,L+3|V] ++ [2,1,3]), - case 'Constructed':decode('S3', Bytes) of - {error,{asn1,{unexpected,_}}} -> ok - end, + {unexpected,_} = dec_error('S3', Bytes), %% Unexpected bytes must be accepted if there is an extensionmark {ok,{'S3ext',17}} = 'Constructed':decode('S3ext', Bytes), %% Truncated tag. - {error,{asn1,{invalid_tag,_}}} = - (catch 'Constructed':decode('I', <<31,255,255>>)), + {invalid_tag,_} = dec_error('I', <<31,255,255>>), %% Overlong tag. - {error,{asn1,{invalid_tag,_}}} = - (catch 'Constructed':decode('I', <<31,255,255,255,127>>)), + {invalid_tag,_} = dec_error('I', <<31,255,255,255,127>>), %% Invalid length. - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('I', <<8,255>>)), + {invalid_length,_} = dec_error('I', <<8,255>>), %% Other errors. - {error,{asn1,{invalid_value,_}}} = - (catch 'Constructed':decode('I', <<>>)), + {invalid_value,_} = dec_error('I', <<>>), - {error,{asn1,{invalid_value,_}}} = - (catch 'Constructed':decode('I', <<8,7>>)), + {invalid_value,_} = dec_error('I', <<8,7>>), %% Short indefinite length. Make sure that the decoder doesn't look %% beyond the end of binary when looking for a 0,0 terminator. - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('S', sub(<<8,16#80,0,0>>, 3))), - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('S', sub(<<8,16#80,0,0>>, 2))), - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('S', sub(<<40,16#80,1,1,255,0,0>>, 6))), - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('S', sub(<<40,16#80,1,1,255,0,0>>, 5))), + {invalid_length,_} = dec_error('S', sub(<<8,16#80,0,0>>, 3)), + {invalid_length,_} = dec_error('S', sub(<<8,16#80,0,0>>, 2)), + {invalid_length,_} = dec_error('S', sub(<<40,16#80,1,1,255,0,0>>, 6)), + {invalid_length,_} = dec_error('S', sub(<<40,16#80,1,1,255,0,0>>, 5)), %% A primitive must not be encoded with an indefinite length. - {error,{asn1,{invalid_length,_}}} = - (catch 'Constructed':decode('OS', <<4,128,4,3,97,98,99,0,0>>)), + {invalid_length,_} = dec_error('OS', <<4,128,4,3,97,98,99,0,0>>), ok. +dec_error(T, Bin) -> + {error,{asn1,{Reason,Stk}}} = 'Constructed':decode(T, Bin), + [{_,_,_,_}|_] = Stk, + Reason. + sub(Bin, Bytes) -> <> = Bin, B. diff --git a/lib/asn1/test/testChoPrim.erl b/lib/asn1/test/testChoPrim.erl index 573c482f2b..61b6ab2d05 100644 --- a/lib/asn1/test/testChoPrim.erl +++ b/lib/asn1/test/testChoPrim.erl @@ -31,10 +31,10 @@ bool(Rules) -> roundtrip('ChoCon', {int2,233}), case Rules of ber -> - {error,{asn1,{invalid_choice_type,wrong}}} = - (catch 'ChoPrim':encode('ChoCon', {wrong,233})), - {error,{asn1,{invalid_choice_tag,_WrongTag}}} = - (catch 'ChoPrim':decode('ChoCon', <<131,2,0,233>>)); + {error,{asn1,{{invalid_choice_type,wrong},[_|_]}}} = + (catch 'ChoPrim':encode('ChoCon', {wrong,233})), + {error,{asn1,{{invalid_choice_tag,_WrongTag},[_|_]}}} = + (catch 'ChoPrim':decode('ChoCon', <<131,2,0,233>>)); per -> ok; uper -> diff --git a/lib/asn1/test/testInfObjectClass.erl b/lib/asn1/test/testInfObjectClass.erl index 560986fac9..540407fa51 100644 --- a/lib/asn1/test/testInfObjectClass.erl +++ b/lib/asn1/test/testInfObjectClass.erl @@ -33,19 +33,29 @@ main(Rule) -> roundtrip('Seq', Val), %% OTP-5783 - {error,{asn1,{'Type not compatible with table constraint', - {component,'ArgumentType'}, - {value,_},_}}} = 'InfClass':encode('Seq', {'Seq',12,13,1}), + {'Type not compatible with table constraint', + {component,'ArgumentType'}, + {value,_},_} = enc_error('Seq', {'Seq',12,13,1}), Bytes2 = case Rule of ber -> <<48,9,2,1,12,2,1,11,2,1,1>>; _ -> <<1,12,1,11,1,1>> end, - {error,{asn1,{'Type not compatible with table constraint', - {{component,_}, - {value,_B},_}}}} = 'InfClass':decode('Seq', Bytes2), + {'Type not compatible with table constraint', + {{component,_}, + {value,_B},_}} = dec_error('Seq', Bytes2), ok. roundtrip(T, V) -> asn1_test_lib:roundtrip('InfClass', T, V). + +enc_error(T, V) -> + {error,{asn1,{Reason,Stk}}} = 'InfClass':encode(T, V), + [{_,_,_,_}|_] = Stk, + Reason. + +dec_error(T, Bin) -> + {error,{asn1,{Reason,Stk}}} = 'InfClass':decode(T, Bin), + [{_,_,_,_}|_] = Stk, + Reason. diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index 14546ff41c..b2933dfabc 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.erl @@ -195,7 +195,8 @@ roundtrip(Type, Value, ExpectedValue) -> enc_error(T, V) -> case get(no_ok_wrapper) of false -> - {error,{asn1,Reason}} = 'Prim':encode(T, V), + {error,{asn1,{Reason,Stk}}} = 'Prim':encode(T, V), + [{_,_,_,_}|_] = Stk, Reason; true -> try 'Prim':encode(T, V) of -- cgit v1.2.3 From eb437db9e7df90d5e72d6314ee7c49cbde77135a Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Wed, 1 Mar 2017 09:34:50 -0800 Subject: Fix typos: lenght -> length --- lib/asn1/test/asn1_SUITE_data/testobj.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/testobj.erl b/lib/asn1/test/asn1_SUITE_data/testobj.erl index e547ea4572..66f4a92188 100644 --- a/lib/asn1/test/asn1_SUITE_data/testobj.erl +++ b/lib/asn1/test/asn1_SUITE_data/testobj.erl @@ -967,7 +967,7 @@ pdu_pdp() -> 116,101,115,116, % lable1 = test 4, % length lable2 116,101,115,116, % lable2 = test - 4, % lenght lable3 + 4, % length lable3 116,101,115,116, % lable3 = test 4, % length lable3 116,101,115,116, % lable4 = test -- cgit v1.2.3 From 3334c0c7b831ecf47738c713fd764eef891a298a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 6 Mar 2017 14:28:31 +0100 Subject: asn1_erl_nif.c: Correct handling of tags >= 16384 Tags number above 16383 were not decoded correctly in ber_decode_tag(). We could fix the problem, but there does not seem to be any need. First, the only way that high tag numbers can be created is with manual tagging; after 1994 manual tagging is no longer recommended. Second, the ASN.1 playground (http://asn1-playground.oss.com) only supports tags up to 16383 (the same is presumably true for OSS Nokalva's other tools). Therefore, clean up the existing code and make it an explicit 'invalid_tag' error when tags above 13383 are encountered (instead of an implicit 'wrong_tag' error). --- lib/asn1/test/asn1_SUITE.erl | 1 + lib/asn1/test/asn1_SUITE_data/HighTagNumbers.asn1 | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/asn1/test/asn1_SUITE_data/HighTagNumbers.asn1 (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 580c919b9d..d99190b6b0 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1108,6 +1108,7 @@ test_modules() -> "From", "H235-SECURITY-MESSAGES", "H323-MESSAGES", + "HighTagNumbers", "Import", "Int", "MAP-commonDataTypes", diff --git a/lib/asn1/test/asn1_SUITE_data/HighTagNumbers.asn1 b/lib/asn1/test/asn1_SUITE_data/HighTagNumbers.asn1 new file mode 100644 index 0000000000..b681063965 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/HighTagNumbers.asn1 @@ -0,0 +1,17 @@ +HighTagNumbers DEFINITIONS ::= +BEGIN + +S ::= SEQUENCE { + a [127] INTEGER, + b [128] INTEGER, + c [150] INTEGER, + d [207] INTEGER, + e [255] INTEGER, + f [256] INTEGER, + g [7777] INTEGER, + h [9999] INTEGER, + i [16382] INTEGER, + j [16383] INTEGER +} + +END -- cgit v1.2.3 From 83e20c62057ebc1d8064bf57b01be560cd244e1d Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Thu, 4 May 2017 15:42:21 +0200 Subject: Update copyright year --- lib/asn1/test/Makefile | 2 +- lib/asn1/test/asn1_SUITE.erl | 2 +- lib/asn1/test/asn1_SUITE_data/test_records.erl | 2 +- lib/asn1/test/asn1_SUITE_data/testobj.erl | 2 +- lib/asn1/test/asn1_app_SUITE.erl | 2 +- lib/asn1/test/asn1_test_lib.erl | 2 +- lib/asn1/test/ber_decode_error.erl | 2 +- lib/asn1/test/h323test.erl | 2 +- lib/asn1/test/testChoPrim.erl | 2 +- lib/asn1/test/testContextSwitchingTypes.erl | 2 +- lib/asn1/test/testInfObj.erl | 2 +- lib/asn1/test/testInfObjectClass.erl | 2 +- lib/asn1/test/testMultipleLevels.erl | 2 +- lib/asn1/test/testNBAPsystem.erl | 2 +- lib/asn1/test/testPrim.erl | 2 +- lib/asn1/test/testRfcs.erl | 2 +- lib/asn1/test/testSeqExtension.erl | 2 +- lib/asn1/test/testTCAP.erl | 2 +- lib/asn1/test/testTimer.erl | 2 +- lib/asn1/test/testUniqueObjectSets.erl | 2 +- lib/asn1/test/test_compile_options.erl | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index afd063aa8e..f4041fa89b 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2016. All Rights Reserved. +# Copyright Ericsson AB 1997-2017. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index d99190b6b0..5fe6945ff2 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/asn1_SUITE_data/test_records.erl b/lib/asn1/test/asn1_SUITE_data/test_records.erl index afb1c8c80b..16167e2f85 100644 --- a/lib/asn1/test/asn1_SUITE_data/test_records.erl +++ b/lib/asn1/test/asn1_SUITE_data/test_records.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% Copyright Ericsson AB 2005-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/asn1_SUITE_data/testobj.erl b/lib/asn1/test/asn1_SUITE_data/testobj.erl index 66f4a92188..b582935f73 100644 --- a/lib/asn1/test/asn1_SUITE_data/testobj.erl +++ b/lib/asn1/test/asn1_SUITE_data/testobj.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/asn1_app_SUITE.erl b/lib/asn1/test/asn1_app_SUITE.erl index c089a7267c..b06eb59ed9 100644 --- a/lib/asn1/test/asn1_app_SUITE.erl +++ b/lib/asn1/test/asn1_app_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% Copyright Ericsson AB 2005-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl index a79958d229..1cc332406b 100644 --- a/lib/asn1/test/asn1_test_lib.erl +++ b/lib/asn1/test/asn1_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2016. All Rights Reserved. +%% Copyright Ericsson AB 2008-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/ber_decode_error.erl b/lib/asn1/test/ber_decode_error.erl index c45d130ff4..e5b231a7c7 100644 --- a/lib/asn1/test/ber_decode_error.erl +++ b/lib/asn1/test/ber_decode_error.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. +%% Copyright Ericsson AB 1999-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/h323test.erl b/lib/asn1/test/h323test.erl index 41a9159335..c4eaa75c9a 100644 --- a/lib/asn1/test/h323test.erl +++ b/lib/asn1/test/h323test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. +%% Copyright Ericsson AB 1999-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testChoPrim.erl b/lib/asn1/test/testChoPrim.erl index 61b6ab2d05..91fbc1488a 100644 --- a/lib/asn1/test/testChoPrim.erl +++ b/lib/asn1/test/testChoPrim.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. +%% Copyright Ericsson AB 1997-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl index 5688d8afd6..bc7d9733b9 100644 --- a/lib/asn1/test/testContextSwitchingTypes.erl +++ b/lib/asn1/test/testContextSwitchingTypes.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl index c519c70cdf..d3ec35b652 100644 --- a/lib/asn1/test/testInfObj.erl +++ b/lib/asn1/test/testInfObj.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testInfObjectClass.erl b/lib/asn1/test/testInfObjectClass.erl index 540407fa51..02ff38e78a 100644 --- a/lib/asn1/test/testInfObjectClass.erl +++ b/lib/asn1/test/testInfObjectClass.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testMultipleLevels.erl b/lib/asn1/test/testMultipleLevels.erl index e9d83665aa..5de2c5a2fa 100644 --- a/lib/asn1/test/testMultipleLevels.erl +++ b/lib/asn1/test/testMultipleLevels.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2016. All Rights Reserved. +%% Copyright Ericsson AB 2012-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testNBAPsystem.erl b/lib/asn1/test/testNBAPsystem.erl index 8d61ca18ce..264cf5abd4 100644 --- a/lib/asn1/test/testNBAPsystem.erl +++ b/lib/asn1/test/testNBAPsystem.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% Copyright Ericsson AB 2005-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index b2933dfabc..a5d34f5f08 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. +%% Copyright Ericsson AB 1997-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testRfcs.erl b/lib/asn1/test/testRfcs.erl index 20176e35eb..502a53220e 100644 --- a/lib/asn1/test/testRfcs.erl +++ b/lib/asn1/test/testRfcs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2014-2016. All Rights Reserved. +%% Copyright Ericsson AB 2014-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testSeqExtension.erl b/lib/asn1/test/testSeqExtension.erl index be1d1c2490..f7187314ce 100644 --- a/lib/asn1/test/testSeqExtension.erl +++ b/lib/asn1/test/testSeqExtension.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. +%% Copyright Ericsson AB 1997-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testTCAP.erl b/lib/asn1/test/testTCAP.erl index a6f0f9fad7..d892863f5e 100644 --- a/lib/asn1/test/testTCAP.erl +++ b/lib/asn1/test/testTCAP.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. +%% Copyright Ericsson AB 2003-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index 3edeb1b712..e8313802e4 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index 30cbceb577..476d190651 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2014-2016. All Rights Reserved. +%% Copyright Ericsson AB 2014-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl index c15e61550c..f9997d37d0 100644 --- a/lib/asn1/test/test_compile_options.erl +++ b/lib/asn1/test/test_compile_options.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% Copyright Ericsson AB 2005-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. -- cgit v1.2.3 From e1327157189f09aa118342d0686a32fb927dca96 Mon Sep 17 00:00:00 2001 From: Kenneth Lundin Date: Tue, 4 Jul 2017 15:03:03 +0200 Subject: Corrected behavior of option {n2n, EnumTypeName} when EnumTypeName contains a hypen like fore example Cause-Misc. This caused syntax errors when compiling the generated Erlang code. --- lib/asn1/test/asn1_SUITE.erl | 12 ++++++------ lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 5fe6945ff2..f94b4278bf 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1198,14 +1198,14 @@ testComment(Config) -> testName2Number(Config) -> N2NOptions0 = [{n2n,Type} || - Type <- ['CauseMisc', 'CauseProtocol', - 'CauseRadioNetwork', - 'CauseTransport','CauseNas']], + Type <- ['Cause-Misc', 'CauseProtocol']], N2NOptions = [?NO_MAPS_MODULE|N2NOptions0], - asn1_test_lib:compile("S1AP-IEs", Config, N2NOptions), + asn1_test_lib:compile("EnumN2N", Config, N2NOptions), - 0 = 'S1AP-IEs':name2num_CauseMisc('control-processing-overload'), - 'unknown-PLMN' = 'S1AP-IEs':num2name_CauseMisc(5), + 0 = 'EnumN2N':'name2num_Cause-Misc'('control-processing-overload'), + 'unknown-PLMN' = 'EnumN2N':'num2name_Cause-Misc'(5), + 4 = 'EnumN2N':name2num_CauseProtocol('semantic-error'), + 'transfer-syntax-error' = 'EnumN2N':num2name_CauseProtocol(0), %% OTP-10144 %% Test that n2n option generates name2num and num2name functions supporting diff --git a/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 b/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 index a724f2f3f5..a610eb6230 100644 --- a/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 @@ -1,6 +1,28 @@ EnumN2N DEFINITIONS AUTOMATIC TAGS ::= BEGIN +Cause-Misc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + unknown-PLMN, +... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + + NoExt ::= ENUMERATED { blue(0), red(1), -- cgit v1.2.3 From dede6b114f0006c55f41063e73d4b28b29710b95 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 20 Jul 2017 16:06:27 +0200 Subject: asn1: Fix missing quotes of external encoding call introduced by 8e4a9864385242b962ce7446f7daa4f58cfecca5. --- lib/asn1/test/asn1_SUITE_data/ImportsFrom.asn1 | 3 ++- lib/asn1/test/asn1_SUITE_data/ImportsFrom2.asn1 | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE_data/ImportsFrom.asn1 b/lib/asn1/test/asn1_SUITE_data/ImportsFrom.asn1 index 32b8f75dde..dee3cd5048 100644 --- a/lib/asn1/test/asn1_SUITE_data/ImportsFrom.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/ImportsFrom.asn1 @@ -1,8 +1,9 @@ ImportsFrom DEFINITIONS AUTOMATIC TAGS ::= BEGIN -IMPORTS Int FROM ImportsFrom2; +IMPORTS Int, Quoted-Seq FROM ImportsFrom2; i Int ::= 42 +My-Seq ::= Quoted-Seq END diff --git a/lib/asn1/test/asn1_SUITE_data/ImportsFrom2.asn1 b/lib/asn1/test/asn1_SUITE_data/ImportsFrom2.asn1 index b0c29d24ae..a8e619e215 100644 --- a/lib/asn1/test/asn1_SUITE_data/ImportsFrom2.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/ImportsFrom2.asn1 @@ -2,6 +2,11 @@ ImportsFrom2 DEFINITIONS AUTOMATIC TAGS ::= BEGIN IMPORTS Int FROM ImportsFrom3; +Quoted-Seq ::= SEQUENCE { + x INTEGER(0..17), + y INTEGER(0..666) +} + LocalDef ::= OCTET STRING END -- cgit v1.2.3 From 5d33ec9021ff4fa8e3ffac01bdd0228871636edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 10 Aug 2017 14:52:31 +0200 Subject: Fix broken handling of default values in extensions for PER Default values have never worked in extension for PER. Note that for default values in the root part of SEQUENCE, giving a value equal to the DEFAULT value, will result in the same encoding as if asn1_DEFAULT was given. However, that behavior is not promised by the documentation. The documentation says that asn1_DEFAULT should be used for default values. For DEFAULT in extensions, only implement what the documentation promises and nothing more. ERIERL-60 --- lib/asn1/test/Makefile | 1 + lib/asn1/test/asn1_SUITE.erl | 7 +++ .../test/asn1_SUITE_data/ExtensionDefault.asn1 | 12 +++++ lib/asn1/test/testExtensionDefault.erl | 53 ++++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 lib/asn1/test/asn1_SUITE_data/ExtensionDefault.asn1 create mode 100644 lib/asn1/test/testExtensionDefault.erl (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index f4041fa89b..c38d1c6ebd 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -43,6 +43,7 @@ MODULES= \ testChoTypeRefSet \ testConstraints \ testDef \ + testExtensionDefault \ testOpt \ testSeqDefault \ testSeqExtension \ diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 5fe6945ff2..69f226bcc0 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -147,6 +147,7 @@ groups() -> testImport, testDER, testDEFAULT, + testExtensionDefault, testMvrasn6, testContextSwitchingTypes, testOpenTypeImplicitTag, @@ -444,6 +445,12 @@ testDEFAULT(Config, Rule, Opts) -> testDef:main(Rule), testSeqSetDefaultVal:main(Rule, Opts). +testExtensionDefault(Config) -> + test(Config, fun testExtensionDefault/3). +testExtensionDefault(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["ExtensionDefault"], Config, [Rule|Opts]), + testExtensionDefault:main(Rule). + testMaps(Config) -> test(Config, fun testMaps/3, [{ber,[maps,no_ok_wrapper]}, diff --git a/lib/asn1/test/asn1_SUITE_data/ExtensionDefault.asn1 b/lib/asn1/test/asn1_SUITE_data/ExtensionDefault.asn1 new file mode 100644 index 0000000000..67d9cb6312 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/ExtensionDefault.asn1 @@ -0,0 +1,12 @@ +ExtensionDefault DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Message ::= SEQUENCE { + id INTEGER (0..5), + ..., + priority Priority DEFAULT low +} +Priority ::= ENUMERATED { low(0), high(1), ... } + +END diff --git a/lib/asn1/test/testExtensionDefault.erl b/lib/asn1/test/testExtensionDefault.erl new file mode 100644 index 0000000000..cc50fa95b8 --- /dev/null +++ b/lib/asn1/test/testExtensionDefault.erl @@ -0,0 +1,53 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2017. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%% +%% +-module(testExtensionDefault). + +-export([main/1]). + +main(_Erule) -> + roundtrip('Message', {'Message',1,low}), %Will be explicitly encoded. + roundtrip('Message', {'Message',1,high}), + roundtrip('Message', {'Message',1,asn1_DEFAULT}, {'Message',1,low}), + + map_roundtrip('Message', #{id=>1,priority=>low}), %Will be explicitly encoded. + map_roundtrip('Message', #{id=>1,priority=>high}), + map_roundtrip('Message', #{id=>1}, #{id=>1,priority=>low}), + ok. + +roundtrip(Type, Value) -> + asn1_test_lib:roundtrip('ExtensionDefault', Type, Value). + +roundtrip(Type, Value, Expected) -> + %% asn1_test_lib:roundtrip/3 will invoke map_roundtrip/3, which will + %% not work in this case. Therefore, implement the roundtrip ourselves. + M = 'ExtensionDefault', + {ok,Enc} = M:encode(Type, Value), + {ok,Expected} = M:decode(Type, Enc), + ok. + +map_roundtrip(Type, Value) -> + map_roundtrip(Type, Value, Value). + +map_roundtrip(Type, Value, Expected) -> + M = 'maps_ExtensionDefault', + Enc = M:encode(Type, Value), + Expected = M:decode(Type, Enc), + ok. -- cgit v1.2.3 From 4cd39050980ad78ec60079b80a76aec5677b1a7f Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 6 Sep 2017 10:47:57 +0200 Subject: asn1: Fix test suite deprecated functions --- lib/asn1/test/asn1_SUITE.erl | 2 +- lib/asn1/test/testUniqueObjectSets.erl | 2 +- lib/asn1/test/test_modified_x420.erl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index c61cecca4c..b98a704e28 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -266,7 +266,7 @@ replace_path(PathA, PathB) -> true = code:add_patha(PathB). join(Rule, Opts) -> - string:join([atom_to_list(Rule)|lists:map(fun atom_to_list/1, Opts)], "_"). + lists:join("_", [atom_to_list(Rule)|lists:map(fun atom_to_list/1, Opts)]). %%------------------------------------------------------------------------------ %% Test cases diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index 476d190651..cabdb44a0c 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -60,7 +60,7 @@ main(CaseDir, Rule, Opts) -> Objs = [gen_obj(I) || {I,_,_} <- D1], DupObjs = [gen_dup_obj(I, T) || {I,T,_} <- D1], DupObjRefs0 = [gen_dup_obj_refs(I) || {I,_,_} <- D1], - DupObjRefs = string:join(DupObjRefs0, " |\n"), + DupObjRefs = lists:join(" |\n", DupObjRefs0), Asn1Spec = 'UniqueObjectSets', A = ["UniqueObjectSets DEFINITIONS AUTOMATIC TAGS ::=\n", "BEGIN\n\n", diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl index 6cd9e0e33b..15f7c70978 100644 --- a/lib/asn1/test/test_modified_x420.erl +++ b/lib/asn1/test/test_modified_x420.erl @@ -38,7 +38,7 @@ read_pem(File) -> extract_base64(Binary) -> - extract_base64_lines(string:tokens(binary_to_list(Binary), "\n")). + extract_base64_lines(string:lexemes(binary_to_list(Binary), "\n")). extract_base64_lines(["-----BEGIN"++_ | Lines]) -> take_base64_lines(Lines, _Acc = []); -- cgit v1.2.3 From a2f97956b21acdb345a188b174a4108959a1c1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 17 Jan 2018 11:47:45 +0100 Subject: asn1_SUITE: Fix failure in xref_export_all/1 The variable 'S' was used twice. If the test case failed because there were unused functions in asn1_SUITE, there would be an ugly badmatch exception instead of the intended nice error message. --- lib/asn1/test/asn1_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index b98a704e28..bfeffa969f 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1355,8 +1355,8 @@ xref_export_all(_Config) -> [] -> ok; [_|_] -> - S = [io_lib:format("~p:~p/~p\n", [M,F,A]) || {M,F,A} <- Unused], - io:format("There are unused functions:\n\n~s\n", [S]), + Msg = [io_lib:format("~p:~p/~p\n", [M,F,A]) || {M,F,A} <- Unused], + io:format("There are unused functions:\n\n~s\n", [Msg]), ?t:fail(unused_functions) end. -- cgit v1.2.3 From 1f4b02e1ebe8dd011feba5dc6916025e61ee7e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 16 Apr 2018 12:59:43 +0200 Subject: asn1: Eliminate use of erlang:get_stacktrace/0 Also eliminate use of erlang:get_stacktrace/0 in code generated by the ASN.1 compiler. --- lib/asn1/test/asn1_SUITE.erl | 5 ++--- lib/asn1/test/testUniqueObjectSets.erl | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index bfeffa969f..8cf6745103 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -227,10 +227,9 @@ test(Config, TestF, Rules) -> try TestF(C, R, O) catch - Class:Reason -> + Class:Reason:Stk -> NewReason = {Reason, [{rule, R}, {options, O}]}, - erlang:raise(Class, NewReason, - erlang:get_stacktrace()) + erlang:raise(Class, NewReason, Stk) end end, Result = [run_case(Config, Fun, rule(Rule), opts(Rule)) || Rule <- Rules], diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index cabdb44a0c..c75a673c4b 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -30,8 +30,7 @@ seq_roundtrip(I, D0) -> asn1_test_lib:map_roundtrip(M, 'Seq', Enc), {ok,{'Seq',I,D}} = M:decode('Seq', Enc), D - catch C:E -> - Stk = erlang:get_stacktrace(), + catch C:E:Stk -> io:format("FAILED: ~p ~p\n", [I,D0]), erlang:raise(C, E, Stk) end. -- cgit v1.2.3 From 5ca92e2eac1e84fd22f60e7abc3aa2b0ff1cb42b Mon Sep 17 00:00:00 2001 From: Henrik Nord Date: Mon, 18 Jun 2018 14:51:18 +0200 Subject: Update copyright year --- lib/asn1/test/asn1_SUITE.erl | 2 +- lib/asn1/test/testUniqueObjectSets.erl | 2 +- lib/asn1/test/test_modified_x420.erl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 8cf6745103..7b669c1c2c 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2017. All Rights Reserved. +%% Copyright Ericsson AB 2001-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index c75a673c4b..0c61da96a1 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2014-2017. All Rights Reserved. +%% Copyright Ericsson AB 2014-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl index 15f7c70978..a4b335026d 100644 --- a/lib/asn1/test/test_modified_x420.erl +++ b/lib/asn1/test/test_modified_x420.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2016. All Rights Reserved. +%% Copyright Ericsson AB 2008-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. -- cgit v1.2.3 From a473aaaa43e34705bb730b05350d6b733890e542 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 1 Aug 2018 20:38:54 +0200 Subject: Fix NIF stack recursion bug and enforce a limit Fix recursion bug when decoding Constructed value within another value - here the allowed buffer for the recursed decode shall only be the size of the enclosing value, not the whole buffer. Return ASN1_ERROR if BER decode recurses more than about 8 kWords. --- lib/asn1/test/asn1_SUITE.erl | 45 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index bfeffa969f..31b41a4ba6 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2017. All Rights Reserved. +%% Copyright Ericsson AB 2001-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -132,7 +132,8 @@ groups() -> testSeq2738, % Uses 'Constructed' {group, [], [constructed, - ber_decode_error]}, + ber_decode_error, + otp_14440]}, testSeqSetIndefinite, testChoiceIndefinite, per_open_type, @@ -737,6 +738,36 @@ ber_decode_error(Config, Rule, Opts) -> asn1_test_lib:compile("Constructed", Config, [Rule|Opts]), ber_decode_error:run(Opts). +otp_14440(_Config) -> + Args = " -pa \"" ++ filename:dirname(code:which(?MODULE)) ++ "\"", + {ok,N} = slave:start(hostname(), otp_14440, Args), + Result = rpc:call(N, ?MODULE, otp_14440_decode, []), + io:format("Decode result = ~p~n", [Result]), + case Result of + {exit,{error,{asn1,{invalid_value,5}}}} -> + ok = slave:stop(N); + %% We get this if stack depth limit kicks in: + {exit,{error,{asn1,{unknown,_}}}} -> + ok = slave:stop(N); + _ -> + _ = slave:stop(N), + ?t:fail(Result) + end. +%% +otp_14440_decode() -> + Data = + iolist_to_binary( + lists:duplicate( + 32, list_to_binary(lists:duplicate(1024, 16#7f)))), + try asn1rt_nif:decode_ber_tlv(Data) of + Result -> + {unexpected_return,Result} + catch + Class:Reason -> + {Class,Reason} + end. + + h323test(Config) -> test(Config, fun h323test/3). h323test(Config, Rule, Opts) -> Files = ["H235-SECURITY-MESSAGES", "H323-MESSAGES", @@ -1351,7 +1382,7 @@ xref_export_all(_Config) -> {ok,_} = xref:q(S, Def), {ok,Unused} = xref:q(S, "X - Called - range (closure E | Called)"), xref:stop(S), - case Unused of + case Unused -- [{?MODULE,otp_14440_decode,0}] of [] -> ok; [_|_] -> @@ -1386,3 +1417,11 @@ all_called_1([F|T]) when is_atom(F) -> L ++ all_called_1(T); all_called_1([]) -> []. + +hostname() -> + hostname(atom_to_list(node())). + +hostname([$@ | Hostname]) -> + list_to_atom(Hostname); +hostname([_C | Cs]) -> + hostname(Cs). -- cgit v1.2.3 From 7c79f91fd5878c31c302015f5fc7fec51e4e7977 Mon Sep 17 00:00:00 2001 From: Kenneth Lundin Date: Tue, 4 Dec 2018 09:40:41 +0100 Subject: Handle erroneous length during decode (BER only) without crashing --- lib/asn1/test/asn1_SUITE.erl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 5506923341..ab78678110 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -63,7 +63,8 @@ groups() -> constraint_equivalence]}, {ber, Parallel, - [ber_choiceinseq, + [ber_decode_invalid_length, + ber_choiceinseq, % Uses 'SOpttest' ber_optional, tagdefault_automatic]}, @@ -665,6 +666,19 @@ module_test(M0, Config, Rule, Opts) -> end end. +ber_decode_invalid_length(_Config) -> + Bin = <<48,129,157,48,0,2,1,2,164,0,48,129,154,49,24,48,22,6, + 3,85,4,10,19,15,69,120,97,109,112,108,101,32,67,111, + 109,112,97,110,121,49,29,48,27,6,9,42,134,72,134,247, + 13,1,9,1,22,14,99,97,64,101,120,97,109,112,108,101,46, + 99,111,109,49,13,48,11,6,3,85,4,7,19,4,79,117,108,117, + 49,26,48,24,6,3,85,4,8,19,17,80,111,104,106,111,105, + 115,45,80,111,104,106,97,110,109,97,97,49,11,48,9,6,3, + 85,4,6,19,2,70,73,49,19,48,17,6,3,85,4,3,19,10,69,120, + 97,109,112,108,101,32,67,65,49,11,48,16,6,3,85,4,11, + 19,9,84,101>>, + {'EXIT',{error,{asn1,{invalid_value,12}}}} = (catch asn1rt_nif:decode_ber_tlv(Bin)), + ok. ber_choiceinseq(Config) -> test(Config, fun ber_choiceinseq/3, [ber]). -- cgit v1.2.3