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/diameter_sy.xml b/dict/diameter_sy.xml
deleted file mode 100644
index e634034..0000000
--- a/dict/diameter_sy.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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/dict.js b/example/diam/dict.js
index 319ea81..8bcda3e 100644
--- a/example/diam/dict.js
+++ b/example/diam/dict.js
@@ -784,11 +784,12 @@ export const avpCode = {
OMCId: 1466,
TraceCollectionEntity: 1452,
MDTConfiguration: 1622,
- // Diameter Sy
- SLRequestType: 2904,
+ // Extra
+ EventNameCode: 13001,
}
export const vendorId = {
TGPP: 10415,
+ Matrixxsoftware: 35838,
}
diff --git a/example/example.js b/example/example.js
index cf74749..4e22832 100644
--- a/example/example.js
+++ b/example/example.js
@@ -1,5 +1,6 @@
import diam from 'k6/x/diameter'
import avp from 'k6/x/diameter/avp'
+import dict from 'k6/x/diameter/dict'
import { avpCode, flags, vendorId } from './diam/dict.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 () {