Merge "Normalize MAC OctetString to fix InvalidMAC exception"

This commit is contained in:
Jenkins 2016-04-06 18:08:54 +00:00 committed by Gerrit Code Review
commit f0c524dab4
3 changed files with 8 additions and 4 deletions
ironic
drivers/modules/irmc
tests/unit/drivers/modules/irmc
releasenotes/notes

@ -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']]

@ -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:

@ -0,0 +1,3 @@
---
fixes:
- This fixes InvalidMAC exception of iRMC out-of-band inspection.