netqasm.backend.network_stack

Network stack interface for simulators.

This module provides the BaseNetworkStack class which can be used by simulators as a base class for modeling the network stack.

class netqasm.backend.network_stack.Address(node_id, epr_socket_id)

Bases: object

Parameters
  • node_id (int) –

  • epr_socket_id (int) –

node_id: int
epr_socket_id: int
class netqasm.backend.network_stack.BaseNetworkStack

Bases: abc.ABC

Base class for a (extremly simplified) network stack in simulators.

This class can be used as a simplified network stack that can handle requests that adhere to the QLink-Interface.

abstract put(request)

Put a link layer request to the network stack

Parameters

request (Union[LinkLayerCreate, LinkLayerRecv]) –

Return type

None

abstract setup_epr_socket(epr_socket_id, remote_node_id, remote_epr_socket_id, timeout=1.0)

Ask the network stack to open an EPR socket.

Parameters
  • epr_socket_id (int) –

  • remote_node_id (int) –

  • remote_epr_socket_id (int) –

  • timeout (float) –

Return type

Generator[Any, None, None]

abstract get_purpose_id(remote_node_id, epr_socket_id)
Parameters
  • remote_node_id (int) –

  • epr_socket_id (int) –

Return type

int