SnmpKit.SnmpSim.TestHelpers.PortAllocator (snmpkit v0.6.4)

Simple port allocation service for tests.

Manages a pool of available ports and allocates them on demand. Ports can be reserved and released for reuse.

Summary

Functions

Legacy function for backward compatibility. Allocates a port range for a specific test type.

Returns a specification to start this module under a supervisor.

Get allocation statistics.

Release a single port back to the pool.

Release a port range back to the pool.

Reserve a single port. Returns {:ok, port} or {:error, reason}

Reserve a range of ports. Returns {:ok, {start_port, end_port}} or {:error, reason}

Reset all allocations.

Start the port allocator service.

Functions

allocate_port_range(test_type, count)

Legacy function for backward compatibility. Allocates a port range for a specific test type.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_stats()

Get allocation statistics.

release_port(port)

Release a single port back to the pool.

release_port_range(start_port, end_port)

Release a port range back to the pool.

reserve_port()

Reserve a single port. Returns {:ok, port} or {:error, reason}

reserve_port_range(count)

Reserve a range of ports. Returns {:ok, {start_port, end_port}} or {:error, reason}

reset()

Reset all allocations.

start_link(opts \\ [])

Start the port allocator service.