/* ETSI Software License
* As long as the here under conditions are respected, non-exclusive permission is hereby granted,
* free of charge, to use, reproduce and modify this software source code, under the following conditions:
* This source code is provided AS IS with no warranties, express or implied, including but not limited to,
* the warranties of merchant ability, fitness for a particular purpose and warranties for non-infringement
* of intellectual property rights.
* ETSI shall not be held liable in any event for any direct or indirect damages whatsoever (including, without
* limitation, damages for loss of profits, business interruption, loss of information, or any other pecuniary
* loss) arising out of or related to the use of or inability to use the source code.
* This permission is granted to facilitate the implementation of the related ETSI standard, provided that
* ETSI is given the right to use, reproduce and amend the modified source code under the same conditions
* as the present permission.
* This permission does not apply to any documentation associated with this source code for which ETSI keeps
* all rights reserved.
* The present ETSI Source Code license shall be included in all copies of whole or part of this source code
* and shall not imply any sub-license right.
* (c) ETSI 2023-2024 
*/
 
 
Package Ngnas_Common {
    Domain {
        pics:
            - NONE
            //5G NAS PICS
            - PICS_A2/1		//AMF
            - PICS_A3/1  	//5GMM-DEREGISTERED
            - PICS_A3/2  	//5GMM-COMMON-PROCEDURE-INITIATED
            - PICS_A3/3  	//5GMM-REGISTERED
            - PICS_A3/4  	//5GMM-DEREGISTERED-INITIATED
            - PICS_A3/5  	//5GSM-PDU SESSION INACTIVE
            - PICS_A3/6  	//5GSM-PDU SESSION ACTIVE
            - PICS_A3/7  	//5GSM-PDU SESSION INACTIVE PENDING
            - PICS_A3/8  	//5GSM-PDU SESSION MODIFICATION PENDING
            - PICS_A3/9  	//5GSM-PROCEDURE TRANSACTION INACTIVE
            - PICS_A3/10  	//5GSM-PROCEDURE TRANSACTION PENDING
            - PICS_A4/1  	//5GMM-Primary authentication and key agreement procedures
            - PICS_A4/1_1  	//Initiation and control of the EAP based primary authentication and key agreement procedures
            - PICS_A4/1_2  	//Initiation and control of the 5G AKA based primary authentication and key agreement procedures
            - PICS_A4/1_2_1_1  	//Provision of new authentication parameters to the UE on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure"
            - PICS_A4/1_2_1_2  	//Termination of the 5G AKA based primary authentication and key agreement procedure with AUTHENTICATION REJECT on receipt of two consecutive AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure"
            - PICS_A4/1_2_2_1  	//Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure"
            - PICS_A4/1_2_2_2  	//Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure"
            - PICS_A4/1_2_3_1  	//Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable"
            - PICS_A4/1_2_3_2  	//Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable"
            - PICS_A4/1_2_4  	//Re-initiation of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #71 "ngKSI already in use"
            - PICS_A4/2  	//Security mode control procedures
			- PICS_A4/2_1  	//Initiation of the security mode control procedure to take a 5G NAS security context into use, and initialise and start NAS signalling security
			- PICS_A4/2_2  	//Initiation of the security mode control procedure to change the 5G NAS security algorithms for a current 5G NAS security context already in use
			- PICS_A4/2_3  	//Initiation of the security mode control procedure to change the value of uplink NAS COUNT used in the latest SECURITY MODE COMPLETE message
			- PICS_A4/2_4  	//Initiation of the security mode control procedure to provide the Selected EPS NAS security algorithms to the UE
            - PICS_A4/3  	//Identification procedures
            - PICS_A4/4  	//Generic UE configuration update procedures    
            - PICS_A4/4_1  	//Sending of CONFIGURATION UPDATE COMMAND messages to the UE?      
            - PICS_A4/5  	//NAS transport procedures
            - PICS_A4/5_1  	//UE-initiated NAS transport procedures (receipt of UL NAS TRANSPORT messages)
            - PICS_A4/5_1_1  	//Sending back to the UE 5GSM messages which were not forwarded due to abnormal case on the network side
            - PICS_A4/5_2  	//Network-initiated NAS transport procedures (sending of DL NAS TRANSPORT messages)
            - PICS_A4/6  	//5GMM status procedures
            - PICS_A4/7  	//Network slice-specific authentication and authorization procedures
            - PICS_A4/8  	//Registration procedures
            - PICS_A4/8_1  	//Initial registration procedures
            - PICS_A4/8_1_1_1  	//Initiation of 5GMM common procedures during the initial registration procedure
            - PICS_A4/8_1_1_2  	//Skipping of the authentication procedure during an (initial) emergency registration procedure, if the AMF is configured to support emergency registration for unauthenticated SUCIs
            - PICS_A4/8_1_2_1  	//Inclusion of service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message
            - PICS_A4/8_1_2_2  	//Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message
            - PICS_A4/8_1_2_3  	//Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message
            - PICS_A4/8_1_2_4  	//Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message
            - PICS_A4/8_1_3  	//SMS over NAS in initial registration
            - PICS_A4/8_1_4  	//MICO mode in initial registration i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message
            - PICS_A4/8_2  	//Registration procedures for mobility and periodic registration update
            - PICS_A4/8_2_1_1  	//Initiation of 5GMM common procedures during the mobility and periodic registration update procedure
            - PICS_A4/8_2_1_2  	//Skipping of the authentication procedure during the registration procedure for mobility and periodic registration update for a UE that has only an emergency PDU session
            - PICS_A4/8_2_2_1  	//Inclusion of a new TAI list for the UE in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_2_2  	//Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_2_3  	//Inclusion of new service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_2_4  	//Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_2_5  	//Inclusion of the LADN information IE in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_2_6  	//Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message
            - PICS_A4/8_2_3  	//SMS over NAS in mobility and periodic registration updates
            - PICS_A4/8_2_4  	//MICO mode in mobility and periodic registration updates i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message
            - PICS_A4/9  	//Deregistration procedures
            - PICS_A4/9_1  	//UE-initiated deregistration procedures
            - PICS_A4/9_2  	//Network-initiated deregistration procedures
            - PICS_A4/9_2_1  	//Inclusion of the 5GMM cause IE to specify the reason for the deregistration in the DEREGISTRATION REQUEST message
            - PICS_A4/10  	//Service request procedures
            - PICS_A4/10_1  	//Initiation of common procedures during the service request procedure (receipt of SERVICE REQUEST or CONTROL PLANE SERVICE REQUEST message)
            - PICS_A4/11  	//Paging procedures
            - PICS_A4/11_1  	//Re-initiation of network paging on expiry of timer T3513
            - PICS_A4/12  	//Notification procedures
            - PICS_A5/1  	//PDU session authentication and authorization procedures
            - PICS_A5/2  	//Network-requested PDU session modification procedures
            - PICS_A5/3  	//Network-requested PDU session release procedures
            - PICS_A5/6  	//UE-requested PDU session establishment procedures
            - PICS_A5/6_1  	//Inclusion of the Back-off timer value IE in the PDU SESSION ESTABLISHMENT REJECT message, if a PDU session establishment procedure is not accepted by the network
            - PICS_A5/7  	//UE-requested PDU session modification procedures
            - PICS_A5/7_1  	//Inclusion of the Back-off timer value IE in the PDU SESSION MODIFICATION REJECT message, if a PDU session modification procedure is not accepted by the network
            - PICS_A5/8  	//UE-requested PDU session release procedures
            - PICS_A5/9  	//5GMM status procedures
            - PICS_A5/10  	//Exchange of extended protocol configuration options
            - PICS_A6/1  	//Procedures for handling of unknown, unforeseen, and erroneous protocol data?
            - PICS_A6/1_1  	//Handling (i.e., ignoring) of messages that are too short to contain a complete message type information element
            - PICS_A6/1_2_1  	//Handling of an unknown, erroneous, or unforeseen PTI received in a 5GSM message
            - PICS_A6/1_2_2  	//Handling of an unknown, erroneous, or unforeseen PDU session identity received in the header of a 5GSM message
            - PICS_A6/1_3  	//Sending of a 5GMM STATUS or 5GSM STATUS message (depending on the EPD) with cause #97 "message type non-existent or not implemented" on receipt of a message with message type not defined for the EPD or not implemented by the receiver
            - PICS_A6/1_4_1  	//Treating messages (see note) received with non-semantical mandatory information element errors
            - PICS_A6/1_4_2  	//Ignoring messages (see note) received with non-semantical mandatory information element errors
            - PICS_A6/1_4_3  	//Rejection of PDU SESSION ESTABLISHMENT REQUEST, PDU SESSION MODIFICATION REQUEST, and PDU SESSION RELEASE REQUEST messages with cause #96 "invalid mandatory information" when an error is encountered with a mandatory information element in the 5GSM message
            - PICS_A6/1_5  	//Handling of messages containing unknown or unforeseen (out of sequence, repeated) IEs in the non-imperative message part
            - PICS_A6/1_6_1  	//Treating messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE
            - PICS_A6/1_6_2  	//Ignoring messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE
            - PICS_A6/1_6_2_1  	//Returning a status message (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #100 "conditional IE error" when ignoring a message received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE
            - PICS_A6/1_7  	//Responding to messages (where a reaction is foreseen) with semantically incorrect contents with status messages (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #95 "semantically incorrect message

        ;
        entities:
            - UE
            - GNB
            - AMF
            - IUT
        ;
        events:
            - receives
            - sends
            - forwards
            - isRequestedToPlaceACall
            - aborts
            // Initial conditions
            - isNotRegisteredTo
            - hasAchievedFirstRegistration
            - isRegisteredTo
            - isNotAttachedTo
            - isAttachedTo
            - isNotConfiguredForTopologyHiding
            - isConfiguredForTopologyHiding
            - isExistingIn
            - isNotAppropriateToServe
            - establishedSecurityRelation
            - registeredIdentityTelURI
            - registeredIdentitySipURI
            - hasInitiatedDialogWith
            - hasInitiatedPS2CSinEarlydialog
            - hasInitiatedPS2CSinAlertingState
            - hasEstablishedDialog
            - hasEstablishedPS2CSDialog
            - hasEstablishedInitialContext
            - hasEstablishedRRCConnection
            - hasEstablishedContextInproperly
            - hasEstablishedPDUsessionWithSameId
            - hasEstablishedPDUsession
            - isConfiguredWithENUMentryForTelURI_E164NumberOf
            - hasReceivedInitialRequestForDialog
            - hasReceived200OkOnInitialRequestForDialogWith
            - hasReceived180OnInitialRequest
            - hasReceived200OkCancel
            - hasReceivedTerminatedRequest
            - hasReceivedNASMessage
            - hasReceivedPAGINGMessage
            - hasReceivedOVERLOADSTARTtMessage
            - hasSuspendedContext
            - hasPendingDataTransmission
            - registeredPublicIdsWithTelUriAndSipUri
            - hasReceivedSubsequentOrTargetRefreshRequestInDialog
            - previouslyEstablishedCallWith
            - isRequestedToSend
            - isRequestedToDeregisterUser
            - isBusy
            - isNoLongerAvailable
            - isTriggeredToDetachUser
            - isRequestedToDetachfromNetwork
            - isTransitioningTo
            - hasAchievedFirstREGISTER
            - hasResponded486INVITE
            - hasAchievedInitialINVITE
            - hasAchievedINVITE
            - hasAchievedUPDATEuponINVITE
            - timerOperatorSpecificTimeout //NOTE: 8 seconds is an appropriate value for the operator policy.
            - isAttachingToNetwork
            - hasDoneSubscription
            - indicate
            - trigger
            - isCMIDLE
            - isCMCONNECTED
            - alreadyPreparedHandover
            - completedHandover
            - isInOverloadedState
        ;
        event templates:
        /* This template can be used as default AUTHENTICATION REQUEST message within a DOWNLINK NAS TRANSFER message. */
            - AUTHENTICATION_REQUEST {
                the IUT entity sends an DOWNLINK_NAS_TRANSFER containing
						NAS_PDU containing
							extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values 
							security_header_type set to NOT_SECURITY_PROTECTED,
							spare_half_octet,
							authentication_request_message_identity set to AUTHENTICATION_REQUEST,
							ngKSI containing
								nas_key_set_identifier set to "111"
							;,
							spare_half_octet,
							ABBA,
                            Authentication_parameter_RAND,
                            Authentication_parameter_AUTN
						;
				;
				to the UE entity
            }
        ;
    } // End of Domain section

    Data {
    	
        type NgapMessage;
        type Cause;
        type Bitstring;
        type PIXIT;

        PIXIT PX_WRONG_ARP_IEI; //0x20
        PIXIT PX_WRONG_ARP_IEI; //0x20
        
        //Table 8.1-1     
        NgapMessage AMF_CONFIGURATION_UPDATE;
        NgapMessage AMF_CONFIGURATION_UPDATE_ACKNOWLEDGE;
        NgapMessage AMF_CONFIGURATION_UPDATE_FAILURE;
        NgapMessage RAN_CONFIGURATION_UPDATE;
        NgapMessage RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE;
        NgapMessage RAN_CONFIGURATION_UPDATE_FAILURE;
        NgapMessage HANDOVER_CANCEL;
        NgapMessage HANDOVER_CANCEL_ACKNOWLEDGE;
        NgapMessage HANDOVER_REQUIRED;
        NgapMessage HANDOVER_COMMAND;
        NgapMessage HANDOVER_PREPARATION_FAILURE;
        NgapMessage HANDOVER_REQUEST ;
        NgapMessage HANDOVER_REQUEST_ACKNOWLEDGE;
        NgapMessage HANDOVER_FAILURE;
        NgapMessage INITIAL_CONTEXT_SETUP_REQUEST;
        NgapMessage INITIAL_CONTEXT_SETUP_RESPONSE;
        NgapMessage INITIAL_CONTEXT_SETUP_FAILURE;
        NgapMessage NG_RESET;
        NgapMessage NG_RESET_ACKNOWLEDGE;
        NgapMessage NG_SETUP_REQUEST;
        NgapMessage NG_SETUP_RESPONSE; 
        NgapMessage NG_SETUP_FAILURE;
        NgapMessage PATH_SWITCH_REQUEST;
        NgapMessage PATH_SWITCH_REQUEST_ACKNOWLEDGE;
        NgapMessage PATH_SWITCH_REQUEST_FAILURE;
        NgapMessage PDU_SESSION_RESOURCE_MODIFY_REQUEST;
        NgapMessage PDU_SESSION_RESOURCE_MODIFY_RESPONSE;
        NgapMessage PDU_SESSION_RESOURCE_MODIFY_INDICATION;
        NgapMessage PDU_SESSION_RESOURCE_MODIFY_CONFIRM;
        NgapMessage PDU_SESSION_RESOURCE_RELEASE_COMMAND;
        NgapMessage PDU_SESSION_RESOURCE_RELEASE_RESPONSE;
        NgapMessage PDU_SESSION_RESOURCE_SETUP_REQUEST;
        NgapMessage PDU_SESSION_RESOURCE_SETUP_RESPONSE;
        NgapMessage UE_CONTEXT_MODIFICATION_REQUEST;
        NgapMessage UE_CONTEXT_MODIFICATION_RESPONSE;
        NgapMessage UE_CONTEXT_MODIFICATION_FAILURE;
        NgapMessage UE_CONTEXT_RELEASE_COMMAND;
        NgapMessage UE_CONTEXT_RELEASE_COMPLETE;
        NgapMessage WRITE_REPLACE_WARNING_REQUEST;
        NgapMessage WRITE_REPLACE_WARNING_RESPONSE;
        NgapMessage PWS_CANCEL_REQUEST;
        NgapMessage PWS_CANCEL_RESPONSE;
        NgapMessage UE_RADIO_CAPABILITY_CHECK_REQUEST;
        NgapMessage UE_RADIO_CAPABILITY_CHECK_RESPONSE;
        NgapMessage UE_CONTEXT_SUSPEND_REQUEST;
        NgapMessage UE_CONTEXT_SUSPEND_RESPONSE;
        NgapMessage UE_CONTEXT_SUSPEND_FAILURE;
        NgapMessage UE_CONTEXT_RESUME_REQUEST;
        NgapMessage UE_CONTEXT_RESUME_RESPONSE;
        NgapMessage UE_CONTEXT_RESUME_FAILURE;
        NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST;
        NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_RESPONSE;
        
        //Table 8.1-2
        NgapMessage DOWNLINK_RAN_CONFIGURATION_TRANSFER;
        NgapMessage DOWNLINK_RAN_STATUS_TRANSFER;
        NgapMessage DOWNLINK_NAS_TRANSPORT;
        NgapMessage ERROR_INDICATION;
        NgapMessage UPLINK_RAN_CONFIGURATION_TRANSFER;
        NgapMessage UPLINK_RAN_STATUS_TRANSFER;
        NgapMessage HANDOVER_NOTIFY;
        NgapMessage INITIAL_UE_MESSAGE;
        NgapMessage NAS_NON_DELIVERY_INDICATION;
        NgapMessage PAGING;
        NgapMessage PDU_SESSION_RESOURCE_NOTIFY;
        NgapMessage REROUTE_NAS_REQUEST;
        NgapMessage UE_CONTEXT_RELEASE_REQUEST;
        NgapMessage UPLINK_NAS_TRANSPORT;
        NgapMessage AMF_STATUS_INDICATION;
        NgapMessage PWS_RESTART_INDICATION;
        NgapMessage PWS_FAILURE_INDICATION;
        NgapMessage DOWNLINK_UE_ASSOCIATED_NRPPA_TRANSPORT;
        NgapMessage UPLINK_UE_ASSOCIATED_NRPPA_TRANSPORT;
        NgapMessage DOWNLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT;
        NgapMessage UPLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT;
        NgapMessage TRACE_START;
        NgapMessage TRACE_FAILURE_INDICATION;
        NgapMessage DEACTIVATE_TRACE;
        NgapMessage CELL_TRAFFIC_TRACE;
        NgapMessage LOCATION_REPORTING_CONTROL;
        NgapMessage LOCATION_REPORTING_FAILURE_INDICATION;
        NgapMessage LOCATION_REPORT;
        NgapMessage UE_TNLA_BINDING_RELEASE_REQUEST;
        NgapMessage UE_RADIO_CAPABILITY_INFO_INDICATION;
        NgapMessage RRC_INACTIVE_TRANSITION_REPORT;
        NgapMessage OVERLOAD_START;
        NgapMessage OVERLOAD_STOP;
        NgapMessage SECONDARY_RAT_DATA_USAGE_REPORT;
        NgapMessage UPLINK_RIM_INFORMATION_TRANSFER;
        NgapMessage DOWNLINK_RIM_INFORMATION_TRANSFER;
        NgapMessage RETRIEVE_UE_INFORMATION;
        NgapMessage UE_INFORMATION_TRANSFER;
        NgapMessage RAN_CP_RELOCATION_INDICATION;
        NgapMessage CONNECTION_ESTABLISHMENT_INDICATION;
        NgapMessage AMF_CP_RELOCATION_INDICATION;
        NgapMessage HANDOVER_SUCCESS;
        NgapMessage UPLINK_RAN_EARLY_STATUS_TRANSFER;
        NgapMessage DOWNLINK_RAN_EARLY_STATUS_TRANSFER;

        NgapMessage SECURITY_MODE_COMPLETE;
        NgapMessage SECURITY_MODE_REJECT;

        //Table 8.2
        NgapMessage AUTHENTICATION_REQUEST;
        NgapMessage AUTHENTICATION_RESPONSE;
        
        // Table 9.3.1: Security header type
        Bitstring PLAIN_5GS_NAS_MESSAGE; // 0 0 0 0 , not security protected
        Bitstring INTEGRITY_PROTECTED; // 0 0 0 1
        Bitstring INTEGRITY_PROTECTED_AND_CIPHERED; // 0 0 1 0
        Bitstring INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT; // 0 0 1 1
        Bitstring INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_5G_NAS_SECURITY_CONTEXT; // 0 1 0 0

        //Section 9.11.3.2
        Cause MAC_failure; 

        
                
    } // End of Data section
          
        Configuration {
            Interface Type defaultGT accepts NgapMessage;
            Component Type NgapComponent with gate g of type defaultGT;
            Component Type NgapComponent with gate g2 of type defaultGT;
            
            
            Test Configuration CF_GNB_N2N1 
                containing 
                    Tester component AMF of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between AMF.g and IUT.g;
                    
            Test Configuration CF_AMF_N2N1
                containing 
                    Tester component GNB of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between GNB.g and IUT.g;
            
            
            Test Configuration CF_GNB_2N2 
                containing 
                    Tester component AMF of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between AMF.g and IUT.g;
                    
            Test Configuration CF_AMF_2N2 
                containing 
                    Tester component GNB of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between GNB.g and IUT.g;
            
            
            Test Configuration CF_GNB_N2N1 
                containing 
                    Tester component AMF of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between AMF.g and IUT.g;
                    
            Test Configuration CF_AMF_N2N1
                containing 
                    Tester component GNB of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between GNB.g and IUT.g;
            
            
            Test Configuration CF_GNB_2N2N1 
                containing 
                    Tester component AMF of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between AMF.g and IUT.g;
                    
            Test Configuration CF_AMF_2N2N1 
                containing 
                    Tester component GNB of type NgapComponent
                    SUT component IUT of type NgapComponent
                    connection between GNB.g and IUT.g;
                    
        }
    
    
} // End of Package Ngnas_Common

