Actors¶
This module contains all actor definitions.
| Actor(env[, name]) | Representation of an actor |
| Buffer(env, capacity, link) | Representation of a data storage container |
| Flow(env, name, source, destination, amount) | Representation of a connection between access points |
| Host(env, name, address) | Representation of an access point |
| Link(env, name, source, destination, delay, ...) | Representation of a physical link between access points or routers |
| Router(env, name, address[, update_time]) | Representation of a router |
Actor¶
- class cs143sim.actors.Actor(env, name=None)[source]¶
Representation of an actor
The superclass of all actors defining environment variables.
Parameters: - env – SimPy simulation Environment
- name (str) – name from input file
Variables: - env – SimPy simulation Environment
- name (str) – name from input file
Buffer¶
- class cs143sim.actors.Buffer(env, capacity, link)[source]¶
Representation of a data storage container
Buffers store data to be linked while Link is busy sending data.
Parameters: Variables:
Flow¶
Host¶
Link¶
- class cs143sim.actors.Link(env, name, source, destination, delay, rate, buffer_capacity)[source]¶
Representation of a physical link between access points or routers
Links carry packets from one end to the other.
Parameters: Variables: - source – source Host or Router
- destination – destination Host or Router
- delay (float) – amount of time required to transmit a Packet
- rate (float) – speed of removing data from source
- buffer (list) – Packets currently in transmission
- busy (bool) – whether currently removing data from source
- utilization (float) – fraction of capacity in use
Router¶
- class cs143sim.actors.Router(env, name, address, update_time=1000)[source]¶
Representation of a router
Routers route packets through the network to their destination Hosts.
Parameters: Variables: - generate_router_packet()[source]¶
Design RouterPacket(source,timestamp,routertable) that send the whole router table of this router to communicate with its neighbor
- initialize_routing_table(all_host_ip_addresses)[source]¶
the key of table is destination (IP_address of hosts) the first element in value of table is the distance between current router to final host the second element in value of table is where to go for next hop
If the host destination is not in neighbor links, then set the distance to be inf, the next_hop to be the default_gateway If the host destination is in its neighbor links, then set the distance to be 1( dynamic still inf?), the next_hop to be direct host destination
- react_to_packet_receipt(event)[source]¶
Read packet head to tell whether is a DataPacket or a RouterPacket
If it is normal packet, call map_route function If it is update_RT_communication packet, call update_router_table function
- react_to_routing_table_outdated(event)[source]¶
Periodically generate RouterPacket to all neighbor links.