Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let's seal() the AS in lua too
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 27 Mar 2016 09:35:12 +0000 (11:35 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 27 Mar 2016 09:35:12 +0000 (11:35 +0200)
examples/platforms/cluster_prototype.lua
examples/platforms/routing_cluster.lua
examples/platforms/small_platform.lua
src/bindings/lua/lua_platf.cpp
src/bindings/lua/simgrid_lua.h
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index de2c0f8..19c45e0 100644 (file)
@@ -47,7 +47,7 @@
               simgrid.platf.link_new{id=linkname .. "_loopback",bandwidth=args.loopback_bw,latency=args.loopback_lat,sharing_policy="FATPIPE"}
             end
         end
-        simgrid.platf.AS_close()
+        simgrid.platf.AS_seal()
       end
   end
 
index ee134cf..b70de8d 100644 (file)
@@ -22,7 +22,7 @@ simgrid.platf.AS_open{id="AS0",mode="Full"}
 
     simgrid.platf.backbone_new{id="backbone1",bandwidth="2.25GBps",lat="500us"};
 
-  simgrid.platf.AS_close()
+  simgrid.platf.AS_seal()
   simgrid.platf.AS_open{id="my_cluster2",mode="Cluster"}
     simgrid.platf.router_new{id="router2"}
 
@@ -41,11 +41,11 @@ simgrid.platf.AS_open{id="AS0",mode="Full"}
 
     simgrid.platf.backbone_new{id="backbone2",bandwidth="2.25GBps",lat="500us"}
 
-  simgrid.platf.AS_close()
+  simgrid.platf.AS_seal()
   simgrid.platf.link_new{id="link1-2",bandwidth="2.25GBps",lat="500us"};
 
   simgrid.platf.ASroute_new{src="my_cluster1", dst="my_cluster2",
                             gw_src="router1", gw_dst="router2", links="link1-2"}
 
-simgrid.platf.AS_close()
+simgrid.platf.AS_seal()
 simgrid.platf.close()
index 9696c24..aa88cc3 100644 (file)
@@ -51,6 +51,6 @@
 
   simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Bourassa",links="5,2,0,1,6,7"};
 
-  simgrid.platf.AS_close();
+  simgrid.platf.AS_seal();
 
   simgrid.platf.close();
index d180552..e913618 100644 (file)
@@ -32,7 +32,7 @@ static const luaL_Reg platf_functions[] = {
     {"open", console_open},
     {"close", console_close},
     {"AS_open", console_AS_open},
-    {"AS_close", console_AS_close},
+    {"AS_seal", console_AS_seal},
     {"backbone_new", console_add_backbone},
     {"host_link_new", console_add_host___link},
     {"host_new", console_add_host},
@@ -537,9 +537,9 @@ int console_AS_open(lua_State *L) {
 
  return 0;
 }
-int console_AS_close(lua_State *L) {
-  XBT_DEBUG("Closing AS");
-  sg_platf_new_AS_end();
+int console_AS_seal(lua_State *L) {
+  XBT_DEBUG("Sealing AS");
+  sg_platf_new_AS_seal();
   return 0;
 }
 
index d5162e6..289974f 100644 (file)
@@ -25,7 +25,7 @@ int console_add_router(lua_State* L);
 int console_add_route(lua_State*);
 int console_add_ASroute(lua_State*);
 int console_AS_open(lua_State*);
-int console_AS_close(lua_State *L);
+int console_AS_seal(lua_State *L);
 int console_set_function(lua_State*);
 int console_host_set_property(lua_State*);
 }
index 4076bf6..8cfb69d 100644 (file)
@@ -378,7 +378,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   }
 
   XBT_DEBUG("</AS>");
-  sg_platf_new_AS_end();
+  sg_platf_new_AS_seal();
 
   simgrid::surf::on_cluster(cluster);
 }
@@ -693,7 +693,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   static_cast<AsCluster*>(current_routing)->router_ = static_cast<NetCard*>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
 
   XBT_DEBUG("</AS>");
-  sg_platf_new_AS_end();
+  sg_platf_new_AS_seal();
   XBT_DEBUG(" ");
 
   free(router_id);
@@ -780,7 +780,7 @@ static void surf_config_models_setup()
  *
  * Add a new autonomous system to the platform. Any elements (such as host,
  * router or sub-AS) added after this call and before the corresponding call
- * to sg_platf_new_AS_close() will be added to this AS.
+ * to sg_platf_new_AS_seal() will be added to this AS.
  *
  * Once this function was called, the configuration concerning the used
  * models cannot be changed anymore.
@@ -857,12 +857,12 @@ void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
 }
 
 /**
- * \brief Specify that the current description of AS is finished
+ * \brief Specify that the description of the current AS is finished
  *
- * Once you've declared all the content of your AS, you have to close
+ * Once you've declared all the content of your AS, you have to seal
  * it with this call. Your AS is not usable until you call this function.
  */
-void sg_platf_new_AS_end()
+void sg_platf_new_AS_seal()
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->seal();
index 1066e86..79e42b7 100644 (file)
@@ -201,7 +201,7 @@ XBT_PUBLIC(void) sg_platf_begin(void);  // Start a new platform
 XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform
 
 XBT_PUBLIC(void) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin description of new AS
-XBT_PUBLIC(void) sg_platf_new_AS_end(void);                     // That AS is fully described
+XBT_PUBLIC(void) sg_platf_new_AS_seal(void);                     // That AS is fully described
 
 XBT_PUBLIC(void) sg_platf_new_host   (sg_platf_host_cbarg_t   host);   // Add an host   to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
index 43a7a95..056620d 100644 (file)
@@ -410,7 +410,7 @@ void STag_surfxml_host(void){
 
 void STag_surfxml_prop(void)
 {
-  if(AS_TAG){
+  if(AS_TAG){ // We need a stack here to retrieve the most recently opened AS
     if (!as_current_property_set){
       xbt_assert(as_prop_nb < 1024, "Number of AS property reach the limit!!!");
       as_current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
@@ -882,13 +882,10 @@ void ETag_surfxml_AS(void){
     xbt_dict_t dict = (xbt_dict_t) as_dict_tab[as_prop_nb-1];
     as_prop_nb--;
     XBT_DEBUG("POP prop %p for AS '%s'",dict,name);
-    xbt_lib_set(as_router_lib,
-        name,
-      ROUTING_PROP_ASR_LEVEL,
-      dict);
+    xbt_lib_set(as_router_lib, name, ROUTING_PROP_ASR_LEVEL, dict);
     xbt_free(name);
   }
-  sg_platf_new_AS_end();
+  sg_platf_new_AS_seal();
 }
 
 void STag_surfxml_config(void){