suite analyse tres complexe de fichier perl
Le
lepetitjoe
Bonjour,
J´ai eu à poster un message sur ce forum concernant l´analyse d´un
fichier en Perl, le lien est celui ci
http://groups.google.fr/group/fr.co...ad/2cfce2=
0489024141/7592d6dacd6baa0e#7592d6dacd6baa0e
A present le programme marche a moitié, c´est a dire le fichier xml
qui est generé par le programme n´est pas lu jusqu´a la fin.
J´arrive pas a determiner le pourquoi.Donc le parcoursdu fichier
n´est pas effectué jusqu´a la fin par l´algorithme de parcours del
a structure de données.
Quelqu´un pourrait il avoir une idée?
Merci
Ci-dessous le code:
use strict;
use warnings;
use XML::Writer;
my $xml_var;
my $xml_write = new XML::Writer(OUTPUT => \$xml_var,
DATA_MODE => 1, DATA_INDENT => 2);
$xml_write->xmlDecl('iso-8859-1');
$xml_write->startTag('racine');
while (<DATA>) { chomp; s/^\s+//; s/\s+$//;
if (/^(.*?)\s*{$/) {
$xml_write->startTag('bal', id=>$1);
}
elsif (/^}$/) {
$xml_write->endTag('bal');
}
else {
$xml_write->dataElement('ligne', $_);
}
}
$xml_write->endTag('racine');
$xml_write->end();
##########################################
use XML::Simple;
my $xml_mem = XMLin($xml_var,ForceArray => 1, KeyAttr => ['bal']);
##########################################
for my $r_ptr ( @{ $xml_mem->{'bal'}->[0]->{'bal'} } ) {
my $router = $r_ptr->{'id'};
print "router: $router";
for my $i_ptr ( @{ $r_ptr->{'bal'}->[0]->{'bal'} } ) {
my $interface = $i_ptr->{'id'};
print " interface.: $interface";
for my $u_ptr ( @{ $i_ptr->{'bal'} } ) {
my $unit = $u_ptr->{'id'};
$unit =~ s/^unit (.*?);?$/$1/;
my $vlan = $u_ptr->{'ligne'}->[0];
$vlan =~ s/^vlan-id (.*?);?$/$1/;
my $addr;
LOOP1:
for my $a_ptr (@{ $u_ptr->{'bal'} }) {
for my $b_ptr (@{ $a_ptr->{'bal'} }) {
my $t = $b_ptr->{'id'};
if (defined $t
and $t =~ /^address (.*?);?$/) {
$addr = $1; last LOOP1;
}
}
my $t = $a_ptr->{'ligne'}->[0];
if (defined $t
and $t =~ /^address (.*?);?$/) {
$addr = $1; last LOOP1;
}
}
printf " unit.: %-3s ", $unit;
printf "(vlan-id = %3s", $vlan;
printf ", address = %s)", $addr;
}
}
}
############################################
__DATA__
logical-routers {
mx0_0_asx {
interfaces {
ge-0/x/0 {
unit 50 {
vlan-id 50;
family inet {
address 2xx.x.95.226/29 {
vrrp-group 50 {
virtual-address 2xx.x.95.225;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 5x {
vlan-id 5x;
family inet {
address x42.x6.44.x2/2x {
vrrp-group 5x {
virtual-address x42.x6.44.xx;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 52 {
enable;
vlan-id 52;
family inet {
address x42.x6.44.2/26 {
primary;
vrrp-group 52 {
virtual-address x42.x6.44.x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 53 {
vlan-id 53;
family inet {
address x42.x6.4x.62/26 {
vrrp-group 53 {
virtual-address x42.x6.4x.x;
accept-data;
}
}
}
}
unit 54 {
vlan-id 54;
family inet {
address x42.x6.4x.94/2x {
vrrp-group 54 {
virtual-address x42.x6.4x.xx;
accept-data;
}
}
}
}
unit 55 {
vlan-id 55;
family inet {
address 2xx.x.95.23x/29 {
vrrp-group 55 {
virtual-address 2xx.x.95.233;
accept-data;
}
}
}
}
unit 56 {
vlan-id 56;
family inet {
address x42.x6.49.93/2x {
vrrp-group 56 {
virtual-address x42.x6.49.xx;
accept-data;
}
}
}
}
unit 54 {
vlan-id 54;
family inet {
address x42.x6.49.x43/2x {
vrrp-group 54 {
virtual-address x42.x6.49.x6x;
accept-data;
}
}
}
}
unit 40 {
vlan-id 40;
family inet {
address 2xx.x.94.2x3/29 {
vrrp-group 40 {
virtual-address 2xx.x.94.209;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 4x {
vlan-id 4x;
family inet {
address x42.x6.49.234/2x {
vrrp-group 4x {
virtual-address x42.x6.49.225;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 42 {
vlan-id 42;
family inet {
address x42.x6.49.x3/2x {
vrrp-group 42 {
virtual-address x42.x6.49.x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit x2 {
disable;
vlan-id x2;
family inet {
address 2xx.x.94.x90/2x {
vrrp-group xx2 {
virtual-address 2xx.x.94.xx5;
accept-data;
}
}
}
}
unit x9x {
vlan-id x9x;
family inet {
address x42.x6.x92.x/2x;
}
}
unit x92 {
vlan-id x92;
family inet {
address x42.x6.x92.x4/2x;
}
}
unit x93 {
vlan-id x93;
family inet {
address x42.x6.x92.33/24;
}
}
unit x94 {
vlan-id x94;
family inet {
address x42.x6.x92.65/2x;
}
}
unit x95 {
vlan-id x95;
family inet {
address x42.x6.x92.xx/2x;
}
}
unit x96 {
vlan-id x96;
family inet {
address x42.x6.x92.94/24;
}
}
unit 502 {
vlan-id 502;
family inet {
address x42.x6.254.2/30;
}
}
unit 403 {
vlan-id 403;
family inet {
address x42.x6.54.x30/26 {
vrrp-group 20x {
virtual-address x42.x6.54.x29;
preempt;
accept-data;
}
}
address x0.20x.0.2/x6 {
vrrp-group 202 {
virtual-address x0.20x.0.x;
preempt;
accept-data;
}
}
}
}
unit 409 {
vlan-id 409;
family inet {
address x42.x6.22.xx/2x {
primary;
}
address x92.x6x.4x.2/24;
}
}
unit 4x0 {
vlan-id 4x0;
family inet {
address x42.x6.22.34/29 {
primary;
}
address x92.x6x.43.2/24;
}
}
unit 4xx {
vlan-id 4xx;
family inet {
address x42.x6.22.66/24 {
primary;
}
address x92.x6x.42.2/24;
}
}
unit x00 {
vlan-id x00;
family inet {
address 2xx.x.96.x/2x;
}
}
unit x0x {
vlan-id x0x;
family inet {
address x42.24.x.66/26 {
vrrp-group xx {
virtual-address x42.24.x.65;
priority 200;
preempt;
accept-data;
}
}
address x42.24.x.x94/26 {
primary;
vrrp-group x3 {
virtual-address x42.24.x.x93;
priority 200;
preempt;
accept-data;
}
}
address x42.x6.xxx.x29/25;
}
}
unit x4x {
vlan-id x4x;
family inet {
address x42.24.x04.66/26;
address x92.x6x.4x.2/24;
}
}
unit x42 {
vlan-id x42;
family inet {
address x42.24.4.2/24;
address x92.x6x.42.2/24;
}
}
unit x43 {
vlan-id x43;
family inet {
address x42.24.x04.x94/26;
address x92.x6x.43.2/24;
}
}
unit x5x {
vlan-id x5x;
family inet {
address x42.24.x05.66/26;
address x92.x6x.5x.2/24;
}
}
unit x52 {
vlan-id x52;
family inet {
address x42.24.5.2/24;
address x92.x6x.52.2/24;
}
}
unit x63 {
vlan-id x63;
family inet {
address x42.24.x06.x93/26;
address x92.x6x.63.x/24;
}
}
}
ge-x/x/0 {
unit xx {
vlan-id xx;
family inet {
address x42.20.xx2.6/30;
}
}
}
}
protocols {
ospf {
export ospf_export_asx;
area 0.0.0.x0 {
interface ge-x/x/0.xx;
interface ge-0/x/0.403;
}
}
}
policy-options {
policy-statement ospf_export_asx {
term not_distributed_routes {
from {
route-filter x42.x6.254.x46/29 orlonger;
route-filter x92.x6x.0.0/x6 orlonger reject;
route-filter x42.x6.26.0/24 orlonger;
route-filter x42.x6.24.0/24 orlonger;
route-filter x42.x6.29.0/24 orlonger;
route-filter x42.x6.2x.0/24 orlonger;
}
then reject;
}
term no_mgmt_vlan {
from {
route-filter 2xx.x.39.x92/24 exact;
}
then reject;
}
term no_local_adresses {
from protocol local;
then reject;
}
term ospf_cost_x00 {
from interface [ ge-0/x/0.55 ge-0/x/0.54
ge-0/x/0.53 ge-0/x/0.x4x ge-0/x/0.x42 ge-0/x/0.x43 ge-0/x/0.x5x
ge-0/x/0.x52 ge-0/x/0.x53 ge-0/x/0.x3 ge-0/x/0.x2 ge-0/x/0.x4
ge-0/x/0.409 ge-0/x/0.4x0 ge-0/x/0.4xx ge-0/x/0.56 ge-0/x/0.54 ];
then {
metric x00;
next term;
}
}
term red_direct_and_static {
from protocol [ direct static ];
then accept;
}
}
}
routing-options {
router-id x0.x.x0.x;
}
}
mx0_0_as6x {
interfaces {
fe-0/3/3 {
unit 0 {
family inet6 {
address fec0:0:0:xxxx:0:0:0:x/64;
}
}
}
}
}
mx0_0_netm;
mx0_0_vrx {
interfaces {
ge-x/0/0 {
unit 20x {
vlan-id 20x;
family inet {
filter {
output fil-x/0/0.20x;
}
address x42.xx.xx.2/24 {
vrrp-group 20x {
virtual-address x42.xx.xx.x;
priority 200;
preempt;
}
}
}
}
unit 336 {
vlan-id 336;
family inet {
address x42.xx.x5.x93/26;
address x92.x6x.20.x/24;
}
}
}
ge-x/x/0 {
unit x0 {
vlan-id x0;
family inet {
address x42.20.xx2.2/30;
}
}
}
}
protocols {
ospf {
area 0.0.0.x0 {
interface ge-x/x/0.x0;
interface ge-x/0/0.20x;
interface ge-x/0/0.33x;
interface ge-x/0/0.332;
interface ge-x/0/0.336 {
passive;
}
interface ge-x/0/0.334 {
passive;
}
interface ge-x/0/0.335 {
passive;
}
interface ge-x/0/0.240;
interface ge-x/0/0.243;
interface ge-x/0/0.24x;
interface ge-x/0/0.244;
}
}
}
routing-options {
router-id x0.5x.x0.x;
}
}
}
interfaces {
ge-0/x/0 {
vlan-tagging;
unit 200 {
vlan-id 200;
family inet {
address x92.x6x.x50.x/24;
address x42.xx.x5.x/24 {
primary;
}
}
}
unit 20x {
vlan-id 20x;
family inet {
filter {
input mirror_pkts;
output mirror_pkts;
}
address x42.xx.x5.x29/26 {
primary;
}
address x92.x6x.x5x.x/24;
}
}
unit 202 {
vlan-id 202;
family inet {
address x92.x6x.x52.x/24;
address x42.xx.x5.65/2x;
}
}
unit 203 {
vlan-id 203;
family inet {
address x42.xx.x5.33/24;
address x92.x6x.x53.x/24;
}
}
unit 204 {
vlan-id 204;
family inet {
address x42.xx.x5.x93/26;
address x92.x6x.x54.x/24;
}
}
unit 205 {
vlan-id 205;
family inet {
address x42.xx.x5.xx/2x;
address x92.x6x.x55.x/24;
}
}
unit 206 {
vlan-id 206;
family inet {
address x42.xx.x5.94/2x;
}
}
unit 204 {
vlan-id 204;
family inet {
address x42.xx.x5.xx3/2x;
}
}
unit 20x {
vlan-id 20x;
family inet {
address x42.xx.26.65/2x;
}
}
unit 209 {
vlan-id 209;
family inet {
address x42.xx.26.x4/2x;
}
}
unit 2x0 {
vlan-id 2x0;
family inet {
address x42.xx.20.xx9/24 {
vrrp-group 2x0 {
virtual-address x42.xx.20.x6x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 36x {
vlan-id 36x;
family inet {
address x42.xx.x.65/24;
address x92.x6x.x03.x/24;
}
}
}
ge-0/2/0 {
unit 0 {
family inet {
address x42.20.xx0.2/30;
}
}
}
fe-0/3/0 {
unit 0 {
family inet {
no-redirects;
address x39.2x.200.x29/25 {
primary;
}
address x39.2x.20x.x/25;
address 2xx.x.3x.x/26;
address 2xx.x.53.65/26;
address x92.x6x.3x.254/24;
address x92.x6x.56.254/24;
}
}
}
fe-0/3/2 {
unit 0 {
family inet {
address x42.x6.4.65/30;
}
}
}
ge-x/0/0 {
vlan-tagging;
}
ge-x/x/0 {
vlan-tagging;
}
fxp0 {
description "Management Link to VLAN 500";
unit 0 {
family inet {
address 2xx.x.39.2x4/24;
}
}
}
lo0 {
unit 0 {
family inet {
address x24.0.0.x/32;
}
}
}
}
J´ai eu à poster un message sur ce forum concernant l´analyse d´un
fichier en Perl, le lien est celui ci
http://groups.google.fr/group/fr.co...ad/2cfce2=
0489024141/7592d6dacd6baa0e#7592d6dacd6baa0e
A present le programme marche a moitié, c´est a dire le fichier xml
qui est generé par le programme n´est pas lu jusqu´a la fin.
J´arrive pas a determiner le pourquoi.Donc le parcoursdu fichier
n´est pas effectué jusqu´a la fin par l´algorithme de parcours del
a structure de données.
Quelqu´un pourrait il avoir une idée?
Merci
Ci-dessous le code:
use strict;
use warnings;
use XML::Writer;
my $xml_var;
my $xml_write = new XML::Writer(OUTPUT => \$xml_var,
DATA_MODE => 1, DATA_INDENT => 2);
$xml_write->xmlDecl('iso-8859-1');
$xml_write->startTag('racine');
while (<DATA>) { chomp; s/^\s+//; s/\s+$//;
if (/^(.*?)\s*{$/) {
$xml_write->startTag('bal', id=>$1);
}
elsif (/^}$/) {
$xml_write->endTag('bal');
}
else {
$xml_write->dataElement('ligne', $_);
}
}
$xml_write->endTag('racine');
$xml_write->end();
##########################################
use XML::Simple;
my $xml_mem = XMLin($xml_var,ForceArray => 1, KeyAttr => ['bal']);
##########################################
for my $r_ptr ( @{ $xml_mem->{'bal'}->[0]->{'bal'} } ) {
my $router = $r_ptr->{'id'};
print "router: $router";
for my $i_ptr ( @{ $r_ptr->{'bal'}->[0]->{'bal'} } ) {
my $interface = $i_ptr->{'id'};
print " interface.: $interface";
for my $u_ptr ( @{ $i_ptr->{'bal'} } ) {
my $unit = $u_ptr->{'id'};
$unit =~ s/^unit (.*?);?$/$1/;
my $vlan = $u_ptr->{'ligne'}->[0];
$vlan =~ s/^vlan-id (.*?);?$/$1/;
my $addr;
LOOP1:
for my $a_ptr (@{ $u_ptr->{'bal'} }) {
for my $b_ptr (@{ $a_ptr->{'bal'} }) {
my $t = $b_ptr->{'id'};
if (defined $t
and $t =~ /^address (.*?);?$/) {
$addr = $1; last LOOP1;
}
}
my $t = $a_ptr->{'ligne'}->[0];
if (defined $t
and $t =~ /^address (.*?);?$/) {
$addr = $1; last LOOP1;
}
}
printf " unit.: %-3s ", $unit;
printf "(vlan-id = %3s", $vlan;
printf ", address = %s)", $addr;
}
}
}
############################################
__DATA__
logical-routers {
mx0_0_asx {
interfaces {
ge-0/x/0 {
unit 50 {
vlan-id 50;
family inet {
address 2xx.x.95.226/29 {
vrrp-group 50 {
virtual-address 2xx.x.95.225;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 5x {
vlan-id 5x;
family inet {
address x42.x6.44.x2/2x {
vrrp-group 5x {
virtual-address x42.x6.44.xx;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 52 {
enable;
vlan-id 52;
family inet {
address x42.x6.44.2/26 {
primary;
vrrp-group 52 {
virtual-address x42.x6.44.x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 53 {
vlan-id 53;
family inet {
address x42.x6.4x.62/26 {
vrrp-group 53 {
virtual-address x42.x6.4x.x;
accept-data;
}
}
}
}
unit 54 {
vlan-id 54;
family inet {
address x42.x6.4x.94/2x {
vrrp-group 54 {
virtual-address x42.x6.4x.xx;
accept-data;
}
}
}
}
unit 55 {
vlan-id 55;
family inet {
address 2xx.x.95.23x/29 {
vrrp-group 55 {
virtual-address 2xx.x.95.233;
accept-data;
}
}
}
}
unit 56 {
vlan-id 56;
family inet {
address x42.x6.49.93/2x {
vrrp-group 56 {
virtual-address x42.x6.49.xx;
accept-data;
}
}
}
}
unit 54 {
vlan-id 54;
family inet {
address x42.x6.49.x43/2x {
vrrp-group 54 {
virtual-address x42.x6.49.x6x;
accept-data;
}
}
}
}
unit 40 {
vlan-id 40;
family inet {
address 2xx.x.94.2x3/29 {
vrrp-group 40 {
virtual-address 2xx.x.94.209;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 4x {
vlan-id 4x;
family inet {
address x42.x6.49.234/2x {
vrrp-group 4x {
virtual-address x42.x6.49.225;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 42 {
vlan-id 42;
family inet {
address x42.x6.49.x3/2x {
vrrp-group 42 {
virtual-address x42.x6.49.x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit x2 {
disable;
vlan-id x2;
family inet {
address 2xx.x.94.x90/2x {
vrrp-group xx2 {
virtual-address 2xx.x.94.xx5;
accept-data;
}
}
}
}
unit x9x {
vlan-id x9x;
family inet {
address x42.x6.x92.x/2x;
}
}
unit x92 {
vlan-id x92;
family inet {
address x42.x6.x92.x4/2x;
}
}
unit x93 {
vlan-id x93;
family inet {
address x42.x6.x92.33/24;
}
}
unit x94 {
vlan-id x94;
family inet {
address x42.x6.x92.65/2x;
}
}
unit x95 {
vlan-id x95;
family inet {
address x42.x6.x92.xx/2x;
}
}
unit x96 {
vlan-id x96;
family inet {
address x42.x6.x92.94/24;
}
}
unit 502 {
vlan-id 502;
family inet {
address x42.x6.254.2/30;
}
}
unit 403 {
vlan-id 403;
family inet {
address x42.x6.54.x30/26 {
vrrp-group 20x {
virtual-address x42.x6.54.x29;
preempt;
accept-data;
}
}
address x0.20x.0.2/x6 {
vrrp-group 202 {
virtual-address x0.20x.0.x;
preempt;
accept-data;
}
}
}
}
unit 409 {
vlan-id 409;
family inet {
address x42.x6.22.xx/2x {
primary;
}
address x92.x6x.4x.2/24;
}
}
unit 4x0 {
vlan-id 4x0;
family inet {
address x42.x6.22.34/29 {
primary;
}
address x92.x6x.43.2/24;
}
}
unit 4xx {
vlan-id 4xx;
family inet {
address x42.x6.22.66/24 {
primary;
}
address x92.x6x.42.2/24;
}
}
unit x00 {
vlan-id x00;
family inet {
address 2xx.x.96.x/2x;
}
}
unit x0x {
vlan-id x0x;
family inet {
address x42.24.x.66/26 {
vrrp-group xx {
virtual-address x42.24.x.65;
priority 200;
preempt;
accept-data;
}
}
address x42.24.x.x94/26 {
primary;
vrrp-group x3 {
virtual-address x42.24.x.x93;
priority 200;
preempt;
accept-data;
}
}
address x42.x6.xxx.x29/25;
}
}
unit x4x {
vlan-id x4x;
family inet {
address x42.24.x04.66/26;
address x92.x6x.4x.2/24;
}
}
unit x42 {
vlan-id x42;
family inet {
address x42.24.4.2/24;
address x92.x6x.42.2/24;
}
}
unit x43 {
vlan-id x43;
family inet {
address x42.24.x04.x94/26;
address x92.x6x.43.2/24;
}
}
unit x5x {
vlan-id x5x;
family inet {
address x42.24.x05.66/26;
address x92.x6x.5x.2/24;
}
}
unit x52 {
vlan-id x52;
family inet {
address x42.24.5.2/24;
address x92.x6x.52.2/24;
}
}
unit x63 {
vlan-id x63;
family inet {
address x42.24.x06.x93/26;
address x92.x6x.63.x/24;
}
}
}
ge-x/x/0 {
unit xx {
vlan-id xx;
family inet {
address x42.20.xx2.6/30;
}
}
}
}
protocols {
ospf {
export ospf_export_asx;
area 0.0.0.x0 {
interface ge-x/x/0.xx;
interface ge-0/x/0.403;
}
}
}
policy-options {
policy-statement ospf_export_asx {
term not_distributed_routes {
from {
route-filter x42.x6.254.x46/29 orlonger;
route-filter x92.x6x.0.0/x6 orlonger reject;
route-filter x42.x6.26.0/24 orlonger;
route-filter x42.x6.24.0/24 orlonger;
route-filter x42.x6.29.0/24 orlonger;
route-filter x42.x6.2x.0/24 orlonger;
}
then reject;
}
term no_mgmt_vlan {
from {
route-filter 2xx.x.39.x92/24 exact;
}
then reject;
}
term no_local_adresses {
from protocol local;
then reject;
}
term ospf_cost_x00 {
from interface [ ge-0/x/0.55 ge-0/x/0.54
ge-0/x/0.53 ge-0/x/0.x4x ge-0/x/0.x42 ge-0/x/0.x43 ge-0/x/0.x5x
ge-0/x/0.x52 ge-0/x/0.x53 ge-0/x/0.x3 ge-0/x/0.x2 ge-0/x/0.x4
ge-0/x/0.409 ge-0/x/0.4x0 ge-0/x/0.4xx ge-0/x/0.56 ge-0/x/0.54 ];
then {
metric x00;
next term;
}
}
term red_direct_and_static {
from protocol [ direct static ];
then accept;
}
}
}
routing-options {
router-id x0.x.x0.x;
}
}
mx0_0_as6x {
interfaces {
fe-0/3/3 {
unit 0 {
family inet6 {
address fec0:0:0:xxxx:0:0:0:x/64;
}
}
}
}
}
mx0_0_netm;
mx0_0_vrx {
interfaces {
ge-x/0/0 {
unit 20x {
vlan-id 20x;
family inet {
filter {
output fil-x/0/0.20x;
}
address x42.xx.xx.2/24 {
vrrp-group 20x {
virtual-address x42.xx.xx.x;
priority 200;
preempt;
}
}
}
}
unit 336 {
vlan-id 336;
family inet {
address x42.xx.x5.x93/26;
address x92.x6x.20.x/24;
}
}
}
ge-x/x/0 {
unit x0 {
vlan-id x0;
family inet {
address x42.20.xx2.2/30;
}
}
}
}
protocols {
ospf {
area 0.0.0.x0 {
interface ge-x/x/0.x0;
interface ge-x/0/0.20x;
interface ge-x/0/0.33x;
interface ge-x/0/0.332;
interface ge-x/0/0.336 {
passive;
}
interface ge-x/0/0.334 {
passive;
}
interface ge-x/0/0.335 {
passive;
}
interface ge-x/0/0.240;
interface ge-x/0/0.243;
interface ge-x/0/0.24x;
interface ge-x/0/0.244;
}
}
}
routing-options {
router-id x0.5x.x0.x;
}
}
}
interfaces {
ge-0/x/0 {
vlan-tagging;
unit 200 {
vlan-id 200;
family inet {
address x92.x6x.x50.x/24;
address x42.xx.x5.x/24 {
primary;
}
}
}
unit 20x {
vlan-id 20x;
family inet {
filter {
input mirror_pkts;
output mirror_pkts;
}
address x42.xx.x5.x29/26 {
primary;
}
address x92.x6x.x5x.x/24;
}
}
unit 202 {
vlan-id 202;
family inet {
address x92.x6x.x52.x/24;
address x42.xx.x5.65/2x;
}
}
unit 203 {
vlan-id 203;
family inet {
address x42.xx.x5.33/24;
address x92.x6x.x53.x/24;
}
}
unit 204 {
vlan-id 204;
family inet {
address x42.xx.x5.x93/26;
address x92.x6x.x54.x/24;
}
}
unit 205 {
vlan-id 205;
family inet {
address x42.xx.x5.xx/2x;
address x92.x6x.x55.x/24;
}
}
unit 206 {
vlan-id 206;
family inet {
address x42.xx.x5.94/2x;
}
}
unit 204 {
vlan-id 204;
family inet {
address x42.xx.x5.xx3/2x;
}
}
unit 20x {
vlan-id 20x;
family inet {
address x42.xx.26.65/2x;
}
}
unit 209 {
vlan-id 209;
family inet {
address x42.xx.26.x4/2x;
}
}
unit 2x0 {
vlan-id 2x0;
family inet {
address x42.xx.20.xx9/24 {
vrrp-group 2x0 {
virtual-address x42.xx.20.x6x;
priority 200;
preempt;
accept-data;
}
}
}
}
unit 36x {
vlan-id 36x;
family inet {
address x42.xx.x.65/24;
address x92.x6x.x03.x/24;
}
}
}
ge-0/2/0 {
unit 0 {
family inet {
address x42.20.xx0.2/30;
}
}
}
fe-0/3/0 {
unit 0 {
family inet {
no-redirects;
address x39.2x.200.x29/25 {
primary;
}
address x39.2x.20x.x/25;
address 2xx.x.3x.x/26;
address 2xx.x.53.65/26;
address x92.x6x.3x.254/24;
address x92.x6x.56.254/24;
}
}
}
fe-0/3/2 {
unit 0 {
family inet {
address x42.x6.4.65/30;
}
}
}
ge-x/0/0 {
vlan-tagging;
}
ge-x/x/0 {
vlan-tagging;
}
fxp0 {
description "Management Link to VLAN 500";
unit 0 {
family inet {
address 2xx.x.39.2x4/24;
}
}
}
lo0 {
unit 0 {
family inet {
address x24.0.0.x/32;
}
}
}
}

Poser une question


- le programme fonctionne sur une structure "$xml_mem"
("Hash-of-Array-of-Hash-of..." généré par XML::Simple).
- avec chaque boucle "for" on descend un niveau dans la structure.
- l'élément {'bal'} correspond à une balise - l'algorithme descend jusqu'à une certain profondeur dans la
structure, la profondeur est limité par le nombre de boucles "for"
dans l'algorithme.
Dans ma réponse du 17 Août 2006 ("analyse tres complexe de fichier
perl") sur ce forum fr.comp.lang.perl j'ai donné (parmi autres) 3
liens de documentation qui sont indispensable pour la compréhension du
programme:
http://perl.enstimac.fr/DocFr/perllol.html
http://search.cpan.org/~josephw/XML-Writer-0.600/Writer.pm
http://search.cpan.org/~grantm/XML-Simple-2.14/lib/XML/Simple.pm
Je propose que vous donnez plus de détails des règles de composition
de ce fichier. Avec des détails supplémentaires, on pourrait
peut-être proposer une autre solution, même, si nécessaire, une
autre stratégie.
En ce qui concerne la stratégie: je reviens sur ma réponse du 17
Août 2006:
[ snip de 600 lignes ]
Merci de réduire la taille du fichier DATA, tel qu'il est, il est
définitivement trop gros.
- L'algorithme travaille sur une structure $xml_mem (du genre
"Hash-of-Array-of-Hash-of...") qui est générée par XML::Simple
- L'élément {'bal'} correspond à une balise <bal> dans le fichier
XML
- Avec chaque boucle "for" dans l'algorithme, on descend un niveau dans
la structure, la profondeur maximale est limité par le nombre des
boucles "for".
Pour comprendre le fonctionnement du programme, il est indispensable de
comprendre d'abord les 3 documents suivants:
http://perl.enstimac.fr/DocFr/perllol.html
http://search.cpan.org/~josephw/XML-Writer-0.600/Writer.pm
http://search.cpan.org/~grantm/XML-Simple-2.14/lib/XML/Simple.pm
Comme déjà signalé dans ma réponse du 17 Août 2006 ("analyse tres
complexe de fichier perl") dans ce forum fr.comp.lang.perl:
[ snip de 600 lignes ]
Le fichier DATA est trop gros. Il faut réduire la taille du fichier et
donner plutôt les règles de composition du fichier.
tel, ce fichier est generé automatiquement par un serveur et moi
utilisateur je n´ai aucune influence sur la composition du fichier.
Donc je ne peux pas exactement vous dire sur quelles bases le fichier
est composé.
Mon probleme est de detecter exactement ce qui bloque la suite de la
lecture de la structure XML .
Merci bien
Comme déjà dit, pour comprendre le fonctionnement de mon programme,
il est indispensable de comprendre d'abord les 3 documents suivants:
http://perl.enstimac.fr/DocFr/perllol.html
http://search.cpan.org/~josephw/XML-Writer-0.600/Writer.pm
http://search.cpan.org/~grantm/XML-Simple-2.14/lib/XML/Simple.pm
Mais pour analyser un fichier log avec Perl et XML, vous n'êtes pas
obligé d'utiliser la méthode XML::Simple dans mon programme.
La méthode XML::Simple n'est qu'une première stratégie/module parmi
des centaines des stratégies/modules XML sous Perl. Il est probable
qu'il existe autres stratégies/modules XML qui sont beaucoup mieux
adapté au problème (peut-être XML::Twig ? -- ou XML::TokeParser ?)