#1706 - Fixed the "smart" merging of SimComponent that PyCharm performed. Integrated the Filesystem class into the Node. Added prettytable to deps in pyproject.toml
This commit is contained in:
@@ -33,6 +33,7 @@ dependencies = [
|
|||||||
"platformdirs==3.5.1",
|
"platformdirs==3.5.1",
|
||||||
"plotly==5.15.0",
|
"plotly==5.15.0",
|
||||||
"polars==0.18.4",
|
"polars==0.18.4",
|
||||||
|
"prettytable==3.8.0",
|
||||||
"PyYAML==6.0",
|
"PyYAML==6.0",
|
||||||
"stable-baselines3==1.6.2",
|
"stable-baselines3==1.6.2",
|
||||||
"tensorflow==2.12.0",
|
"tensorflow==2.12.0",
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ from pydantic import BaseModel, ConfigDict
|
|||||||
class SimComponent(BaseModel):
|
class SimComponent(BaseModel):
|
||||||
"""Extension of pydantic BaseModel with additional methods that must be defined by all classes in the simulator."""
|
"""Extension of pydantic BaseModel with additional methods that must be defined by all classes in the simulator."""
|
||||||
|
|
||||||
uuid: str
|
|
||||||
"""The component UUID."""
|
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
if not kwargs.get("uuid"):
|
if not kwargs.get("uuid"):
|
||||||
kwargs["uuid"] = str(uuid4())
|
kwargs["uuid"] = str(uuid4())
|
||||||
@@ -21,11 +18,6 @@ class SimComponent(BaseModel):
|
|||||||
uuid: str
|
uuid: str
|
||||||
"The component UUID."
|
"The component UUID."
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
if not kwargs.get("uuid"):
|
|
||||||
kwargs["uuid"] = str(uuid4())
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def describe_state(self) -> Dict:
|
def describe_state(self) -> Dict:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import re
|
|||||||
import secrets
|
import secrets
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from ipaddress import IPv4Address, IPv4Network
|
from ipaddress import IPv4Address, IPv4Network
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from prettytable import PrettyTable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
from primaite import getLogger
|
from primaite import getLogger
|
||||||
from primaite.exceptions import NetworkError
|
from primaite.exceptions import NetworkError
|
||||||
from primaite.simulator.core import SimComponent
|
from primaite.simulator.core import SimComponent
|
||||||
|
from primaite.simulator.file_system.file_system import FileSystem
|
||||||
from primaite.simulator.network.protocols.arp import ARPEntry, ARPPacket
|
from primaite.simulator.network.protocols.arp import ARPEntry, ARPPacket
|
||||||
from primaite.simulator.network.transmission.data_link_layer import EthernetHeader, Frame
|
from primaite.simulator.network.transmission.data_link_layer import EthernetHeader, Frame
|
||||||
from primaite.simulator.network.transmission.network_layer import ICMPPacket, ICMPType, IPPacket, IPProtocol
|
from primaite.simulator.network.transmission.network_layer import ICMPPacket, ICMPType, IPPacket, IPProtocol
|
||||||
@@ -784,7 +785,7 @@ class Node(SimComponent):
|
|||||||
"All services on the node."
|
"All services on the node."
|
||||||
processes: Dict = {}
|
processes: Dict = {}
|
||||||
"All processes on the node."
|
"All processes on the node."
|
||||||
file_system: Any = None
|
file_system: FileSystem
|
||||||
"The nodes file system."
|
"The nodes file system."
|
||||||
sys_log: SysLog
|
sys_log: SysLog
|
||||||
arp: ARPCache
|
arp: ARPCache
|
||||||
@@ -814,6 +815,8 @@ class Node(SimComponent):
|
|||||||
kwargs["software_manager"] = SoftwareManager(
|
kwargs["software_manager"] = SoftwareManager(
|
||||||
sys_log=kwargs.get("sys_log"), session_manager=kwargs.get("session_manager")
|
sys_log=kwargs.get("sys_log"), session_manager=kwargs.get("session_manager")
|
||||||
)
|
)
|
||||||
|
if not kwargs.get("file_system"):
|
||||||
|
kwargs["file_system"] = FileSystem()
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.arp.nics = self.nics
|
self.arp.nics = self.nics
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user