- if($line =~ /^(.*)<\/platform>(.*)$/) {
- $output_string .= " <\/AS>\n<\/platform>";
- } else {
- $output_string .= "$line\n";
+ $line =~ s/\blink:ctn\b/link_ctn/g;
+ $line =~ s/\btrace:connect\b/trace_connect/g;
+
+ if($AS_opened && (($line=~ /<\/platform>/) || ($line=~ /<process/))) {
+ $output_string .= "</AS>\n";
+ $AS_opened = 0;
+ }
+
+ if( (!$AS_opened) && (
+ ($line =~ /<host/) ||
+ ($line =~ /<link/) ||
+ ($line =~ /<cluster/) ||
+ ($line =~ /<router/)
+ )) {
+ $output_string .= " <AS id=\"AS0\" routing=\"Full\">\n";
+ $AS_opened=1;