2009-03-26 22:56:36 +02:00
|
|
|
use strict;
|
|
|
|
|
|
|
|
my @fields = (
|
2009-12-20 00:19:09 +02:00
|
|
|
[ "_n", "UINT", " - Number of samples", 4 ],
|
|
|
|
[ "_s", "UINT", " - Sum of samples", 8 ],
|
|
|
|
[ "_ss", "UINT", " - Sum of squared samples", 8 ],
|
2009-03-26 22:56:36 +02:00
|
|
|
);
|
|
|
|
|
2009-12-20 00:19:34 +02:00
|
|
|
my $file = $ARGV[0] or die "Syntax: $0 <file> <start>\n";
|
2009-03-26 22:56:36 +02:00
|
|
|
-f $file or die "File not found\n";
|
2009-12-20 00:19:34 +02:00
|
|
|
my $start = $ARGV[1];
|
|
|
|
$start =~ /^\d+$/ or die "Invalid start number";
|
|
|
|
open FILE, "<$file" or die "Can't open file";
|
|
|
|
while (<FILE>) {
|
2009-03-29 05:12:21 +03:00
|
|
|
/^(%?)(\w+),\s*(\w+),\s*(.+)$/ and do {
|
|
|
|
my $counter = $1;
|
|
|
|
my $rfield = $2;
|
|
|
|
my $nfield = $3;
|
|
|
|
my $descr = $4;
|
|
|
|
my @f;
|
|
|
|
if ($counter) {
|
2009-12-20 00:19:09 +02:00
|
|
|
@f = [ "", "UINT", "", 4];
|
2009-03-29 05:12:21 +03:00
|
|
|
} else {
|
|
|
|
@f = @fields;
|
|
|
|
}
|
|
|
|
foreach my $f (@f) {
|
2009-12-20 00:19:34 +02:00
|
|
|
my $nr = $start++;
|
2009-03-26 22:56:36 +02:00
|
|
|
my $n = $f->[0];
|
|
|
|
my $N = uc $n;
|
|
|
|
my $ftype = $f->[1];
|
|
|
|
my $fdesc = $f->[2];
|
2009-12-20 00:19:09 +02:00
|
|
|
my $size = $f->[3];
|
|
|
|
print "$nr, IPFIX_FT_WPROBE_$rfield$N, $size, IPFIX_CODING_$ftype, \"$nfield$n\", \"$descr$fdesc\"\n";
|
2009-03-26 22:56:36 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2009-12-20 00:19:34 +02:00
|
|
|
close FILE;
|
2009-03-26 22:56:36 +02:00
|
|
|
|