Diameter Client Controller

Introduction

The Diameter protocol is an authentication, authorization, and accounting protocol for computer networks that evolved from and replaces the RADIUS protocol that preceded it.

The TIBCO StreamBase® Client Controller Adapter for Diameter allows for controlling of the Diameter client connection and also outputs status information about the current Diameter connection. This adapter is not required for the Diameter client input and output adapters to work, but it is highly recommended as no status output occurs on the other client adapters. All the adapters sharing a configuration work together on the same underlying connection; see the section below about shared configurations for more information.

Adapter Properties

This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.

General Tab

Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: This field that shows the formal name of the adapter and the fully-qualified name of the class that implements the adapter. If the selected adapter is custom-written, you can click the class name link to open the Java source for this adapter. (Adapters provided by TIBCO StreamBase do not offer source view.)

Start with application: If this field is set to Yes (default) or to a module parameter that evaluates to true, this instance of this adapter starts as part of the JVM engine that runs this EventFlow fragment. If this field is set to No or to a module parameter that evaluates to false, the adapter instance is loaded with the engine, but does not start until you send an epadmin container resume command (or its sbadmin equivalent), or until you start the component with StreamBase Manager. With this option set to No or false, the adapter does not start even if the fragment as a whole is suspended and later resumed.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Operator Properties Tab

Property Type Description
Adapter Configuration Drop-down list The adapter configuration from the configuration file to use with this adapter.
Enable Control Port Check box If enabled a control port will allow commands to be sent to the operator to perform actions during runtime.
Log Level Drop-down list Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

Shared Adapter Configuration

This section describes the shared adapter configuration block found in the sbd.sbconf file.

Adapter Shared Location

The shared adapter configuration for the Diameter adapters is located in the sbd.sbconf file under the streambase-configuration and adapter-configurations XML elements.

Each shared adapter configuration must be under an element called adapter-configuration with a name attribute of DiameterAdapters. Following that, an element named section with a name attribute of DiameterAdapter is required.

Example Shared Adapter Configuration

<?xml version="1.0" encoding="UTF-8"?>
<streambase-configuration xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.streambase.com/schemas/sbconf/">
    <adapter-configurations>
        <adapter-configuration name="DiameterAdapters">
            <section name="DiameterAdapter">
                <setting name="id" val="DiameterSectionedMessagesServer"/>
                <setting name="dictionary" val="TestDictionary.json"/>
                <setting name="host" val=""/>
            </section>
            <section name="DiameterAdapter">
                <setting name="id" val="DiameterSectionedMessagesClient"/>
                <setting name="dictionary" val="TestDictionary.json"/>
                <setting name="host" val="127.0.0.1"/>
            </section>
            <section name="DiameterAdapter">
                <setting name="id" val="DiameterSectionedMessagesClient2"/>
                <setting name="dictionary" val="TestDictionary.json"/>
                <setting name="host" val="127.0.0.1"/>
            </section>
        </adapter-configuration>
    </adapter-configurations>
</streambase-configuration>

Shared Adapter Configuration Options

Property Type Default Description
id string   This is the name that will link the adapters together and is displayed in the drop down list on each adapters property configuration.
dictionary string   This is the filename of the Diameter dictionary file that will be for composing and parsing Diameter messages.
host string   For the server this is the host it will accept connections on, leave blank for all, and for the client this is the host to connect to.
port int 3868 For the server this is the port the server listens on; for the client, this is the port the client will create the outbound connection to.
networkProtocol string tcp Valid values are tcp and sctp and will determine the underlying network protocol to use.
startServerAtStartup boolean true Only valid for server adapters. If set to true, the server creates a listener at the startup of the application. If set to false, then the control port must be used to start the server listener.
connectAtStartup boolean true Only valid for client adapters. If set to true the client will attempt to connect to the server at startup of the application, if set to false then the control port must be used to establish a connection.
noDelay boolean false If set to true, the connection option no delay is set on the sockets.
maxDeviceWatchDogRequests int 3 The maximum number of device watch dog request messages to send before disconnecting.
watchDogTimeoutMS int 3000 The amount of time before the watch dog times out,in milliseconds, and sends a watchdog request.
originHost string 127.0.0.1 The origin host to use with the connection.
originRealm string my.realm The origin realm to use with the connection.
productName string StreamBase The product name to use with the connection.
firmwareVersion int 210 The firmware to use with the connection.
readBufferSize int 102400 The number of bytes for each sockets circular read buffer.
writeBufferSize int 102400 The number of bytes for each sockets circular write buffer.

Diameter Dictionary

This section describes Diameter dictionaries and how they are used with the adapters to parse and compose Diameter messages.

Dictionary files are in JSON format and are cumulative in that you can include more dictionary files inside of other dictionary files to keep them organized and less complex.

Base Dictionary

The Diameter sample that comes with StreamBase includes a BaseDictionary.json file which should be the base for all of your projects. This base dictionary includes all the required information for the Diameter adapters to perform the most basic Diameter protocol functions. The sample also includes a TestDictionary.json that shows the most basic dictionary files, including the base dictionary, to get the adapters up and running.

Dictionary Schema

The following shows the schema to which each dictionary must conform:

{
   "$schema":"http://json-schema.org/draft-04/schema#",
   "type":"object",
   "properties":{
      "includeDictionary":{
        "type":"array",
         "items":{
            "type":"object",
            "properties":{
               "file":{
                  "type":"string"
               }
            },
            "required":[
               "file"
            ]
         }       
      },
      "settings":{
        "type":"object",
        "properties":{
           "enumAsString":{
              "type":"boolean"
           },
           "applicationAndCommandAsString":{
              "type":"boolean"
           }
        }        
      },
      "vendors":{
         "type":"array",
         "items":{
            "type":"object",
            "properties":{
               "name":{
                  "type":"string"
               },
               "id":{
                  "type":"string"
               },
               "code":{
                  "type":"integer"
               }
            },
            "required":[
               "name",
               "id",
               "code"
            ]
         }
      },
      "dataTypes":{
         "type":"array",
         "items":{
            "type":"object",
            "properties":{
               "dataType":{
                  "type":"string"
               },
               "parentDataType":{
                  "type":"string"
               }
            },
            "required":[
               "dataType"
            ]
         }
      },
      "avps":{
         "type":"array",
         "items":{
            "type":"object",
            "properties":{
               "name":{
                  "type":"string"
               },
               "code":{
                  "type":"integer"
               },
               "vendorId":{
                  "type":"string"
               },
               "must":{
                  "type":"array",
                  "items":{
                     "enum":[
                        "M",
                        "V",
                        null
                     ]
                  }
               },
               "must-not":{
                  "type":"array",
                  "items":{
                     "enum":[
                        "M",
                        "V",
                        null
                     ]
                  }
               },
               "type":{
                  "type":"object",
                  "properties":{
                     "dataType":{
                        "type":"string"
                     },
                     "enum":{
                        "type":[
                           "array",
                           "object"
                        ],
                        "items":{
                           "type":"object",
                           "properties":{
                              "value":{
                                 "type":"integer"
                              },
                              "name":{
                                 "type":"string"
                              }
                           },
                           "required":[
                              "name"
                           ]
                        }
                     }
                  },
                  "required":[
                     "dataType"
                  ]
               },
               "grouped":{
                  "type":"array",
                  "items":{
                     "type":"object",
                     "properties":{
                        "name":{
                           "type":"string"
                        },
                        "min":{
                           "type":"integer"
                        },
                        "max":{
                           "type":"integer"
                        }
                     }
                  }
               }
            },
            "required":[
               "name",
               "code"
            ]
         }
      },
      "applications":{
         "type":"array",
         "items":{
            "type":"object",
            "properties":{
               "applicationId":{
                  "type":"integer"
               },
               "name":{
                  "type":"string"
               },
               "commands":{
                  "type":"array",
                  "items":{
                     "type":"object",
                     "properties":{
                        "name":{
                           "type":"string"
                        },
                        "code":{
                           "type":"integer"
                        },
                        "proxiable": {
                            "type":"boolean"
                        },
                        "request":{
                           "type":"array",
                           "items":{
                              "type":"object",
                              "properties":{
                                 "name":{
                                    "type":"string"
                                 },
                                 "min":{
                                    "type":"integer"
                                 },
                                 "max":{
                                    "type":"integer"
                                 },
                                 "vendorId":{
                                    "type":"string"
                                 },
                                 "index":{
                                    "type":"integer"
                                 },
                                 "hidden":{
                                    "type":"boolean"
                                 }
                              },
                              "required":[
                                 "name",
                                 "min"
                              ]
                           }
                        },
                        "answer":{
                           "type":"array",
                           "items":{
                              "type":"object",
                              "properties":{
                                 "name":{
                                    "type":"string"
                                 },
                                 "min":{
                                    "type":"integer"
                                 },
                                 "max":{
                                    "type":"integer"
                                 },
                                 "vendorId":{
                                    "type":"string"
                                 },
                                 "index":{
                                    "type":"integer"
                                 },
                                 "hidden":{
                                    "type":"boolean"
                                 }
                              },
                              "required":[
                                 "name",
                                 "min"
                              ]
                           }
                        }
                     },
                     "required":[
                        "name",
                        "code",
                        "proxiable",
                        "request",
                        "answer"
                     ]
                  }
               }
            },
            "required":[
               "commands",
               "applicationId"
            ]
         }
      }
   },
   "required":[
      "vendors",
      "dataTypes",
      "avps",
      "applications"
   ]
}
        

Dictionary Layout

The following are the major categories of the dictionary file and an overview of their usage.

includeDictionary

The includeDictionary section is an array of files that allows one dictionary file to include another dictionary file. This enables you to organize your dictionaries into logical application or vendor groups and combine them into a single dictionary.

  • file — The relative path to the linked dictionary file to include.

settings

The settings section allows dictionary related settings to be set.

  • enumAsString — The enumAsString setting is a true/false flag that determines if the string values of the enumerations in the dictionary should be used in EventFlow instead of the integer values. If set to true, the schemas produced by parsing the dictionary files will input/output a string value for all enum fields and require that any input fields match one of the enum values listed.

  • applicationAndCommandAsString — The applicationAndCommandAsString setting is a true/false flag that determines if the applicationId and commandCode fields of the request and answer message headers should be treated as string or numeric fields. If this value is true, the input and outputs of the adapters will consider the applicationId and commandCode to be string fields and match them to the dictionary name values. All messages read from the Diameter connection are translated to the correct string values, and all tuples are converted to the correct numeric values for the outbound Diameter messages.

vendors

The vendors section allows you to add vendor names and codes that will be used later in avp's and application commands.

  • name — The human-readable name of the vendor.

  • code — The code of the vendor to use with vendorId fields in other sections, for linking.

  • id — The ID of the vendor to send with Diameter messages.

dataTypes

The dataTypes section allows you to add any extended data types that are not already specified by the base dictionary.

  • dataType - The name of the data type which will be used when creating AVPs.

  • parentDataType - The parent data type which must eventually link back to one of the base underlying data types (OctetString, Integer32, Integer64, Unsigned32, Unsigned64, Float32, Float64).

avps

The avps (attribute value pairs) section allows you to add any AVPs that are not currently present in the base dictionary. These AVPs can be self-referenced to form nested structures. The AVPs are used in the application commands as the fields for each request and answer command.

  • name — The AVP name that is used later in the application commands to link AVPs to commands.

    code — The AVP code that is sent and used in the Diameter message.

    vendorId — (Optional) The vendor associated with this AVP, use the code of on of the vendors in the vendor section.

    must — An array of Diameter values to specify how this AVP will operate, value available:

    • M — In the must case it means the AVP must appear in the Diameter message or the message will be rejected.

    • V — In the must case it means the vendorId must have a value.

    must-not — An array of Diameter values to specify how this AVP will operate, value available:

    • M — In the must not case it means the AVP must NOT appear in the Diameter message or the message will be rejected.

    • V — In the must not case it means the vendorId must NOT appear in the Diameter message or the message will be rejected.

    type — The data type of this AVP which must correspond to one of the base or extended data types. If this field is missing then the grouped field must exist.

    grouped — An array of nested AVP values.

    • name — The name of the AVP to include.

    • min — (Optional) The minimum number of times this value must appear.

    • max — (Optional) The maximum number of times this value must appear.

applications

The applications section allows you to add any applications and commands that are not currently present in the base dictionary. The applications section is the main building block for creating a Diameter application and is comprised of multiple commands. Each command in turn has a request and answer message that is created from one or many AVPs listed in the AVP section.

  • applicationId — The application ID used when sending Diameter messages, this value is also used during the capabilities exchange.

  • name — The human-readable name of this application to use in the adapter properties.

  • commands — The array of commands associated with this application.

    • name — The name of the command and is used in the adapter properties.

    • code — The code of the command used to create the Diameter message.

    • proxiable — A flag to specify if this command is proxiable.

    • request/answer — An array of AVP values which make up the request/answer commands.

      • name — The name of the AVP to include.

      • min — (Optional) The minimum number of times this value must appear.

      • max — (Optional) The maximum number of times this value must appear.

      • vendorId — (Optional) The vendor associated with this AVP; use the code of one of the vendors in the vendor section.

      • index — (Optional) The index of this AVP value is the order of the AVP values.

      • hidden — (Optional) If hidden is true, the AVP value will be parsed from messages but is ignored in the StreamBase application and does not appear in the generated schema. This value cannot be true if the min value present and is greater than 0.

Command Input Port

Use the command port to send action commands to the adapter.

The schema for the command input port is a single field named command of type string.

The suggested full schema for the command input port is the following:

  • command, string, the command to send to the adapter. Valid values are:

    • connect - Starts a connection to a Diameter server.

    • disconnect - Forcefully disconnects the current connection from the Diameter server.

    • gracefuldisconnect - Starts a client disconnection by sending a Disconnect Peer(282) request message and waits for an answer before closing the connection.

Status Output Port

The status output port will output tuples for the current configuration giving relevant information about the connection.

The schema for the status output port is:

Field Name Field Type Description
type String The type of report, which follows normal log levels Debug, Error, Info, Trace, Warn.
action String The action that caused the report. "CER", "CEA", "DWR", "DWA", "DPR", "DPA", "Connect", "DisconnectClient", "Server", "Client"
object String An option object that has been affected by this status.
Message String A human readable message about the status.
time Tuple The timestamp that the status occurred.