Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a866f87bf1c0f7f07d8ea0e7ef30115f1f7c122d
[simgrid.git] / examples / platforms / syscoord / generate_peer_platform.pl
1 #!/usr/bin/env perl
2
3 # Copyright (c) 2011, 2014, 2016. 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 use warnings;
11
12 my $toversion=4;
13 my $nb_peer = $ARGV[0];
14 my $i;
15
16 print "<?xml version='1.0'?>\n";
17 print "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\">\n";
18 print "<platform version=\"$toversion\">\n";
19
20 print "\n<config id=\"General\">\n";
21 print "\t<prop id=\"coordinates\" value=\"yes\"></prop>\n";
22 print "</config>\n\n";
23
24 print "\t<AS id=\"AS0\" routing=\"Vivaldi\">\n";
25
26 my $line;
27
28 open SITES_LIGNE, $ARGV[0] or die "Unable to open $ARGV[1]\n";
29 while(defined($line=<SITES_LIGNE>))
30 {
31     #278 7.2 -9.4 h 2.3 
32     if($line =~ /^(.*) (.*) (.*) h (.*)$/)
33     {
34         print "\t\t<peer id=\"peer-$1\" coordinates=\"$2 $3 $4\" speed=\"730Mf\" ";
35         print "bw_in=\"13.38MBps\" bw_out=\"1.024MBps\" lat=\"500us\"/>\n";
36     }
37 }                       
38 print "\t</AS>\n";
39 print "</platform>\n";