extern routing_global_t global_routing;
+static void replace_str(char *str, const char *orig, const char *rep)
+{
+ char buffer[30];
+ char *p;
+
+ if(!(p = strstr(str, orig))) // Is 'orig' even in 'str'?
+ return;
+
+ strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
+ buffer[p-str] = '\0';
+
+ sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
+ xbt_free(str);
+ str = xbt_strdup(buffer);
+}
+
+static void replace_bdw_ns3(char * bdw)
+{
+// replace_str(bdw,".00","");
+// char *temp = xbt_strdup(bdw);
+//
+// replace_str(bdw,"000000000","Gbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"00000000","00Mbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"0000000","0Mbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"000000","Mbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"00000","00Kbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"0000","0Kbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+// replace_str(bdw,"000","Kbps");
+// if(strcmp(bdw,temp)) {xbt_free(temp);return;}
+//
+// xbt_free(bdw);
+// bdw = bprintf("%s%s",temp,"bps");
+// xbt_free(temp);
+
+ char *temp = xbt_strdup(bdw);
+ xbt_free(bdw);
+ bdw = bprintf("%fbps",atof(temp));
+ xbt_free(temp);
+
+}
+
+static void replace_lat_ns3(char * lat)
+{
+ char *temp = xbt_strdup(lat);
+ xbt_free(lat);
+ lat = bprintf("%fs",atof(temp));
+ xbt_free(temp);
+}
+
void parse_ns3_add_host(void)
{
XBT_DEBUG("NS3_ADD_HOST '%s'",A_surfxml_host_id);
link->generic_resource.name = xbt_strdup(A_surfxml_link_id);
link->generic_resource.properties = current_property_set;
link->data = link_ns3;
+ link->created = 1;
xbt_lib_set(link_lib,A_surfxml_link_id,NS3_LINK_LEVEL,link_ns3);
xbt_lib_set(link_lib,A_surfxml_link_id,SURF_LINK_LEVEL,link);
}
void parse_ns3_add_cluster(void)
{
- XBT_DEBUG("NS3_ADD_CLUSTER '%s'",A_surfxml_cluster_id);
- routing_parse_Scluster();
+ char *cluster_prefix = A_surfxml_cluster_prefix;
+ char *cluster_suffix = A_surfxml_cluster_suffix;
+ char *cluster_radical = A_surfxml_cluster_radical;
+ char *cluster_bb_bw = A_surfxml_cluster_bb_bw;
+ char *cluster_bb_lat = A_surfxml_cluster_bb_lat;
+ char *cluster_bw = A_surfxml_cluster_bw;
+ char *cluster_lat = A_surfxml_cluster_lat;
+ char *groups = NULL;
+
+ int start, end, i;
+ unsigned int iter;
+
+ xbt_dynar_t radical_elements;
+ xbt_dynar_t radical_ends;
+ xbt_dynar_t tab_elements_num = xbt_dynar_new(sizeof(int), NULL);
+
+ char *router_id,*host_id;
+
+ radical_elements = xbt_str_split(cluster_radical, ",");
+ xbt_dynar_foreach(radical_elements, iter, groups) {
+ radical_ends = xbt_str_split(groups, "-");
+
+ switch (xbt_dynar_length(radical_ends)) {
+ case 1:
+ surf_parse_get_int(&start,xbt_dynar_get_as(radical_ends, 0, char *));
+ xbt_dynar_push_as(tab_elements_num, int, start);
+ router_id = bprintf("ns3_%s%d%s", cluster_prefix, start, cluster_suffix);
+ xbt_lib_set(host_lib,
+ router_id,
+ NS3_HOST_LEVEL,
+ ns3_add_host_cluster(router_id)
+ );
+ XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
+ free(router_id);
+ break;
+
+ case 2:
+ surf_parse_get_int(&start,xbt_dynar_get_as(radical_ends, 0, char *));
+ surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
+ for (i = start; i <= end; i++){
+ xbt_dynar_push_as(tab_elements_num, int, i);
+ router_id = bprintf("ns3_%s%d%s", cluster_prefix, i, cluster_suffix);
+ xbt_lib_set(host_lib,
+ router_id,
+ NS3_HOST_LEVEL,
+ ns3_add_host_cluster(router_id)
+ );
+ XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
+ free(router_id);
+ }
+ break;
+
+ default:
+ XBT_DEBUG("Malformed radical");
+ }
+ }
+
+
+
+ //Create links
+ unsigned int cpt;
+ int elmts;
+ char * lat = xbt_strdup(cluster_lat);
+ char * bw = xbt_strdup(cluster_bw);
+ replace_lat_ns3(lat);
+ replace_bdw_ns3(bw);
+
+ xbt_dynar_foreach(tab_elements_num,cpt,elmts)
+ {
+ host_id = bprintf("%s%d%s", cluster_prefix, elmts, cluster_suffix);
+ router_id = bprintf("ns3_%s%d%s", cluster_prefix, elmts, cluster_suffix);
+ XBT_DEBUG("Create link from '%s' to '%s'",host_id,router_id);
+
+ ns3_nodes_t host_src = xbt_lib_get_or_null(host_lib,host_id, NS3_HOST_LEVEL);
+ ns3_nodes_t host_dst = xbt_lib_get_or_null(host_lib,router_id,NS3_HOST_LEVEL);
+
+ if(host_src && host_dst){}
+ else xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);
+
+ ns3_add_link(host_src->node_num,host_dst->node_num,bw,lat);
+
+ free(router_id);
+ free(host_id);
+ }
+ xbt_dynar_free(&tab_elements_num);
+
+
+ //Create link backbone
+ lat = xbt_strdup(cluster_bb_lat);
+ bw = xbt_strdup(cluster_bb_bw);
+ replace_lat_ns3(lat);
+ replace_bdw_ns3(bw);
+ ns3_add_cluster(bw,lat,A_surfxml_cluster_id);
+ xbt_free(lat);
+ xbt_free(bw);
}
double ns3_get_link_latency (const void *link)
{
double lat;
- XBT_INFO("link_id:%s link_lat:%s link_bdw:%s",((surf_ns3_link_t)link)->data->id,((surf_ns3_link_t)link)->data->lat,((surf_ns3_link_t)link)->data->bdw);
+ //XBT_DEBUG("link_id:%s link_lat:%s link_bdw:%s",((surf_ns3_link_t)link)->data->id,((surf_ns3_link_t)link)->data->lat,((surf_ns3_link_t)link)->data->bdw);
sscanf(((surf_ns3_link_t)link)->data->lat,"%lg",&lat);
return lat;
}
double ns3_get_link_bandwidth (const void *link)
{
double bdw;
- XBT_INFO("link_id:%s link_lat:%s link_bdw:%s",((surf_ns3_link_t)link)->data->id,((surf_ns3_link_t)link)->data->lat,((surf_ns3_link_t)link)->data->bdw);
+ //XBT_DEBUG("link_id:%s link_lat:%s link_bdw:%s",((surf_ns3_link_t)link)->data->id,((surf_ns3_link_t)link)->data->lat,((surf_ns3_link_t)link)->data->bdw);
sscanf(((surf_ns3_link_t)link)->data->bdw,"%lg",&bdw);
return bdw;
}
void parse_ns3_end_platform(void)
{
- xbt_lib_cursor_t cursor = NULL;
- char *name = NULL;
- void **data = NULL;
- XBT_INFO("link_lib");
- xbt_lib_foreach(link_lib, cursor, name, data) {
- XBT_INFO("\tSee link '%s'\t--> NS3_LEVEL %p",
- name,
- data[NS3_LINK_LEVEL]);
- }
- XBT_INFO(" ");
- XBT_INFO("host_lib");
- xbt_lib_foreach(host_lib, cursor, name, data) {
- XBT_INFO("\tSee host '%s'\t--> NS3_LEVEL %p",
- name,
- data[NS3_HOST_LEVEL]);
- }
- XBT_INFO(" ");
- XBT_INFO("as_router_lib");
- xbt_lib_foreach(as_router_lib, cursor, name, data) {
- XBT_INFO("\tSee ASR '%s'\t--> NS3_LEVEL %p",
- name,
- data[NS3_ASR_LEVEL]);
- }
-}
-
-static void replace_str(char *str, const char *orig, const char *rep)
-{
- char buffer[30];
- char *p;
-
- if(!(p = strstr(str, orig))) // Is 'orig' even in 'str'?
- return;
-
- strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
- buffer[p-str] = '\0';
-
- sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
- xbt_free(str);
- str = xbt_strdup(buffer);
-}
-
-static void replace_bdw_ns3(char * bdw)
-{
- char *temp = xbt_strdup(bdw);
-
- replace_str(bdw,"000000000","Gbps");
- if(strcmp(bdw,temp)) {xbt_free(temp);return;}
- replace_str(bdw,"000000","Mbps");
- if(strcmp(bdw,temp)) {xbt_free(temp);return;}
- replace_str(bdw,"000","Kbps");
- if(strcmp(bdw,temp)) {xbt_free(temp);return;}
-
- xbt_free(bdw);
- bdw = bprintf("%s%s",temp,"bps");
- xbt_free(temp);
-}
-
-static void replace_lat_ns3(char * lat)
-{
- char *temp = xbt_strdup(lat);
-
- replace_str(lat,"E-1","00ms");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-2","0ms");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-3","ms");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-4","00us");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-5","0us");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-6","us");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-7","00ns");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-8","0ns");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
- replace_str(lat,"E-9","ns");
- if(strcmp(lat,temp)) {xbt_free(temp);return;}
-
- xbt_free(lat);
- lat = bprintf("%s%s",temp,"s");
- xbt_free(temp);
+ ns3_end_platform();
+
+// xbt_lib_cursor_t cursor = NULL;
+// char *name = NULL;
+// void **data = NULL;
+// XBT_INFO("link_lib");
+// xbt_lib_foreach(link_lib, cursor, name, data) {
+// XBT_INFO("\tSee link '%s'\t--> NS3_LEVEL %p",
+// name,
+// data[NS3_LINK_LEVEL]);
+// }
+// XBT_INFO(" ");
+// XBT_INFO("host_lib");
+// xbt_lib_foreach(host_lib, cursor, name, data) {
+// XBT_INFO("\tSee host '%s'\t--> NS3_LEVEL %p",
+// name,
+// data[NS3_HOST_LEVEL]);
+// }
+// XBT_INFO(" ");
+// XBT_INFO("as_router_lib");
+// xbt_lib_foreach(as_router_lib, cursor, name, data) {
+// XBT_INFO("\tSee ASR '%s'\t--> NS3_LEVEL %p",
+// name,
+// data[NS3_ASR_LEVEL]);
+// }
+//
+// XBT_INFO(" ");
}
/* Create the ns3 topology based on routing strategy */
void create_ns3_topology()
{
- int src_id,dst_id;
+// int src_id,dst_id;
- XBT_DEBUG("Starting topology generation");
+ XBT_INFO("Starting topology generation");
//get the onelinks from the parsed platform
xbt_dynar_t onelink_routes = global_routing->get_onelink_routes();
if (!onelink_routes)
xbt_die("There is no routes!");
-
+ XBT_INFO("Have get_onelink_routes, found %ld routes",onelink_routes->used);
//save them in trace file
onelink_t onelink;
unsigned int iter;
char *src = onelink->src;
char *dst = onelink->dst;
void *link = onelink->link_ptr;
- src_id = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,src));
- dst_id = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,dst));
- if(src_id != dst_id){
- char * link_bdw = xbt_strdup(((surf_ns3_link_t)link)->data->bdw);
+//TODO need to uncomment those two line
+// src_id = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,src));
+// dst_id = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,dst));
+
+// if( (src_id != dst_id) && ((surf_ns3_link_t)link)->created){
+ if( strcmp(src,dst) && ((surf_ns3_link_t)link)->created){
+ XBT_INFO("Route from '%s' to '%s' with link '%s'",src,dst,((surf_ns3_link_t)link)->data->id);
+ char * link_bdw = xbt_strdup(((surf_ns3_link_t)link)->data->bdw);
char * link_lat = xbt_strdup(((surf_ns3_link_t)link)->data->lat);
- // replace_bdw_ns3(link_bdw);
- // replace_lat_ns3(link_lat);
- XBT_INFO("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
+ ((surf_ns3_link_t)link)->created = 0;
+
+ replace_bdw_ns3(link_bdw);
+ replace_lat_ns3(link_lat);
+// XBT_INFO("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
XBT_INFO("\tLink (%s) bdw:%s->%s lat:%s->%s",((surf_ns3_link_t)link)->data->id,
((surf_ns3_link_t)link)->data->bdw,link_bdw,
((surf_ns3_link_t)link)->data->lat,link_lat
);
+
+ //create link ns3
+ ns3_nodes_t host_src = xbt_lib_get_or_null(host_lib,src,NS3_HOST_LEVEL);
+ if(!host_src) host_src = xbt_lib_get_or_null(as_router_lib,src,NS3_ASR_LEVEL);
+ ns3_nodes_t host_dst = xbt_lib_get_or_null(host_lib,dst,NS3_HOST_LEVEL);
+ if(!host_dst) host_dst = xbt_lib_get_or_null(as_router_lib,dst,NS3_ASR_LEVEL);
+
+ if(host_src && host_dst){}
+ else xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);
+
+ ns3_add_link(host_src->node_num,host_dst->node_num,link_bdw,link_lat);
+
xbt_free(link_bdw);
xbt_free(link_lat);
}
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_cluster_cb_list, &parse_ns3_add_cluster); //CLUSTER
-
- surfxml_add_callback(ETag_surfxml_platform_cb_list, &parse_ns3_end_platform); //DEBUG
- surfxml_add_callback(ETag_surfxml_platform_cb_list, &create_ns3_topology);
+ 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_cluster_cb_list, &parse_ns3_add_cluster); //CLUSTER
+
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, &create_ns3_topology); //get_one_link_routes
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, &parse_ns3_end_platform); //InitializeRoutes
}
static void free_ns3_elmts(void * elmts)
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";
surf_network_model->extension.network.get_link_latency = ns3_get_link_latency;
surf_network_model->extension.network.get_link_bandwidth = ns3_get_link_bandwidth;
surf_network_model->extension.network.get_route = ns3_get_route;
routing_model_create(sizeof(s_surf_ns3_link_t), NULL, NULL);
+ define_callbacks_ns3(filename);
NS3_HOST_LEVEL = xbt_lib_add_level(host_lib,(void_f_pvoid_t)free_ns3_host);
NS3_ASR_LEVEL = xbt_lib_add_level(as_router_lib,(void_f_pvoid_t)free_ns3_host);
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/global-route-manager.h"
+#include "ns3/global-route-manager.h"
+#include "ns3/ipv4-global-routing-helper.h"
using namespace ns3;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(interface_ns3, surf,
"Logging specific to the SURF network NS3 module");
+InternetStackHelper stack;
NodeContainer nodes;
+NodeContainer Cluster_nodes;
+Ipv4InterfaceContainer interfaces;
+
int number_of_nodes = 0;
+int number_of_clusters_nodes = 0;
+int number_of_links = 1;
+int number_of_networks = 1;
void * ns3_add_host(char * id)
{
ns3_nodes_t host = xbt_new0(s_ns3_nodes_t,1);
- XBT_INFO("Interface ns3 add host '%s'",id);
+ XBT_INFO("Interface ns3 add host[%d] '%s'",number_of_nodes,id);
+ Ptr<Node> node = CreateObject<Node> (0);
+ stack.Install(node);
+ nodes.Add(node);
+ host->node_num = number_of_nodes;
+ host->type = NS3_NETWORK_ELEMENT_HOST;
+ host->data = node;
+ number_of_nodes++;
+ return host;
+}
+
+void * ns3_add_host_cluster(char * id)
+{
+ ns3_nodes_t host = xbt_new0(s_ns3_nodes_t,1);
+ XBT_INFO("Interface ns3 add host[%d] '%s'",number_of_nodes,id);
Ptr<Node> node = CreateObject<Node> (0);
+ stack.Install(node);
+ Cluster_nodes.Add(node);
nodes.Add(node);
host->node_num = number_of_nodes;
host->type = NS3_NETWORK_ELEMENT_HOST;
void * ns3_add_router(char * id)
{
ns3_nodes_t router = xbt_new0(s_ns3_nodes_t,1);
- XBT_INFO("Interface ns3 add router '%s'",id);
+ XBT_INFO("Interface ns3 add router[%d] '%s'",number_of_nodes,id);
Ptr<Node> node = CreateObject<Node> (0);
+ stack.Install(node);
nodes.Add(node);
router->node_num = number_of_nodes;
router->type = NS3_NETWORK_ELEMENT_ROUTER;
return router;
}
+void * ns3_add_cluster(char * bw,char * lat,char *id)
+{
+
+ XBT_DEBUG("cluster_id: %s",id);
+ XBT_DEBUG("bw: %s lat: %s",bw,lat);
+ XBT_DEBUG("Number of %s nodes: %d",id,Cluster_nodes.GetN() - number_of_clusters_nodes);
+
+ NodeContainer Nodes;
+ int i;
+
+ for(i = number_of_clusters_nodes; i < Cluster_nodes.GetN() ; i++){
+ Nodes.Add(Cluster_nodes.Get(i));
+ XBT_DEBUG("Add node %d to cluster",i);
+ }
+ number_of_clusters_nodes = Cluster_nodes.GetN();
+
+ XBT_DEBUG("Add router %d to cluster",nodes.GetN()-Nodes.GetN()-1);
+ Nodes.Add(nodes.Get(nodes.GetN()-Nodes.GetN()-1));
+
+ if(Nodes.GetN() > 254)
+ xbt_die("Cluster with NS3 is limited to 254 nodes");
+ CsmaHelper csma;
+ csma.SetChannelAttribute ("DataRate", StringValue (bw));
+ csma.SetChannelAttribute ("Delay", StringValue (lat));
+ NetDeviceContainer devices = csma.Install (Nodes);
+ XBT_DEBUG("Create CSMA");
+
+
+ char * adr = bprintf("10.%d.%d.0",number_of_networks,number_of_links);
+ XBT_DEBUG("Assign IP Addresses %s to CSMA.",adr);
+ Ipv4AddressHelper ipv4;
+ ipv4.SetBase (adr, "255.255.255.0");
+ interfaces.Add(ipv4.Assign (devices));
+
+ if(number_of_links == 255){
+ if(number_of_networks == 255)
+ xbt_die("Number of links and networks exceed 255*255");
+ number_of_links = 1;
+ number_of_networks++;
+ }else{
+ number_of_links++;
+ }
+ XBT_DEBUG("Number of nodes in Cluster_nodes: %d",Cluster_nodes.GetN());
+}
+
void * ns3_add_AS(char * id)
{
XBT_INFO("Interface ns3 add AS '%s'",id);
return NULL;
}
+
+void * ns3_add_link(int src,int dst,char * bw,char * lat)
+{
+ if(number_of_links == 1 ) {
+ LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
+ LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
+ }
+
+ PointToPointHelper pointToPoint;
+ NetDeviceContainer netA;
+ Ipv4AddressHelper address;
+
+ Ptr<Node> a = nodes.Get(src);
+ Ptr<Node> b = nodes.Get(dst);
+
+ XBT_DEBUG("\tAdd PTP from %d to %d bw:'%s' lat:'%s'",src,dst,bw,lat);
+ pointToPoint.SetDeviceAttribute ("DataRate", StringValue (bw));
+ pointToPoint.SetChannelAttribute ("Delay", StringValue (lat));
+ //pointToPoint.EnablePcapAll("test_ns3_trace"); //DEBUG
+
+ netA.Add(pointToPoint.Install (a, b));
+
+ char * adr = bprintf("10.%d.%d.0",number_of_networks,number_of_links);
+ address.SetBase (adr, "255.255.255.0");
+ XBT_DEBUG("\tInterface stack '%s'",adr);
+ interfaces.Add(address.Assign (netA));
+
+ XBT_DEBUG(" ");
+ if(number_of_links == 255){
+ if(number_of_networks == 255)
+ xbt_die("Number of links and networks exceed 255*255");
+ number_of_links = 1;
+ number_of_networks++;
+ }else{
+ number_of_links++;
+ }
+}
+
+void * ns3_end_platform(void)
+{
+ XBT_INFO("InitializeRoutes");
+ GlobalRouteManager::BuildGlobalRoutingDatabase();
+ GlobalRouteManager::InitializeRoutes();
+ //TODO REMOVE ;)
+ Ptr<Node> a = nodes.Get(0);
+ Ptr<Node> b = nodes.Get(11);
+ Ptr<Node> c = nodes.Get(12);
+ Ptr<Node> d = nodes.Get(13);
+
+ UdpEchoServerHelper echoServer (9);
+
+ ApplicationContainer serverApps = echoServer.Install (a);
+ serverApps.Start (Seconds (1.0));
+ serverApps.Stop (Seconds (20.0));
+
+ UdpEchoClientHelper echoClient (interfaces.GetAddress (0), 9);
+ echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
+ echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
+ echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
+ ApplicationContainer clientApps_b = echoClient.Install (b);
+ clientApps_b.Start (Seconds (2.0));
+ clientApps_b.Stop (Seconds (10.0));
+
+ UdpEchoClientHelper echoClient2 (interfaces.GetAddress (0), 9);
+ echoClient2.SetAttribute ("MaxPackets", UintegerValue (1));
+ echoClient2.SetAttribute ("Interval", TimeValue (Seconds (1.)));
+ echoClient2.SetAttribute ("PacketSize", UintegerValue (512));
+ ApplicationContainer clientApps_c = echoClient2.Install (c);
+ clientApps_c.Start (Seconds (3.0));
+ clientApps_c.Stop (Seconds (10.0));
+
+ UdpEchoClientHelper echoClient3 (interfaces.GetAddress (0), 9);
+ echoClient3.SetAttribute ("MaxPackets", UintegerValue (1));
+ echoClient3.SetAttribute ("Interval", TimeValue (Seconds (1.)));
+ echoClient3.SetAttribute ("PacketSize", UintegerValue (256));
+ ApplicationContainer clientApps_d = echoClient3.Install (d);
+ clientApps_d.Start (Seconds (4.0));
+ clientApps_d.Stop (Seconds (10.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ //HEEEEEEE
+}