5 die "Usage: perl transfrom_optorsim_platform.pl <file.conf>\n";
8 my($conf_file)=$ARGV[0];
10 open FILE, $conf_file or die "Unable to open $conf_file";
12 print "<?xml version='1.0'?>\n";
13 print "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n";
14 print "<platform version=\"3\">\n";
15 print "<AS id=\"AS0\" routing=\"Floyd\">\n";
30 while(defined($line=<FILE>))
33 if($line =~ /^#(.*)\)(.*)$/)
35 print "<!--$1 $2-->\n";
36 push @list_of_name, $2;
38 elsif($line =~ /^([0-9]*) ([0-9]*) ([0-9]*) (.*)$/)
40 if($1.$2.$3 == "000"){
42 push @routers, "\t<router id=\"$list_of_name[$src]\"/>\n";
45 push @routers, "\t<router id=\"$src\"/>\n";
54 push @hosts, "\t<host id=\"$list_of_name[$src]\" power=\"$power\"/>\n";
57 push @hosts, "\t<host id=\"$src\" power=\"$power\"/>\n";
61 @tokens = split(/ /,$table);
62 foreach $token (@tokens) {
66 push @links, "\t<link id=\"link$num_link\" bandwidth=\"$token\"/>\n";
69 push @routes, "\t<route src=\"$list_of_name[$src]\" dst=\"$list_of_name[$dst]\">\n";
72 push @routes, "\t<route src=\"$src\" dst=\"$dst\">\n";
74 push @routes, "\t\t<link_ctn id=\"link$num_link\"/>\n";
75 push @routes, "\t</route>\n";