Updates to documentation and inclusion of how-to guides
This commit is contained in:
@@ -42,7 +42,7 @@ Example code where a node is turned on:
|
||||
from primaite.simulator.network.hardware.base import Node
|
||||
from primaite.simulator.network.hardware.node_operating_state import NodeOperatingState
|
||||
|
||||
node = Node(hostname="pc_a")
|
||||
node = Node(config={"hostname":"pc_a"})
|
||||
|
||||
assert node.operating_state is NodeOperatingState.OFF # By default, node is instantiated in an OFF state
|
||||
|
||||
@@ -65,7 +65,7 @@ If the node needs to be instantiated in an on state:
|
||||
from primaite.simulator.network.hardware.base import Node
|
||||
from primaite.simulator.network.hardware.node_operating_state import NodeOperatingState
|
||||
|
||||
node = Node(hostname="pc_a", operating_state=NodeOperatingState.ON)
|
||||
node = Node(config={"hostname":"pc_a", "operating_state":NodeOperatingState.ON})
|
||||
|
||||
assert node.operating_state is NodeOperatingState.ON # node is in ON state
|
||||
|
||||
@@ -76,7 +76,7 @@ Setting ``start_up_duration`` and/or ``shut_down_duration`` to ``0`` will allow
|
||||
from primaite.simulator.network.hardware.base import Node
|
||||
from primaite.simulator.network.hardware.node_operating_state import NodeOperatingState
|
||||
|
||||
node = Node(hostname="pc_a", start_up_duration=0, shut_down_duration=0)
|
||||
node = Node(config={"hostname":"pc_a", "start_up_duration":0, "shut_down_duration":0})
|
||||
|
||||
assert node.operating_state is NodeOperatingState.OFF # node is in OFF state
|
||||
|
||||
@@ -196,21 +196,23 @@ Setting up a Client-Server Network
|
||||
def client_server_network() -> Tuple[Computer, Server, Network]:
|
||||
network = Network()
|
||||
|
||||
client = Computer(
|
||||
hostname="client",
|
||||
ip_address="192.168.1.2",
|
||||
subnet_mask="255.255.255.0",
|
||||
default_gateway="192.168.1.1",
|
||||
start_up_duration=0,
|
||||
client = Computer(config={
|
||||
"hostname":"client",
|
||||
"ip_address":"192.168.1.2",
|
||||
"subnet_mask":"255.255.255.0",
|
||||
"default_gateway":"192.168.1.1",
|
||||
"start_up_duration":0,
|
||||
}
|
||||
)
|
||||
client.power_on()
|
||||
|
||||
server = Server(
|
||||
hostname="server",
|
||||
ip_address="192.168.1.3",
|
||||
subnet_mask="255.255.255.0",
|
||||
default_gateway="192.168.1.1",
|
||||
start_up_duration=0,
|
||||
server = Server(config = {
|
||||
"hostname":"server",
|
||||
"ip_address":"192.168.1.3",
|
||||
"subnet_mask":"255.255.255.0",
|
||||
"default_gateway":"192.168.1.1",
|
||||
"start_up_duration":0,
|
||||
}
|
||||
)
|
||||
server.power_on()
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ we'll use the following Network that has a client, server, two switches, and a r
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
router_1 = Router(hostname="router_1", num_ports=3)
|
||||
router_1 = Router(config={"hostname":"router_1", "num_ports":3})
|
||||
router_1.power_on()
|
||||
router_1.configure_port(port=1, ip_address="192.168.1.1", subnet_mask="255.255.255.0")
|
||||
router_1.configure_port(port=2, ip_address="192.168.2.1", subnet_mask="255.255.255.0")
|
||||
@@ -57,9 +57,9 @@ we'll use the following Network that has a client, server, two switches, and a r
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
switch_1 = Switch(hostname="switch_1", num_ports=6)
|
||||
switch_1 = Switch(config={"hostname":"switch_1", "num_ports":6})
|
||||
switch_1.power_on()
|
||||
switch_2 = Switch(hostname="switch_2", num_ports=6)
|
||||
switch_2 = Switch(config={"hostname":"switch_2", "num_ports":6})
|
||||
switch_2.power_on()
|
||||
|
||||
5. Connect the Switches to the Router
|
||||
@@ -75,18 +75,20 @@ we'll use the following Network that has a client, server, two switches, and a r
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
client_1 = Computer(
|
||||
hostname="client_1",
|
||||
ip_address="192.168.2.2",
|
||||
subnet_mask="255.255.255.0",
|
||||
default_gateway="192.168.2.1"
|
||||
client_1 = Computer(config = {
|
||||
"hostname":"client_1",
|
||||
"ip_address":"192.168.2.2",
|
||||
"subnet_mask":"255.255.255.0",
|
||||
"default_gateway":"192.168.2.1",
|
||||
}
|
||||
)
|
||||
client_1.power_on()
|
||||
server_1 = Server(
|
||||
hostname="server_1",
|
||||
ip_address="192.168.1.2",
|
||||
subnet_mask="255.255.255.0",
|
||||
default_gateway="192.168.1.1"
|
||||
server_1 = Server(config= {
|
||||
"hostname":"server_1",
|
||||
"ip_address":"192.168.1.2",
|
||||
"subnet_mask":"255.255.255.0",
|
||||
"default_gateway":"192.168.1.1",
|
||||
}
|
||||
)
|
||||
server_1.power_on()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user