diff --git a/monkey/monkey_island/cc/models/machine.py b/monkey/monkey_island/cc/models/machine.py index 25c830a24..1624ff522 100644 --- a/monkey/monkey_island/cc/models/machine.py +++ b/monkey/monkey_island/cc/models/machine.py @@ -13,7 +13,7 @@ MachineID = PositiveInt class Machine(MutableBaseModel): id: MachineID = Field(..., allow_mutation=False) - node_id: Optional[PositiveInt] + hardware_id: Optional[PositiveInt] network_interfaces: Sequence[IPv4Interface] operating_system: OperatingSystems operating_system_version: str diff --git a/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py b/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py index 2945d7744..a6d152dc0 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py +++ b/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py @@ -11,7 +11,7 @@ from monkey_island.cc.models import Machine MACHINE_OBJECT_DICT = MappingProxyType( { "id": 1, - "node_id": uuid.getnode(), + "hardware_id": uuid.getnode(), "network_interfaces": [IPv4Interface("10.0.0.1/24"), IPv4Interface("192.168.5.32/16")], "operating_system": OperatingSystems.WINDOWS, "operating_system_version": "eXtra Problems", @@ -22,7 +22,7 @@ MACHINE_OBJECT_DICT = MappingProxyType( MACHINE_SIMPLE_DICT = MappingProxyType( { "id": 1, - "node_id": uuid.getnode(), + "hardware_id": uuid.getnode(), "network_interfaces": ["10.0.0.1/24", "192.168.5.32/16"], "operating_system": "windows", "operating_system_version": "eXtra Problems", @@ -51,7 +51,7 @@ def test_to_dict(): "key, value", [ ("id", "not-an-int"), - ("node_id", "not-an-int"), + ("hardware_id", "not-an-int"), ("network_interfaces", "not-a-list"), ("operating_system", 2.1), ("operating_system", "bsd"), @@ -71,7 +71,7 @@ def test_construct_invalid_field__type_error(key, value): "key, value", [ ("id", -1), - ("node_id", 0), + ("hardware_id", 0), ("network_interfaces", [1, "stuff", 3]), ("network_interfaces", ["10.0.0.1/16", 2, []]), ], @@ -98,18 +98,18 @@ def test_id_immutable(): m.id = 2 -@pytest.mark.parametrize("node_id", [None, 1, 100]) -def test_node_id_set_valid_value(node_id): +@pytest.mark.parametrize("hardware_id", [None, 1, 100]) +def test_hardware_id_set_valid_value(hardware_id): m = Machine(**MACHINE_OBJECT_DICT) # Raises exception_on_failure - m.node_id = node_id + m.hardware_id = hardware_id -def test_node_id_validate_on_set(): +def test_hardware_id_validate_on_set(): m = Machine(**MACHINE_OBJECT_DICT) with pytest.raises(ValueError): - m.node_id = -50 + m.hardware_id = -50 def test_network_interfaces_set_valid_value():