vRouter
The class "vSwitch" and "vRouter" are the implementation of the switch and router in the simulated network topology. "vSwitch" and "vRouter" will create a scheduling process to schedule all "vPacket" in the queue to "vNIC" for transmission based on the priority of "vPacket" when a "vPacket" arrived or has been transmitted. The scheduling process is implemented as an "event and only one scheduling process for each "vSwitch" or "vRouter" can exist at any time. If a "vSwitch" or "vRouter" does not have enough RAM to accommodate a "vPacket" upon receiving it, the "vPacket" will be dropped. The difference between "vSwitch" and "vRouter" are:
-
For a "vSwitch," the IP address attribute of its "vNIC" is set to none, and its "vNIC" can be connected to any entity.
-
For a "vRouter," the IP address of each of its "vNIC" instances must belong to a unique network and its "vNIC" cannot be connected to a "vHost" entity.
Bases: PhysicalEntity
Source code in PyCloudSim\entity\v_router.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
__init__(ipc, frequency, num_cpu_cores, ram, delay=0.01, at=simulation.now, after=None, label=None)
Create a virtual router.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ipc |
Union[int, float]
|
the instructions per cycle of the CPU. |
required |
frequency |
Union[int, float]
|
the frequency of the CPU. |
required |
num_cpu_cores |
int
|
the number of CPU cores. |
required |
ram |
int
|
the amount of RAM in MiB. |
required |
delay |
float
|
the packet processing delay. Defaults to 0.01. |
0.01
|
at |
Union[int, float, Callable]
|
same as entity. Defaults to simulation.now. |
now
|
after |
Optional[Entity | List[Entity]]
|
same as entity. Defaults to None. |
None
|
label |
Optional[str]
|
same as entity. Defaults to None. |
None
|
Source code in PyCloudSim\entity\v_router.py
cache_packet(packet)
Cache a packet, this function will be automatically called by the vNIC upon receiving a packet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
packet |
vPacket
|
the received packet. |
required |
Source code in PyCloudSim\entity\v_router.py
connect_device(device, bandwidth=1000)
Connect the vRouter to a device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device |
Union[vSwitch, vGateway]
|
the device to connect to. |
required |
bandwidth |
int
|
the bandwidth of this link. Defaults to 1000. |
1000
|