Initial commit

Signed-off-by: Gabor Szalai <gabor.szalai@ericsson.com>
diff --git a/5G_system_TS32291_Nchf_CNL113894.tpd b/5G_system_TS32291_Nchf_CNL113894.tpd
new file mode 100644
index 0000000..aa93641
--- /dev/null
+++ b/5G_system_TS32291_Nchf_CNL113894.tpd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>5G_system_TS32291_Nchf_CNL113894</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="5G_system_TS29571_CommonData_CNL113880" projectLocationURI="../5G_system_TS29571_CommonData_CNL113880/5G_system_TS29571_CommonData_CNL113880.tpd"/>
+  </ReferencedProjects>
+  <Folders>
+    <FolderResource projectRelativePath="src" relativeURI="src"/>
+  </Folders>
+  <Files>
+    <FileResource projectRelativePath="src/TS32291_Nchf_ConvergedCharging.ttcn" relativeURI="src/TS32291_Nchf_ConvergedCharging.ttcn"/>
+  </Files>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <GNUMake>true</GNUMake>
+          <incrementalDependencyRefresh>true</incrementalDependencyRefresh>
+          <targetExecutable>bin/5G_system_TS32291_Nchf_CNL113894</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
\ No newline at end of file
diff --git a/doc/5G_system_TS29572_Nlmf_Description.adoc b/doc/5G_system_TS29572_Nlmf_Description.adoc
new file mode 100644
index 0000000..ec55f1b
--- /dev/null
+++ b/doc/5G_system_TS29572_Nlmf_Description.adoc
@@ -0,0 +1,73 @@
+= 5G system TS32291 Nchf Protocol Modules for TTCN-3 Toolset with TITAN, Description
+:author: Gábor Szalai
+:toc: left
+
+== About This Document
+
+This is the description for the 5G system TS32291 Nchf protocol module. The 5G system TS32291 Nchf protocol modules are developed for the TTCN-3 Toolset with Titan. 
+
+== Functionality
+
+The 5G system TS32291 Nchf protocol module implements the object structures of the 3GPP TS 32291 v15.1.0<<_5, [5]>> in a formalized way, using the standard specification language TTCN-3. This allows defining of test data (templates) in the TTCN-3 language and correctly encoding/decoding messages when executing test suites using the Titan TTCN-3 test environment.
+The 5G system TS32291 Nchf protocol module uses Titan’s JSON encoding <<_3, [3]>> and hence is usable with the Titan test toolset only.
+
+=== System Requirements
+Protocol modules are a set of TTCN-3 source code files that can be used as part of TTCN-3 test suites only. Hence, protocol modules alone do not put specific requirements on the system used. However, in order to compile and execute a TTCN-3 test suite using the set of protocol modules the following system requirements must be satisfied:
+
+* Titan TTCN-3 Test Executor version CRL 113 200/6 R5A (6.5.pl0) or higher installed. For Installation Guide see <<_2, [2]>>. Please note: This version of the test port is not compatible with Titan releases earlier than CRL 113 200/6 R5A.
+
+=== Installation
+The set of protocol modules can be used in developing TTCN-3 test suites using any text editor. Since the 5G system TS32291 Nchf protocol is used as a part of a TTCN-3 test suite, this requires TTCN-3 Test Executor be installed before the module can be compiled and executed together with other parts of the test suite. For more details on the installation of TTCN-3 Test Executor see the relevant section of <<_2, [2]>>.
+
+== Interface description
+
+=== Encoding/decoding and other related functions
+This product also contains encoding/decoding functions, which assure correct encoding of messages when sent from Titan and correct decoding of messages when received by Titan. 
+
+==== Implemented encoding and decoding functions
+
+[source]
+----
+Name	Type of formal parameters	Type of return value
+f_enc_ChargingDataRequest(in ChargingDataRequest pdu) return octetstring 
+f_dec_ChargingDataRequest(in octetstring stream, out ChargingDataRequest pdu) return integer 
+f_enc_ChargingDataResponse(in ChargingDataResponse pdu) return octetstring 
+f_dec_ChargingDataResponse(in octetstring stream, out ChargingDataResponse pdu) return integer 
+f_enc_ChargingNotification(in ChargingNotification pdu) return octetstring 
+f_dec_ChargingNotification(in octetstring stream, out ChargingNotification pdu) return integer 
+----
+
+== Usage
+
+The protocol module provides abstract data types for JSON objects used by the services defined in the standard <<_5, [5]>>. The protocol module provides encoder and decoder functions for the JSON objects. The decoder function validates the received JSON object based on the JSON schema as well. Only the validated JSON value is decoded.
+
+== Terminology	
+
+=== Abbreviations
+
+JSON:: JavaScript Object Notation
+
+PDU:: Protocol Data Unit
+
+TTCN-3:: Testing and Test Control Notation version 3
+
+== References
+
+[[_1]]
+[1]	ETSI ES 201 873-1 v4.4.1 (2012-04) +
+The Testing and Test Control Notation version 3. Part 1: Core Language
+
+[[_2]]
+[2]	1/ 198 17-CRL 113 200/6 Uen +
+Installation Guide for the TITAN TTCN-3 Test Executor
+
+[[_3]]
+[3]	2/198 17-CRL 113 200/6 Uen +
+Programmer's Technical Reference for Titan TTCN-3 Test Executor
+
+[[_4]]
+[4]	https://www.json.org
+
+[[_5]]
+[5] 3GPP TS 32291 v15.1.0+
+Telecommunication management; Charging management; 5G system, charging service; Stage 3
diff --git a/doc/change.log b/doc/change.log
new file mode 100644
index 0000000..eca83da
--- /dev/null
+++ b/doc/change.log
@@ -0,0 +1,9 @@
+= 5G system TS32291 Nchf Protocol Modules for TTCN-3 Toolset with TITAN, Change log

+:author: Gábor Szalai

+:toc: left

+

+== Changes

+

+=== R1A

+

+Initial revision
\ No newline at end of file
diff --git a/src/TS32291_Nchf_ConvergedCharging.ttcn b/src/TS32291_Nchf_ConvergedCharging.ttcn
new file mode 100644
index 0000000..f0a3950
--- /dev/null
+++ b/src/TS32291_Nchf_ConvergedCharging.ttcn
@@ -0,0 +1,443 @@
+/******************************************************************************
+* Copyright (c) 2000-2019  Ericsson AB
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v2.0
+* which accompanies this distribution, and is available at
+* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
+*
+* Contributors:
+*   Gabor Szalai - initial implementation and initial documentation
+******************************************************************************/
+//
+//  File:               TS32291_Nchf_ConvergedCharging.ttcn
+//  Description:	      Type definitions for 3GPP TS32291
+/////////////////////////////////////////////// 
+module TS32291_Nchf_ConvergedCharging {
+
+  import from TS29571_CommonData all
+
+external function f_enc_ChargingDataRequest(in ChargingDataRequest pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_ChargingDataRequest(in octetstring stream, out ChargingDataRequest pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_ChargingDataResponse(in ChargingDataResponse pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_ChargingDataResponse(in octetstring stream, out ChargingDataResponse pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_ChargingNotification(in ChargingNotification pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_ChargingNotification(in octetstring stream, out ChargingNotification pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+
+  type set ChargingDataRequest {
+    TS29571_CommonData.Supi    subscriberIdentifier optional,
+    NFConsumerIdentification    nfConsumerIdentification,
+    TS29571_CommonData.DateTime    invocationTimeStamp,
+    TS29571_CommonData.Uint32    invocationSequenceNumber,
+    TS29571_CommonData.Uri    notifyUri optional,
+    set of       MultipleUnitUsage    multipleUnitUsage optional,
+    set of       Trigger    triggers optional,
+    PDUSessionChargingInformation    pDUSessionChargingInformation optional,
+    RoamingQBCInformation    roamingQBCInformation optional
+  }
+
+  type set ChargingDataResponse {
+    TS29571_CommonData.DateTime    invocationTimeStamp,
+    TS29571_CommonData.Uint32    invocationSequenceNumber,
+    InvocationResult    invocationResult,
+    SessionFailover    sessionFailover optional,
+    set of       MultipleQuotaInformation    multipleQuotaInformation optional,
+    set of       Trigger    triggers optional,
+    PDUSessionChargingInformation    pDUSessionChargingInformation optional,
+    RoamingQBCInformation    roamingQBCInformation optional
+  }
+
+  type set ChargingNotification {
+    NotificationType    notificationType,
+    set of       ReauthorizationDetails    reauthorizationDetails optional
+  }
+
+  type set NFConsumerIdentification {
+    TS29571_CommonData.NfInstanceId    nFName,
+    TS29571_CommonData.Ipv4Addr    nFIPv4Address,
+    TS29571_CommonData.Ipv6Addr    nFIPv6Address,
+    TS29571_CommonData.PlmnId    nFPLMNID optional,
+    NodeFunctionality    nodeFunctionality
+  }
+
+  type set MultipleUnitUsage {
+    RatingGroupId    ratingGroup,
+    RequestedUnit    requestedUnit optional,
+    set of       UsedUnitContainer    UsedUnitContainer optional,
+    TS29571_CommonData.NfInstanceId    uPFID optional
+  }
+
+  type set InvocationResult {
+    TS29571_CommonData.ProblemDetails    error_,
+    FailureHandling    failureHandling optional
+  } with {
+    variant (error_) "name as 'error'"
+  }
+
+  type set Trigger {
+    TriggerType    triggerType,
+    TriggerCategory    category optional,
+    TS29571_CommonData.DurationSec    timeLimit optional,
+    TS29571_CommonData.Uint32    volumeLimit optional,
+    TS29571_CommonData.Uint32    maxNumberOfccc optional
+  }
+
+  type set MultipleQuotaInformation {
+    ResultCode    resultCode optional,
+    RatingGroupId    ratingGroup,
+    GrantedUnit    grantedUnit optional,
+    set of       Trigger    triggers optional,
+    TS29571_CommonData.DateTime    validityTime optional,
+    TS29571_CommonData.DurationSec    quotaHoldingTime optional,
+    FinalUnitIndication    finalUnitIndication optional,
+    integer timeQuotaThreshold optional,
+    integer volumeQuotaThreshold optional,
+    integer unitQuotaThreshold optional,
+    TS29571_CommonData.NfInstanceId    uPFID optional
+  }
+
+  type set RequestedUnit {
+    TS29571_CommonData.Uint32    time optional,
+    TS29571_CommonData.Uint64    totalVolume optional,
+    TS29571_CommonData.Uint64    uplinkVolume optional,
+    TS29571_CommonData.Uint64    downlinkVolume optional,
+    TS29571_CommonData.Uint64    serviceSpecificUnits optional
+  }
+
+  type set UsedUnitContainer {
+    ServiceId    serviceId optional,
+    QuotaManagementIndicator    quotaManagementIndicator optional,
+    set of       Trigger    triggers optional,
+    TS29571_CommonData.DateTime    triggerTimestamp optional,
+    TS29571_CommonData.Uint32    time optional,
+    TS29571_CommonData.Uint64    totalVolume optional,
+    TS29571_CommonData.Uint64    uplinkVolume optional,
+    TS29571_CommonData.Uint64    downlinkVolume optional,
+    TS29571_CommonData.Uint64    serviceSpecificUnits optional,
+    TS29571_CommonData.DateTime    eventTimeStamps optional,
+    integer localSequenceNumber,
+    PDUContainerInformation    pDUContainerInformation optional
+  }
+
+  type set GrantedUnit {
+    TS29571_CommonData.DateTime    tariffTimeChange optional,
+    TS29571_CommonData.Uint32    time optional,
+    TS29571_CommonData.Uint64    totalVolume optional,
+    TS29571_CommonData.Uint64    uplinkVolume optional,
+    TS29571_CommonData.Uint64    downlinkVolume optional,
+    TS29571_CommonData.Uint64    serviceSpecificUnits optional
+  }
+
+  type set FinalUnitIndication {
+    FinalUnitAction    finalUnitAction,
+    IPFilterRule    restrictionFilterRule optional,
+    charstring filterId optional,
+    RedirectServer    redirectServer optional
+  }
+
+  type set RedirectServer {
+    RedirectAddressType    redirectAddressType,
+    charstring redirectServerAddress
+  }
+
+  type set ReauthorizationDetails {
+    ServiceId    serviceIdentifier optional,
+    RatingGroupId    ratingGroup,
+    QuotaManagementIndicator    quotaManagementIndicator optional
+  }
+
+  type set PDUSessionChargingInformation {
+    charstring chargingId optional,
+    UserInformation    userInformation,
+    TS29571_CommonData.UserLocation    userLocationinfo optional,
+    TS29571_CommonData.DateTime    userLocationTime optional,
+    set of record {
+      universal charstring key,
+      TS29571_CommonData.PresenceInfo    additionalProperties
+    } presenceReportingAreaInformation optional,
+    TS29571_CommonData.TimeZone    uetimeZone optional,
+    PDUSessionInformation    pduSessionInformation,
+    TS29571_CommonData.DurationSec    unusedQuotaTimer optional
+  } with {
+    variant (presenceReportingAreaInformation) "as map"
+  }
+
+
+  type set UserInformation {
+    TS29571_CommonData.Gpsi    servedGPSI,
+    TS29571_CommonData.Pei    servedPEI optional,
+    boolean unauthenticatedFlag optional,
+    RoamerInOut    roamerInOut optional
+  }
+
+  type set PDUSessionInformation {
+    NetworkSlicingInfo    networkSlicingInfo optional,
+    TS29571_CommonData.PduSessionId    pduSessionID,
+    TS29571_CommonData.PduSessionType    pduType optional,
+    TS29571_CommonData.SscMode    sscMode optional,
+    TS29571_CommonData.PlmnId    hPlmnId optional,
+    set of       TS29571_CommonData.AmfId    servingNodeID optional,
+    ServingNetworkFunctionID    servingNetworkFunctionID optional,
+    TS29571_CommonData.RatType    ratType optional,
+    charstring dnnId,
+    charstring chargingCharacteristics optional,
+    ChargingCharacteristicsSelectionMode    chargingCharacteristicsSelectionMode optional,
+    TS29571_CommonData.DateTime    startTime optional,
+    TS29571_CommonData.DateTime    stopTime optional,
+    ThreeGPPPSDataOffStatus    threegppPSDataOffStatus optional,
+    boolean sessionStopIndicator optional,
+    PDUAddress    pduAddress optional,
+    Diagnostics    diagnostics optional,
+    TS29571_CommonData.DefaultQosInformation    qoSInformation optional,
+    TS29571_CommonData.PlmnId    servingCNPlmnId optional
+  } with {
+    variant (threegppPSDataOffStatus) "name as '3gppPSDataOffStatus'"
+  }
+
+
+  type set PDUContainerInformation {
+    TS29571_CommonData.DateTime    timeofFirstUsage optional,
+    TS29571_CommonData.DateTime    timeofLastUsage optional,
+    TS29571_CommonData.DefaultQosInformation    qoSInformation optional,
+    charstring aFCorrelationInformation optional,
+    TS29571_CommonData.UserLocation    userLocationInformation optional,
+    TS29571_CommonData.TimeZone    uetimeZone optional,
+    TS29571_CommonData.RatType    rATType optional,
+    set of       TS29571_CommonData.AmfId    servingNodeID optional,
+    set of record {
+      universal charstring key,
+      TS29571_CommonData.PresenceInfo    additionalProperties
+    } presenceReportingAreaInformation optional,
+    ThreeGPPPSDataOffStatus    threegppPSDataOffStatus optional,
+    charstring sponsorIdentity optional,
+    charstring applicationserviceProviderIdentity optional,
+    charstring chargingRuleBaseName optional
+  } with {
+    variant (presenceReportingAreaInformation) "as map"
+    variant (threegppPSDataOffStatus) "name as '3gppPSDataOffStatus'"
+  }
+
+
+  type set NetworkSlicingInfo {
+    TS29571_CommonData.Snssai    sNSSAI
+  }
+
+  type set PDUAddress {
+    TS29571_CommonData.Ipv4Addr    pduIPv4Address optional,
+    TS29571_CommonData.Ipv6Addr    pduIPv6Address optional,
+    integer pduAddressprefixlength optional,
+    boolean IPv4dynamicAddressFlag optional,
+    boolean IPv6dynamicAddressFlag optional
+  }
+
+  type set ServingNetworkFunctionID {
+    charstring servingNetworkFunctionName optional,
+    charstring servingNetworkFunctionInstanceid optional
+  }
+
+  type set RoamingQBCInformation {
+    set of       MultipleQFIcontainer    multipleQFIcontainer optional,
+    TS29571_CommonData.NfInstanceId    uPFID optional,
+    RoamingChargingProfile    roamingChargingProfile optional
+  }
+
+  type set MultipleQFIcontainer {
+    set of       Trigger    triggers optional,
+    TS29571_CommonData.DateTime    triggerTimestamp optional,
+    TS29571_CommonData.Uint32    time optional,
+    TS29571_CommonData.Uint64    totalVolume optional,
+    TS29571_CommonData.Uint64    uplinkVolume optional,
+    integer localSequenceNumber,
+    QFIContainerInformation    qFIContainerInformation optional
+  }
+
+  type set QFIContainerInformation {
+    TS29571_CommonData.Qfi    qFI optional,
+    TS29571_CommonData.DateTime    timeofFirstUsage optional,
+    TS29571_CommonData.DateTime    timeofLastUsage optional,
+    TS29571_CommonData.DefaultQosInformation    qoSInformation optional,
+    TS29571_CommonData.UserLocation    userLocationInformation optional,
+    TS29571_CommonData.TimeZone    uetimeZone optional,
+    set of record {
+      universal charstring key,
+      TS29571_CommonData.PresenceInfo    additionalProperties
+    } presenceReportingAreaInformation optional,
+    TS29571_CommonData.RatType    rATType optional,
+    set of       TS29571_CommonData.AmfId    servingNetworkFunctionID optional,
+    ThreeGPPPSDataOffStatus    threegppPSDataOffStatus optional
+  } with {
+    variant (presenceReportingAreaInformation) "as map"
+    variant (threegppPSDataOffStatus) "name as '3gppPSDataOffStatus'"
+  }
+
+  type set RoamingChargingProfile {
+    set of       Trigger    triggers optional,
+    PartialRecordMethod    partialRecordMethod optional
+  }
+
+  type integer RatingGroupId
+
+  type integer ServiceId
+
+  type integer Diagnostics
+
+  type charstring IPFilterRule
+
+  type enumerated NotificationType_enum { REAUTHORIZATION, ABORT_CHARGING}
+
+  type union NotificationType {
+    NotificationType_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated NodeFunctionality_enum { SMF}
+
+  type union NodeFunctionality {
+    NodeFunctionality_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated ChargingCharacteristicsSelectionMode_enum { HOME_DEFAULT, ROAMING_DEFAULT, VISITING_DEFAULT}
+
+  type union ChargingCharacteristicsSelectionMode {
+    ChargingCharacteristicsSelectionMode_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated TriggerType_enum { QUOTA_THRESHOLD, QHT, FINAL, QUOTA_EXHAUSTED, VALIDITY_TIME, OTHER_QUOTA_TYPE, FORCED_REAUTHORISATION, UNUSED_QUOTA_TIMER, ABNORMAL_RELEASE, QOS_CHANGE, VOLUME_LIMIT, TIME_LIMIT, PLMN_CHANGE, USER_LOCATION_CHANGE, RAT_CHANGE, UE_TIMEZONE_CHANGE, TARIFF_TIME_CHANGE, MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS, MANAGEMENT_INTERVENTION, CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA, CHANGE_OF_3GPP_PS_DATA_OFF_STATUS, SERVING_NODE_CHANGE, REMOVAL_OF_UPF, ADDITION_OF_UPF}
+
+  type union TriggerType {
+    TriggerType_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated FinalUnitAction_enum { TERMINATE, REDIRECT, RESTRICT_ACCESS}
+
+  type union FinalUnitAction {
+    FinalUnitAction_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated RedirectAddressType_enum { IPV4, IPV6, URL}
+
+  type union RedirectAddressType {
+    RedirectAddressType_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated TriggerCategory_enum { IMMEDIATE_REPORT, DEFERRED_REPORT}
+
+  type union TriggerCategory {
+    TriggerCategory_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated QuotaManagementIndicator_enum { ONLINE_CHARGING, OFFLINE_CHARGING}
+
+  type union QuotaManagementIndicator {
+    QuotaManagementIndicator_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated FailureHandling_enum { TERMINATE, CONTINUE, RETRY_AND_TERMINATE}
+
+  type union FailureHandling {
+    FailureHandling_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated SessionFailover_enum { FAILOVER_NOT_SUPPORTED, FAILOVER_SUPPORTED}
+
+  type union SessionFailover {
+    SessionFailover_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated ThreeGPPPSDataOffStatus_enum { ACTIVE, INACTIVE}
+
+  type union ThreeGPPPSDataOffStatus {
+    ThreeGPPPSDataOffStatus_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated ResultCode_enum { END_USER_SERVICE_DENIED, CREDIT_CONTROL_NOT_APPLICABLE, CREDIT_LIMIT_REACHED, AUTHORIZATION_REJECTED, USER_UNKNOWN, RATING_FAILED}
+
+  type union ResultCode {
+    ResultCode_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated PartialRecordMethod_enum { DEFAULT, INDIVIDUAL}
+
+  type union PartialRecordMethod {
+    PartialRecordMethod_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated RoamerInOut_enum { IN_BOUND, OUT_BOUND}
+
+  type union RoamerInOut {
+    RoamerInOut_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+
+
+
+
+} with {
+  encode "JSON"
+}