21except ModuleNotFoundError:
 
   23        "Error: ns3 Python module not found;" 
   24        " Python bindings may not be enabled" 
   25        " or your PYTHONPATH might not be properly configured" 
   30    cmd = ns.CommandLine()
 
   37    all = ns.NodeContainer(3)
 
   38    net1 = ns.NodeContainer()
 
   41    net2 = ns.NodeContainer()
 
   46    internetv6 = ns.InternetStackHelper()
 
   47    internetv6.Install(all)
 
   50    csma = ns.CsmaHelper()
 
   51    csma.SetChannelAttribute(
"DataRate", ns.DataRateValue(ns.DataRate(5000000)))
 
   52    csma.SetChannelAttribute(
"Delay", ns.TimeValue(ns.MilliSeconds(2)))
 
   53    d1 = csma.Install(net1)
 
   54    d2 = csma.Install(net2)
 
   58    ipv6 = ns.Ipv6AddressHelper()
 
   59    ipv6.SetBase(ns.Ipv6Address(
"2001:1::"), ns.Ipv6Prefix(64))
 
   61    i1.SetForwarding(1, 
True)
 
   62    i1.SetDefaultRouteInAllNodes(1)
 
   63    ipv6.SetBase(ns.Ipv6Address(
"2001:2::"), ns.Ipv6Prefix(64))
 
   65    i2.SetForwarding(0, 
True)
 
   66    i2.SetDefaultRouteInAllNodes(0)
 
   72    interPacketInterval = ns.Seconds(1)
 
   74    ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
 
   79    ping.SetAttribute(
"Count", ns.UintegerValue(maxPacketCount))
 
   80    ping.SetAttribute(
"Interval", ns.TimeValue(interPacketInterval))
 
   81    ping.SetAttribute(
"Size", ns.UintegerValue(packetSize))
 
   83    apps = ping.Install(ns.NodeContainer(net1.Get(0)))
 
   84    apps.Start(ns.Seconds(2))
 
   85    apps.Stop(ns.Seconds(20))
 
   88    ascii = ns.AsciiTraceHelper()
 
   89    csma.EnableAsciiAll(ascii.CreateFileStream(
"simple-routing-ping6.tr"))
 
   90    csma.EnablePcapAll(
"simple-routing-ping6", 
True)
 
   94    ns.Simulator.Destroy()
 
   97if __name__ == 
"__main__":