23ns.LogComponentEnable(
"BriteTopologyHelper", ns.LOG_LEVEL_ALL)
 
   28confFile = 
"src/brite/examples/conf_files/TD_ASBarabasi_RTWaxman.conf" 
   33bth = ns.BriteTopologyHelper(confFile)
 
   36p2p = ns.PointToPointHelper()
 
   38stack = ns.InternetStackHelper()
 
   40nixRouting = ns.Ipv4NixVectorHelper()
 
   41stack.SetRoutingHelper(nixRouting)
 
   43address = ns.Ipv4AddressHelper()
 
   44address.SetBase(
"10.0.0.0", 
"255.255.255.252")
 
   46bth.BuildBriteTopology(stack)
 
   47bth.AssignIpv4Addresses(address)
 
   49print(f
"Number of AS created {bth.GetNAs()}")
 
   54client = ns.NodeContainer()
 
   55server = ns.NodeContainer()
 
   61numLeafNodesInAsZero = bth.GetNLeafNodesForAs(0)
 
   62client.Add(bth.GetLeafNodeForAs(0, numLeafNodesInAsZero - 1))
 
   68numLeafNodesInAsOne = bth.GetNLeafNodesForAs(1)
 
   69server.Add(bth.GetLeafNodeForAs(1, numLeafNodesInAsOne - 1))
 
   71p2p.SetDeviceAttribute(
"DataRate", ns.StringValue(
"5Mbps"))
 
   72p2p.SetChannelAttribute(
"Delay", ns.StringValue(
"2ms"))
 
   74p2pClientDevices = p2p.Install(client)
 
   75p2pServerDevices = p2p.Install(server)
 
   77address.SetBase(
"10.1.0.0", 
"255.255.0.0")
 
   78clientInterfaces = address.Assign(p2pClientDevices)
 
   80address.SetBase(
"10.2.0.0", 
"255.255.0.0")
 
   81serverInterfaces = ns.Ipv4InterfaceContainer()
 
   82serverInterfaces = address.Assign(p2pServerDevices)
 
   84echoServer = ns.UdpEchoServerHelper(9)
 
   85serverApps = echoServer.Install(server.Get(0))
 
   86serverApps.Start(ns.Seconds(1.0))
 
   87serverApps.Stop(ns.Seconds(5.0))
 
   89echoClient = ns.UdpEchoClientHelper(serverInterfaces.GetAddress(0).ConvertTo(), 9)
 
   90echoClient.SetAttribute(
"MaxPackets", ns.UintegerValue(1))
 
   91echoClient.SetAttribute(
"Interval", ns.TimeValue(ns.Seconds(1.)))
 
   92echoClient.SetAttribute(
"PacketSize", ns.UintegerValue(1024))
 
   94clientApps = echoClient.Install(client.Get(0))
 
   95clientApps.Start(ns.Seconds(2.0))
 
   96clientApps.Stop(ns.Seconds(5.0))
 
   98asciiTrace = ns.AsciiTraceHelper()
 
   99p2p.EnableAsciiAll(asciiTrace.CreateFileStream(
"briteLeaves.tr"))
 
  102ns.Simulator.Stop(ns.Seconds(6.0))
 
  104ns.Simulator.Destroy()