Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
finish the cleanup of the netcard list container
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 22 Dec 2016 22:37:22 +0000 (23:37 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 22 Dec 2016 22:37:28 +0000 (23:37 +0100)
- move it from global to the engine
- use a std::unordered_map instead of a xbt_dict. Its order being
  harder to predict, this forces to sort the list in the routing
  integration tests.

I'm not completely happy about the register/unregister functions being
public, but I cannot find anything better, and it's later already...

14 files changed:
include/simgrid/s4u/engine.hpp
include/surf/surf_routing.h
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/kernel/routing/NetCard.cpp
src/kernel/routing/NetCard.hpp
src/kernel/routing/NetZoneImpl.cpp
src/msg/msg_private.h
src/s4u/s4u_engine.cpp
src/s4u/s4u_host.cpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/flatifier/flatifier.tesh
teshsuite/simdag/is-router/is-router.cpp
teshsuite/simdag/is-router/is-router.tesh

index 62b4164..8db94fb 100644 (file)
@@ -75,6 +75,8 @@ public:
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
   simgrid::kernel::routing::NetCard* netcardByNameOrNull(const char* name);
   void netcardList(std::vector<simgrid::kernel::routing::NetCard*> * list);
+  void netcardRegister(simgrid::kernel::routing::NetCard*);
+  void netcardUnregister(simgrid::kernel::routing::NetCard*);
 
   template<class F>
   void registerFunction(const char* name)
index edeb6ef..725f8a1 100644 (file)
@@ -15,8 +15,6 @@ SG_BEGIN_DECL()
 
 XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL; //Simix storage level
 
-XBT_PUBLIC_DATA(xbt_dict_t) netcards_dict;
-
 XBT_PUBLIC_DATA(xbt_lib_t) storage_lib;
 XBT_PUBLIC_DATA(int) ROUTING_STORAGE_LEVEL;        //Routing storage level
 XBT_PUBLIC_DATA(int) ROUTING_STORAGE_HOST_LEVEL;
index 175a18a..f88b59c 100644 (file)
@@ -8,21 +8,15 @@
 #include "src/kernel/routing/NetZoneImpl.hpp"
 #include <simgrid/s4u/host.hpp>
 
-xbt_dict_t netcards_dict;
-
 namespace simgrid {
 namespace kernel {
 
-EngineImpl::EngineImpl()
-{
-  netcards_dict = xbt_dict_new_homogeneous([](void* p) {
-    delete static_cast<simgrid::kernel::routing::NetCard*>(p);
-  });
-}
+EngineImpl::EngineImpl() = default;
 EngineImpl::~EngineImpl()
 {
   delete netRoot_;
-  xbt_dict_free(&netcards_dict);
+  for (auto kv : netcards_)
+    delete kv.second;
 }
 }
 }
index 839f300..d038e3b 100644 (file)
@@ -6,10 +6,13 @@
 #include <simgrid/s4u/forward.hpp>
 #include <xbt/dict.h>
 
+#include <unordered_map>
+
 namespace simgrid {
 namespace kernel {
 namespace routing {
 class NetZoneImpl;
+class NetCard;
 }
 
 class EngineImpl {
@@ -19,6 +22,7 @@ public:
   kernel::routing::NetZoneImpl* netRoot_ = nullptr;
 
 protected:
+  std::unordered_map<std::string,simgrid::kernel::routing::NetCard*> netcards_;
   friend simgrid::s4u::Engine;
 };
 }
index e45e174..d875e89 100644 (file)
@@ -22,7 +22,7 @@ NetCard::NetCard(std::string name, NetCard::Type componentType, NetZoneImpl* net
 {
   if (netzone_p != nullptr)
     id_ = netzone_p->addComponent(this);
-  xbt_dict_set(netcards_dict, name.c_str(), static_cast<void*>(this), nullptr);
+  simgrid::s4u::Engine::instance()->netcardRegister(this);
   simgrid::kernel::routing::NetCard::onCreation(this);
 }
 }
index b899b68..42c9ceb 100644 (file)
@@ -45,6 +45,8 @@ public:
 
   static simgrid::xbt::signal<void(NetCard*)> onCreation;
 
+  bool operator<(const NetCard &rhs) const { return name_ < rhs.name_; }
+
 private:
   unsigned int id_;
   std::string name_;
index 7a8ecff..3927a8f 100644 (file)
@@ -39,7 +39,7 @@ NetZoneImpl::~NetZoneImpl()
   for (auto& kv : bypassRoutes_)
     delete kv.second;
 
-  xbt_dict_remove(netcards_dict, name_);
+  simgrid::s4u::Engine::instance()->netcardUnregister(netcard_);
 }
 
 simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount)
index 0536796..4270fd8 100644 (file)
@@ -17,7 +17,6 @@ SG_BEGIN_DECL()
 /**************** datatypes **********************************/
 /********************************* Host **************************************/
 typedef struct s_msg_host_priv {
-
   std::vector<int> *file_descriptor_table;
 } s_msg_host_priv_t;
 /********************************* Task **************************************/
index 6e37df0..c98ab30 100644 (file)
@@ -15,6 +15,8 @@
 #include "simgrid/simix.h"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/routing/NetZoneImpl.hpp"
+#include "src/kernel/routing/NetCard.hpp"
+
 
 #include "src/surf/network_interface.hpp"
 #include "surf/surf.h"               // routing_platf. FIXME:KILLME. SOON
@@ -114,16 +116,29 @@ NetZone* Engine::netzoneByNameOrNull(const char* name)
 /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
 simgrid::kernel::routing::NetCard* Engine::netcardByNameOrNull(const char* name)
 {
-  return static_cast<simgrid::kernel::routing::NetCard*>(xbt_dict_get_or_null(netcards_dict, name));
+  if (pimpl->netcards_.find(name) == pimpl->netcards_.end())
+    return nullptr;
+  return pimpl->netcards_.at(name);
 }
+/** @brief Fill the provided vector with all existing netcards */
 void Engine::netcardList(std::vector<simgrid::kernel::routing::NetCard*>* list)
 {
-  xbt_lib_cursor_t cursor = nullptr;
-  char* key;
-  void* data;
-  xbt_dict_foreach (netcards_dict, cursor, key, data) {
-    list->push_back(static_cast<simgrid::kernel::routing::NetCard*>(data));
-  }
+  for (auto kv: pimpl->netcards_)
+    list->push_back(kv.second);
+}
+/** @brief Register a new netcard to the system */
+void Engine::netcardRegister(simgrid::kernel::routing::NetCard* card)
+{
+//  simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread
+      pimpl->netcards_[card->name()] = card;
+//  });
+}
+/** @brief Unregister a given netcard */
+void Engine::netcardUnregister(simgrid::kernel::routing::NetCard* card)
+{
+  simgrid::simix::kernelImmediate([&]{
+      pimpl->netcards_.erase(card->name());
+  });
 }
 }
 }
index 1499c26..72c3dfc 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <unordered_map>
 
+#include "simgrid/s4u/engine.hpp"
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/storage.hpp"
 #include "simgrid/simix.hpp"
@@ -53,7 +54,7 @@ Host::~Host()
 
   delete pimpl_;
   if (pimpl_netcard != nullptr) // not removed yet by a children class
-    xbt_dict_remove(netcards_dict, name_.c_str());
+    simgrid::s4u::Engine::instance()->netcardUnregister(pimpl_netcard);
   delete pimpl_cpu;
   delete mounts;
 }
index f1b74a7..710bb1a 100644 (file)
@@ -89,6 +89,10 @@ int main(int argc, char **argv)
 
   std::vector<simgrid::kernel::routing::NetCard*> netcardList;
   simgrid::s4u::Engine::instance()->netcardList(&netcardList);
+  std::sort(netcardList.begin(), netcardList.end(),
+      [](simgrid::kernel::routing::NetCard* a, simgrid::kernel::routing::NetCard* b) {
+      return a->name() < b->name();
+  });
 
   if (timings) {
     XBT_INFO("Parsing time: %fs (%zu hosts, %d links)", xbt_os_timer_elapsed(parse_time),
index 2f27faa..1fd4bbf 100644 (file)
@@ -373,8 +373,8 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <host id="alice1.crepe.fr" speed="1000000000"/>
 >   <host id="bob0.hamburger.edu" speed="1000000000"/>
 >   <host id="bob1.hamburger.edu" speed="1000000000"/>
->   <router id="bobbob_cluster_router.hamburger.edu"/>
 >   <router id="alicealice_cluster_router.crepe.fr"/>
+>   <router id="bobbob_cluster_router.hamburger.edu"/>
 >   <link id="__loopback__" bandwidth="498000000" latency="0.000015000" sharing_policy="FATPIPE"/>
 >   <link id="alice_cluster_backbone" bandwidth="2250000000" latency="0.000500000"/>
 >   <link id="alice_cluster_link_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
@@ -399,12 +399,12 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <route src="alice0.crepe.fr" dst="bob1.hamburger.edu">
 >   <link_ctn id="alice_cluster_link_0_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
->   <route src="alice0.crepe.fr" dst="bobbob_cluster_router.hamburger.edu">
->   <link_ctn id="alice_cluster_link_0_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/>
->   </route>
 >   <route src="alice0.crepe.fr" dst="alicealice_cluster_router.crepe.fr">
 >   <link_ctn id="alice_cluster_link_0_UP"/><link_ctn id="alice_cluster_backbone"/>
 >   </route>
+>   <route src="alice0.crepe.fr" dst="bobbob_cluster_router.hamburger.edu">
+>   <link_ctn id="alice_cluster_link_0_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/>
+>   </route>
 >   <route src="alice1.crepe.fr" dst="alice0.crepe.fr">
 >   <link_ctn id="alice_cluster_link_1_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
 >   </route>
@@ -417,12 +417,12 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <route src="alice1.crepe.fr" dst="bob1.hamburger.edu">
 >   <link_ctn id="alice_cluster_link_1_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
->   <route src="alice1.crepe.fr" dst="bobbob_cluster_router.hamburger.edu">
->   <link_ctn id="alice_cluster_link_1_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/>
->   </route>
 >   <route src="alice1.crepe.fr" dst="alicealice_cluster_router.crepe.fr">
 >   <link_ctn id="alice_cluster_link_1_UP"/><link_ctn id="alice_cluster_backbone"/>
 >   </route>
+>   <route src="alice1.crepe.fr" dst="bobbob_cluster_router.hamburger.edu">
+>   <link_ctn id="alice_cluster_link_1_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="backbone"/>
+>   </route>
 >   <route src="bob0.hamburger.edu" dst="alice0.crepe.fr">
 >   <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
 >   </route>
@@ -435,12 +435,12 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <route src="bob0.hamburger.edu" dst="bob1.hamburger.edu">
 >   <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
->   <route src="bob0.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
->   <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/>
->   </route>
 >   <route src="bob0.hamburger.edu" dst="alicealice_cluster_router.crepe.fr">
 >   <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="backbone"/>
 >   </route>
+>   <route src="bob0.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
+>   <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/>
+>   </route>
 >   <route src="bob1.hamburger.edu" dst="alice0.crepe.fr">
 >   <link_ctn id="bob_cluster_link_1_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
 >   </route>
@@ -453,36 +453,18 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <route src="bob1.hamburger.edu" dst="bob1.hamburger.edu">
 >   <link_ctn id="bob_cluster_link_1_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
->   <route src="bob1.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
->   <link_ctn id="bob_cluster_link_1_UP"/><link_ctn id="bob_cluster_backbone"/>
->   </route>
 >   <route src="bob1.hamburger.edu" dst="alicealice_cluster_router.crepe.fr">
 >   <link_ctn id="bob_cluster_link_1_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="backbone"/>
 >   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
->   <link_ctn id="bob_cluster_backbone"/>
->   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="alicealice_cluster_router.crepe.fr">
->   <link_ctn id="backbone"/>
->   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="alice0.crepe.fr">
->   <link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
->   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="alice1.crepe.fr">
->   <link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_1_DOWN"/>
->   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="bob0.hamburger.edu">
->   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_0_DOWN"/>
+>   <route src="bob1.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
+>   <link_ctn id="bob_cluster_link_1_UP"/><link_ctn id="bob_cluster_backbone"/>
 >   </route>
->   <route src="bobbob_cluster_router.hamburger.edu" dst="bob1.hamburger.edu">
->   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
+>   <route src="alicealice_cluster_router.crepe.fr" dst="alicealice_cluster_router.crepe.fr">
+>   <link_ctn id="alice_cluster_backbone"/>
 >   </route>
 >   <route src="alicealice_cluster_router.crepe.fr" dst="bobbob_cluster_router.hamburger.edu">
 >   <link_ctn id="backbone"/>
 >   </route>
->   <route src="alicealice_cluster_router.crepe.fr" dst="alicealice_cluster_router.crepe.fr">
->   <link_ctn id="alice_cluster_backbone"/>
->   </route>
 >   <route src="alicealice_cluster_router.crepe.fr" dst="alice0.crepe.fr">
 >   <link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
 >   </route>
@@ -495,6 +477,24 @@ $ ${bindir:=.}/flatifier$EXEEXT ../platforms/two_clusters.xml "--log=root.fmt:[%
 >   <route src="alicealice_cluster_router.crepe.fr" dst="bob1.hamburger.edu">
 >   <link_ctn id="backbone"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="alicealice_cluster_router.crepe.fr">
+>   <link_ctn id="backbone"/>
+>   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="bobbob_cluster_router.hamburger.edu">
+>   <link_ctn id="bob_cluster_backbone"/>
+>   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="alice0.crepe.fr">
+>   <link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
+>   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="alice1.crepe.fr">
+>   <link_ctn id="backbone"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_1_DOWN"/>
+>   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="bob0.hamburger.edu">
+>   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_0_DOWN"/>
+>   </route>
+>   <route src="bobbob_cluster_router.hamburger.edu" dst="bob1.hamburger.edu">
+>   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
+>   </route>
 > </AS>
 > </platform>
 
@@ -559,8 +559,8 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 >   <host id="1" speed="1000000000"/>
 >   <host id="2" speed="1000000000"/>
 >   <host id="3" speed="1000000000"/>
->   <router id="my_cluster_2_router"/>
 >   <router id="my_cluster_1_router"/>
+>   <router id="my_cluster_2_router"/>
 >   <router id="my_cluster_3_router"/>
 >   <link id="__loopback__" bandwidth="498000000" latency="0.000015000" sharing_policy="FATPIPE"/>
 >   <link id="link1" bandwidth="1250000000" latency="0.000500000"/>
@@ -582,12 +582,12 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 >   <route src="1" dst="3">
 >   <link_ctn id="my_cluster_1_link_1_UP"/><link_ctn id="link1"/><link_ctn id="link3"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
->   <route src="1" dst="my_cluster_2_router">
->   <link_ctn id="my_cluster_1_link_1_UP"/><link_ctn id="link_tmp"/>
->   </route>
 >   <route src="1" dst="my_cluster_1_router">
 >   <link_ctn id="my_cluster_1_link_1_UP"/>
 >   </route>
+>   <route src="1" dst="my_cluster_2_router">
+>   <link_ctn id="my_cluster_1_link_1_UP"/><link_ctn id="link_tmp"/>
+>   </route>
 >   <route src="1" dst="my_cluster_3_router">
 >   <link_ctn id="my_cluster_1_link_1_UP"/><link_ctn id="link1"/><link_ctn id="link3"/>
 >   </route>
@@ -600,12 +600,12 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 >   <route src="2" dst="3">
 >   <link_ctn id="my_cluster_2_link_2_UP"/><link_ctn id="link2"/><link_ctn id="link3"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
->   <route src="2" dst="my_cluster_2_router">
->   <link_ctn id="my_cluster_2_link_2_UP"/>
->   </route>
 >   <route src="2" dst="my_cluster_1_router">
 >   <link_ctn id="my_cluster_2_link_2_UP"/><link_ctn id="link2"/><link_ctn id="link1"/>
 >   </route>
+>   <route src="2" dst="my_cluster_2_router">
+>   <link_ctn id="my_cluster_2_link_2_UP"/>
+>   </route>
 >   <route src="2" dst="my_cluster_3_router">
 >   <link_ctn id="my_cluster_2_link_2_UP"/><link_ctn id="link2"/><link_ctn id="link3"/>
 >   </route>
@@ -618,39 +618,21 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 >   <route src="3" dst="3">
 >   <link_ctn id="my_cluster_3_link_3_UP"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
->   <route src="3" dst="my_cluster_2_router">
->   <link_ctn id="my_cluster_3_link_3_UP"/><link_ctn id="link3"/><link_ctn id="link2"/>
->   </route>
 >   <route src="3" dst="my_cluster_1_router">
 >   <link_ctn id="my_cluster_3_link_3_UP"/><link_ctn id="link3"/><link_ctn id="link1"/>
 >   </route>
+>   <route src="3" dst="my_cluster_2_router">
+>   <link_ctn id="my_cluster_3_link_3_UP"/><link_ctn id="link3"/><link_ctn id="link2"/>
+>   </route>
 >   <route src="3" dst="my_cluster_3_router">
 >   <link_ctn id="my_cluster_3_link_3_UP"/>
 >   </route>
->   <route src="my_cluster_2_router" dst="my_cluster_2_router">
+>   <route src="my_cluster_1_router" dst="my_cluster_1_router">
 >   
 >   </route>
->   <route src="my_cluster_2_router" dst="my_cluster_1_router">
->   <link_ctn id="link2"/><link_ctn id="link1"/>
->   </route>
->   <route src="my_cluster_2_router" dst="my_cluster_3_router">
->   <link_ctn id="link2"/><link_ctn id="link3"/>
->   </route>
->   <route src="my_cluster_2_router" dst="1">
->   <link_ctn id="link2"/><link_ctn id="link1"/><link_ctn id="my_cluster_1_link_1_DOWN"/>
->   </route>
->   <route src="my_cluster_2_router" dst="2">
->   <link_ctn id="my_cluster_2_link_2_DOWN"/>
->   </route>
->   <route src="my_cluster_2_router" dst="3">
->   <link_ctn id="link2"/><link_ctn id="link3"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
->   </route>
 >   <route src="my_cluster_1_router" dst="my_cluster_2_router">
 >   <link_ctn id="link_tmp"/>
 >   </route>
->   <route src="my_cluster_1_router" dst="my_cluster_1_router">
->   
->   </route>
 >   <route src="my_cluster_1_router" dst="my_cluster_3_router">
 >   <link_ctn id="link1"/><link_ctn id="link3"/>
 >   </route>
@@ -663,12 +645,30 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 >   <route src="my_cluster_1_router" dst="3">
 >   <link_ctn id="link1"/><link_ctn id="link3"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
->   <route src="my_cluster_3_router" dst="my_cluster_2_router">
->   <link_ctn id="link3"/><link_ctn id="link2"/>
+>   <route src="my_cluster_2_router" dst="my_cluster_1_router">
+>   <link_ctn id="link2"/><link_ctn id="link1"/>
+>   </route>
+>   <route src="my_cluster_2_router" dst="my_cluster_2_router">
+>   
+>   </route>
+>   <route src="my_cluster_2_router" dst="my_cluster_3_router">
+>   <link_ctn id="link2"/><link_ctn id="link3"/>
+>   </route>
+>   <route src="my_cluster_2_router" dst="1">
+>   <link_ctn id="link2"/><link_ctn id="link1"/><link_ctn id="my_cluster_1_link_1_DOWN"/>
+>   </route>
+>   <route src="my_cluster_2_router" dst="2">
+>   <link_ctn id="my_cluster_2_link_2_DOWN"/>
+>   </route>
+>   <route src="my_cluster_2_router" dst="3">
+>   <link_ctn id="link2"/><link_ctn id="link3"/><link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
 >   <route src="my_cluster_3_router" dst="my_cluster_1_router">
 >   <link_ctn id="link3"/><link_ctn id="link1"/>
 >   </route>
+>   <route src="my_cluster_3_router" dst="my_cluster_2_router">
+>   <link_ctn id="link3"/><link_ctn id="link2"/>
+>   </route>
 >   <route src="my_cluster_3_router" dst="my_cluster_3_router">
 >   
 >   </route>
index 5ac0df5..4e873ef 100644 (file)
@@ -20,6 +20,10 @@ int main(int argc, char **argv)
 
   std::vector<simgrid::kernel::routing::NetCard*> netcardList;
   simgrid::s4u::Engine::instance()->netcardList(&netcardList);
+  std::sort(netcardList.begin(), netcardList.end(),
+      [](simgrid::kernel::routing::NetCard* a, simgrid::kernel::routing::NetCard* b) {
+      return a->name() < b->name();
+  });
 
   int it;
   sg_host_t host;
index 2fabad2..6039c37 100644 (file)
@@ -1,6 +1,6 @@
 #! ./tesh
 
-$ ${bindir:=.}/is-router ../platforms/test_of_is_router.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
+$ ${bindir:=.}/is-router ${srcdir}/teshsuite/simdag/platforms/test_of_is_router.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
 > [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > Host count: 10, link number: 1
 >    - Seen: "host01". Type: host
@@ -14,6 +14,12 @@ $ ${bindir:=.}/is-router ../platforms/test_of_is_router.xml "--log=root.fmt:[%10
 >    - Seen: "host09". Type: host
 >    - Seen: "host10". Type: host
 > NetCards count: 21
+>    - Seen: "AS". Type: netzone
+>    - Seen: "AS0". Type: netzone
+>    - Seen: "AS1". Type: netzone
+>    - Seen: "AS2". Type: netzone
+>    - Seen: "AS3". Type: netzone
+>    - Seen: "AS4". Type: netzone
 >    - Seen: "host01". Type: host
 >    - Seen: "host02". Type: host
 >    - Seen: "host03". Type: host
@@ -23,15 +29,9 @@ $ ${bindir:=.}/is-router ../platforms/test_of_is_router.xml "--log=root.fmt:[%10
 >    - Seen: "host07". Type: host
 >    - Seen: "host08". Type: host
 >    - Seen: "host09". Type: host
+>    - Seen: "host10". Type: host
 >    - Seen: "router1". Type: router
 >    - Seen: "router2". Type: router
 >    - Seen: "router3". Type: router
 >    - Seen: "router4". Type: router
 >    - Seen: "router5". Type: router
->    - Seen: "host10". Type: host
->    - Seen: "AS0". Type: netzone
->    - Seen: "AS1". Type: netzone
->    - Seen: "AS2". Type: netzone
->    - Seen: "AS3". Type: netzone
->    - Seen: "AS4". Type: netzone
->    - Seen: "AS". Type: netzone