vNIC
The class "vNIC" serves as the implementation of the network interface card in the simulation. It includes a queue specifically designed to store "vPacket" objects and has the capability to establish connections with other "vNIC" instances. The "vNIC" class is equipped with two resources: uplink bandwidth and downlink bandwidth. These resources are allocated to the transmission and reception of "vPacket" objects respectively. The transmission and reception functionalities of "vPacket" are implemented as member functions within the class. Upon receiving a "vPacket", a specialized "vProcess" called PacketHandler is created to simulate the decoding process and the associated processing delay. If there is insufficient uplink or downlink bandwidth available, the "vPacket" will be kept in the queue until the necessary resources become available.
Bases: PhysicalComponent
Source code in PyCloudSim\entity\v_nic.py
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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
bandwidth: float
property
The bandwidth of the vNIC in MB/s.
connected_to: Optional[Union[vHost, vRouter, vSwitch, vGateway]]
property
The connected device.
downlink: Resource
property
The downlink of the vNIC.
host: Union[vHost, vRouter, vSwitch, vGateway]
property
The attached host.
ip: Optional[IPv4Address]
property
The IP address of the vNIC.
type: str
property
The type of the vNIC.
uplink: Resource
property
The uplink of the vNIC.
__init__(host, connected_to=None, bandwidth=1000, delay=0.02, ip=None, at=simulation.now, after=None, label=None)
Create a vNIC object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
Union[vHost, vRouter, vSwitch, vGateway]
|
the host that the vNIC is attached to. |
required |
connected_to |
Optional[Union[vHost, vRouter, vSwitch, vGateway]]
|
the device that the vNIC is connected to. Defaults to None. |
None
|
bandwidth |
int
|
the bandwidth in MBps of the vNIC. Defaults to 1000. |
1000
|
delay |
float
|
the processing delay of the vNIC. Defaults to 0.02. |
0.02
|
ip |
Optional[IPv4Address]
|
the IP address of the vNIC. Defaults to None. |
None
|
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_nic.py
creation()
downlink_utilization(inertval=0.1)
receive_packet(packet, delay=0.0)
Rceive a vPacket, the vPacket will be dropped if the attached host does not have enough RAM.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
packet |
vPacket
|
the vPacket to be recevived. |
required |
delay |
float
|
the delay for receiving this vPacket in term of transmitting time. Defaults to 0.0. |
0.0
|
Source code in PyCloudSim\entity\v_nic.py
send_packet(packet, delay=0.0)
Send a vPacket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
packet |
vPacket
|
the vPacket to be sent. |
required |
delay |
float
|
the delay for sending this packet in term of transmitting time. Defaults to 0.0. |
0.0
|