From 924ab47c83837fae7c70713cab51665b8fc858a6 Mon Sep 17 00:00:00 2001 From: JoeOLeary Date: Fri, 15 Feb 2019 13:46:01 +0000 Subject: Add Mapping Change-Id: I417b7fe9d0e588c6c38dc23eb55e43a85e277e81 Issue-ID: DCAEGEN2-1216 Signed-off-by: JoeOLeary --- src/main/resources/mapping.ftl | 128 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 src/main/resources/mapping.ftl (limited to 'src/main/resources/mapping.ftl') diff --git a/src/main/resources/mapping.ftl b/src/main/resources/mapping.ftl new file mode 100644 index 0000000..0b35c54 --- /dev/null +++ b/src/main/resources/mapping.ftl @@ -0,0 +1,128 @@ +<#ftl ns_prefixes={"D":"http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"}> +<#-- + ============LICENSE_START======================================================= + Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= + --> +<#assign fileHeader = xml.measCollecFile.fileHeader> +<#assign fileFooter = xml.measCollecFile.fileFooter> +<#assign measData = xml.measCollecFile.measData> +<#setting datetime_format="iso"> +{ + "event": { + "commonEventHeader": <@commonEventHeader/> + <#if measData?has_content>, + "perf3gppFields": <@perf3gppFields/> + + } +} + + +<#macro commonEventHeader> +{ + "domain": "perf3gpp", + "eventId": "${eventId}", + "sequence": 0, + "eventName": "perf3gpp_${metadata.productName}-${metadata.vendorName}_pmMeasResult", + "sourceName": "${metadata.sourceName}", + "reportingEntityName": "", + "priority": "Normal", + "startEpochMicrosec": ${fileHeader.measCollec.@beginTime?datetime?long?c}, + "lastEpochMicrosec": ${fileFooter.measCollec.@endTime?datetime?long?c}, + "version": "4.0", + "vesEventListenerVersion": "7.1", + "timeZoneOffset": "${metadata.timeZoneOffset}" +} + + + +<#macro measTypes measInfo> +{ + "sMeasTypesList":[ + <#if measInfo.measType?has_content> + <#list measInfo.measType as measType> + "${measType}"<#sep>, + + <#else> + <#list measInfo.measTypes?split(" ") as measType> + "${measType}"<#sep>, + + + ] +} + + + +<#macro measValuesList measInfo> +[ + { + "measObjInstId": "${measInfo.measValue.@measObjLdn[0]!}", + "suspectFlag": "${measInfo.measValue.suspect[0]! "false"}", + "measResults": [ + <#if measInfo.measValue.r?has_content> + <#list measInfo.measValue.r as r> + { + "p": ${r.@p}, + "sValue": "${r}" + }<#sep>, + + <#else> + <#list measInfo.measValue.measResults?split(" ") as r> + { + "p":${r?index+1}, + "sValue": "${r}" + }<#sep>, + + + ] + } +] + + + +<#macro measInfoList> +[ +<#list measData.measInfo as measInfo> + { + "measInfoId": { + "sMeasInfoId": "${measInfo.@measInfoId[0]!}" + }, + "measTypes": <@measTypes measInfo/>, + "measValuesList": <@measValuesList measInfo/> + }<#sep>, + +] + + + +<#macro measDataCollection> +{ + "granularityPeriod": ${measData.measInfo.granPeriod.@endTime[0]!?datetime?long?c}, + "measuredEntityUserName": "${measData.managedElement.@userLabel[0]!}", + "measuredEntityDn": "${measData.managedElement.@localDn}", + "measuredEntitySoftwareVersion": "${measData.managedElement.@swVersion}", + "measInfoList": <@measInfoList/> +} + + + +<#macro perf3gppFields> +{ + "perf3gppFieldsVersion": "1.0", + "measDataCollection": <@measDataCollection/> +} + -- cgit 1.2.3-korg