5 #include "simdag/simdag.h"
11 XBT_LOG_NEW_DEFAULT_CATEGORY(test,
14 int main(int argc, char **argv) {
16 const SD_workstation_t *workstations;
22 xbt_dict_cursor_t cursor = NULL;
24 char noexist[]="NoProp";
26 char exist[]="SG_TEST_Hdd";
28 const SD_link_t *route;
31 /* initialisation of SD */
34 INFO1("Usage: %s platform_file", argv[0]);
35 INFO1("example: %s sd_platform.xml", argv[0]);
38 SD_create_environment(argv[1]);
40 /* init of platform elements */
41 workstations = SD_workstation_get_list();
44 SD_workstation_set_access_mode(w2, SD_WORKSTATION_SEQUENTIAL_ACCESS);
45 name1 = SD_workstation_get_name(w1);
46 name2 = SD_workstation_get_name(w2);
49 /* The host properties can be retrived from all interfaces */
51 INFO1("Property list for workstation %s", name1);
52 /* Get the property list of the workstation 1 */
53 props = SD_workstation_get_properties(w1);
56 /* Trying to set a new property */
57 xbt_dict_set(props, xbt_strdup("NewProp"), strdup("newValue"), free);
59 /* Print the properties of the workstation 1 */
60 xbt_dict_foreach(props,cursor,key,data) {
61 INFO2("\tProperty: %s has value: %s",key,data);
64 /* Try to get a property that does not exist */
66 value = SD_workstation_get_property_value(w1,noexist);
68 INFO1("\tProperty: %s is undefined", noexist);
70 INFO2("\tProperty: %s has value: %s", noexist, value);
73 INFO1("Property list for workstation %s", name2);
74 /* Get the property list of the workstation 2 */
75 props = SD_workstation_get_properties(w2);
78 /* Print the properties of the workstation 2 */
79 xbt_dict_foreach(props,cursor,key,data) {
80 INFO2("\tProperty: %s on host: %s",key,data);
83 /* Modify an existing property test. First check it exists */\
84 INFO0("Modify an existing property");
86 value = SD_workstation_get_property_value(w2,exist);
88 INFO1("\tProperty: %s is undefined", exist);
90 INFO2("\tProperty: %s old value: %s", exist, value);
91 xbt_dict_set(props, exist, strdup("250"), free);
94 /* Test if we have changed the value */
95 value = SD_workstation_get_property_value(w2,exist);
97 INFO1("\tProperty: %s is undefined", exist);
99 INFO2("\tProperty: %s new value: %s", exist, value);
101 /* NOTE: The link properties can be retrieved only from the SimDag interface */
102 route = SD_route_get_list(w1, w2);
103 route_size = SD_route_get_size(w1, w2);
104 for (i = 0; i < route_size; i++) {
105 xbt_dict_cursor_t cursor = NULL;
107 char noexist1[]="Other";
108 props = SD_link_get_properties(route[i]);
111 /* Print the properties of the current link */
112 xbt_dict_foreach(props,cursor,key,data) {
113 INFO3("\tLink %s property: %s has value: %s",SD_link_get_name(route[i]),key,data);
115 /* Try to get a property that does not exist */
117 value = SD_link_get_property_value(route[i], noexist1);
119 INFO2("\tProperty: %s for link %s is undefined", noexist, SD_link_get_name(route[i]));
121 INFO3("\tLink %s property: %s has value: %s",SD_link_get_name(route[i]),noexist,value);