GTP::ie

Description

This set of commands allows for the parsing and interpretation of GTP IE elements.

Syntax

GTP::ie append [<ie-path>] <type|name> <instance> <value>
GTP::ie count [-type <value>] [-instance <value>] [<ie-path>]
GTP::ie exists [<ie-path>]
GTP::ie get instance <ie-path>
GTP::ie get length <ie-path>
GTP::ie get encode_type <ie-path>
GTP::ie get value <ie-path>
GTP::ie get list [-type <value>] [-instance <value>] [<ie-path>]
GTP::ie info <version>
GTP::ie info <version> <type>
GTP::ie info <version> <name>
GTP::ie info -encode-type <version> <type>
GTP::ie info -encode-type <version> <name>
GTP::ie info -name <version> <type>
GTP::ie info -type <version> <name>
GTP::ie insert <ie-path> <type|name> <instance> <value>
GTP::ie list
GTP::ie remove <ie-path>
GTP::ie set <instance | value> <ie-path> <value>

GTP::ie append [<ie-path>] <type|name> <instance> <value>

  • Appends new IE to the end of the scope of grouped-IE provided by ie-path. The absence of ie-path argument sets the message as the scope, hence new IE is appended to the end of the message.
  • For example, “GTP::ie append bearer-ctx ebi 0 6” appends ebi EPS Bearer ID IE (with instance = 0, value = 6) to the end of bearer-ctx’s embedded IE. Note that instance is only valid for message version 2.

GTP::ie exists [<ie-path>]

  • Helps verify if this IE exists. In the absence of ie-path, it returns true, if at the least one IE element is present in the message.

GTP::ie count [-type <value>] [-instance <value>] [<ie-path>]

  • The count of IEs held by referred path is returned that matches the given type & instance, if the options are provided. The path provides the scope for counting. Path has to be the last argument to the command. The absence of path argument sets the message as the scope, hence count of all IEs in the message is returned. If “-type ” is provided, only those IEs that matches this type within the scope are counted. If “-instance ” is provided, only those IEs that matches this instance within the scope are counted.
  • NOTE: The count happens at the given scope, implying it does not include any embedded IEs in the count. Say message has 3 IEs and one of which is grouped-IE. Here “GTP::ie count” returns 3. GTP::ie count bearer_context Returns count of embedded IEs in the first bearer-context in the message. GTP::ie count Returns count of all IEs in the message. GTP::ie-count -type ip-address pdn-conn Return the count of IP address IEs inside the first PDN connection IE in the message. Only first PDN Connection is used as absence of index in path defaults to 0.

GTP::ie get instance <ie-path>

  • Returns the instance value of this IE. For messages of version 1, instance value is returned as 0.

GTP::ie get length <ie-path>

  • Returns the length in octets of value of this IE

GTP::ie get encode_type <ie-path>

  • Returns the type of encoding of the value.

GTP::ie get value

  • Returns the value of this IE.

GTP::ie get list [-type <value>] [-instance <value>] [<ie-path>]

  • Returns list of IE objects in the contained scope. The scope is provided by the path. path has to be the last argument. Absence of any path set the message level as scope. - -type helps collect IEs that matches this type value only. - -instance helps collect IEs of given instance value only. - Each IE object is a list of type, index, length, instance, encode-type

    and value. In case of messages of version 1, all elements are considered to have instance value of 0.

GTP::ie info <version>

  • Lists the following info for each IE supported in this version:
    name, type (integer), encode-type, description. This command can be used to gather information of all supported IEs.

GTP::ie info <version> <type>

  • Returns the info as in GTP::ie info for the specified IE “type” only. For example, “GTP::ie info 1 131” returns “apn 131 string {Access Point Name}”.

GTP::ie info <version> <name>

  • Returns the info as in GTP::ie info for the specified IE “name” only. For example, “GTP::ie info 1 apn” returns “apn 131 string {Access Point Name}”.

GTP::ie info -encode-type <version> <type>

  • Returns only the encode type of the specified IE “type”. For example, “GTP::ie info -encode-type 1 apn” returns “string”.

GTP::ie info -encode-type <version> <name>

  • Returns only the encode type of the specified IE “name”. For example, “GTP::ie info -encode-type 1 apn” returns “string”.

GTP::ie info -name <version> <type>

  • Returns the name of specified IE “type”. For example, “GTP::ie info -name 1 131” returns “apn”.

GTP::ie info -type <version> <name>

  • Returns the type of specified IE “name”. For example, “GTP::ie info -name 1 apn” returns “131”.

GTP::ie insert <ie-path> <type|name> <instance> <value>

  • Inserts new IE at location of IE specified by ie-path. The new IE is created based on supported type or name, instance and value. For example, “GTP::ie insert 2 apn 0 new-apn” inserts apn IE at location of existing IE type=2. Note that instance is only valid for message version 2.

GTP::ie list

  • Returns the list of all the IE elements contained in the message.

GTP::ie remove <ie-path>

  • Removes IE specified by ie-path. For example, “GTP::ie remove apn” removes the first apn.

GTP::ie set instance <ie-path> <value>

  • Sets the instance value of this IE. This is valid only for message version 2.

GTP::ie set value <ie-path> <value>

  • Sets the value of this IE.

Examples

proc decode_ie { ie_list } {
  foreach ie $ie_list {
    foreach { type len instance value } $ie {}
    switch [gtp_encode_type $type] {
      "grouped" {
        decode_ie $value
      }
      "string" {
        log local0. "${type}/${instance} ($len) : $value"
      }
      "unsigned32" {
        binary scan $value I value
        set value [expr {$value & 0xffffffff}]
        log local0. "${type}/${instance} ($len) : $value"
              default {
        binary scan $value H[expr {2 * $len}] value
        log local0. "${type}/${instance} ($len) : $value"
      }
    }
  }
}

proc apn_encode { apn } {
    set result ""
    foreach element [ split $apn . ] {
        set len [format %c [string length $element]]
        append result $len$element
    }
    return $result
}
when GTP_SIGNALLING_INGRESS {
    set apn_name [ call apn_encode "test.koenning.org"]
        if {[GTP::header version] == 1 &&  [GTP::header type] == 32 } {
                GTP::ie set value 131 $apn_name
        }
}
when GTP_SIGNALLING_INGRESS {
    if { [GTP::ie exists imsi:0] } {
        log local0. "GTP imsi [GTP::ie get value imsi:0]"
    }
    log local0. "Total number of top level IEs [GTP::ie count]"
    set ie_list [ GTP::ie get list]
    foreach ie $ie_list {
        log local0. "IE $ie"
    }
}
  • Introduced: BIGIP-11.5.0

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.