Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a01bcebd1e4aa0e8e28ce9f302f3edb2487115e2
[simgrid.git] / examples / platforms / syscoord / generate_peer_platform.pl
1 #!/usr/bin/perl -w
2
3 # Copyright (c) 2011, 2014. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 use strict;
10
11 my $toversion=3;
12 my $nb_peer = $ARGV[0];
13 my $i;
14
15 print "<?xml version='1.0'?>\n";
16 print "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n";
17 print "<platform version=\"$toversion\">\n";
18
19 print "\n<config id=\"General\">\n";
20 print "\t<prop id=\"coordinates\" value=\"yes\"></prop>\n";
21 print "</config>\n\n";
22
23 print "\t<AS  id=\"AS0\"  routing=\"Vivaldi\">\n";
24
25 my $line;
26
27 open SITES_LIGNE, $ARGV[0] or die "Unable to open $ARGV[1]\n";
28 while(defined($line=<SITES_LIGNE>))
29 {
30         #278 7.2 -9.4 h 2.3 
31                 if($line =~ /^(.*) (.*) (.*) h (.*)$/)
32                 {
33                 print "\t\t<peer id=\"peer-$1\" coordinates=\"$2 $3 $4\" power=\"730000000.0\"\n";
34                 print "\t\tbw_in=\"13380000\" bw_out=\"1024000\" lat=\"5E-4\" />\n\n";
35                 }
36 }
37                         
38 print "\t</AS>\n";
39 print "</platform>";
40
41 print " \n";