Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / teshsuite / simdag / platforms / is_router_test.cpp
1 /* Copyright (c) 2008-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <stdio.h>
8 #include "simgrid/simdag.h"
9 #include "src/surf/surf_routing.hpp"
10
11 int main(int argc, char **argv)
12 {
13   /* SD initialization */
14   int size;
15   xbt_lib_cursor_t cursor = NULL;
16   char *key, *data;
17
18   SD_init(&argc, argv);
19
20   /* creation of the environment */
21   SD_create_environment(argv[1]);
22
23   size = xbt_dict_length(host_list) + xbt_lib_length(as_router_lib);
24
25   printf("Host number: %zu, link number: %d, elmts number: %d\n", sg_host_count(), sg_link_count(), size);
26
27   xbt_dict_foreach(host_list, cursor, key, data) {
28     simgrid::surf::NetCard * nc = sg_netcard_by_name_or_null(key);
29     printf("   - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host"));
30   }
31
32   xbt_lib_foreach(as_router_lib, cursor, key, data) {
33     simgrid::surf::NetCard * nc = sg_netcard_by_name_or_null(key);
34     printf("   - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host"));
35   }
36
37   SD_exit();
38   return 0;
39 }