#1816 - Added the final pieces of the puzzle to get data up from NIC → session manager → software manager → service.
- Implemented a basic sim DB that matches UC2 data manipulation DB in IY. - Added a test that confirms DB queries can be sent over the network.
This commit is contained in:
@@ -29,7 +29,7 @@ def file_system() -> FileSystem:
|
||||
return Node(hostname="fs_node").file_system
|
||||
|
||||
|
||||
#PrimAITE v2 stuff
|
||||
# PrimAITE v2 stuff
|
||||
class TempPrimaiteSession(PrimaiteSession):
|
||||
"""
|
||||
A temporary PrimaiteSession class.
|
||||
|
||||
@@ -2,9 +2,9 @@ from ipaddress import IPv4Address
|
||||
|
||||
from primaite.simulator.network.hardware.nodes.computer import Computer
|
||||
from primaite.simulator.network.networks import arcd_uc2_network
|
||||
from primaite.simulator.network.transmission.data_link_layer import Frame, EthernetHeader
|
||||
from primaite.simulator.network.transmission.data_link_layer import EthernetHeader, Frame
|
||||
from primaite.simulator.network.transmission.network_layer import IPPacket, Precedence
|
||||
from primaite.simulator.network.transmission.transport_layer import TCPHeader, Port
|
||||
from primaite.simulator.network.transmission.transport_layer import Port, TCPHeader
|
||||
|
||||
|
||||
def test_database_query_across_the_network():
|
||||
@@ -20,22 +20,15 @@ def test_database_query_across_the_network():
|
||||
outbound_nic = client_1.arp.get_arp_cache_nic(IPv4Address("192.168.1.14"))
|
||||
client_1.ping("192.168.1.14")
|
||||
|
||||
|
||||
frame = Frame(
|
||||
ethernet=EthernetHeader(
|
||||
src_mac_addr=client_1.ethernet_port[1].mac_address,
|
||||
dst_mac_addr=dst_mac_address
|
||||
),
|
||||
ethernet=EthernetHeader(src_mac_addr=client_1.ethernet_port[1].mac_address, dst_mac_addr=dst_mac_address),
|
||||
ip=IPPacket(
|
||||
src_ip_address=client_1.ethernet_port[1].ip_address,
|
||||
dst_ip_address=IPv4Address("192.168.1.14"),
|
||||
precedence=Precedence.FLASH
|
||||
precedence=Precedence.FLASH,
|
||||
),
|
||||
tcp=TCPHeader(
|
||||
src_port=Port.POSTGRES_SERVER,
|
||||
dst_port=Port.POSTGRES_SERVER
|
||||
),
|
||||
payload="SELECT * FROM user;"
|
||||
tcp=TCPHeader(src_port=Port.POSTGRES_SERVER, dst_port=Port.POSTGRES_SERVER),
|
||||
payload="SELECT * FROM user;",
|
||||
)
|
||||
|
||||
outbound_nic.send_frame(frame)
|
||||
@@ -43,4 +36,4 @@ def test_database_query_across_the_network():
|
||||
client_1_last_payload = outbound_nic.pcap.read()[-1]["payload"]
|
||||
|
||||
assert client_1_last_payload["status_code"] == 200
|
||||
assert client_1_last_payload["data"]
|
||||
assert client_1_last_payload["data"]
|
||||
|
||||
@@ -29,4 +29,4 @@ def test_creation():
|
||||
assert False, f"Test was not supposed to throw exception: {e}"
|
||||
|
||||
# there should be a session after the service is started
|
||||
assert len(client_1.session_manager.sessions_by_uuid) == 1
|
||||
assert len(client_1.session_manager.sessions_by_uuid) == 1
|
||||
|
||||
@@ -56,4 +56,4 @@ def test_creation(database_server):
|
||||
|
||||
def test_db_population(database):
|
||||
database.show()
|
||||
assert database.tables() == ["user"]
|
||||
assert database.tables() == ["user"]
|
||||
|
||||
Reference in New Issue
Block a user