diff --git a/src/usr/lib/python3/dist-packages/ztp/ZTPObjects.py b/src/usr/lib/python3/dist-packages/ztp/ZTPObjects.py index 5b2b7e9..c40a969 100644 --- a/src/usr/lib/python3/dist-packages/ztp/ZTPObjects.py +++ b/src/usr/lib/python3/dist-packages/ztp/ZTPObjects.py @@ -51,6 +51,8 @@ def getIdentifier(self): return sysEeprom.get_serial_number() elif identifier_data == "product-name": return sysEeprom.get_product_name() + elif identifier_data == "mac": + return sysEeprom.get_mac_addr() elif identifier_data == "sonic-version": return get_sonic_version() else: diff --git a/tests/test_Identifier.py b/tests/test_Identifier.py index 474abd4..6dd72f8 100644 --- a/tests/test_Identifier.py +++ b/tests/test_Identifier.py @@ -95,6 +95,15 @@ def test_product_name(self): v = id.getIdentifier() assert(v == sysEeprom.get_product_name()) + def test_mac(self): + '''! + Test when we call the constructor function using the MAC + ''' + + id = Identifier('mac') + v = id.getIdentifier() + assert(v == sysEeprom.get_mac_addr()) + def test_other(self): '''! Test when we call the constructor function using the product name