/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/csma-module.h"
#include "ns3/ipv4-global-routing-helper.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");

int
main (int argc, char *argv[])
{
	//LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
	//LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
//CORPORATE NETWORK
	NodeContainer corporateNodes;
	corporateNodes.Create(17);//16 noduri + 1 nefolosit in trafic, doar pt legatura intre LAN
  
	CsmaHelper csmaCorporate;
	csmaCorporate.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
	csmaCorporate.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6000)));

	NetDeviceContainer csmaDevicesCorporate;
	csmaDevicesCorporate = csmaCorporate.Install (corporateNodes);
	
	InternetStackHelper stack;
	stack.Install(corporateNodes);
	
	Ipv4AddressHelper address;
	address.SetBase("10.1.1.0","255.255.255.0");
	Ipv4InterfaceContainer corporateInterfaces;
	corporateInterfaces = address.Assign(csmaDevicesCorporate);
	
//CONTROL NETWORK

	NodeContainer controlNodes;
	
	controlNodes.Create(13);
	controlNodes.Add(corporateNodes.Get(16));
  
	CsmaHelper csmaControl;
	csmaControl.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
	csmaControl.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6000)));

	NetDeviceContainer csmaDevicesControl;
	csmaDevicesControl = csmaControl.Install (controlNodes);
	
	for (int i=0;i<13;i++){
		stack.Install(controlNodes.Get(i));
	}
	
	Ipv4AddressHelper address2;
	address2.SetBase("85.1.1.0","255.255.255.0");
	Ipv4InterfaceContainer controlInterfaces;
	controlInterfaces = address2.Assign(csmaDevicesControl);
	
// DMZ NETWORK

	NodeContainer dmzNodes;
	
	dmzNodes.Create(11);
	dmzNodes.Add(corporateNodes.Get(16));
  
	CsmaHelper csmaDmz;
	csmaDmz.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
	csmaDmz.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6000)));

	NetDeviceContainer csmaDevicesDmz;
	csmaDevicesDmz = csmaDmz.Install (dmzNodes);
	
	for (int i=0;i<11;i++){
		stack.Install(dmzNodes.Get(i));
	}
	
	Ipv4AddressHelper address3;
	address3.SetBase("132.8.1.0","255.255.255.0");
	Ipv4InterfaceContainer dmzInterfaces;
	dmzInterfaces = address3.Assign(csmaDevicesDmz);

// >>>>>>>>>>>>>>>>>>>>>>>>TRAFIC>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


// trafic in CORPORATE
//1 
	UdpEchoServerHelper echoServerLAN(10);
	ApplicationContainer serverAppsLAN = echoServerLAN.Install (corporateNodes.Get (15));
	serverAppsLAN.Start (Seconds (1.0));
	serverAppsLAN.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN (corporateInterfaces.GetAddress (14), 10);
	echoClientLAN.SetAttribute ("MaxPackets", UintegerValue (4800));
	echoClientLAN.SetAttribute ("Interval", TimeValue (Seconds (1.5)));
	echoClientLAN.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN = echoClientLAN.Install (corporateNodes.Get (9));
	clientAppsLAN.Start (Seconds (1.0));
	clientAppsLAN.Stop (Seconds (7200.0));
//2
	ApplicationContainer serverAppsLAN2 = echoServerLAN.Install (corporateNodes.Get (8));
	serverAppsLAN2.Start (Seconds (2.0));
	serverAppsLAN2.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN2 (corporateInterfaces.GetAddress (8), 10);
	echoClientLAN2.SetAttribute ("MaxPackets", UintegerValue (21600));
	echoClientLAN2.SetAttribute ("Interval", TimeValue (Seconds (0.3)));
	echoClientLAN2.SetAttribute ("PacketSize", UintegerValue (64));

	ApplicationContainer clientAppsLAN2 = echoClientLAN2.Install (corporateNodes.Get (2));
	clientAppsLAN2.Start (Seconds (1.0));
	clientAppsLAN2.Stop (Seconds (7200.0));
//3
	ApplicationContainer serverAppsLAN3 = echoServerLAN.Install (corporateNodes.Get (1));
	serverAppsLAN3.Start (Seconds (1.0));
	serverAppsLAN3.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN3 (corporateInterfaces.GetAddress (1), 10);
	echoClientLAN3.SetAttribute ("MaxPackets", UintegerValue (14400));
	echoClientLAN3.SetAttribute ("Interval", TimeValue (Seconds (2.0)));
	echoClientLAN3.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN3 = echoClientLAN3.Install (corporateNodes.Get (0));
	clientAppsLAN3.Start (Seconds (1.0));
	clientAppsLAN3.Stop (Seconds (7200.0));
//4
	ApplicationContainer serverAppsLAN4 = echoServerLAN.Install (corporateNodes.Get (3));
	serverAppsLAN4.Start (Seconds (1.0));
	serverAppsLAN4.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN4 (corporateInterfaces.GetAddress (3), 10);
	echoClientLAN4.SetAttribute ("MaxPackets", UintegerValue (2400));
	echoClientLAN4.SetAttribute ("Interval", TimeValue (Seconds (3.0)));
	echoClientLAN4.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN4 = echoClientLAN4.Install (corporateNodes.Get (11));
	clientAppsLAN4.Start (Seconds (1.0));
	clientAppsLAN4.Stop (Seconds (7200.0));
	
// trafic in CONTROL
//5
	ApplicationContainer serverAppsLAN5 = echoServerLAN.Install (controlNodes.Get (11));
	serverAppsLAN5.Start (Seconds (1.0));
	serverAppsLAN5.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN5 (controlInterfaces.GetAddress (11), 10);
	echoClientLAN5.SetAttribute ("MaxPackets", UintegerValue (72000));
	echoClientLAN5.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN5.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN5 = echoClientLAN5.Install (controlNodes.Get (10));
	clientAppsLAN5.Start (Seconds (1.0));
	clientAppsLAN5.Stop (Seconds (7200.0));
//6
	ApplicationContainer serverAppsLAN6 = echoServerLAN.Install (controlNodes.Get (8));
	serverAppsLAN6.Start (Seconds (1.0));
	serverAppsLAN6.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN6 (controlInterfaces.GetAddress (8), 10);
	echoClientLAN6.SetAttribute ("MaxPackets", UintegerValue (5760));
	echoClientLAN6.SetAttribute ("Interval", TimeValue (Seconds (1.25)));
	echoClientLAN6.SetAttribute ("PacketSize", UintegerValue (512));

	ApplicationContainer clientAppsLAN6 = echoClientLAN6.Install (controlNodes.Get (9));
	clientAppsLAN6.Start (Seconds (1.0));
	clientAppsLAN6.Stop (Seconds (7200.0));
//7
	ApplicationContainer serverAppsLAN7= echoServerLAN.Install (controlNodes.Get (9));
	serverAppsLAN7.Start (Seconds (1.0));
	serverAppsLAN7.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN7 (controlInterfaces.GetAddress (9), 10);
	echoClientLAN7.SetAttribute ("MaxPackets", UintegerValue (3600));
	echoClientLAN7.SetAttribute ("Interval", TimeValue (Seconds (1.5)));
	echoClientLAN7.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN7 = echoClientLAN7.Install (controlNodes.Get (2));
	clientAppsLAN7.Start (Seconds (1.0));
	clientAppsLAN7.Stop (Seconds (7200.0));
//8
	ApplicationContainer serverAppsLAN8 = echoServerLAN.Install (controlNodes.Get (0));
	serverAppsLAN8.Start (Seconds (1.0));
	serverAppsLAN8.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN8 (controlInterfaces.GetAddress (0), 10);
	echoClientLAN8.SetAttribute ("MaxPackets", UintegerValue (1440));
	echoClientLAN8.SetAttribute ("Interval", TimeValue (Seconds (5.0)));
	echoClientLAN8.SetAttribute ("PacketSize", UintegerValue (128));

	ApplicationContainer clientAppsLAN8 = echoClientLAN8.Install (controlNodes.Get (11));
	clientAppsLAN8.Start (Seconds (1.0));
	clientAppsLAN8.Stop (Seconds (7200.0));
//trafic intre retele LAN1 si LAN3

//9
	ApplicationContainer serverAppsLAN9 = echoServerLAN.Install (corporateNodes.Get (10));
	serverAppsLAN9.Start (Seconds (1.0));
	serverAppsLAN9.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN9 (corporateInterfaces.GetAddress (10), 10);
	echoClientLAN9.SetAttribute ("MaxPackets", UintegerValue (720));
	echoClientLAN9.SetAttribute ("Interval", TimeValue (Seconds (10.0)));
	echoClientLAN9.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN9 = echoClientLAN9.Install (controlNodes.Get (2));
	clientAppsLAN9.Start (Seconds (1.0));
	clientAppsLAN9.Stop (Seconds (7200.0));
//10
	ApplicationContainer serverAppsLAN10 = echoServerLAN.Install (corporateNodes.Get (2));
	serverAppsLAN10.Start (Seconds (1.0));
	serverAppsLAN10.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN10 (corporateInterfaces.GetAddress (2), 10);
	echoClientLAN10.SetAttribute ("MaxPackets", UintegerValue (360));
	echoClientLAN10.SetAttribute ("Interval", TimeValue (Seconds (20)));
	echoClientLAN10.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN10 = echoClientLAN10.Install (controlNodes.Get (11));
	clientAppsLAN10.Start (Seconds (1.0));
	clientAppsLAN10.Stop (Seconds (7200.0));
//11
	ApplicationContainer serverAppsLAN11= echoServerLAN.Install (controlNodes.Get (7));
	serverAppsLAN11.Start (Seconds (1.0));
	serverAppsLAN11.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN11 (controlInterfaces.GetAddress (7), 10);
	echoClientLAN11.SetAttribute ("MaxPackets", UintegerValue (9600));
	echoClientLAN11.SetAttribute ("Interval", TimeValue (Seconds (0.75)));
	echoClientLAN11.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN11 = echoClientLAN11.Install (corporateNodes.Get (10));
	clientAppsLAN11.Start (Seconds (1.0));
	clientAppsLAN11.Stop (Seconds (7200.0));
//12
	ApplicationContainer serverAppsLAN12 = echoServerLAN.Install (controlNodes.Get (10));
	serverAppsLAN12.Start (Seconds (1.0));
	serverAppsLAN12.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN12 (controlInterfaces.GetAddress (10), 10);
	echoClientLAN12.SetAttribute ("MaxPackets", UintegerValue (3600));
	echoClientLAN12.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
	echoClientLAN12.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN12 = echoClientLAN12.Install (corporateNodes.Get (4));
	clientAppsLAN12.Start (Seconds (1.0));
	clientAppsLAN12.Stop (Seconds (7200.0));

// trafic in LAN3

//13
	ApplicationContainer serverAppsLAN13 = echoServerLAN.Install (dmzNodes.Get (9));
	serverAppsLAN13.Start (Seconds (3601.0));
	serverAppsLAN13.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN13 (dmzInterfaces.GetAddress (9), 10);
	echoClientLAN13.SetAttribute ("MaxPackets", UintegerValue (3600));
	echoClientLAN13.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
	echoClientLAN13.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN13 = echoClientLAN13.Install (dmzNodes.Get (1));
	clientAppsLAN13.Start (Seconds (3601.0));
	clientAppsLAN13.Stop (Seconds (7200.0));
//14
	ApplicationContainer serverAppsLAN14 = echoServerLAN.Install (dmzNodes.Get (3));
	serverAppsLAN14.Start (Seconds (14.0));
	serverAppsLAN14.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN14 (dmzInterfaces.GetAddress (3), 10);
	echoClientLAN14.SetAttribute ("MaxPackets", UintegerValue (2880));
	echoClientLAN14.SetAttribute ("Interval", TimeValue (Seconds (2.5)));
	echoClientLAN14.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN14 = echoClientLAN14.Install (dmzNodes.Get (1));
	clientAppsLAN14.Start (Seconds (1.0));
	clientAppsLAN14.Stop (Seconds (7200.0));
//15
	ApplicationContainer serverAppsLAN15= echoServerLAN.Install (dmzNodes.Get (6));
	serverAppsLAN15.Start (Seconds (1.0));
	serverAppsLAN15.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN15 (dmzInterfaces.GetAddress (6), 10);
	echoClientLAN15.SetAttribute ("MaxPackets", UintegerValue (4114));
	echoClientLAN15.SetAttribute ("Interval", TimeValue (Seconds (1.75)));
	echoClientLAN15.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN15 = echoClientLAN15.Install (dmzNodes.Get (9));
	clientAppsLAN15.Start (Seconds (1.0));
	clientAppsLAN15.Stop (Seconds (7200.0));
//16
	ApplicationContainer serverAppsLAN16 = echoServerLAN.Install (dmzNodes.Get (4));
	serverAppsLAN16.Start (Seconds (1.0));
	serverAppsLAN16.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN16 (dmzInterfaces.GetAddress (4), 10);
	echoClientLAN16.SetAttribute ("MaxPackets", UintegerValue (7200));
	echoClientLAN16.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
	echoClientLAN16.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN16 = echoClientLAN16.Install (dmzNodes.Get (2));
	clientAppsLAN16.Start (Seconds (1.0));
	clientAppsLAN16.Stop (Seconds (7200.0));
	
// trafic intre LAN1 si LAN2

//17
	ApplicationContainer serverAppsLAN17 = echoServerLAN.Install (corporateNodes.Get (9));
	serverAppsLAN17.Start (Seconds (1.0));
	serverAppsLAN17.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN17 (corporateInterfaces.GetAddress (9), 10);
	echoClientLAN17.SetAttribute ("MaxPackets", UintegerValue (2400));
	echoClientLAN17.SetAttribute ("Interval", TimeValue (Seconds (3.0)));
	echoClientLAN17.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN17 = echoClientLAN17.Install (dmzNodes.Get (2));
	clientAppsLAN17.Start (Seconds (1.0));
	clientAppsLAN17.Stop (Seconds (7200.0));
//18
	ApplicationContainer serverAppsLAN18 = echoServerLAN.Install (corporateNodes.Get (7));
	serverAppsLAN18.Start (Seconds (1.0));
	serverAppsLAN18.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN18 (corporateInterfaces.GetAddress (7), 10);
	echoClientLAN18.SetAttribute ("MaxPackets", UintegerValue (360));
	echoClientLAN18.SetAttribute ("Interval", TimeValue (Seconds (20.0)));
	echoClientLAN18.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN18 = echoClientLAN18.Install (dmzNodes.Get (4));
	clientAppsLAN18.Start (Seconds (1.0));
	clientAppsLAN18.Stop (Seconds (7200.0));
//19
	ApplicationContainer serverAppsLAN19= echoServerLAN.Install (dmzNodes.Get (7));
	serverAppsLAN19.Start (Seconds (1.0));
	serverAppsLAN19.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN19 (dmzInterfaces.GetAddress (7), 10);
	echoClientLAN19.SetAttribute ("MaxPackets", UintegerValue (3200));
	echoClientLAN19.SetAttribute ("Interval", TimeValue (Seconds (2.25)));
	echoClientLAN19.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN19 = echoClientLAN19.Install (corporateNodes.Get (10));
	clientAppsLAN19.Start (Seconds (1.0));
	clientAppsLAN19.Stop (Seconds (7200.0));
//20
	ApplicationContainer serverAppsLAN20 = echoServerLAN.Install (dmzNodes.Get (9));
	serverAppsLAN20.Start (Seconds (1.0));
	serverAppsLAN20.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN20 (dmzInterfaces.GetAddress (9), 10);
	echoClientLAN20.SetAttribute ("MaxPackets", UintegerValue (7200));
	echoClientLAN20.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
	echoClientLAN20.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN20 = echoClientLAN20.Install (corporateNodes.Get (4));
	clientAppsLAN20.Start (Seconds (1.0));
	clientAppsLAN20.Stop (Seconds (7200.0));
	
//trafic intre LAN2 SI LAN3

//21
	ApplicationContainer serverAppsLAN21 = echoServerLAN.Install (controlNodes.Get (6));
	serverAppsLAN21.Start (Seconds (1.0));
	serverAppsLAN21.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN21 (controlInterfaces.GetAddress (6), 10);
	echoClientLAN21.SetAttribute ("MaxPackets", UintegerValue (7200));
	echoClientLAN21.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
	echoClientLAN21.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN21 = echoClientLAN21.Install (dmzNodes.Get (2));
	clientAppsLAN21.Start (Seconds (1.0));
	clientAppsLAN21.Stop (Seconds (7200.0));
//22
	ApplicationContainer serverAppsLAN22 = echoServerLAN.Install (controlNodes.Get (2));
	serverAppsLAN22.Start (Seconds (1.0));
	serverAppsLAN22.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN22 (controlInterfaces.GetAddress (2), 10);
	echoClientLAN22.SetAttribute ("MaxPackets", UintegerValue (14400));
	echoClientLAN22.SetAttribute ("Interval", TimeValue (Seconds (0.5)));
	echoClientLAN22.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN22 = echoClientLAN22.Install (dmzNodes.Get (4));
	clientAppsLAN22.Start (Seconds (1.0));
	clientAppsLAN22.Stop (Seconds (7200.0));
//23
	ApplicationContainer serverAppsLAN23= echoServerLAN.Install (dmzNodes.Get (1));
	serverAppsLAN23.Start (Seconds (1.0));
	serverAppsLAN23.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN23 (dmzInterfaces.GetAddress (1), 10);
	echoClientLAN23.SetAttribute ("MaxPackets", UintegerValue (72));
	echoClientLAN23.SetAttribute ("Interval", TimeValue (Seconds (100)));
	echoClientLAN23.SetAttribute ("PacketSize", UintegerValue (1024));

	ApplicationContainer clientAppsLAN23 = echoClientLAN23.Install (controlNodes.Get (10));
	clientAppsLAN23.Start (Seconds (1.0));
	clientAppsLAN23.Stop (Seconds (7200.0));
//24
	ApplicationContainer serverAppsLAN24 = echoServerLAN.Install (dmzNodes.Get (2));
	serverAppsLAN24.Start (Seconds (1.0));
	serverAppsLAN24.Stop (Seconds (7200.0));
	
	UdpEchoClientHelper echoClientLAN24 (dmzInterfaces.GetAddress (2), 10);
	echoClientLAN24.SetAttribute ("MaxPackets", UintegerValue (240));
	echoClientLAN24.SetAttribute ("Interval", TimeValue (Seconds (30)));
	echoClientLAN24.SetAttribute ("PacketSize", UintegerValue (256));

	ApplicationContainer clientAppsLAN24 = echoClientLAN24.Install (controlNodes.Get (4));
	clientAppsLAN24.Start (Seconds (1.0));
	clientAppsLAN24.Stop (Seconds (7200.0));

//mal trafic

//25
	ApplicationContainer serverAppsLAN25 = echoServerLAN.Install (corporateNodes.Get (6));
	serverAppsLAN25.Start (Seconds (500.0));
	serverAppsLAN25.Stop (Seconds (600.0));
	
	UdpEchoClientHelper echoClientLAN25 (corporateInterfaces.GetAddress (6), 10);
	echoClientLAN25.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN25.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN25.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN25 = echoClientLAN25.Install (corporateNodes.Get (2));
	clientAppsLAN25.Start (Seconds (500.0));
	clientAppsLAN25.Stop (Seconds (600.0));
	
//26
	ApplicationContainer serverAppsLAN26 = echoServerLAN.Install (controlNodes.Get (9));
	serverAppsLAN26.Start (Seconds (1300.0));
	serverAppsLAN26.Stop (Seconds (1400.0));
	
	UdpEchoClientHelper echoClientLAN26 (controlInterfaces.GetAddress (9), 10);
	echoClientLAN26.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN26.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN26.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN26 = echoClientLAN26.Install (controlNodes.Get (1));
	clientAppsLAN26.Start (Seconds (1300.0));
	clientAppsLAN26.Stop (Seconds (1400.0));
	
//27
	ApplicationContainer serverAppsLAN27 = echoServerLAN.Install (dmzNodes.Get (8));
	serverAppsLAN27.Start (Seconds (2500.0));
	serverAppsLAN27.Stop (Seconds (2600.0));
	
	UdpEchoClientHelper echoClientLAN27 (dmzInterfaces.GetAddress (8), 10);
	echoClientLAN27.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN27.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN27.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN27 = echoClientLAN27.Install (dmzNodes.Get (2));
	clientAppsLAN27.Start (Seconds (2500.0));
	clientAppsLAN27.Stop (Seconds (2600.0));
	
//28
	ApplicationContainer serverAppsLAN28 = echoServerLAN.Install (controlNodes.Get (7));
	serverAppsLAN28.Start (Seconds (3300.0));
	serverAppsLAN28.Stop (Seconds (3400.0));
	
	UdpEchoClientHelper echoClientLAN28 (controlInterfaces.GetAddress (7), 10);
	echoClientLAN28.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN28.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN28.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN28 = echoClientLAN28.Install (corporateNodes.Get (2));
	clientAppsLAN28.Start (Seconds (3300.0));
	clientAppsLAN28.Stop (Seconds (3400.0));
	
//29
	ApplicationContainer serverAppsLAN29 = echoServerLAN.Install (dmzNodes.Get (2));
	serverAppsLAN29.Start (Seconds (4100.0));
	serverAppsLAN29.Stop (Seconds (4200.0));
	
	UdpEchoClientHelper echoClientLAN29 (dmzInterfaces.GetAddress (2), 10);
	echoClientLAN29.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN29.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN29.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN29 = echoClientLAN29.Install (corporateNodes.Get (2));
	clientAppsLAN29.Start (Seconds (4100.0));
	clientAppsLAN29.Stop (Seconds (4200.0));
	
//30
	ApplicationContainer serverAppsLAN30 = echoServerLAN.Install (controlNodes.Get (3));
	serverAppsLAN30.Start (Seconds (5600.0));
	serverAppsLAN30.Stop (Seconds (5700.0));
	
	UdpEchoClientHelper echoClientLAN30 (controlInterfaces.GetAddress (3), 10);
	echoClientLAN30.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN30.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN30.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN30 = echoClientLAN30.Install (dmzNodes.Get (6));
	clientAppsLAN30.Start (Seconds (5600.0));
	clientAppsLAN30.Stop (Seconds (5700.0));
	
//31
	ApplicationContainer serverAppsLAN31 = echoServerLAN.Install (corporateNodes.Get (2));
	serverAppsLAN31.Start (Seconds (6500.0));
	serverAppsLAN31.Stop (Seconds (6600.0));
	
	UdpEchoClientHelper echoClientLAN31 (corporateInterfaces.GetAddress (2), 10);
	echoClientLAN31.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN31.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN31.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN31 = echoClientLAN31.Install (dmzNodes.Get (8));
	clientAppsLAN31.Start (Seconds (6500.0));
	clientAppsLAN31.Stop (Seconds (6600.0));
	
//32
	ApplicationContainer serverAppsLAN32 = echoServerLAN.Install (corporateNodes.Get (5));
	serverAppsLAN32.Start (Seconds (7000.0));
	serverAppsLAN32.Stop (Seconds (7100.0));
	
	UdpEchoClientHelper echoClientLAN32 (corporateInterfaces.GetAddress (5), 10);
	echoClientLAN32.SetAttribute ("MaxPackets", UintegerValue (1000));
	echoClientLAN32.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
	echoClientLAN32.SetAttribute ("PacketSize", UintegerValue (16));

	ApplicationContainer clientAppsLAN32 = echoClientLAN32.Install (dmzNodes.Get (8));
	clientAppsLAN32.Start (Seconds (7000.0));
	clientAppsLAN32.Stop (Seconds (7100.0));

//tracing	
	Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
	
	
	GlobalValue::Bind("ChecksumEnabled",BooleanValue(true));
	csmaCorporate.EnablePcapAll("5-4corporate");
	csmaControl.EnablePcapAll("5-4control");
	csmaDmz.EnablePcapAll("5-4dmz");

	
	Simulator::Run ();
	Simulator::Destroy ();
	return 0;
}
