From: Martin Quinson Date: Fri, 16 Dec 2016 08:15:24 +0000 (+0100) Subject: Completely rework the properties of netzones X-Git-Tag: v3_14~48 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/55e3e5942266691da7914fc1e9fdc894a802a966 Completely rework the properties of netzones - This changes some MSG functions, but I doubt that any users really used them. Even if someone did, there is no real loss of functionnality. The only missing thing would be if someone wants to traverse the whole set, but I don't have no good idea here since the data is stored in a C++ container. It's hard to let C code traverse it. I could add a _dump() method to just display it. - the change in the tesh file denotes an old bug that this change fixes. The name property was not defined in the cluster tag, but in the previous one in the XML, so it should not have landed in the properties of the cluster's hosts. - the code in the XML to stack the dictionnaries for each AS is simply gone. The AS is created in the STag function, so simply retrieve it by name and use it when we need it. No need for an additional storage. - surf_routing is almost gone, now \o/ --- diff --git a/ChangeLog b/ChangeLog index e45415e02d..36ded83179 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,10 @@ SimGrid (3.14) UNRELEASED; urgency=low - MSG_storage_set_property_value() * VM properties. Since msg_vm_t are msg_host_t, just use MSG_host_get_property_value() and friends + * MSG_as_router_get_property_value() was redundent with + MSG_environment_as_get_property_value(). + - Removed MSG_as_router_*propert*() functions + - Added MSG_environment_as_set_property_value() for consistency * xbt heterogeneous dictionnaries (created with xbt_dict_new()). Well, they are still there for now, but deprecated with a warning. Please switch to xbt_dict_new_homogeneous() before this is removed diff --git a/examples/msg/platform-properties/platform-properties.tesh b/examples/msg/platform-properties/platform-properties.tesh index 7e264559b3..518a2db552 100644 --- a/examples/msg/platform-properties/platform-properties.tesh +++ b/examples/msg/platform-properties/platform-properties.tesh @@ -34,7 +34,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/platform-properties$EXEEXT ${srcdir:=.}/prop.xml $ > [ 2.000000] (4:david@host2) == Print the properties of the host 'node-0.acme.org' > [ 2.000000] (4:david@host2) Host property: 'mem' -> '42' > [ 2.000000] (4:david@host2) Host property: 'bla' -> 'acme cluster' -> [ 2.000000] (4:david@host2) Host property: 'name' -> 'AS2' > [ 2.000000] (4:david@host2) Host property: 'Hdd' -> '180' > [ 2.000000] (4:david@host2) == Try to get a host property that does not exist > [ 2.000000] (4:david@host2) == Try to get a host property that does exist diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 2cf2afdd05..59ce52ebf9 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -190,6 +190,7 @@ XBT_PUBLIC(const char*) MSG_environment_as_get_name(msg_netzone_t as); XBT_PUBLIC(msg_netzone_t) MSG_environment_as_get_by_name(const char* name); XBT_PUBLIC(xbt_dict_t) MSG_environment_as_get_routing_sons(msg_netzone_t as); XBT_PUBLIC(const char*) MSG_environment_as_get_property_value(msg_netzone_t as, const char* name); +XBT_PUBLIC(void) MSG_environment_as_set_property_value(const char* asr, const char* name, char* value); XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_netzone_t as); /************************** File handling ***********************************/ @@ -225,10 +226,6 @@ XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage); XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage); XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname); XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage); -/************************** AS Router handling ************************************/ -XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name); -XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr); -XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char* name, char* value); /************************** Host handling ***********************************/ XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name); diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 3b3eb5f5a6..bf96c02933 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -6,8 +6,8 @@ #ifndef SIMGRID_S4U_NETZONE_HPP #define SIMGRID_S4U_NETZONE_HPP -#include #include +#include #include #include @@ -50,6 +50,13 @@ public: xbt_dict_t children(); // Sub netzones xbt_dynar_t hosts(); // my content as a dynar + /** Get the properties assigned to a host */ + std::unordered_map* properties(); + + /** Retrieve the property value (or nullptr if not set) */ + const char* property(const char* key); + void setProperty(const char* key, const char* value); + /* Add content to the netzone, at parsing time. It should be sealed afterward. */ virtual int addComponent(kernel::routing::NetCard * elm); /* A host, a router or a netzone, whatever */ virtual void addRoute(sg_platf_route_cbarg_t route); @@ -66,6 +73,7 @@ protected: vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex) private: + std::unordered_map properties_; NetZone* father_ = nullptr; char* name_ = nullptr; diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 9b0c8e6da8..5e02fad5bb 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -398,10 +398,6 @@ XBT_PUBLIC(xbt_dict_t) simcall_storage_get_content(smx_storage_t storage); XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_storage_t storage); XBT_PUBLIC(sg_size_t) SIMIX_storage_get_size(smx_storage_t storage); XBT_PUBLIC(const char*) SIMIX_storage_get_host(smx_storage_t storage); -/************************** AS router **********************************/ -XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name); -/************************** AS router simcalls ***************************/ -XBT_PUBLIC(xbt_dict_t) simcall_asr_get_properties(const char *name); /************************** MC simcalls **********************************/ XBT_PUBLIC(int) simcall_mc_random(int min, int max); diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h index 181cd1f2e6..2675a83185 100644 --- a/include/surf/surf_routing.h +++ b/include/surf/surf_routing.h @@ -17,7 +17,6 @@ XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL; //Simix storage level XBT_PUBLIC_DATA(xbt_lib_t) as_router_lib; XBT_PUBLIC_DATA(int) ROUTING_ASR_LEVEL; //Routing level -XBT_PUBLIC_DATA(int) ROUTING_PROP_ASR_LEVEL; //Properties for AS and router XBT_PUBLIC_DATA(xbt_lib_t) storage_lib; XBT_PUBLIC_DATA(int) ROUTING_STORAGE_LEVEL; //Routing storage level diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 4056ae59fb..67a61f15dd 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -636,8 +636,6 @@ XBT_PUBLIC(void) parse_platform_file(const char *file); /* For the trace and trace:connect tag (store their content till the end of the parsing) */ XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list; -XBT_PUBLIC(xbt_dict_t) get_as_router_properties(const char* name); - /* * Returns the initial path. On Windows the initial path is the current directory for the current process in the other * case the function returns "./" that represents the current directory on Unix/Linux platforms. diff --git a/src/kernel/routing/NetZoneImpl.hpp b/src/kernel/routing/NetZoneImpl.hpp index 9ecd0ae730..4e1aa5876a 100644 --- a/src/kernel/routing/NetZoneImpl.hpp +++ b/src/kernel/routing/NetZoneImpl.hpp @@ -6,6 +6,8 @@ #ifndef SIMGRID_ROUTING_NETZONEIMPL_HPP #define SIMGRID_ROUTING_NETZONEIMPL_HPP +#include + #include "xbt/graph.h" #include "simgrid/s4u/NetZone.hpp" diff --git a/src/msg/msg_environment.cpp b/src/msg/msg_environment.cpp index bf29367099..9783390f54 100644 --- a/src/msg/msg_environment.cpp +++ b/src/msg/msg_environment.cpp @@ -55,9 +55,9 @@ msg_netzone_t MSG_environment_get_routing_root() return simgrid::s4u::Engine::instance()->netRoot(); } -const char* MSG_environment_as_get_name(msg_netzone_t as) +const char* MSG_environment_as_get_name(msg_netzone_t netzone) { - return as->name(); + return netzone->name(); } msg_netzone_t MSG_environment_as_get_by_name(const char* name) @@ -65,21 +65,22 @@ msg_netzone_t MSG_environment_as_get_by_name(const char* name) return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name); } -xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t as) +xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t netzone) { - return as->children(); + return netzone->children(); } -const char* MSG_environment_as_get_property_value(msg_netzone_t as, const char* name) +const char* MSG_environment_as_get_property_value(msg_netzone_t netzone, const char* name) { - xbt_dict_t dict = static_cast (xbt_lib_get_or_null(as_router_lib, MSG_environment_as_get_name(as), - ROUTING_PROP_ASR_LEVEL)); - if (dict==nullptr) - return nullptr; - return static_cast(xbt_dict_get_or_null(dict, name)); + return netzone->property(name); } -xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t as) +void MSG_environment_as_set_property_value(msg_netzone_t netzone, const char* name, char* value) { - return as->hosts(); + netzone->setProperty(name, value); +} + +xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t netzone) +{ + return netzone->hosts(); } diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 9e56db867b..d7d6119275 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -916,39 +916,3 @@ const char *MSG_task_get_category (msg_task_t task) { return task->category; } - -/** - * \brief Returns the value of a given AS or router property - * - * \param asr the name of a router or AS - * \param name a property name - * \return value of a property (or nullptr if property not set) - */ -const char *MSG_as_router_get_property_value(const char* asr, const char *name) -{ - return static_cast(xbt_dict_get_or_null(MSG_as_router_get_properties(asr), name)); -} - -/** - * \brief Returns a xbt_dict_t consisting of the list of properties assigned to - * a the AS or router - * - * \param asr the name of a router or AS - * \return a dict containing the properties - */ -xbt_dict_t MSG_as_router_get_properties(const char* asr) -{ - return (simcall_asr_get_properties(asr)); -} - -/** - * \brief Change the value of a given AS or router - * - * \param asr the name of a router or AS - * \param name a property name - * \param value what to change the property to - */ -void MSG_as_router_set_property_value(const char* asr, const char* name, char* value) -{ - xbt_dict_set(MSG_as_router_get_properties(asr), name, value, nullptr); -} diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 6ae075f5a6..77057f2a85 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -43,7 +43,7 @@ simgrid::xbt::signal Host::onStateChange; Host::Host(const char* name) : name_(name) { - xbt_assert(sg_host_by_name(name) == nullptr, "Refusing to create a second host named '%s'.", name); + xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name); host_list[name_] = this; } diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index ed4aa1dd5d..84e10dd289 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/NetZone.hpp" #include "simgrid/s4u/host.hpp" +#include "simgrid/simix.hpp" #include "src/kernel/routing/NetCard.hpp" #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header #include "src/surf/surf_routing.hpp" @@ -40,6 +41,20 @@ NetZone::~NetZone() xbt_dict_free(&children_); xbt_free(name_); } +std::unordered_map* NetZone::properties() +{ + return simgrid::simix::kernelImmediate([&] { return &properties_; }); +} + +/** Retrieve the property value (or nullptr if not set) */ +const char* NetZone::property(const char* key) +{ + return properties_.at(key).c_str(); +} +void NetZone::setProperty(const char* key, const char* value) +{ + simgrid::simix::kernelImmediate([&] { properties_[key] = value; }); +} xbt_dict_t NetZone::children() { diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 7ccc835004..e1de85955c 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -46,20 +46,6 @@ void simcall_call(smx_actor_t process) } } -// ***** AS simcalls - -/** - * \ingroup simix_host_management - * \brief Returns a dict of the properties assigned to a router or AS. - * - * \param name The name of the router or AS - * \return The properties - */ -xbt_dict_t simcall_asr_get_properties(const char *name) -{ - return simcall_BODY_asr_get_properties(name); -} - /** * \ingroup simix_process_management * \brief Creates a synchro that executes some computation of an host. diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 4601e40e4a..6635ff8f34 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -1084,19 +1084,6 @@ static inline void simcall_storage_get_content__set__result(smx_simcall_t simcal simgrid::simix::marshal(simcall->result, result); } -static inline const char* simcall_asr_get_properties__get__name(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[0]); -} -static inline void simcall_asr_get_properties__set__name(smx_simcall_t simcall, const char* arg) { - simgrid::simix::marshal(simcall->args[0], arg); -} -static inline xbt_dict_t simcall_asr_get_properties__get__result(smx_simcall_t simcall){ - return simgrid::simix::unmarshal(simcall->result); -} -static inline void simcall_asr_get_properties__set__result(smx_simcall_t simcall, xbt_dict_t result){ - simgrid::simix::marshal(simcall->result, result); -} - static inline int simcall_mc_random__get__min(smx_simcall_t simcall) { return simgrid::simix::unmarshal(simcall->args[0]); } @@ -1188,5 +1175,4 @@ XBT_PRIVATE xbt_dynar_t simcall_HANDLER_file_get_info(smx_simcall_t simcall, smx XBT_PRIVATE int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t fd, const char* fullpath); XBT_PRIVATE sg_size_t simcall_HANDLER_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage); XBT_PRIVATE sg_size_t simcall_HANDLER_storage_get_used_size(smx_simcall_t simcall, smx_storage_t name); -XBT_PRIVATE xbt_dict_t simcall_HANDLER_asr_get_properties(smx_simcall_t simcall, const char* name); XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max); \ No newline at end of file diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 8986295e89..7073743cba 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -407,12 +407,6 @@ inline static xbt_dict_t simcall_BODY_storage_get_content(smx_storage_t storage) return simcall(SIMCALL_STORAGE_GET_CONTENT, storage); } -inline static xbt_dict_t simcall_BODY_asr_get_properties(const char* name) { - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_asr_get_properties(&SIMIX_process_self()->simcall, name); - return simcall(SIMCALL_ASR_GET_PROPERTIES, name); - } - inline static int simcall_BODY_mc_random(int min, int max) { /* Go to that function to follow the code flow through the simcall barrier */ if (0) simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall, min, max); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index cd8d89d307..37a4057877 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -80,7 +80,6 @@ typedef enum { SIMCALL_STORAGE_GET_USED_SIZE, SIMCALL_STORAGE_GET_PROPERTIES, SIMCALL_STORAGE_GET_CONTENT, - SIMCALL_ASR_GET_PROPERTIES, SIMCALL_MC_RANDOM, SIMCALL_SET_CATEGORY, SIMCALL_RUN_KERNEL, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 43c6d26b5d..d7e3514049 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -85,7 +85,6 @@ const char* simcall_names[] = { "SIMCALL_STORAGE_GET_USED_SIZE", "SIMCALL_STORAGE_GET_PROPERTIES", "SIMCALL_STORAGE_GET_CONTENT", - "SIMCALL_ASR_GET_PROPERTIES", "SIMCALL_MC_RANDOM", "SIMCALL_SET_CATEGORY", "SIMCALL_RUN_KERNEL", @@ -393,11 +392,6 @@ case SIMCALL_STORAGE_GET_CONTENT: SIMIX_simcall_answer(simcall); break; -case SIMCALL_ASR_GET_PROPERTIES: - simgrid::simix::marshal(simcall->result, simcall_HANDLER_asr_get_properties(simcall, simgrid::simix::unmarshal(simcall->args[0]))); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_MC_RANDOM: simgrid::simix::marshal(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]))); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 1aa78dd556..b0478e8260 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -109,7 +109,6 @@ sg_size_t storage_get_used_size(smx_storage_t name); xbt_dict_t storage_get_properties(smx_storage_t storage) [[nohandler]]; xbt_dict_t storage_get_content(smx_storage_t storage) [[nohandler]]; -xbt_dict_t asr_get_properties(const char* name); int mc_random(int min, int max); void set_category(smx_activity_t synchro, const char* category) [[nohandler]]; diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index dd1e2687f5..95c67dacde 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -693,14 +693,6 @@ void SIMIX_display_process_status() } } -xbt_dict_t simcall_HANDLER_asr_get_properties(smx_simcall_t simcall, const char *name){ - return SIMIX_asr_get_properties(name); -} -xbt_dict_t SIMIX_asr_get_properties(const char *name) -{ - return static_cast(xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL)); -} - int SIMIX_is_maestro() { return simix_global==nullptr /*SimDag*/|| SIMIX_process_self() == simix_global->maestro_process; diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index b0ac64c353..dfd079987b 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -296,7 +296,6 @@ void surf_init(int *argc, char **argv) watched_hosts_lib = xbt_dict_new_homogeneous(nullptr); XBT_DEBUG("Add routing levels"); - ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr); ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) { delete static_cast(p); }); diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 1292fde307..b5f8acb5ff 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -13,4 +13,3 @@ int MSG_STORAGE_LEVEL = -1; //Msg storage level xbt_lib_t as_router_lib; int ROUTING_ASR_LEVEL = -1; //Routing level -int ROUTING_PROP_ASR_LEVEL = -1; //Where the properties are stored diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index d36c014f49..a3fc7d9f1f 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -9,6 +9,7 @@ #include /* va_arg */ #include "simgrid/link.h" +#include "simgrid/s4u/engine.hpp" #include "simgrid/sg_config.h" #include "src/kernel/routing/NetCard.hpp" #include "src/surf/network_interface.hpp" @@ -275,12 +276,7 @@ double surf_parse_get_speed(const char *string, const char *entity_kind, const c /* The default current property receiver. Setup in the corresponding opening callbacks. */ xbt_dict_t current_property_set = nullptr; xbt_dict_t current_model_property_set = nullptr; -xbt_dict_t as_current_property_set = nullptr; -int AS_TAG = 0; -char* as_name_tab[1024]; -void* as_dict_tab[1024]; -int as_prop_nb = 0; - +int AS_TAG = 0; // Whether we just opened an AS tag (to see what to do with the properties) /* dictionary of random generator data */ xbt_dict_t random_data_list = nullptr; @@ -460,23 +456,18 @@ void STag_surfxml_host(){ void STag_surfxml_prop() { - 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 - as_name_tab[as_prop_nb] = xbt_strdup(A_surfxml_AS_id); - as_dict_tab[as_prop_nb] = as_current_property_set; - XBT_DEBUG("PUSH prop set %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); - as_prop_nb++; - } - XBT_DEBUG("add prop %s=%s into current AS property set", A_surfxml_prop_id, A_surfxml_prop_value); - xbt_dict_set(as_current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), nullptr); + if (AS_TAG) { // We need to retrieve the most recently opened AS + XBT_DEBUG("Set AS property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value); + simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::instance()->netzoneByNameOrNull(A_surfxml_AS_id); + + netzone->setProperty(A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value)); } else{ if (!current_property_set) current_property_set = xbt_dict_new_homogeneous(&xbt_free_f); // Maybe, it should raise an error xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), nullptr); - XBT_DEBUG("add prop %s=%s into current property set", A_surfxml_prop_id, A_surfxml_prop_value); + XBT_DEBUG("add prop %s=%s into current property set %p", A_surfxml_prop_id, A_surfxml_prop_value, + current_property_set); } } @@ -544,7 +535,7 @@ void STag_surfxml_router(){ void ETag_surfxml_cluster(){ s_sg_platf_cluster_cbarg_t cluster; memset(&cluster,0,sizeof(cluster)); - cluster.properties = as_current_property_set; + cluster.properties = current_property_set; cluster.id = A_surfxml_cluster_id; cluster.prefix = A_surfxml_cluster_prefix; @@ -620,6 +611,7 @@ void ETag_surfxml_cluster(){ } void STag_surfxml_cluster(){ + AS_TAG = 0; parse_after_config(); xbt_assert(current_property_set == nullptr, "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)"); } @@ -902,19 +894,9 @@ void STag_surfxml_AS(){ AS_TAG = 1; s_sg_platf_AS_cbarg_t AS = { A_surfxml_AS_id, (int)A_surfxml_AS_routing}; - as_current_property_set = nullptr; - sg_platf_new_AS_begin(&AS); } void ETag_surfxml_AS(){ - if(as_prop_nb){ - char *name = as_name_tab[as_prop_nb-1]; - 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_free(name); - } sg_platf_new_AS_seal(); } @@ -1066,12 +1048,3 @@ static int _surf_parse() { } int_f_void_t surf_parse = _surf_parse; - -/* Prop tag functions - * - * With XML parser - */ -xbt_dict_t get_as_router_properties(const char* name) -{ - return (xbt_dict_t)xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL); -}