Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'pikachuyann/simgrid-xbt_random'
[simgrid.git] / examples / platforms / syscoord / generate_peer_platform.pl
1 #!/usr/bin/env perl
2
3 # Copyright (c) 2011-2020. 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 print "<?xml version='1.0'?>\n";
13 print "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n";
14 print "<platform version=\"4\">\n\n";
15
16 print "<!-- This file was generated with the following command:\n          generate_peer_platform.pl $ARGV[0]\n-->\n\n";
17
18 print "\t<AS id=\"AS0\" routing=\"Vivaldi\">\n";
19
20 my $line;
21
22 open INPUT, $ARGV[0] or die "Unable to open $ARGV[1]: $!\n";
23 while(defined($line=<INPUT>))
24 {
25     next if ($line =~ /^#/);
26     # 278 7.2 -9.4 h 2.3 
27     if($line =~ /^([^ ]*) ([^ ]*) ([^ ]*) h ([^ ]*) *$/) {
28         print "\t\t<peer id=\"peer-$1\" coordinates=\"$2 $3 $4\" speed=\"730Mf\" bw_in=\"13.38MBps\" bw_out=\"1.024MBps\"/>\n";
29         next;
30     }
31     die "Parse error: $line\n";
32 }                       
33 print "\t</AS>\n";
34 print "</platform>\n";