Initial commit

Signed-off-by: Gabor Szalai <gabor.szalai@ericsson.com>
diff --git a/5G_system_TS29514_Npcf_CNL113889.tpd b/5G_system_TS29514_Npcf_CNL113889.tpd
new file mode 100644
index 0000000..2d6bd8a
--- /dev/null
+++ b/5G_system_TS29514_Npcf_CNL113889.tpd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>5G_system_TS29514_Npcf_CNL113889</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="5G_system_TS29512_Npcf_CNL113888" projectLocationURI="../5G_system_TS29512_Npcf_CNL113888/5G_system_TS29512_Npcf_CNL113888.tpd"/>
+    <ReferencedProject name="5G_system_TS29571_CommonData_CNL113880" projectLocationURI="../5G_system_TS29571_CommonData_CNL113880/5G_system_TS29571_CommonData_CNL113880.tpd"/>
+    <ReferencedProject name="5G_system_TS32291_Nchf_CNL113894" projectLocationURI="../5G_system_TS32291_Nchf_CNL113894/5G_system_TS32291_Nchf_CNL113894.tpd"/>
+    <ReferencedProject name="TS29122_T8_CNL113881" projectLocationURI="../TS29122_T8_CNL113881/TS29122_T8_CNL113881.tpd"/>
+  </ReferencedProjects>
+  <Folders>
+    <FolderResource projectRelativePath="src" relativeURI="src"/>
+  </Folders>
+  <Files>
+    <FileResource projectRelativePath="src/TS29514_Npcf_PolicyAuthorization.ttcn" relativeURI="src/TS29514_Npcf_PolicyAuthorization.ttcn"/>
+  </Files>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <GNUMake>true</GNUMake>
+          <incrementalDependencyRefresh>true</incrementalDependencyRefresh>
+          <targetExecutable>bin/5G_system_TS29514_Npcf_CNL113889</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_TS29514_Npcf_Description.adoc b/doc/5G_system_TS29514_Npcf_Description.adoc
new file mode 100644
index 0000000..f2f1f8c
--- /dev/null
+++ b/doc/5G_system_TS29514_Npcf_Description.adoc
@@ -0,0 +1,80 @@
+= 5G system TS29514 Npcf 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 TS29514 Npcf protocol module. The 5G system TS29514 Npcf protocol modules are developed for the TTCN-3 Toolset with Titan. 
+
+== Functionality
+
+The 5G system TS29514 Npcf protocol module implements the object structures of the 3GPP TS 29514 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 TS29514 Npcf 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 TS29514 Npcf 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_AppSessionContextReqData(in AppSessionContextReqData pdu) return octetstring 
+f_dec_AppSessionContextReqData(in octetstring stream, out AppSessionContextReqData pdu) return integer 
+f_enc_AppSessionContext(in AppSessionContext pdu) return octetstring 
+f_dec_AppSessionContext(in octetstring stream, out AppSessionContext pdu) return integer 
+f_enc_TerminationInfo(in TerminationInfo pdu) return octetstring 
+f_dec_TerminationInfo(in octetstring stream, out TerminationInfo pdu) return integer 
+f_enc_EventsNotification(in EventsNotification pdu) return octetstring 
+f_dec_EventsNotification(in octetstring stream, out EventsNotification pdu) return integer 
+f_enc_AppSessionContextUpdateData(in AppSessionContextUpdateData pdu) return octetstring 
+f_dec_AppSessionContextUpdateData(in octetstring stream, out AppSessionContextUpdateData pdu) return integer 
+f_enc_EventsSubscReqData(in EventsSubscReqData pdu) return octetstring 
+f_dec_EventsSubscReqData(in octetstring stream, out EventsSubscReqData 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 29514 v15.1.0+
+5G System; Policy Authorization Service; Stage 3
+
diff --git a/doc/change.log b/doc/change.log
new file mode 100644
index 0000000..6959e33
--- /dev/null
+++ b/doc/change.log
@@ -0,0 +1,9 @@
+= 5G system TS29514 Npcf 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/TS29514_Npcf_PolicyAuthorization.ttcn b/src/TS29514_Npcf_PolicyAuthorization.ttcn
new file mode 100644
index 0000000..800cb70
--- /dev/null
+++ b/src/TS29514_Npcf_PolicyAuthorization.ttcn
@@ -0,0 +1,399 @@
+/******************************************************************************
+* 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:               TS29514_Npcf_PolicyAuthorization.ttcn
+//  Description:	      Type definitions for 3GPP TS29514
+/////////////////////////////////////////////// 
+module TS29514_Npcf_PolicyAuthorization {
+
+  import from TS29122_CommonData all
+  import from TS29571_CommonData all
+  import from TS29512_CommonData all
+  import from TS32291_Nchf_ConvergedCharging all
+
+external function f_enc_AppSessionContextReqData(in AppSessionContextReqData pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_AppSessionContextReqData(in octetstring stream, out AppSessionContextReqData pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_AppSessionContext(in AppSessionContext pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_AppSessionContext(in octetstring stream, out AppSessionContext pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_TerminationInfo(in TerminationInfo pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_TerminationInfo(in octetstring stream, out TerminationInfo pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_EventsNotification(in EventsNotification pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_EventsNotification(in octetstring stream, out EventsNotification pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_AppSessionContextUpdateData(in AppSessionContextUpdateData pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_AppSessionContextUpdateData(in octetstring stream, out AppSessionContextUpdateData pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+external function f_enc_EventsSubscReqData(in EventsSubscReqData pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_EventsSubscReqData(in octetstring stream, out EventsSubscReqData pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+
+  type set AppSessionContext {
+    AppSessionContextReqData    ascReqData optional,
+    AppSessionContextRespData    ascRespData optional,
+    EventsNotification    evsNotif optional
+  }
+
+  type set AppSessionContextReqData {
+    AfAppId    afAppId optional,
+    AfChargingId    afChargId optional,
+    AfRoutingRequirement    afRoutReq optional,
+    AspId    aspId optional,
+    TS29122_CommonData.BdtReferenceId    bdtRefId optional,
+    TS29571_CommonData.Dnn    dnn optional,
+    EventsSubscReqData    evSubsc optional,
+    set of record {
+      universal charstring key,
+      MediaComponent    additionalProperties
+    } medComponents optional,
+    charstring ipDomain optional,
+    charstring mpsId optional,
+    TS29122_CommonData.Link    notifUri,
+    TS29571_CommonData.Snssai    sliceInfo optional,
+    SponId    sponId optional,
+    SponsoringStatus    sponStatus optional,
+    TS29571_CommonData.Supi    supi optional,
+    TS29571_CommonData.SupportedFeatures    suppFeat optional,
+    TS29571_CommonData.Ipv4Addr    ueIpv4 optional,
+    TS29571_CommonData.Ipv6Addr    ueIpv6 optional,
+    TS29571_CommonData.MacAddr48    ueMac optional
+  }
+
+  type set AppSessionContextRespData {
+    ServAuthInfo    servAuthInfo optional,
+    TS29571_CommonData.SupportedFeatures    suppFeat optional
+  }
+
+  type set AppSessionContextUpdateData {
+    AfAppId    afAppId optional,
+    AfRoutingRequirement    afRoutReq optional,
+    AspId    aspId optional,
+    TS29122_CommonData.BdtReferenceId    bdtRefId optional,
+    EventsSubscReqData    evSubsc optional,
+    set of record {
+      universal charstring key,
+      MediaComponent    additionalProperties
+    } medComponents optional,
+    charstring mpsId optional,
+    SponId    sponId optional,
+    SponsoringStatus    sponStatus optional
+  }
+
+  type set EventsSubscReqData {
+    TS29571_CommonData.DnaiChangeType    dnaiChgType optional,
+    set of       AfEventSubscription    events,
+    TS29122_CommonData.Link    notifUri,
+    RequiredAccessInfo    reqAni optional,
+    TS29122_CommonData.UsageThreshold    usgThres optional
+  }
+
+  type set MediaComponent {
+    AfAppId    afAppId optional,
+    AfRoutingRequirement    afRoutReq optional,
+    ContentVersion    contVer optional,
+    set of       CodecData    codecs optional,
+    FlowStatus    fStatus optional,
+    TS29571_CommonData.BitRate    marBwDl optional,
+    TS29571_CommonData.BitRate    marBwUl optional,
+    integer medCompN,
+    set of record {
+      universal charstring key,
+      MediaSubComponent    additionalProperties
+    } medSubComps optional,
+    MediaType    medType optional,
+    TS29571_CommonData.BitRate    mirBwDl optional,
+    TS29571_CommonData.BitRate    mirBwUl optional,
+    ReservPriority    resPrio optional
+  }
+
+  type set MediaSubComponent {
+    set of       EthFlowDescription    ethfDescs optional,
+    integer fNum,
+    set of       FlowDescription    fDescs optional,
+    FlowStatus    fStatus optional,
+    TS29571_CommonData.BitRate    marBwDl optional,
+    TS29571_CommonData.BitRate    marBwUl optional,
+    TosTrafficClass    tosTrCl optional,
+    FlowUsage    flowUsage optional
+  }
+
+  type set EventsNotification {
+    TS29571_CommonData.AccessType    accessType optional,
+    AccessNetChargingAddress    anChargAddr optional,
+    set of       AccessNetChargingIdentifier    anChargIds optional,
+    AnGwAddress    anGwAddr optional,
+    TS29122_CommonData.Link    evSubsUri,
+    set of       AfEventNotification    evNotifs,
+    set of       ResourcesAllocationInfo    failedResourcAllocReports optional,
+    NetLocAccSupp    netLocAccSupp optional,
+    set of       OutOfCreditInformation    outOfCredReports optional,
+    TS29571_CommonData.PlmnId    plmnCcNc optional,
+    TS29571_CommonData.PlmnId    plmnId optional,
+    set of       QosNotificationControlInfo    qncReports optional,
+    TS29571_CommonData.RatType    ratType optional,
+    TS29571_CommonData.UserLocation    ueLoc optional,
+    TS29571_CommonData.DateTime    ueLocTime optional,
+    TS29571_CommonData.TimeZone    ueTimeZone optional,
+    TS29571_CommonData.UserLocation    addUeLoc optional,
+    TS29571_CommonData.DateTime    addUeLocTime optional,
+    TS29122_CommonData.AccumulatedUsage    usgRep optional
+  }
+
+  type set AfEventSubscription {
+    AfEvent    event,
+    AfNotifMethod    notifMethod optional
+  }
+
+  type set AfEventNotification {
+    AfEvent    event,
+    set of       Flows    flows optional
+  }
+
+  type set TerminationInfo {
+    TerminationCause    termCause,
+    TS29122_CommonData.Link    resUri
+  }
+
+  type set AfRoutingRequirement {
+    boolean appReloc optional,
+    charstring afTransId,
+    set of       TS29571_CommonData.RouteToLocation    routeToLocs optional,
+    SpatialValidity    spVal optional,
+    set of       TemporalValidity    tempVals optional
+  }
+
+  type set SpatialValidity {
+    set of       charstring praIds optional,
+    set of record {
+      universal charstring key,
+      TS29571_CommonData.PresenceInfo    additionalProperties
+    } presenceInfoList optional
+  }
+
+  type set AccessNetChargingAddress {
+    TS29571_CommonData.Ipv4Addr    anChargIpv4Addr optional,
+    TS29571_CommonData.Ipv6Addr    anChargIpv6Addr optional
+  }
+
+  type set AccessNetChargingIdentifier {
+    charstring anChargIdValue,
+    set of       Flows    flows optional
+  }
+
+  type set AnGwAddress {
+    TS29571_CommonData.Ipv4Addr    anGwIpv4Addr optional,
+    TS29571_CommonData.Ipv6Addr    anGwIpv6Addr optional
+  }
+
+  type set Flows {
+    set of       ContentVersion    contVers optional,
+    set of       integer fNums optional,
+    integer medCompN
+  }
+
+  type set EthFlowDescription {
+    TS29571_CommonData.MacAddr48    destMacAddr optional,
+    charstring ethType,
+    FlowDescription    fDesc optional,
+    TS29512_CommonData.FlowDirection    fDir optional,
+    TS29571_CommonData.MacAddr48    sourceMacAddr optional,
+    charstring vlanTags optional
+  }
+
+  type set OutOfCreditInformation {
+    TS32291_Nchf_ConvergedCharging.FinalUnitAction    finUnitAct optional,
+    set of       Flows    flows optional
+  }
+
+  type set ResourcesAllocationInfo {
+    MediaComponentResourcesStatus    mcResourcStatus,
+    set of       Flows    flows
+  }
+
+  type set TemporalValidity {
+    TS29571_CommonData.DateTime    startTime optional,
+    TS29571_CommonData.DateTime    stopTime optional
+  }
+
+  type set QosNotificationControlInfo {
+    QosNotifType    notifType,
+    set of       Flows    flows optional
+  }
+
+  type charstring AfChargingId
+
+  type charstring AfAppId
+
+  type charstring AspId
+
+  type charstring CodecData
+
+  type integer ContentVersion
+
+  type charstring FlowDescription
+
+  type boolean NetLocAccSupp
+
+  type charstring SponId
+
+  type enumerated MediaType_enum { AUDIO, VIDEO, DATA, APPLICATION, CONTROL, TEXT, MESSAGE, OTHER}
+
+  type union MediaType {
+    MediaType_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated ReservPriority_enum { PRIO_1, PRIO_2, PRIO_3, PRIO_4, PRIO_5, PRIO_6, PRIO_7, PRIO_8, PRIO_9, PRIO_10, PRIO_11, PRIO_12, PRIO_13, PRIO_14, PRIO_15, PRIO_16}
+
+  type union ReservPriority {
+    ReservPriority_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated ServAuthInfo_enum { TP_NOT_KNOWN, TP_EXPIRED, TP_NOT_YET_OCURRED, UNAUTH_TRAFFIC_ROUTING_REQ}
+
+  type union ServAuthInfo {
+    ServAuthInfo_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated SponsoringStatus_enum { SPONSOR_DISABLED, SPONSOR_ENABLED}
+
+  type union SponsoringStatus {
+    SponsoringStatus_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated AfEvent_enum { ACCESS_TYPE_CHANGE, ANI_REPORT, CHARGING_CORRELATION, DNAI_CHG, FAILED_RESOURCES_ALLOCATION, OUT_OF_CREDIT, PLMN_CHG, QOS_NOTIFICATION_CONTROL, ROUT_REQ_STATUS_CHG, SUCCESSFUL_RESOURCES_ALLOCATION, USAGE_REPORT}
+
+  type union AfEvent {
+    AfEvent_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated AfNotifMethod_enum { EVENT_DETECTION, ONE_TIME}
+
+  type union AfNotifMethod {
+    AfNotifMethod_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated QosNotifType_enum { FULFILLED, NOT_FULFILLED}
+
+  type union QosNotifType {
+    QosNotifType_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated TerminationCause_enum { ALL_SDF_DEACTIVATION, PDU_SESSION_TERMINATION}
+
+  type union TerminationCause {
+    TerminationCause_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated RequiredAccessInfo_enum { USER_LOCATION, MS_TIME_ZONE}
+
+  type union RequiredAccessInfo {
+    RequiredAccessInfo_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated MediaComponentResourcesStatus_enum { ACTIVE, INACTIVE}
+
+  type union MediaComponentResourcesStatus {
+    MediaComponentResourcesStatus_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated FlowUsage_enum { NO_INFO, RTCP}
+
+  type union FlowUsage {
+    FlowUsage_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated FlowStatus_enum { ENABLED_UPLINK, ENABLED_DOWNLINK, ENABLED, DISABLED, REMOVED}
+  with {
+    variant "text 'ENABLED_UPLINK' as 'ENABLED-UPLINK'"
+    variant "text 'ENABLED_DOWNLINK' as 'ENABLED-DOWNLINK'"
+  }
+
+  type union FlowStatus {
+    FlowStatus_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type charstring TosTrafficClass
+
+
+
+
+
+} with {
+  encode "JSON"
+}