src/surf/network_gtnets.c
)
+set(NS3_SRC
+ src/surf/network_ns3.c
+ src/surf/ns3/ns3_interface.cc
+ )
+
set(SURF_SRC
src/surf/surf_model.c
src/surf/surf_action.c
)
endif(HAVE_MC)
+if(HAVE_NS3)
+ set(simgrid_sources
+ ${simgrid_sources}
+ ${NS3_SRC}
+ )
+endif(HAVE_NS3)
+
# WINDOWS
if(WIN32)
set(simgrid_sources
if(NOT operation1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${HAVE_NS3_LIB} ")
endif(NOT operation1)
+
+ string(REGEX MATCH "-I${HAVE_CORE_MODULE_H} " operation1 "${CMAKE_C_FLAGS}")
+ if(NOT operation1)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${HAVE_CORE_MODULE_H} ")
+ endif(NOT operation1)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-I${HAVE_CORE_MODULE_H} -L${HAVE_NS3_LIB} ")
endif(NOT operation)
/* Indicates that we have GTNETS support */
#cmakedefine HAVE_GTNETS @HAVE_GTNETS@
+/* Indicates that we have NS3 support */
+#cmakedefine HAVE_NS3 @HAVE_NS3@
+
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@
XBT_PUBLIC(void) surf_network_model_init_GTNETS(const char *filename);
#endif
+#ifdef HAVE_NS3
+/** \brief Initializes the platform with the network model NS3
+ * \ingroup SURF_models
+ * \param filename XML platform file name
+ *
+ * This function is called by surf_workstation_model_init_NS3
+ * or by yourself only if you plan using surf_workstation_model_init_compound
+ *
+ * \see surf_workstation_model_init_NS3()
+ */
+XBT_PUBLIC(void) surf_network_model_init_NS3(const char *filename);
+
+XBT_PUBLIC(void) parse_ns3_add_host(void);
+XBT_PUBLIC(void) parse_ns3_add_router(void);
+XBT_PUBLIC(void) parse_ns3_add_link(void);
+XBT_PUBLIC(void) parse_ns3_add_AS(void);
+XBT_PUBLIC(void) parse_ns3_add_route(void);
+XBT_PUBLIC(void) parse_ns3_add_ASroute(void);
+XBT_PUBLIC(void) parse_ns3_add_cluster(void);
+
+#endif
+
/** \brief Initializes the platform with the network model Reno
* \ingroup SURF_models
* \param filename XML platform file name
--- /dev/null
+/* Copyright (c) 2007, 2008, 2009, 2010, 2011. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "surf_private.h"
+#include "surf/ns3/ns3_interface.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_ns3, surf,
+ "Logging specific to the SURF network NS3 module");
+
+extern routing_global_t global_routing;
+
+void parse_ns3_add_host(void)
+{
+ XBT_INFO("NS3_ADD_HOST '%s'",A_surfxml_host_id);
+ //ns3_add_host(A_surfxml_host_id);
+}
+void parse_ns3_add_router(void)
+{
+ XBT_INFO("NS3_ADD_ROUTER '%s'",A_surfxml_router_id);
+}
+void parse_ns3_add_link(void)
+{
+ XBT_INFO("NS3_ADD_LINK '%s'",A_surfxml_link_id);
+}
+void parse_ns3_add_AS(void)
+{
+ XBT_INFO("NS3_ADD_AS '%s'",A_surfxml_AS_id);
+}
+void parse_ns3_add_route(void)
+{
+ XBT_INFO("NS3_ADD_ROUTE from '%s' to '%s'",A_surfxml_route_src,A_surfxml_route_dst);
+}
+void parse_ns3_add_ASroute(void)
+{
+ XBT_INFO("NS3_ADD_ASROUTE from '%s' to '%s'",A_surfxml_ASroute_src,A_surfxml_ASroute_dst);
+}
+void parse_ns3_add_cluster(void)
+{
+ XBT_INFO("NS3_ADD_CLUSTER '%s'",A_surfxml_cluster_id);
+ routing_parse_Scluster();
+}
+
+static void define_callbacks_ns3(const char *filename)
+{
+ surfxml_add_callback(STag_surfxml_host_cb_list, &parse_ns3_add_host); //HOST
+ surfxml_add_callback(STag_surfxml_router_cb_list, &parse_ns3_add_router); //ROUTER
+ surfxml_add_callback(STag_surfxml_link_cb_list, &parse_ns3_add_link); //LINK
+ surfxml_add_callback(STag_surfxml_AS_cb_list, &parse_ns3_add_AS); //AS
+ surfxml_add_callback(STag_surfxml_route_cb_list, &parse_ns3_add_route); //ROUTE
+ surfxml_add_callback(STag_surfxml_ASroute_cb_list, &parse_ns3_add_ASroute); //ASROUTE
+ surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_ns3_add_cluster); //CLUSTER
+}
+
+void surf_network_model_init_NS3(const char *filename)
+{
+ define_callbacks_ns3(filename);
+ surf_network_model = surf_model_init();
+ surf_network_model->name = "network NS3";
+
+ update_model_description(surf_network_model_description,
+ "NS3", surf_network_model);
+}
--- /dev/null
+
+#include "surf/ns3/ns3_interface.h"
+
+#include "ns3/core-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
+#include "ns3/helper-module.h"
+#include "ns3/global-route-manager.h"
+
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(interface_ns3, surf,
+ "Logging specific to the SURF network NS3 module");
+
+//NodeContainer nodes;
+
+void ns3_add_host(char * id)
+{
+ XBT_INFO("Interface ns3 add host");
+// Ptr<Node> a = CreateObject<Node> (0);
+// nodes.Add(a);
+}
--- /dev/null
+/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "xbt/misc.h"
+
+XBT_PUBLIC(void) ns3_add_host(char * id);
{"GTNets",
"Network Pseudo-model using the GTNets simulator instead of an analytic model",
NULL, surf_network_model_init_GTNETS},
+#endif
+#ifdef HAVE_NS3
+ {"NS3",
+ "TODO",
+ NULL, surf_network_model_init_NS3},
#endif
{"Reno",
"Model using lagrange_solve instead of lmm_solve (experts only)", NULL,
XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback, double_f_cpvoid_t get_link_latency_fun);
+XBT_PUBLIC(void) routing_parse_Scluster(void); /* cluster bypass */
+
/**
* Resource protected methods
*/
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
-static void routing_parse_Scluster(void); /* cluster bypass */
static void routing_parse_Speer(void); /* peer bypass */
static void routing_parse_Srandom(void); /* random bypass */
static void routing_parse_Erandom(void); /* random bypass */
XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
}
-static void routing_parse_Scluster(void)
+void routing_parse_Scluster(void)
{
static int AX_ptr = 0;