Chapter 3. Gateway development 59
We can created these mappings by using the PERLIZE rule, which provides
advanced customized data manipulation in header and data blocks. By enabling
debug mode, we can see the first level PIF (see “Sample first level PIF data file”
on page 76 for more information).
From our previous gateway parser engine configurations, we understand some
data resides in the header and data block section. The purpose of having header
data is because it is common information that can be used for all other data block
sections, so they would not need to be repeated within each data block section.
Eventually, the combination of a header and each data block section will form
one record, or row, in the CSV file format. The PERLIZE rule allows manipulation
of the data in header and block sections.
We decide how to manipulate the data from the PIF file as follows:
Input to the PERLIZE rule is defined with the INPUT_FILE_DESCRIPTION
option, as shown in see Example 3-10. We also show how the PERLIZE rule
is called by simply defining the RULE_TYPE option. The RULE_DESC option
is mainly a description, so this rule can be easily searched for when
performing auditing or logging, because sometimes the same rule type may
be used more than once.
Example 3-10 Matching the PIF file name for the PERLIZE rule in UserConfig.pm
RULE_TYPE => 'PERLIZE',
RULE_DESC => 'Manipulating Motorola GGSN Data',
INPUT_FILE_DESCRIPTION => '^*-#-I.pif$',
Header manipulation
In the header, there are several changes that we want to perform:
– We would like to change the time format for startTime and endTime to the
format YYYYMMDD.hhmm. Currently, startTime and endTime information only
includes the time, but does not include date information, which has to be
created by combining the time with the day. To combine them, a
conversion to UNIX® date time is done and then converted to the desired
format. The Date::Manip Perl libraries should be included to allow this date
and time manipulation.
– The startTime and endTime fields use prefixes that conform to the naming
convention of the output file discussed in “GPRS Core GGSN PM CSV file
naming convention” on page 47.
– We want to rename the field from systemName to GGSNName. Copy the
same data from the old field name to a new field name. Then the old data
field, which is not necessary, is removed with the
REDUNDANT_HEADER_COUNTERS option.