Initial commit

Signed-off-by: Gabor Szalai <gabor.szalai@ericsson.com>
diff --git a/5G_system_TS29520_Nnwdaf_CNL113891.tpd b/5G_system_TS29520_Nnwdaf_CNL113891.tpd
new file mode 100644
index 0000000..50f96c4
--- /dev/null
+++ b/5G_system_TS29520_Nnwdaf_CNL113891.tpd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>5G_system_TS29520_Nnwdaf_CNL113891</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/TS29520_Nnwdaf_AnalyticsInfo.ttcn" relativeURI="src/TS29520_Nnwdaf_AnalyticsInfo.ttcn"/>
+    <FileResource projectRelativePath="src/TS29520_Nnwdaf_EventsSubscription.ttcn" relativeURI="src/TS29520_Nnwdaf_EventsSubscription.ttcn"/>
+  </Files>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <GNUMake>true</GNUMake>
+          <incrementalDependencyRefresh>true</incrementalDependencyRefresh>
+          <targetExecutable>bin/5G_system_TS29520_Nnwdaf_CNL113891</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_TS29520_Nnwdaf_Description.adoc b/doc/5G_system_TS29520_Nnwdaf_Description.adoc
new file mode 100644
index 0000000..6521afb
--- /dev/null
+++ b/doc/5G_system_TS29520_Nnwdaf_Description.adoc
@@ -0,0 +1,72 @@
+= 5G system TS29520 Nnwdaf 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 TS29520 Nnwdaf protocol module. The 5G system TS29520 Nnwdaf protocol modules are developed for the TTCN-3 Toolset with Titan. 
+
+== Functionality
+
+The 5G system TS29520 Nnwdaf protocol module implements the object structures of the 3GPP TS 29520 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 TS29520 Nnwdaf 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 TS29520 Nnwdaf 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_AnalyticsData(in AnalyticsData pdu) return octetstring 
+f_dec_AnalyticsData(in octetstring stream, out AnalyticsData pdu) return integer 
+f_enc_NnwdafEventsSubscription(in NnwdafEventsSubscription pdu) return octetstring 
+f_dec_NnwdafEventsSubscription(in octetstring stream, out NnwdafEventsSubscription 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 29520 v15.1.0+
+5G System; Network Data Analytics Services; Stage 3
+
diff --git a/doc/change.log b/doc/change.log
new file mode 100644
index 0000000..d9acdbf
--- /dev/null
+++ b/doc/change.log
@@ -0,0 +1,9 @@
+= 5G system TS29520 Nnwdaf 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/TS29520_Nnwdaf_AnalyticsInfo.ttcn b/src/TS29520_Nnwdaf_AnalyticsInfo.ttcn
new file mode 100644
index 0000000..3c30b87
--- /dev/null
+++ b/src/TS29520_Nnwdaf_AnalyticsInfo.ttcn
@@ -0,0 +1,54 @@
+/******************************************************************************
+* 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:               TS29520_Nnwdaf_AnalyticsInfo.ttcn
+//  Description:	      Type definitions for 3GPP TS29520
+/////////////////////////////////////////////// 
+module TS29520_Nnwdaf_AnalyticsInfo {
+
+  import from TS29520_Nnwdaf_EventsSubscription all
+  import from TS29571_CommonData all
+
+external function f_enc_AnalyticsData(in AnalyticsData pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_AnalyticsData(in octetstring stream, out AnalyticsData pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+
+
+  type set AnalyticsData {
+    set of       TS29520_Nnwdaf_EventsSubscription.SliceLoadLevelInformation    sliceLoadLevelInfos,
+    TS29571_CommonData.SupportedFeatures    supportedFeatures
+  }
+
+  type set EventFilter {
+    TS29520_Nnwdaf_EventsSubscription.AnySlice    anySlice optional,
+    set of       TS29571_CommonData.Snssai    snssai optional
+  }
+
+  type enumerated EventId_enum { Load_Level_Information}
+
+  type union EventId {
+    EventId_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+
+
+
+
+} with {
+  encode "JSON"
+}
diff --git a/src/TS29520_Nnwdaf_EventsSubscription.ttcn b/src/TS29520_Nnwdaf_EventsSubscription.ttcn
new file mode 100644
index 0000000..dd9de59
--- /dev/null
+++ b/src/TS29520_Nnwdaf_EventsSubscription.ttcn
@@ -0,0 +1,86 @@
+/******************************************************************************
+* 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:               TS29520_Nnwdaf_EventsSubscription.ttcn
+//  Description:	      Type definitions for 3GPP TS29520
+/////////////////////////////////////////////// 
+module TS29520_Nnwdaf_EventsSubscription {
+
+  import from TS29571_CommonData all
+
+external function f_enc_NnwdafEventsSubscription(in NnwdafEventsSubscription pdu) return octetstring 
+with { extension "prototype(convert) encode(JSON)" }
+
+external function f_dec_NnwdafEventsSubscription(in octetstring stream, out NnwdafEventsSubscription pdu) return integer 
+with { extension "prototype(backtrack) decode(JSON)" }
+
+
+  type set NnwdafEventsSubscription {
+    set of       EventSubscription    eventSubscriptions,
+    TS29571_CommonData.Uri    notificationURI optional,
+    set of       TS29571_CommonData.SupportedFeatures    supportedFeatures optional
+  }
+
+  type set EventSubscription {
+    AnySlice    anySlice optional,
+    NwdafEvent    event,
+    integer loadLevelThreshold optional,
+    NotificationMethod    notificationMethod optional,
+    TS29571_CommonData.DurationSec    repetitionPeriod optional,
+    set of       TS29571_CommonData.Snssai    snssai optional
+  }
+
+  type set NnwdafEventsSubscriptionNotification {
+    set of       EventNotification    eventNotifications,
+    charstring subscriptionId
+  }
+
+  type set EventNotification {
+    NwdafEvent    event,
+    SliceLoadLevelInformation    sliceLoadLevelInfo
+  }
+
+  type set SliceLoadLevelInformation {
+    LoadLevelInformation    loadLevelInformation,
+    set of       TS29571_CommonData.Snssai    snssai
+  }
+
+  type boolean AnySlice
+
+  type integer LoadLevelInformation
+
+  type enumerated NotificationMethod_enum { PERIODIC, THRESHOLD}
+
+  type union NotificationMethod {
+    NotificationMethod_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+  type enumerated NwdafEvent_enum { Slice_Load_Level}
+
+  type union NwdafEvent {
+    NwdafEvent_enum  enum_val,
+    charstring           other_val
+  } with {
+    variant "JSON: as value"
+  }
+
+
+
+
+
+
+} with {
+  encode "JSON"
+}