diff --git a/README.md b/README.md index 06529d3..a2988c4 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ import diam from 'k6/x/diameter' import avp from 'k6/x/diameter/avp' import dict from 'k6/x/diameter/dict' import { cmd, app, code, flag, vendor } from './diam/const.js' - import { check } from 'k6' let data = diam.DataType() + let client = diam.Client({ authApplicationId: [app.ChargingControl], }) @@ -55,6 +55,15 @@ Use your custom k6 binary to run an example k6 script. ./bin/k6 run example/example.js ``` +## Docker +Alternatively, you may run xk6-diameter packaged in Docker using the following command: +```bash +docker run \ + --net=host \ + -v $(pwd)/example:/mnt/example \ + ghcr.io/matrixxsoftware/xk6-diameter run --logformat=raw /mnt/example/example.js +``` + ## Generator There are thousands of AVPs, each with a unique avp-code and vendor-id. To aid readability and enhance the developer experience, we recommend defining them as constants in a separate file, for example, using `diam/const.js`. @@ -69,11 +78,47 @@ The CLI also supports generating additional AVPs that are not defined in the def ./bin/dict_generator -output example/diam/const.js -dictionary dict/extra.xml ``` -## Docker -Run xk6-diameter docker using the following command: -```bash -docker run \ - --net=host \ - -v $(pwd)/example:/mnt/example \ - ghcr.io/matrixxsoftware/xk6-diameter run --logformat=raw /mnt/example/example.js -``` +Configurations + +## Configuration Options + +### Diameter Config + +| Field Name | JavaScript Type | Description | +| ------------------------------ | ----------------------------- | ----------------------------------------------------- | +| RequestTimeout | duration | Timeout for each request | +| MaxRetransmits | number | Maximum number of message retransmissions | +| RetransmitInterval | duration | Interval between message retransmissions | +| EnableWatchdog | boolean | Flag to enable automatic DWR (Diameter Watchdog Request) | +| WatchdogInterval | duration | Interval between sending DWRs | +| WatchdogStream | number | Stream ID for sending DWRs (for multistreaming protocols) | +| SupportedVendorID | number array | List of supported vendor IDs | +| AcctApplicationID | number array | List of accounting application IDs | +| AuthApplicationID | number array | List of authentication application IDs | +| VendorSpecificApplicationID | number array | List of vendor-specific application IDs | +| CapabilityExchange | object | Configuration for capability exchange | + +### Capability Exchange Config + +| Field Name | JavaScript Type | Description | +| ------------------------------ | ----------------------------- | ----------------------------------------------------- | +| VendorID | number | Vendor ID | +| ProductName | string | Name of the product | +| OriginHost | string | Host name of the origin | +| OriginRealm | string | Realm of the origin | +| FirmwareRevision | number | Firmware revision number | +| HostIPAddresses | string array | List of host IP addresses | + +### Example +The following example demonstrates how to create a Diameter client in k6 with various configuration options. + +```go +let client = diam.Client({ + requestTimeout: "50ms", + enableWatchdog: false, + authApplicationId: [app.ChargingControl], + capabilityExchange: { + vendorId: 35838, + }, +}) +``` \ No newline at end of file diff --git a/example/example.js b/example/example.js index a67043b..6d061d8 100644 --- a/example/example.js +++ b/example/example.js @@ -2,7 +2,6 @@ import diam from 'k6/x/diameter' import avp from 'k6/x/diameter/avp' import dict from 'k6/x/diameter/dict' import { cmd, app, code, flag, vendor } from './diam/const.js' - import { check } from 'k6' export let options = { @@ -14,10 +13,14 @@ export let options = { // dict.load("dict/extra.xml") let data = diam.DataType() + let client = diam.Client({ requestTimeout: "50ms", enableWatchdog: false, authApplicationId: [app.ChargingControl], + capabilityExchange: { + vendorId: 35838, + }, }) export default function () {