X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp-api%2Fpython%2Fvpp_papi%2Fmacaddress.py;h=c3b10a3c11eb5858120ff966de8aa7d2c9f4d78a;hb=6af62565e34f90fc0f9811c14753996a2d14ab16;hp=02c90dbce062a5615846c226328fe4456a84403a;hpb=44d06916b9654f393176e9fa85d0442184decbea;p=vpp.git diff --git a/src/vpp-api/python/vpp_papi/macaddress.py b/src/vpp-api/python/vpp_papi/macaddress.py index 02c90dbce06..c3b10a3c11e 100644 --- a/src/vpp-api/python/vpp_papi/macaddress.py +++ b/src/vpp-api/python/vpp_papi/macaddress.py @@ -54,8 +54,14 @@ class MACAddress(): return '%s(%s)' % (self.__class__.__name__, self.mac_string) def __eq__(self, other): + if not isinstance(other, MACAddress): - return NotImplemented + try: + # if it looks like a mac address, we'll take it. + # (allows for equality with scapy hw-addresses) + return self.mac_binary == MACAddress(other).mac_binary + except Exception: + return NotImplemented return self.mac_binary == other.mac_binary def __ne__(self, other):