Reservation¶
Definition of Reservation protocol and related tools.
This module provides a definition for the reservation protocol used by the network manager. This includes the Reservation, MemoryTimeCard, and QCap classes, which are used by the network manager to track reservations. Also included is the definition of the message type used by the reservation protocol.
- class src.network_management.reservation.MemoryTimeCard(memory_index: int)¶
Class for tracking reservations on a specific memory.
- memory_index¶
index of memory being tracked (in memory array).
- Type:
int
- reservations¶
list of reservations for the memory.
- Type:
List[Reservation]
- add(reservation: Reservation) bool ¶
Method to add reservation.
Will use schedule_reservation method to determine index to insert reservation.
- Parameters:
reservation (Reservation) – reservation to add.
- Returns:
whether or not reservation was inserted successfully.
- Return type:
bool
- remove(reservation: Reservation) bool ¶
Method to remove a reservation.
- Parameters:
reservation (Reservation) – reservation to remove.
- Returns:
if reservation was already on the memory or not.
- Return type:
bool
- schedule_reservation(resv: Reservation) int ¶
Method to add reservation to a memory.
Will return index at which reservation can be inserted into memory reservation list. If no space found for reservation, will raise an exception.
- Parameters:
resv (Reservation) – reservation to schedule.
- Returns:
index to insert reservation in reservation list.
- Return type:
int
- Raises:
Exception – no valid index to insert reservation.
- class src.network_management.reservation.QCap(node: str)¶
Class to collect local information for the reservation protocol
- node¶
name of current node.
- Type:
str
- class src.network_management.reservation.RSVPMsgType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Defines possible message types for the reservation protocol.
- class src.network_management.reservation.Reservation(initiator: str, responder: str, start_time: int, end_time: int, memory_size: int, fidelity: float)¶
Tracking of reservation parameters for the network manager.
- initiator¶
name of the node that created the reservation request.
- Type:
str
- responder¶
name of distant node with witch entanglement is requested.
- Type:
str
- start_time¶
simulation time at which entanglement should be attempted.
- Type:
int
- end_time¶
simulation time at which resources may be released.
- Type:
int
- memory_size¶
number of entangled memory pairs requested.
- Type:
int
- class src.network_management.reservation.ResourceReservationMessage(msg_type: any, receiver: str, reservation: Reservation, **kwargs)¶
Message used by resource reservation protocol.
This message contains all information passed between reservation protocol instances. Messages of different types contain different information.
- msg_type¶
defines the message type.
- Type:
- receiver¶
name of destination protocol instance.
- Type:
str
- reservation¶
reservation object relayed between nodes.
- Type:
- qcaps¶
cumulative quantum capacity object list (if msg_type == REQUEST)
- Type:
List[QCaps]
- path¶
cumulative node list for entanglement path (if msg_type == APPROVE)
- Type:
List[str]
- class src.network_management.reservation.ResourceReservationProtocol(own: QuantumRouter, name: str, memory_array_name: str)¶
ReservationProtocol for node resources.
The reservation protocol receives network entanglement requests and attempts to reserve local resources. If successful, it will forward the request to another node in the entanglement path and create local rules. These rules are passed to the node’s resource manager. If unsuccessful, the protocol will notify the network manager of failure.
- own¶
node that protocol instance is attached to.
- Type:
- name¶
label for protocol instance.
- Type:
str
- memo_arr¶
memory array to track.
- Type:
- timecards¶
list of reservation cards for all memories on node.
- Type:
List[MemoryTimeCard]
- es_succ_prob¶
sets success_probability of EntanglementSwappingA protocols created by rules.
- Type:
float
- es_degradation¶
sets degradation of EntanglementSwappingA protocols created by rules.
- Type:
float
- accepted_reservation¶
list of all approved reservation requests.
- Type:
List[Reservation]
- create_rules(path: List[str], reservation: Reservation) List[Rule] ¶
Method to create rules for a successful request.
Rules are used to direct the flow of information/entanglement in the resource manager.
- Parameters:
path (List[str]) – list of node names in entanglement path.
reservation (Reservation) – approved reservation.
- Returns:
list of rules created by the method.
- Return type:
List[Rule]
- load_rules(rules: List[Rule], reservation: Reservation) None ¶
Method to add created rules to resource manager.
This method will schedule the resource manager to load all rules at the reservation start time. The rules will be set to expire at the reservation end time.
- Parameters:
rules (List[Rules]) – rules to add.
reservation (Reservation) – reservation that created the rules.
- pop(src: str, msg: ResourceReservationMessage)¶
Method to receive messages from lower protocols.
Messages may be of 3 types, causing different network manager behavior:
REQUEST: requests are evaluated, and forwarded along the path if accepted. Otherwise a REJECT message is sent back.
REJECT: any reserved resources are released and the message forwarded back towards the initializer.
APPROVE: rules are created to achieve the approved request. The message is forwarded back towards the initializer.
- Parameters:
src (str) – source node of the message.
msg (ResourceReservationMessage) – message received.
- Side Effects:
May push/pop to lower/upper attached protocols (or network manager).
- Assumption:
the path initiator -> responder is same as the reverse path
- push(responder: str, start_time: int, end_time: int, memory_size: int, target_fidelity: float)¶
Method to receive reservation requests from higher level protocol.
Will evaluate request and determine if node can meet it. If it can, it will push the request down to a lower protocol. Otherwise, it will pop the request back up.
- Parameters:
responder (str) – node that entanglement is requested with.
start_time (int) – simulation time at which entanglement should start.
end_time (int) – simulation time at which entanglement should cease.
memory_size (int) – number of memories to be entangled.
target_fidelity (float) – desired fidelity of entanglement.
- Side Effects:
May push/pop to lower/upper attached protocols (or network manager).
- received_message(src, msg)¶
Method to receive messages directly (should not be used; receive through network manager).
- schedule(reservation: Reservation) bool ¶
Method to attempt reservation request.
- Parameters:
reservation (Reservation) – reservation to approve or reject.
- Returns:
if reservation can be met or not.
- Return type:
bool
- src.network_management.reservation.eg_req_func(protocols: List[EntanglementProtocol], args: Dict[str, Any]) EntanglementGenerationA ¶
Function used by eg_rule_action2 function for selecting generation protocols on the remote node
- src.network_management.reservation.eg_rule_action1(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by entanglement generation protocol on nodes except the initiator
- src.network_management.reservation.eg_rule_action2(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by entanglement generation protocol on nodes except the responder
- src.network_management.reservation.eg_rule_condition(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any]) List[MemoryInfo] ¶
Condition function used by entanglement generation protocol on nodes
- src.network_management.reservation.ep_req_func1(protocols, args: Dict[str, Any]) BBPSSW ¶
Function used by ep_rule_action1 for selecting purification protocols on the remote node
- src.network_management.reservation.ep_rule_action1(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by BBPSSW protocol on nodes except the responder node
- src.network_management.reservation.ep_rule_action2(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by BBPSSW protocol on nodes except the responder
- src.network_management.reservation.ep_rule_condition1(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any])¶
Condition function used by BBPSSW protocol on nodes except the initiator
- src.network_management.reservation.ep_rule_condition2(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any]) List[MemoryInfo] ¶
Condition function used by BBPSSW protocol on nodes except the responder
- src.network_management.reservation.es_req_func(protocols: List[EntanglementProtocol], args: Dict[str, Any]) EntanglementSwappingB ¶
Function used by es_rule_actionA for selecting swapping protocols on the remote node
- src.network_management.reservation.es_rule_actionA(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by EntanglementSwappingA protocol on nodes
- src.network_management.reservation.es_rule_actionB(memories_info: List[MemoryInfo], args: Dict[str, Any])¶
Action function used by EntanglementSwappingB protocol
- src.network_management.reservation.es_rule_conditionA(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any])¶
Condition function used by EntanglementSwappingA protocol on nodes
- src.network_management.reservation.es_rule_conditionB1(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any])¶
Condition function used by EntanglementSwappingB protocol on nodes of either responder or initiator
- src.network_management.reservation.es_rule_conditionB2(memory_info: MemoryInfo, manager: MemoryManager, args: Dict[str, Any]) List[MemoryInfo] ¶
Condition function used by EntanglementSwappingB protocol on intermediate nodes of path