diff --git a/cmd/dict_generator/main.go b/cmd/dict_generator/main.go new file mode 100644 index 0000000..a5d9db2 --- /dev/null +++ b/cmd/dict_generator/main.go @@ -0,0 +1,87 @@ +package main + +import ( + "flag" + "fmt" + "io" + "os" + "strings" + + "github.com/fiorix/go-diameter/v4/diam/dict" + log "github.com/sirupsen/logrus" +) + +func main() { + var dictionary string + var output string + + flag.StringVar(&dictionary, "dictionary", "dictionary.xml", "Dictionary") + flag.StringVar(&output, "output", "const.js", "Output file") + flag.Parse() + + file, err := os.Open(dictionary) + if err != nil { + log.Fatalf("Error opening dictioanry: %s\n", err) + } + defer file.Close() + + parser := dict.Default + parser.Load(file) + if err != nil { + log.Fatalf("Error parsing dictioanry: %s\n", err) + } + + w, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666) + if err != nil { + log.Fatalf("Error opening file: %s\n", err) + } + defer w.Close() + + PrintFlags(w) + PrintAvpCode(w, parser) + PrintVendorId(w, parser) +} + +func PrintFlags(w io.Writer) { + fmt.Fprintf(w, "export const flags = {\n") + fmt.Fprintf(w, " Vbit: 0x80,\n") + fmt.Fprintf(w, " Mbit: 0x40,\n") + fmt.Fprintf(w, " Pbit: 0x20,\n") + fmt.Fprintf(w, "}\n") + fmt.Fprintf(w, "\n") +} + +func PrintAvpCode(w io.Writer, parser *dict.Parser) { + fmt.Fprintf(w, "export const avpCode = {\n") + for _, app := range parser.Apps() { + fmt.Fprintf(w, " // %s\n", app.Name) + for _, avp := range app.AVP { + name := strings.ReplaceAll(avp.Name, "-", "") + fmt.Fprintf(w, " %s: %d,\n", name, avp.Code) + } + } + fmt.Fprintf(w, "}\n") + fmt.Fprintf(w, "\n") + +} + +func PrintVendorId(w io.Writer, parser *dict.Parser) { + vendorIds := make(map[uint32]struct{}) + exists := struct{}{} + + fmt.Fprintf(w, "export const vendorId = {\n") + for _, app := range parser.Apps() { + for _, vendor := range app.Vendor { + // Remove duplicate vendorId + _, found := vendorIds[vendor.ID] + if found { + continue + } + vendorIds[vendor.ID] = exists + + fmt.Fprintf(w, " %s: %d,\n", vendor.Name, vendor.ID) + } + } + fmt.Fprintf(w, "}\n") + fmt.Fprintf(w, "\n") +} diff --git a/diameter.go b/diameter.go index 2839b57..ec0c600 100644 --- a/diameter.go +++ b/diameter.go @@ -3,6 +3,7 @@ package diameter import ( "errors" "net" + "os" "time" "github.com/fiorix/go-diameter/diam/avp" @@ -31,7 +32,9 @@ type DataType struct{} type AVP struct{} -func (*Diameter) NewClient() (*DiameterClient, error) { +type Dict struct{} + +func (*Diameter) XClient() (*DiameterClient, error) { // TODO make all this configurable later cfg := &sm.Settings{ @@ -118,7 +121,7 @@ func (d *Diameter) Send(client *DiameterClient, msg *DiameterMessage) (uint32, e // Wait for CCA resp := <-client.hopIds[hopByHopID] - //log.Infof("Received CCA \n%s", resp) + log.Infof("Received CCA \n%s", resp) delete(client.hopIds, hopByHopID) @@ -228,7 +231,22 @@ func (a *AVP) XNew(code uint32, vendor uint32, flags uint8, data datatype.Type) return diam.NewAVP(code, flags, vendor, data) } +func (*Dict) Load(dictionary string) error { + file, err := os.Open(dictionary) + if err != nil { + return err + } + defer file.Close() + + dict.Default.Load(file) + if err != nil { + return err + } + return nil +} + func init() { modules.Register("k6/x/diameter", &Diameter{}) modules.Register("k6/x/diameter/avp", &AVP{}) + modules.Register("k6/x/diameter/dict", &Dict{}) } diff --git a/dict/dictionary.xml b/dict/dictionary.xml new file mode 100644 index 0000000..59afc8d --- /dev/null +++ b/dict/dictionary.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/example/diam.js b/example/diam.js deleted file mode 100644 index 49f6c6f..0000000 --- a/example/diam.js +++ /dev/null @@ -1,23 +0,0 @@ - -export const flags = { - Vbit: 0x80, - Mbit: 0x40, - Pbit: 0x20, -} - -export const avpCode = { - OriginHost: 264, - OriginRealm: 296, - DestinationHost: 283, - DestinationRealm: 293, - SessionId: 263, - CCRequestType: 416, - CCRequestNumber: 415, - SubscriptionId: 443, - SubscriptionIdData: 444, - SubscriptionIdType: 450, -} - -export const vendorId = { - TGPP: 10415, -} diff --git a/example/diam/const.js b/example/diam/const.js new file mode 100644 index 0000000..8bcda3e --- /dev/null +++ b/example/diam/const.js @@ -0,0 +1,795 @@ +export const flags = { + Vbit: 0x80, + Mbit: 0x40, + Pbit: 0x20, +} + +export const avpCode = { + // Base + AcctInterimInterval: 85, + AccountingRealtimeRequired: 483, + AcctMultiSessionId: 50, + AccountingRecordNumber: 485, + AccountingRecordType: 480, + AccountingSessionId: 44, + AccountingSubSessionId: 287, + AcctApplicationId: 259, + AuthApplicationId: 258, + AuthRequestType: 274, + AuthorizationLifetime: 291, + AuthGracePeriod: 276, + AuthSessionState: 277, + ReAuthRequestType: 285, + Class: 25, + DestinationHost: 293, + DestinationRealm: 283, + DisconnectCause: 273, + ErrorMessage: 281, + ErrorReportingHost: 294, + EventTimestamp: 55, + ExperimentalResult: 297, + ExperimentalResultCode: 298, + FailedAVP: 279, + FirmwareRevision: 267, + HostIPAddress: 257, + InbandSecurityId: 299, + MultiRoundTimeOut: 272, + OriginHost: 264, + OriginRealm: 296, + OriginStateId: 278, + ProductName: 269, + ProxyHost: 280, + ProxyInfo: 284, + ProxyState: 33, + RedirectHost: 292, + RedirectHostUsage: 261, + RedirectMaxCacheTime: 262, + ResultCode: 268, + RouteRecord: 282, + SessionId: 263, + SessionTimeout: 27, + SessionBinding: 270, + SessionServerFailover: 271, + SupportedVendorId: 265, + TerminationCause: 295, + UserName: 1, + VendorId: 266, + VendorSpecificApplicationId: 260, + OCSupportedFeatures: 621, + OCFeatureVector: 622, + OCOLR: 623, + OCSequenceNumber: 624, + OCValidityDuration: 625, + OCReportType: 626, + OCReductionPercentage: 627, + DRMP: 301, + // Base Accounting + // Charging Control + CCCorrelationId: 411, + CCInputOctets: 412, + CCMoney: 413, + CCOutputOctets: 414, + CCRequestNumber: 415, + CCRequestType: 416, + CCServiceSpecificUnits: 417, + CCSessionFailover: 418, + CCSubSessionId: 419, + CCTime: 420, + CCTotalOctets: 421, + CCUnitType: 454, + CheckBalanceResult: 422, + CostInformation: 423, + CostUnit: 424, + CreditControl: 426, + CreditControlFailureHandling: 427, + CurrencyCode: 425, + DirectDebitingFailureHandling: 428, + Exponent: 429, + FinalUnitAction: 449, + FinalUnitIndication: 430, + GrantedServiceUnit: 431, + GSUPoolIdentifier: 453, + GSUPoolReference: 457, + MultipleServicesCreditControl: 456, + MultipleServicesIndicator: 455, + RatingGroup: 432, + RedirectAddressType: 433, + RedirectServer: 434, + RedirectServerAddress: 435, + RequestedAction: 436, + RequestedServiceUnit: 437, + RestrictionFilterRule: 438, + ServiceContextId: 461, + ServiceIdentifier: 439, + ServiceParameterInfo: 440, + ServiceParameterType: 441, + ServiceParameterValue: 442, + SubscriptionId: 443, + SubscriptionIdData: 444, + SubscriptionIdType: 450, + TariffChangeUsage: 452, + TariffTimeChange: 451, + UnitValue: 445, + UsedServiceUnit: 446, + UserEquipmentInfo: 458, + UserEquipmentInfoType: 459, + UserEquipmentInfoValue: 460, + ValueDigits: 447, + ValidityTime: 448, + // Gx Charging Control + FlowDescription: 507, + ChargingRuleInstall: 1001, + ChargingRuleRemove: 1002, + ChargingRuleDefinition: 1003, + ChargingRuleBaseName: 1004, + ChargingRuleName: 1005, + EventTrigger: 1006, + RevalidationTime: 1042, + Precedence: 1010, + ToSTrafficClass: 1014, + IPCANType: 1027, + RuleActivationTime: 1043, + RuleDeactivationTime: 1044, + SecurityParameterIndex: 1056, + FlowLabel: 1057, + FlowInformation: 1058, + PacketFilterIdentifier: 1060, + MonitoringKey: 1066, + UsageMonitoringInformation: 1067, + UsageMonitoringLevel: 1068, + UsageMonitoringReport: 1069, + UsageMonitoringSupport: 1070, + PacketFilterUsage: 1072, + FlowDirection: 1080, + RedirectInformation: 1085, + RedirectSupport: 1086, + NetworkRequestSupport: 1024, + Offline: 1008, + Online: 1009, + DefaultEPSBearerQoS: 1049, + ANGWAddress: 1050, + BearerUsage: 1000, + AccessNetworkChargingIdentifierGx: 1022, + TGPPSGSNAddress: 6, + TGPPGGSNAddress: 7, + AccessNetworkChargingAddress: 501, + TGPPMSTimeZone: 23, + TFTFilter: 1012, + TFTPacketFilterInformation: 1013, + // Network Access + NASPort: 5, + NASPortId: 87, + NASPortType: 61, + CalledStationId: 30, + CallingStationId: 31, + ConnectInfo: 77, + OriginatingLineInfo: 94, + ReplyMessage: 18, + UserPassword: 2, + PasswordRetry: 75, + Prompt: 76, + CHAPAuth: 402, + CHAPAlgorithm: 403, + CHAPIdent: 404, + CHAPResponse: 405, + CHAPChallenge: 60, + ARAPPassword: 70, + ARAPChallengeResponse: 84, + ARAPSecurity: 73, + ARAPSecurityData: 74, + ServiceType: 6, + CallbackNumber: 19, + CallbackId: 20, + IdleTimeout: 28, + PortLimit: 62, + NASFilterRule: 400, + FilterId: 11, + ConfigurationToken: 78, + FramedProtocol: 7, + FramedRouting: 10, + FramedMTU: 12, + FramedCompression: 13, + FramedIPAddress: 8, + FramedIPNetmask: 9, + FramedRoute: 22, + FramedPool: 88, + FramedInterfaceId: 96, + FramedIPv6Prefix: 97, + FramedIPv6Route: 99, + FramedIPv6Pool: 100, + FramedIPXNetwork: 23, + FramedAppletalkLink: 37, + FramedAppletalkNetwork: 38, + FramedAppletalkZone: 39, + ARAPFeatures: 71, + ARAPZoneAccess: 72, + LoginIPHost: 14, + LoginIPv6Host: 98, + LoginService: 15, + LoginTCPPort: 16, + LoginLATService: 34, + LoginLATNode: 35, + LoginLATGroup: 36, + LoginLATPort: 63, + Tunneling: 401, + TunnelType: 64, + TunnelMediumType: 65, + TunnelClientEndpoint: 66, + TunnelServerEndpoint: 67, + TunnelPassword: 69, + TunnelPrivateGroupId: 81, + TunnelAssignmentId: 82, + TunnelPreference: 83, + TunnelClientAuthId: 90, + TunnelServerAuthId: 91, + AccountingInputOctets: 363, + AccountingOutputOctets: 364, + AccountingInputPackets: 365, + AccountingOutputPackets: 366, + AcctSessionTime: 46, + AcctAuthentic: 45, + AccountingAuthMethod: 406, + AcctDelayTime: 41, + AcctLinkCount: 51, + AcctTunnelConnection: 68, + AcctTunnelPacketsLost: 86, + // TGPP + TGPPChargingCharacteristics: 13, + TGPPChargingId: 2, + TGPPGGSNMCCMNC: 9, + TGPPIMSI: 1, + TGPPIMSIMCCMNC: 8, + TGPPMSTimeZone: 23, + TGPPNSAPI: 10, + TGPPPDPType: 3, + TGPPRATType: 21, + TGPPSelectionMode: 12, + TGPPSessionStopIndicator: 11, + TGPPSGSNMCCMNC: 18, + TGPPUserLocationInfo: 22, + AccessNetworkChargingIdentifierValue: 503, + AccessNetworkInformation: 1263, + AccessTransferInformation: 2709, + AccessTransferType: 2710, + AccountExpiration: 2309, + AccumulatedCost: 2052, + Adaptations: 1217, + ADCRuleBaseName: 1095, + AdditionalContentInformation: 1207, + AdditionalTypeInformation: 1205, + AddressData: 897, + AddressDomain: 898, + AddresseeType: 1208, + AddressType: 899, + AFChargingIdentifier: 505, + AFCorrelationInformation: 1276, + AllocationRetentionPriority: 1034, + AlternateChargedPartyAddress: 1280, + AoCCostInformation: 2053, + AoCFormat: 2310, + AoCInformation: 2054, + AoCRequestType: 2055, + AoCService: 2311, + AoCServiceObligatoryType: 2312, + AoCServiceType: 2313, + AoCSubscriptionInformation: 2314, + ApplicationPortIdentifer: 3010, + ApplicationProvidedCalledPartyAddress: 837, + ApplicationServer: 836, + ApplicationServerId: 2101, + ApplicationServiceProviderIdentity: 532, + ApplicationServerInformation: 850, + ApplicationSessionId: 2103, + ApplicId: 1218, + AssociatedPartyAddress: 2035, + AssociatedURI: 856, + AuthorisedQoS: 849, + AuxApplicInfo: 1219, + BaseTimeInterval: 1265, + BasicServiceCode: 3411, + BearerCapability: 3412, + BearerIdentifier: 1020, + BearerService: 854, + BSSID: 2716, + CalledAssertedIdentity: 1250, + CalledPartyAddress: 832, + CallingPartyAddress: 831, + CarrierSelectRoutingInformation: 2023, + CauseCode: 861, + CGAddress: 846, + ChangeCondition: 2037, + ChangeTime: 2038, + ChargeReasonCode: 2118, + ChargedParty: 857, + ChargingCharacteristicsSelectionMode: 2066, + ChargingRuleBaseName: 1004, + ClassIdentifier: 1214, + ClientAddress: 2018, + CNIPMulticastDistribution: 921, + CNOperatorSelectionEntity: 3421, + ContentClass: 1220, + ContentDisposition: 828, + ContentId: 2116, + ContentProviderId: 2117, + ContentLength: 827, + ContentSize: 1206, + CSGAccessMode: 2317, + CSGId: 1437, + CSGMembershipIndication: 2318, + ContentType: 826, + CurrentTariff: 2056, + CUGInformation: 2304, + DataCodingScheme: 2001, + DeferredLocationEventType: 1230, + DeliveryReportRequested: 1216, + DeliveryStatus: 2104, + DestinationInterface: 2002, + Diagnostics: 2039, + DomainName: 1200, + DRMContent: 1221, + DynamicAddressFlag: 2051, + DynamicAddressFlagExtension: 2068, + EarlyMediaDescription: 1272, + ePDGAddress: 3425, + Envelope: 1266, + EnvelopeEndTime: 1267, + EnvelopeReporting: 1268, + EnvelopeStartTime: 1269, + Event: 825, + EventChargingTimeStamp: 1258, + EventType: 823, + Expires: 888, + FileRepairSupported: 1224, + FixedUserLocationInfo: 2825, + Flows: 510, + FromAddress: 2708, + ForwardingPending: 3415, + GGSNAddress: 847, + GuaranteedBitrateDL: 1025, + GuaranteedBitrateUL: 1026, + ExtendedGBRDL: 2850, + ExtendedGBRUL: 2851, + IMSApplicationReferenceIdentifier: 2601, + IMSChargingIdentifier: 841, + IMSCommunicationServiceIdentifier: 1281, + IMSEmergencyIndicator: 2322, + IMSInformation: 876, + IMSVisitedNetworkIdentifier: 2713, + IMSIUnauthenticatedFlag: 2308, + IncomingTrunkGroupId: 852, + IncrementalCost: 2062, + InitialIMSChargingIdentifier: 2321, + InstanceId: 3402, + InterfaceId: 2003, + InterfacePort: 2004, + InterfaceText: 2005, + InterfaceType: 2006, + InterOperatorIdentifier: 838, + IPRealmDefaultIndication: 2603, + ISUPCause: 3416, + ISUPCauseDiagnostics: 3422, + ISUPCauseLocation: 3423, + ISUPCauseValue: 3424, + ISUPLocationNumber: 3414, + LCSAPN: 1231, + LCSClientDialedByMS: 1233, + LCSClientExternalId: 1234, + LCSClientId: 1232, + LCSClientName: 1235, + LCSClientType: 1241, + LCSDataCodingScheme: 1236, + LCSFormatIndicator: 1237, + LCSInformation: 878, + LCSNameString: 1238, + LCSRequestorId: 1239, + LCSRequestorIdString: 1240, + LocalGWInsertedIndication: 2604, + LocalSequenceNumber: 2063, + LocationEstimate: 1242, + LocationEstimateType: 1243, + LocationType: 1244, + LowBalanceIndication: 2020, + LowPriorityIndicator: 2602, + MandatoryCapability: 604, + MaxRequestedBandwidthDL: 515, + MaxRequestedBandwidthUL: 516, + ExtendedMaxRequestedBWDL: 554, + ExtendedMaxRequestedBWUL: 555, + MBMS2G3GIndicator: 907, + MBMSChargedParty: 2323, + MBMSGWAddress: 2307, + MBMSInformation: 880, + MBMSServiceArea: 903, + MBMSServiceType: 906, + MBMSSessionIdentity: 908, + MBMSUserServiceType: 1225, + MediaInitiatorFlag: 882, + MediaInitiatorParty: 1288, + MessageBody: 889, + MessageClass: 1213, + MessageId: 1210, + MessageSize: 1212, + MessageType: 1211, + MMBoxStorageRequested: 1248, + MMContentType: 1203, + MMEName: 2402, + MMENumberforMTSMS: 1645, + MMERealm: 2408, + MMSInformation: 877, + MMTelInformation: 2030, + MMTelSServiceType: 2031, + MSCAddress: 3417, + MSISDN: 701, + MTCIWFAddress: 3406, + NeighbourNodeAddress: 2705, + NetworkCallReferenceNumber: 3418, + NextTariff: 2057, + NNIInformation: 2703, + NNIType: 2704, + NodeFunctionality: 862, + NodeId: 2064, + NumberOfDiversions: 2034, + NumberOfMessagesSent: 2019, + NumberOfMessagesSuccessfullyExploded: 2111, + NumberOfMessagesSuccessfullySent: 2112, + NumberOfParticipants: 885, + NumberOfReceivedTalkBursts: 1282, + NumberOfTalkBursts: 1283, + NumberPortabilityRoutingInformation: 2024, + OfflineCharging: 1278, + OnlineChargingFlag: 2303, + OptionalCapability: 605, + OriginatingIOI: 839, + OriginatorSCCPAddress: 2008, + Originator: 864, + OriginatorAddress: 886, + OriginatorReceivedAddress: 2027, + OriginatorInterface: 2009, + OutgoingSessionId: 2320, + OutgoingTrunkGroupId: 853, + ParticipantAccessPriority: 1259, + ParticipantActionType: 2049, + ParticipantGroup: 1260, + ParticipantsInvolved: 887, + PDNConnectionChargingId: 2050, + PDPAddress: 1227, + PDPContextType: 1247, + PDPAddressPrefixLength: 2606, + PoCChangeCondition: 1261, + PoCChangeTime: 1262, + PoCControllingAddress: 858, + PoCEventType: 2025, + PoCGroupName: 859, + PoCInformation: 879, + PoCServerRole: 883, + PoCSessionId: 1229, + PoCSessionInitiationtype: 1277, + PoCSessionType: 884, + PoCUserRole: 1252, + PoCUserRoleIds: 1253, + PoCUserRoleinfoUnits: 1254, + PositioningData: 1245, + PreferredAoCCurrency: 2315, + PresenceReportingAreaIdentifier: 2821, + PresenceReportingAreaInformation: 2822, + PresenceReportingAreaStatus: 2823, + Priority: 1209, + PriorityIndication: 3006, + PriorityLevel: 1046, + PreemptionCapability: 1047, + PreemptionVulnerability: 1048, + PSAppendFreeFormatData: 867, + PSFreeFormatData: 866, + PSFurnishChargingInformation: 865, + PSInformation: 874, + QoSInformation: 1016, + QoSClassIdentifier: 1028, + QuotaConsumptionTime: 881, + QuotaHoldingTime: 871, + RAI: 909, + RateElement: 2058, + RATType: 1032, + ReadReplyReportRequested: 1222, + RealTimeTariffInformation: 2305, + ReasonHeader: 3401, + ReceivedTalkBurstTime: 1284, + ReceivedTalkBurstVolume: 1285, + RecipientAddress: 1201, + RecipientInfo: 2026, + RecipientReceivedAddress: 2028, + RecipientSCCPAddress: 2010, + ReferenceNumber: 3007, + RefundInformation: 2022, + RelationshipMode: 2706, + RelatedIMSChargingIdentifier: 2711, + RelatedIMSChargingIdentifierNode: 2712, + RemainingBalance: 2021, + ReplyApplicId: 1223, + ReplyPathRequested: 2011, + ReportingReason: 872, + RequestedPartyAddress: 1251, + RequiredMBMSBearerCapabilities: 901, + RoleOfNode: 829, + RouteHeaderReceived: 3403, + RouteHeaderTransmitted: 3404, + ScaleFactor: 2059, + SDPAnswerTimestamp: 1275, + SDPMediaComponent: 843, + SDPMediaDescription: 845, + SDPMediaName: 844, + SDPOfferTimestamp: 1274, + SDPSessionDescription: 842, + SDPTimeStamps: 1273, + SDPType: 2036, + ServingNode: 2401, + SessionDirection: 2707, + ServedPartyIPAddress: 848, + ServerCapabilities: 603, + ServerName: 602, + ServiceDataContainer: 2040, + ServiceId: 855, + ServiceInformation: 873, + ServiceMode: 2032, + ServiceSpecificData: 863, + ServiceSpecificInfo: 1249, + ServiceSpecificType: 1257, + ServingNodeType: 2047, + SessionPriority: 650, + SGSNAddress: 1228, + SGWAddress: 2067, + SGWChange: 2065, + SIPMethod: 824, + SIPRequestTimestampFraction: 2301, + SIPRequestTimestamp: 834, + SIPResponseTimestampFraction: 2302, + SIPResponseTimestamp: 835, + SMDeviceTriggerIndicator: 3407, + SMDeviceTriggerInformation: 3405, + SMDischargeTime: 2012, + SMMessageType: 2007, + SMProtocolId: 2013, + SMSequenceNumber: 3408, + SMSCAddress: 2017, + SMSInformation: 2000, + SMSNode: 2016, + SMSResult: 3409, + SMServiceType: 2029, + SMStatus: 2014, + SMUserDataHeader: 2015, + SponsorIdentity: 531, + SSID: 1524, + StartofCharging: 3419, + StartTime: 2041, + StatusASCode: 2702, + StopTime: 2042, + SubmissionTime: 1202, + SubscriberRole: 2033, + SupplementaryService: 2048, + TADIdentifier: 2717, + TalkBurstExchange: 1255, + TalkBurstTime: 1286, + TalkBurstVolume: 1287, + TariffInformation: 2060, + TariffXML: 2306, + TDFIPAddress: 1091, + Teleservice: 3413, + TerminalInformation: 1401, + IMEI: 1402, + SoftwareVersion: 1403, + TerminatingIOI: 840, + TimeFirstUsage: 2043, + TimeLastUsage: 2044, + TimeQuotaMechanism: 1270, + TimeQuotaThreshold: 868, + TimeQuotaType: 1271, + TimeStamps: 833, + TimeUsage: 2045, + TMGI: 900, + TokenText: 1215, + TotalNumberOfMessagesExploded: 2113, + TotalNumberOfMessagesSent: 2114, + TrafficDataVolumes: 2046, + TranscoderInsertedIndication: 2605, + TransitIOIList: 2701, + Trigger: 1264, + TriggerType: 870, + TrunkGroupId: 851, + TWANUserLocationInfo: 2714, + TypeNumber: 1204, + UnitCost: 2061, + UnitQuotaThreshold: 1226, + UserCSGInformation: 2319, + UserData: 606, + UserLocationInfoTime: 2812, + UserParticipatingType: 1279, + UserSessionId: 830, + VASId: 1102, + VASPId: 1101, + VCSInformation: 3410, + VLRNumber: 3420, + VolumeQuotaThreshold: 869, + SGSNNumber: 1489, + GMLCAddress: 2405, + SupportedFeatures: 628, + FeatureListID: 629, + FeatureList: 630, + APNAggregateMaxBitrateDL: 1040, + APNAggregateMaxBitrateUL: 1041, + ExtendedAPNAMBRDL: 2848, + ExtendedAPNAMBRUL: 2849, + // TGPP S6A + SubscriptionData: 1400, + SubscriberStatus: 1424, + STNSR: 1433, + ICSIndicator: 1491, + NetworkAccessMode: 1417, + OperatorDeterminedBarring: 1425, + HPLMNODB: 1418, + RegionalSubscriptionZoneCode: 1446, + AccessRestrictionData: 1426, + APNOIReplacement: 1427, + LCSInfo: 1473, + GMLCNumber: 1474, + LCSPrivacyException: 1475, + SSCode: 1476, + SSStatus: 1477, + NotificationToUEUser: 1478, + ExternalClient: 1479, + ClientIdentity: 1480, + GMLCRestriction: 1481, + PLMNClient: 1482, + TGPPServiceType: 1483, + ServiceTypeIdentity: 1484, + MOLR: 1485, + TeleserviceList: 1486, + TSCode: 1487, + CallBarringInfo: 1488, + AMBR: 1435, + APNConfigurationProfile: 1429, + ContextIdentifier: 1423, + AllAPNConfigurationsIncludedIndicator: 1428, + APNConfiguration: 1430, + ServedPartyIPAddress: 848, + PDNType: 1456, + EPSSubscribedQoSProfile: 1431, + VPLMNDynamicAddressAllowed: 1432, + PDNGWAllocationType: 1438, + SIPTOPermission: 1613, + LIPAPermission: 1618, + RATFrequencySelectionPriorityID: 1440, + TraceData: 1458, + TraceReference: 1459, + TraceDepth: 1462, + TraceNETypeList: 1463, + TraceInterfaceList: 1464, + TraceEventList: 1465, + OMCId: 1466, + TraceEventList: 1465, + TraceCollectionEntity: 1452, + MDTConfiguration: 1622, + GPRSSubscriptionData: 1467, + CompleteDataListIncludedIndicator: 1468, + PDPContext: 1469, + PDPType: 1470, + QoSSubscribed: 1404, + VPLMNDynamicAddressAllowed: 1432, + ExtPDPType: 1620, + ExtPDPAddress: 1621, + SIPTOPermission: 1613, + CSGSubscriptionData: 1436, + ExpirationDate: 1439, + RoamingRestrictedDueToUnsupportedFeature: 1457, + SubscribedPeriodicRAUTAUTimer: 1619, + MPSPriority: 1616, + VPLMNLIPAAllowed: 1617, + RelayNodeIndicator: 1633, + MDTUserConsent: 1634, + RequestedEUTRANAuthenticationInfo: 1408, + NumberOfRequestedVectors: 1410, + ResynchronizationInfo: 1411, + ImmediateResponsePreferred: 1412, + RequestedUTRANGERANAuthenticationInfo: 1409, + VisitedPLMNId: 1407, + ErrorDiagnostic: 1614, + AuthenticationInfo: 1413, + EUTRANVector: 1414, + UTRANVector: 1415, + GERANVector: 1416, + ItemNumber: 1419, + CancellationType: 1420, + RAND: 1447, + XRES: 1448, + AUTN: 1449, + KASME: 1450, + Kc: 1453, + SRES: 1454, + ConfidentialityKey: 625, + IntegrityKey: 626, + ULRFlags: 1405, + ULAFlags: 1406, + CLRFlags: 1638, + UESRVCCCapability: 1615, + HomogeneousSupportofIMSVoiceOverPSSessions: 1493, + ActiveAPN: 1612, + SpecificAPNInfo: 1472, + ContextIdentifier: 1423, + PURFlags: 1635, + PUAFlags: 1442, + NORFlags: 1443, + SubscribedVSRVCC: 1636, + MIPHomeAgentAddress: 334, + MIPHomeAgentHost: 348, + MIP6AgentInfo: 486, + ServiceSelection: 493, + VisitedNetworkIdentifier: 600, + MIP6HomeLinkPrefix: 125, + UserId: 1444, + // TGPP SWX + RATType: 1032, + ANID: 1504, + VisitedNetworkIdentifier: 600, + TerminalInformation: 1401, + SIPAuthDataItem: 612, + SIPItemNumber: 613, + SIPAuthenticationScheme: 608, + SIPAuthenticate: 609, + SIPAuthorization: 610, + ConfidentialityKey: 625, + IntegrityKey: 626, + SIPNumberAuthItems: 607, + TGPPAAAServerName: 318, + SupportedFeatures: 628, + ServiceSelection: 493, + ContextIdentifier: 1423, + MIP6AgentInfo: 486, + ServerAssignmentType: 614, + DeregistrationReason: 615, + ReasonCode: 616, + ReasonInfo: 617, + Non3GPPUserData: 1500, + SubscriptionId: 443, + SubscriptionIdType: 450, + SubscriptionIdData: 444, + Non3GPPIPAccess: 1501, + Non3GPPIPAccessAPN: 1502, + MIP6FeatureVector: 124, + AMBR: 1435, + MaxRequestedBandwidthDL: 515, + MaxRequestedBandwidthUL: 516, + ExtendedMaxRequestedBWDL: 554, + ExtendedMaxRequestedBWUL: 555, + TGPPChargingCharacteristics: 13, + APNOIReplacement: 1427, + APNConfiguration: 1430, + ServedPartyIPAddress: 848, + PDNType: 1456, + EPSSubscribedQoSProfile: 1431, + QoSClassIdentifier: 1028, + AllocationRetentionPriority: 1034, + PriorityLevel: 1046, + PreemptionCapability: 1047, + PreemptionVulnerability: 1048, + VPLMNDynamicAddressAllowed: 1432, + PDNGWAllocationType: 1438, + SpecificAPNInfo: 1472, + SIPTOPermission: 1613, + LIPAPermission: 1618, + TraceInfo: 1505, + TraceData: 1458, + TraceReference: 1459, + TraceDepth: 1462, + TraceNETypeList: 1463, + TraceInterfaceList: 1464, + TraceEventList: 1465, + OMCId: 1466, + TraceCollectionEntity: 1452, + MDTConfiguration: 1622, + // Extra + EventNameCode: 13001, +} + +export const vendorId = { + TGPP: 10415, + Matrixxsoftware: 35838, +} + diff --git a/example/example.js b/example/example.js index cdbd5ef..a688a9a 100644 --- a/example/example.js +++ b/example/example.js @@ -1,6 +1,7 @@ import diam from 'k6/x/diameter' import avp from 'k6/x/diameter/avp' -import { avpCode, flags, vendorId } from './diam.js' +import dict from 'k6/x/diameter/dict' +import { avpCode, flags, vendorId } from './diam/const.js' import { check } from 'k6' @@ -9,7 +10,11 @@ export let options = { vus: 1, } -let client = diam.newClient() +// Load additional custom AVP definition +dict.load("dict/dictionary.xml") + +// Init Client +let client = diam.Client() let dataType = diam.DataType() export default function () {