Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for optional ethernet mac address in hardware config #74

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ova-compose/ova-compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,17 +483,18 @@ class RasdEthernet(RasdItem):
connectable = True


def __init__(self, network_id, subtype, connected=True):
def __init__(self, network_id, subtype, connected=True, address=None):
super().__init__()
self.config = RasdEthernet.DEFAULT_CONFIG.copy()
self.network_id = network_id
self.subtype = subtype
self.connected = connected
self.address = address


@classmethod
def from_dict(cls, d):
item = cls(d['network'], d['subtype'], d.get('connected', True))
item = cls(d['network'], d['subtype'], d.get('connected', True), d.get('address', None))
return item


Expand All @@ -505,6 +506,8 @@ def xml_item(self, required, element_name):
item = super().xml_item(required, element_name)
item.append(self.xml_element('ResourceSubType', self.subtype))
item.append(self.xml_element('Connection', self.network.name))
if self.address:
item.append(self.xml_element('Address', self.address))

return item

Expand Down