Skip to content

Commit

Permalink
SIMPLE-6827 - removed MAC address block support (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
virlos authored Aug 20, 2024
1 parent 117e363 commit a053525
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def respx_mock_with_labs(respx_mock):
some runtime data, like node states and simulation_statistics.
"""
respx_mock.get(FAKE_HOST_API + "system_information").respond(
json={"version": CURRENT_VERSION, "ready": True},
json={"version": CURRENT_VERSION, "ready": True, "oui": "52:54:00:00:00:00"},
)
respx_mock.post(FAKE_HOST_API + "authenticate").respond(json="BOGUS_TOKEN")
respx_mock.get(FAKE_HOST_API + "authok")
Expand Down
4 changes: 0 additions & 4 deletions virl2_client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ class PyatsDeviceNotFound(PyatsException):
pass


class InvalidMacAddressBlock(VirlException):
message = "MAC address block has to be in range 0-7"


class ControllerNotFound(VirlException):
message = "Controller not found"

Expand Down
29 changes: 1 addition & 28 deletions virl2_client/models/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import time
from typing import TYPE_CHECKING, Any

from virl2_client.exceptions import ControllerNotFound, InvalidMacAddressBlock
from virl2_client.exceptions import ControllerNotFound

from ..utils import _deprecated_argument, get_url_from_template

Expand All @@ -42,7 +42,6 @@ class SystemManagement:
"external_connectors": "system/external_connectors",
"external_connector": "system/external_connectors/{connector_id}",
"web_session_timeout": "web_session_timeout/{timeout}",
"mac_address_block": "mac_address_block/{block}",
"host_configuration": "system/compute_hosts/configuration",
}

Expand Down Expand Up @@ -267,32 +266,6 @@ def set_web_session_timeout(self, timeout: int) -> str:
url = self._url_for("web_session_timeout", timeout=timeout)
return self._session.patch(url).json()

def get_mac_address_block(self) -> int:
"""
Get the MAC address block.
:returns: The MAC address block.
"""
url = self._url_for("mac_address_block", block="")
return self._session.get(url).json()

def set_mac_address_block(self, block: int) -> str:
"""
Set the MAC address block.
:param block: The MAC address block.
:returns: 'OK'
:raises InvalidMacAddressBlock: If the MAC address block is not in 0-7 range.
"""
if block < 0 or block > 7:
raise InvalidMacAddressBlock
return self._set_mac_address_block(block=block)

def _set_mac_address_block(self, block: int) -> str:
"""Helper method to set the MAC address block."""
url = self._url_for("mac_address_block", block=block)
return self._session.patch(url).json()

def get_new_compute_host_state(self) -> str:
"""
Get the admission state of the new compute host.
Expand Down

0 comments on commit a053525

Please sign in to comment.