Forwarding

Forwarding protocol and forwarding message.

This module defines the ForwardingProtocol and ForwardingMessage classes.

class sequence.network_management.forwarding.ForwardingMessage(msg_type: Enum, receiver: str, payload: Message)

Message used for communications between forwarding protocol instances.

msg_type

type of message, required by base Message class.

Type:

Enum

receiver

name of destination protocol instance.

Type:

str

payload

message to be delivered to destination.

Type:

Message

class sequence.network_management.forwarding.ForwardingMessageType(*values)
class sequence.network_management.forwarding.ForwardingProtocol(owner: QuantumRouter, name: str)

Class to forward messages based on the forwarding table (from the NetworkManager) in the routing protocol.

owner

node that protocol instance is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

property forwarding_table: dict[str, str]

Returns the forwarding table.

pop(src: str, msg: ForwardingMessage)

Message to receive reservation messages.

Messages are forwarded to the upper protocol.

Parameters:
  • src (str) – node sending the message.

  • msg (ForwardingMessage) – message received.

Side Effects:

Will call pop method of higher protocol.

push(dst: str, msg: Message, next_hop: str | None = None)

Method to receive a message from upper protocols.

Routing packages the message and forwards it to the next node in the optimal path (determined by the forwarding table).

Parameters:
  • dst (str) – name of destination node. If not None, resort to the forwarding table to get the next hop.

  • msg (Message) – message to relay.

  • next_hop (str) – name of next hop. If dst is None, next_hop shouldn’t be None. next_hop directly tells the next hop.

Side Effects:

Will invoke push method of lower protocol or network manager.

received_message(src: str, msg: Message)

Method to directly receive messages from a node (should not be used).