Format Specifications

The FMT file is made up of 1 or more FSS. An FSS has the following three parts:

  • The format header has the keyword FORMAT followed by the class name. This is optionally followed by the FOLLOWS keyword and a previously defined FORMAT class name. If the incoming message matches this FSS, the class name following the FORMAT keyword is used on the outgoing EIF event.
  • The format content has a format string optionally followed by a list of map rules. The format string performs a function similar to the SELECT segment of a CDS file; that is, it matches the incoming message to a particular FSS. The map rules perform a function similar to the MAP segment in the CDS file; that is, they assign values to event attributes.
  • The END keyword completes the FSS.

The format header, the format string, each map rule, and the END keyword must begin on a new line.

The FOLLOWS relationship is used to enable a specific FSS to be built from more generic ones. When format B follows format A, B inherits all of the map rules (but not the format string) from A. Format B can define any additional map rules, but any map rules redefined by B are not inherited from A. Format B can override inherited map rules by redefining them.

Messages that are forwarded by the NetView® program typically have a common format consisting of a message identifier and message-specific text. These message components can be represented in the format string using a component specifier notation that is very similar to the C-style printf() notation. This printf() notation is similar to the notation used in CDS files.

The following format string describes the entire class of messages that are produced by the NetView automation table:

%s*

Input messages are tokenized into constants and blanks. A constant is any consecutive string of non-blank characters. Component specifiers allow the constants and blanks to be grouped into more complex "tokens" when trying to match an FSS against a specific message. The current allowable component specifiers are:

%lengths Matches one constant in the input message
%lengths* Matches zero or more constants in the input message
%lengths+ Matches one or more constants in the input message

The optional length is a decimal number of any size that truncates the constant if the actual length is greater than the specifier length. For the specifiers that can match multiple constants, each constant in the accumulated string is truncated. Also, the string itself terminates on a constant that is less than the specifier length.

The format string DSI%s %s* is taken from the default message adapter FMT file shipped with the E/AS, and is used in the following discussion to demonstrate the usage of format strings.

As an example of matching a message to the DSI%s %s* format specification, consider the following NetView message:

DSI002I INVALID COMMAND: 'BADCOMMAND'

The component specifiers and matches are as follows:

DSI DSI
%s 002I
%s* INVALID COMMAND:'BADCOMMAND'

The DSI002I message has some constant parts and some variable parts. That is, certain parts of the message (constant parts) will be the same for any DSI002I message that is generated. The constant parts of the message are:

DSI002I INVALID COMMAND: '  '

The variable part of the message is:

BADCOMMAND

Note that the first constant part of the message goes all the way to the first single quote (') in the message. The second single quote is the beginning of the second constant part of the message, which also happens to be the last character in the message. The data inside of the single quotes is all variable.

The following message is an example of another DSI002I message with different variable parts:

DSI002I INVALID COMMAND: 'WORSE COMMAND'

In this case, the variable part is composed of two words and a space -- WORSE COMMAND.

The format string DSI%s %s* can be specialized for the DSI002I message as follows:

DSI %s INVALID COMMAND: '%s*'

Using the previously described DSI002I message, the component specifiers and matches are as follows:

DSI DSI
%s 002I
INVALID COMMAND: 'INVALID COMMAND: '
%s* WORSE COMMAND
' '

The blank characters that separate the words of a message must also be present in the format string. A single space character in the format string will match any number of blank characters in the message.

Suppose the space between the colon (:) and the quote (') is deleted in the specialized DSI002I format string given previously:

DSI %s INVALID COMMAND:'%s*'

In this example, the format string would no longer match DSI002I messages. However, in the following example, the NetView message would match the format specification, since all consecutive blanks from both the input message and the format specification are boiled down to a single blank character:

DSI %s INVALID COMMAND:       '%s*'

Care should be taken when using arbitrary length repeater component specifiers (%s* and %s+ ). The following format string does not make much sense:

This is not a good format %s* %s*

The first %s* matches everything through the end of the message, and the second %s* will never match anything. It might appear that this does not matter, but the importance becomes obvious when map rules are discussed in Map Rules.

The following format string, however, is meaningful:

This is a good format %s* : %s*

The first %s* matches everything up to the first colon (:), and the second %s* matches everything through the end of the message.

From the examples here, you can see that you can specialize a generic format to match a more specific event by either replacing component specifiers with constants or by restricting the arbitrary length repeater specifiers to a fixed length by using constants to terminate the specifier.