Overview of ns.py network components
mainThe ns.py simulator provides a variety of pre-implemented networking components that can be connected to build complex topologies. Key categories include:
Packet Generation
Packet: Represents a network packet with creation time, size, ID, flow ID, source, and destination.DistPacketGenerator: Generates packets based on inter-arrival time and size distributions.TracePacketGenerator: Generates packets from a trace file.TCPPacketGenerator: Generates packets using the TCP transport protocol.ProxyPacketGenerator: Redirects real-world packets into the simulation.
Sinks and Monitoring
PacketSink: Receives packets and records delay statistics.TCPSink: Receives packets, records statistics, and produces TCP acknowledgements.ProxySink: Redirects received packets to a real-world TCP server.PortMonitor: Records the number of packets in aPortat intervals defined by a distribution.ServerMonitor: Records performance statistics for scheduling servers (e.g.,WFQServer,SPServer).
Network Elements and Links
Wire: A network cable with propagation delay following a distribution (bandwidth is modeled by upstream ports/schedulers).Port: An output port on a switch with a specific rate and buffer size (bytes or packet count) using tail-drop.REDPort: An output port using the Early Random Detection (RED) mechanism.Splitter/NWaySplitter: Elements that duplicate and distribute packets to one or multiple downstream ports.TrTCM: A two-rate three-color marker (RFC 2698).RandomDemux/FlowDemux/FIBDemux: Elements that route packets based on random choice, flow ID, or a Flow Information Base (FIB).
Traffic Shaping and Scheduling
TokenBucketShaper/TwoRateTokenBucketShaper: Traffic shaping elements.SPServer: Static Priority (SP) scheduler.WFQServer: Weighted Fair Queueing (WFQ) scheduler.DRRServer: Deficit Round Robin (DRR) scheduler.VirtualClockServer: Virtual Clock scheduler.
Switches
SimplePacketSwitch: A switch with FIFO bounded buffers on outgoing ports.FairPacketSwitch: A switch supporting WFQ, DRR, Static Priority, or Virtual Clock scheduling on outgoing ports, with support for class-based scheduling via theflow_classesparameter.