Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'coverity_scan' of github.com:mquinson/simgrid
[simgrid.git] / examples / msg / kademlia / generate.py
index 19b483e..c1c7a72 100755 (executable)
@@ -1,4 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+
+# Copyright (c) 2012, 2014. The SimGrid Team.
+# All rights reserved.
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the license (GNU LGPL) which comes with this package.
 
 import sys, random
 
@@ -14,9 +20,9 @@ max_id = 2 ** nb_bits - 1
 all_ids = [0]
 
 sys.stdout.write("<?xml version='1.0'?>\n"
-"<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n"
-"<platform version=\"3\">\n"
-"  <process host=\"c-0.me\" function=\"node\"><argument value=\"0000000000000000000000000000000000000000\"/><argument value=\"%d\"/></process>\n" % end_date)
+"<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\">\n"
+"<platform version=\"4\">\n  <process host=\"node-0.acme.org\" function=\"node\">\n"
+"     <argument value=\"0\"/>\n     <argument value=\"%d\"/>\n  </process>\n" % end_date)
 
 for i in range(1, nb_nodes):
        ok = False
@@ -25,7 +31,8 @@ for i in range(1, nb_nodes):
                ok = not my_id in all_ids
        known_id = all_ids[random.randint(0, len(all_ids) - 1)]
        start_date = i * 10
-       line = "  <process host=\"c-%d.me\" function=\"node\"><argument value=\"%s\" /><argument value=\"%s\" /><argument value=\"%d\" /></process>\n" % (i, my_id, known_id,end_date)
+       line = "  <process host=\"node-%d.acme.org\" function=\"node\">\n    <argument value=\"%s\"/>"\
+              "\n    <argument value=\"%s\"/>\n    <argument value=\"%d\"/>\n  </process>\n" % (i, my_id, known_id,end_date)
        sys.stdout.write(line)
        all_ids.append(my_id)