32except ModuleNotFoundError:
 
   34        "Error: ns3 Python module not found;" 
   35        " Python bindings may not be enabled" 
   36        " or your PYTHONPATH might not be properly configured" 
   41    cmd = ns.CommandLine()
 
   48    all = ns.NodeContainer(3)
 
   49    net1 = ns.NodeContainer()
 
   52    net2 = ns.NodeContainer()
 
   57    internetv6 = ns.InternetStackHelper()
 
   58    internetv6.Install(all)
 
   61    csma = ns.CsmaHelper()
 
   62    csma.SetChannelAttribute(
"DataRate", ns.DataRateValue(ns.DataRate(5000000)))
 
   63    csma.SetChannelAttribute(
"Delay", ns.TimeValue(ns.MilliSeconds(2)))
 
   64    d1 = csma.Install(net1)
 
   65    d2 = csma.Install(net2)
 
   69    ipv6 = ns.Ipv6AddressHelper()
 
   70    ipv6.SetBase(ns.Ipv6Address(
"2001:1::"), ns.Ipv6Prefix(64))
 
   72    i1.SetForwarding(1, 
True)
 
   73    i1.SetDefaultRouteInAllNodes(1)
 
   74    ipv6.SetBase(ns.Ipv6Address(
"2001:2::"), ns.Ipv6Prefix(64))
 
   76    i2.SetForwarding(0, 
True)
 
   77    i2.SetDefaultRouteInAllNodes(0)
 
   83    interPacketInterval = ns.Seconds(1.0)
 
   85    ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
 
   90    ping.SetAttribute(
"Count", ns.UintegerValue(maxPacketCount))
 
   91    ping.SetAttribute(
"Interval", ns.TimeValue(interPacketInterval))
 
   92    ping.SetAttribute(
"Size", ns.UintegerValue(packetSize))
 
   94    apps = ping.Install(ns.NodeContainer(net1.Get(0)))
 
   95    apps.Start(ns.Seconds(2.0))
 
   96    apps.Stop(ns.Seconds(20.0))
 
   99    ascii = ns.AsciiTraceHelper()
 
  100    csma.EnableAsciiAll(ascii.CreateFileStream(
"simple-routing-ping6.tr"))
 
  101    csma.EnablePcapAll(
"simple-routing-ping6", 
True)
 
  105    ns.Simulator.Destroy()
 
  108if __name__ == 
"__main__":