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"){
41 push @routers, "\t<router id=\"$list_of_name[$src]\"/>\n";
48 push @hosts, "\t<host id=\"$list_of_name[$src]\" power=\"$power\"/>\n";
51 @tokens = split(/ /,$table);
52 foreach $token (@tokens) {
54 # print "from \"$list_of_name[$src]\" to \"$list_of_name[$dst]\" bdw=\"$token\"\n";
57 push @links, "\t<link id=\"link$num_link\" bandwidth=\"$token\"/>\n";
59 push @routes, "\t<route src=\"$list_of_name[$src]\" dst=\"$list_of_name[$dst]\">\n";
60 push @routes, "\t\t<link_ctn id=\"link$num_link\"/>\n";
61 push @routes, "\t</route>\n";