From f38963e2b2550bed03f9b8db1c3843902931cd72 Mon Sep 17 00:00:00 2001 From: mpeterss Date: Thu, 12 Dec 2019 10:36:30 +0100 Subject: [PATCH] Adding 3GPP-PDP-TYPE to PS-Information protobuffer --- .../org/ostelco/diameter/model/PsInformation.kt | 3 ++- ocs-grpc-api/src/main/proto/ocs.proto | 14 +++++++++++++- .../converter/ProtobufToDiameterConverter.java | 6 +++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/diameter-stack/src/main/kotlin/org/ostelco/diameter/model/PsInformation.kt b/diameter-stack/src/main/kotlin/org/ostelco/diameter/model/PsInformation.kt index eef25045b..331ab04ac 100644 --- a/diameter-stack/src/main/kotlin/org/ostelco/diameter/model/PsInformation.kt +++ b/diameter-stack/src/main/kotlin/org/ostelco/diameter/model/PsInformation.kt @@ -3,6 +3,7 @@ package org.ostelco.diameter.model import org.jdiameter.api.Avp import org.ostelco.diameter.parser.AvpField import java.net.InetAddress +import java.util.* /** * PS-Information ( Avp 874 ) @@ -18,7 +19,7 @@ class PsInformation { // 3GPP-PDP-Type ( Avp 3 ) @AvpField(Avp.TGPP_PDP_TYPE) - var pdpType: ByteArray? = null + var pdpType: Int? = null // PDP-Address ( Avp 1227 ) @AvpField(Avp.PDP_ADDRESS) diff --git a/ocs-grpc-api/src/main/proto/ocs.proto b/ocs-grpc-api/src/main/proto/ocs.proto index ef20bd6ba..ffdf23a27 100644 --- a/ocs-grpc-api/src/main/proto/ocs.proto +++ b/ocs-grpc-api/src/main/proto/ocs.proto @@ -70,6 +70,17 @@ enum ResultCode { DIAMETER_RATING_FAILED = 5031; } +// 3GPP-PDP-Type #: 29.061 +enum PdpType { + IPV4 = 0; + PPP = 1; + IPV6 = 2; + IPV4V6 = 3; + NON_IP = 4; + UNSTRUCTURED = 5; + ETHERNET = 6; +} + message RedirectServer { RedirectAddressType redirectAddressType = 1; string redirectServerAddress = 2; @@ -102,7 +113,8 @@ message PsInformation { string sgsnMccMnc = 2; string imsiMccMnc = 3; bytes userLocationInfo = 4; - string pdpAddress = 5; + PdpType pdpType = 5; + bytes pdpAddress = 6; } message ServiceInfo { diff --git a/ocsgw/src/main/java/org/ostelco/ocsgw/converter/ProtobufToDiameterConverter.java b/ocsgw/src/main/java/org/ostelco/ocsgw/converter/ProtobufToDiameterConverter.java index d037b9341..43fe8d5b5 100644 --- a/ocsgw/src/main/java/org/ostelco/ocsgw/converter/ProtobufToDiameterConverter.java +++ b/ocsgw/src/main/java/org/ostelco/ocsgw/converter/ProtobufToDiameterConverter.java @@ -5,6 +5,7 @@ import org.ostelco.diameter.model.*; import org.ostelco.ocs.api.CreditControlRequestInfo; import org.ostelco.ocs.api.CreditControlRequestType; +import org.ostelco.ocs.api.PdpType; import org.ostelco.ocs.api.PsInformation; import org.ostelco.ocs.api.ServiceInfo; import org.ostelco.ocsgw.datasource.protobuf.GrpcDataSource; @@ -162,8 +163,11 @@ private static void addPsInformation(final CreditControlContext context, CreditC if (psInformation.getUserLocationInfo() != null) { psInformationBuilder.setUserLocationInfo(ByteString.copyFrom(psInformation.getUserLocationInfo())); } + if (psInformation.getPdpType() != null) { + psInformationBuilder.setPdpType(PdpType.forNumber(psInformation.getPdpType())); + } if (psInformation.getPdpAddress() != null) { - psInformationBuilder.setPdpAddress(psInformation.getPdpAddress().getHostAddress()); + psInformationBuilder.setPdpAddress(ByteString.copyFrom(psInformation.getPdpAddress().getAddress())); } builder.setServiceInformation(ServiceInfo.newBuilder().setPsInformation(psInformationBuilder)); }