X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a016b25437d8095a80a8d31965c5a33631839f24..4a6b0a991a67e6f2f67c03fed43529e078da7115:/examples/platforms/conf/transform_optorsim_platform.pl?ds=sidebyside diff --git a/examples/platforms/conf/transform_optorsim_platform.pl b/examples/platforms/conf/transform_optorsim_platform.pl index d2db4d946e..7f9e93fa98 100644 --- a/examples/platforms/conf/transform_optorsim_platform.pl +++ b/examples/platforms/conf/transform_optorsim_platform.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# Copyright (c) 2011, 2014. The SimGrid Team. +# Copyright (c) 2011, 2014, 2016. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it @@ -17,10 +17,21 @@ my($conf_file)=$ARGV[0]; open FILE, $conf_file or die "Unable to open $conf_file"; +print "\n\n"; + print "\n"; print "\n"; print "\n"; -print "\n"; +print "\n"; my $line; my @tokens; @@ -39,134 +50,130 @@ my @routes = (); my @routes_router = (); my @routes_cluster = (); my $nb_host; -while(defined($line=)) -{ - -if($line =~ /^#(.*)\)(.*)$/) -{ +while(defined($line=)){ + if($line =~ /^#(.*)\)(.*)$/) + { print "\n"; push @list_of_name, $2; -} -elsif($line =~ /^([0-9]*) ([0-9]*) ([0-9]*) (.*)$/) -{ + } + elsif($line =~ /^([0-9]*) ([0-9]*) ([0-9]*) (.*)$/) + { if($1 == "0"){ - push @is_router, 1; - if(@list_of_name){ - push @routers, "\t\t\n"; - } - else{ - push @routers, "\t\t\n"; - } + push @is_router, 1; + if(@list_of_name){ + push @routers, " \n"; + } + else{ + push @routers, " \n"; + } } else{ - push @is_router, 0; - $nb_host = $1; - if(@list_of_name){ - push @hosts, "\t\n"; - } - else{ - push @hosts, "\t\n"; - } + push @is_router, 0; + $nb_host = $1; + if(@list_of_name){ + push @hosts, " \n"; + } + else{ + push @hosts, " \n"; + } } my $table = $4; @tokens = split(/ /,$table); foreach $token (@tokens) { - if($src >= $dst){ - if($token != "0") #if there is a link between src and dst - { - #Create a link - if($1 == "0"){ - push @links_router, "\t\t\n"; - } - else{ - push @links, "\t\n"; - } - - #Create the route between router and router - if($is_router[$src] && $is_router[$dst]) - { - if(@list_of_name){ - push @routes_router, "\t\t\n"; - } - else{ - push @routes_router, "\t\t\n"; - } - push @routes_router, "\t\t\t\n"; - push @routes_router, "\t\t\n"; - } - - #Create the route between cluster and cluster - elsif(!$is_router[$src] && !$is_router[$dst]) - { - if(@list_of_name){ - push @routes_cluster, "\t\t\n"; - } - else{ - push @routes_cluster, "\t\t\n"; - } - push @routes_cluster, "\t\t\t\n"; - push @routes_cluster, "\t\t\n"; - } - else - { - push @routes, "\t\n";} - else #cluster - {push @routes, "\t\tdst=\"$list_of_name[$dst]\" gw_dst=\"$list_of_name[$dst]-router\">\n";} - } - else{ - if($is_router[$src]) #router - {push @routes, "src=\"AS_intern\" gw_src=\"router$src\"\n";} - else #cluster - {push @routes, "src=\"cluster$src\" gw_src=\"cluster$src-router\"\n";} - - - if($is_router[$dst]) #router - {push @routes, "\t\tdst=\"AS_intern\" gw_dst=\"router$dst\">\n";} - else #cluster - {push @routes, "\t\tdst=\"cluster$dst\" gw_dst=\"cluster$dst-router\">\n";} - } - push @routes, "\t\t\n"; - push @routes, "\t\n"; - - } - - $num_link++; + if($src >= $dst){ + if($token != "0") #if there is a link between src and dst + { + #Create a link + if($1 == "0"){ + push @links_router, " \n"; + } + else{ + push @links, " \n"; + } + + #Create the route between router and router + if($is_router[$src] && $is_router[$dst]) + { + if(@list_of_name){ + push @routes_router, " "; + } + else{ + push @routes_router, " "; + } + push @routes_router, " "; + push @routes_router, " \n"; + } + + #Create the route between cluster and cluster + elsif(!$is_router[$src] && !$is_router[$dst]) + { + if(@list_of_name){ + push @routes_cluster, " \n"; + } + else{ + push @routes_cluster, " \n"; + } + push @routes_cluster, " \n"; + push @routes_cluster, " \n"; + } + else + { + push @routes, " \n";} + else #cluster + {push @routes, "dst=\"$list_of_name[$dst]\" gw_dst=\"$list_of_name[$dst]-router\">\n";} } + else{ + if($is_router[$src]) #router + {push @routes, "src=\"AS_intern\" gw_src=\"router$src\" ";} + else #cluster + {push @routes, "src=\"cluster$src\" gw_src=\"cluster$src-router\" ";} + + + if($is_router[$dst]) #router + {push @routes, "dst=\"AS_intern\" gw_dst=\"router$dst\">\n";} + else #cluster + {push @routes, "dst=\"cluster$dst\" gw_dst=\"cluster$dst-router\">\n";} + } + push @routes, " \n"; + push @routes, " \n"; + + } + + $num_link++; } - $dst++; + } + $dst++; } $src++; $dst = 0; -} -else -{ -die; -} - - + } + else + { + die; + } } close(FILE); -print "\t\n"; +print " \n"; print @routers; print @links_router; print @routes_router; -print "\t\n"; +print " \n"; print "\n"; print @hosts; print @routes_cluster; @@ -175,9 +182,6 @@ print "\n"; print @links; print "\n"; print @routes; -print "\n"; - print "\n"; print ""; - print " \n";