diff --git a/ironic/drivers/modules/irmc/inspect.py b/ironic/drivers/modules/irmc/inspect.py index 8eece97b85..cc192fd97e 100644 --- a/ironic/drivers/modules/irmc/inspect.py +++ b/ironic/drivers/modules/irmc/inspect.py @@ -99,7 +99,8 @@ def _get_mac_addresses(node): d_info['irmc_snmp_security']) node_classes = snmp_client.get_next(NODE_CLASS_OID) - mac_addresses = snmp_client.get_next(MAC_ADDRESS_OID) + mac_addresses = [':'.join(['%02x' % ord(x) for x in mac]) + for mac in snmp_client.get_next(MAC_ADDRESS_OID)] return [a for c, a in zip(node_classes, mac_addresses) if c == NODE_CLASS_OID_VALUE['primary']] diff --git a/ironic/tests/unit/drivers/modules/irmc/test_inspect.py b/ironic/tests/unit/drivers/modules/irmc/test_inspect.py index cf89b89e19..c74f51edb5 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_inspect.py @@ -49,9 +49,9 @@ class IRMCInspectInternalMethodsTestCase(db_base.DbTestCase): def test__get_mac_addresses(self, snmpclient_mock): snmpclient_mock.return_value = mock.Mock( **{'get_next.side_effect': [[2, 2, 7], - ['aa:aa:aa:aa:aa:aa', - 'bb:bb:bb:bb:bb:bb', - 'cc:cc:cc:cc:cc:cc']]}) + ['\xaa\xaa\xaa\xaa\xaa\xaa', + '\xbb\xbb\xbb\xbb\xbb\xbb', + '\xcc\xcc\xcc\xcc\xcc\xcc']]}) inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] with task_manager.acquire(self.context, self.node.uuid, shared=True) as task: diff --git a/releasenotes/notes/fix-mac-address-48060f9e2847a38c.yaml b/releasenotes/notes/fix-mac-address-48060f9e2847a38c.yaml new file mode 100644 index 0000000000..4484598678 --- /dev/null +++ b/releasenotes/notes/fix-mac-address-48060f9e2847a38c.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - This fixes InvalidMAC exception of iRMC out-of-band inspection.