2018-09-05 15:42:26 -07:00
|
|
|
"""
|
|
|
|
MAC Types
|
|
|
|
|
|
|
|
"""
|
2018-12-06 17:35:12 +01:00
|
|
|
import binascii
|
2018-09-05 15:42:26 -07:00
|
|
|
|
2018-12-06 17:35:12 +01:00
|
|
|
|
|
|
|
def mactobinary(mac):
|
|
|
|
""" Convert the : separated format into binary packet data for the API """
|
|
|
|
return binascii.unhexlify(mac.replace(':', ''))
|
|
|
|
|
|
|
|
|
|
|
|
def binarytomac(binary):
|
|
|
|
""" Convert binary packed data in a : separated string """
|
|
|
|
x = b':'.join(binascii.hexlify(binary)[i:i + 2]
|
|
|
|
for i in range(0, 12, 2))
|
|
|
|
return str(x.decode('ascii'))
|
2018-09-05 15:42:26 -07:00
|
|
|
|
|
|
|
|
|
|
|
class VppMacAddress():
|
|
|
|
def __init__(self, addr):
|
Fix L2BD arp termination Test Case
This patch is a followup to: https://gerrit.fd.io/r/#/c/16307/ which is
currently causing ubuntu1804 to complain.
See: https://logs.fd.io/production/vex-yul-rot-jenkins-1/vpp-beta-verify-master-ubuntu1804/3837/console-timestamp.log.gz
s/RuntimeError/ for details.
==============================================================================
L2BD arp termination Test Case
==============================================================================
12:02:21,850 Couldn't stat : /tmp/vpp-unittest-TestL2bdArpTerm-_h44qo/stats.sock
L2BD arp term - add 5 hosts, verify arp responses OK
L2BD arp term - delete 3 hosts, verify arp responses OK
L2BD arp term - recreate BD1, readd 3 hosts, verify arp responses OK
L2BD arp term - 2 IP4 addrs per host OK
L2BD arp term - create and update 10 IP4-mac pairs OK
L2BD arp/ND term - hosts with both ip4/ip6 OK
L2BD ND term - Add and Del hosts, verify ND replies OK
L2BD ND term - Add and update IP+mac, verify ND replies OK
L2BD arp term - send garps, verify arp event reports OK
L2BD arp term - send duplicate garps, verify suppression OK
L2BD arp term - disable ip4 arp events,send garps, verify no events OK
L2BD ND term - send NS packets verify reports OK
L2BD ND term - send duplicate ns, verify suppression OK
L2BD ND term - disable ip4 arp events,send ns, verify no events OK
==============================================================================
TEST RESULTS:
Scheduled tests: 14
Executed tests: 14
Passed tests: 14
==============================================================================
Test run was successful
Change-Id: If66f22412f8aa36b183131cd22af4b3e7a20da46
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-30 12:03:04 -08:00
|
|
|
self._address = addr
|
2018-09-05 15:42:26 -07:00
|
|
|
|
|
|
|
def encode(self):
|
|
|
|
return {
|
|
|
|
'bytes': self.bytes
|
|
|
|
}
|
|
|
|
|
|
|
|
@property
|
|
|
|
def bytes(self):
|
|
|
|
return mactobinary(self.address)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def address(self):
|
Fix L2BD arp termination Test Case
This patch is a followup to: https://gerrit.fd.io/r/#/c/16307/ which is
currently causing ubuntu1804 to complain.
See: https://logs.fd.io/production/vex-yul-rot-jenkins-1/vpp-beta-verify-master-ubuntu1804/3837/console-timestamp.log.gz
s/RuntimeError/ for details.
==============================================================================
L2BD arp termination Test Case
==============================================================================
12:02:21,850 Couldn't stat : /tmp/vpp-unittest-TestL2bdArpTerm-_h44qo/stats.sock
L2BD arp term - add 5 hosts, verify arp responses OK
L2BD arp term - delete 3 hosts, verify arp responses OK
L2BD arp term - recreate BD1, readd 3 hosts, verify arp responses OK
L2BD arp term - 2 IP4 addrs per host OK
L2BD arp term - create and update 10 IP4-mac pairs OK
L2BD arp/ND term - hosts with both ip4/ip6 OK
L2BD ND term - Add and Del hosts, verify ND replies OK
L2BD ND term - Add and update IP+mac, verify ND replies OK
L2BD arp term - send garps, verify arp event reports OK
L2BD arp term - send duplicate garps, verify suppression OK
L2BD arp term - disable ip4 arp events,send garps, verify no events OK
L2BD ND term - send NS packets verify reports OK
L2BD ND term - send duplicate ns, verify suppression OK
L2BD ND term - disable ip4 arp events,send ns, verify no events OK
==============================================================================
TEST RESULTS:
Scheduled tests: 14
Executed tests: 14
Passed tests: 14
==============================================================================
Test run was successful
Change-Id: If66f22412f8aa36b183131cd22af4b3e7a20da46
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-30 12:03:04 -08:00
|
|
|
return self._address
|
2018-10-10 07:22:51 -07:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.address
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
if isinstance(other, self.__class__):
|
Fix L2BD arp termination Test Case
==============================================================================
L2BD arp termination Test Case
==============================================================================
12:02:21,850 Couldn't stat : /tmp/vpp-unittest-TestL2bdArpTerm-_h44qo/stats.sock
L2BD arp term - add 5 hosts, verify arp responses OK
L2BD arp term - delete 3 hosts, verify arp responses OK
L2BD arp term - recreate BD1, readd 3 hosts, verify arp responses OK
L2BD arp term - 2 IP4 addrs per host OK
L2BD arp term - create and update 10 IP4-mac pairs OK
L2BD arp/ND term - hosts with both ip4/ip6 OK
L2BD ND term - Add and Del hosts, verify ND replies OK
L2BD ND term - Add and update IP+mac, verify ND replies OK
L2BD arp term - send garps, verify arp event reports OK
L2BD arp term - send duplicate garps, verify suppression OK
L2BD arp term - disable ip4 arp events,send garps, verify no events OK
L2BD ND term - send NS packets verify reports OK
L2BD ND term - send duplicate ns, verify suppression OK
L2BD ND term - disable ip4 arp events,send ns, verify no events OK
==============================================================================
TEST RESULTS:
Scheduled tests: 14
Executed tests: 14
Passed tests: 14
==============================================================================
Test run was successful
Change-Id: I6bb1ced11b88080ffaa845d22b0bc471c4f91683
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-30 12:03:04 -08:00
|
|
|
return self.address == other.address
|
2018-10-10 07:22:51 -07:00
|
|
|
elif hasattr(other, "bytes"):
|
|
|
|
# vl_api_mac_addres_t
|
|
|
|
return self.bytes == other.bytes
|
|
|
|
else:
|
Fix L2BD arp termination Test Case
==============================================================================
L2BD arp termination Test Case
==============================================================================
12:02:21,850 Couldn't stat : /tmp/vpp-unittest-TestL2bdArpTerm-_h44qo/stats.sock
L2BD arp term - add 5 hosts, verify arp responses OK
L2BD arp term - delete 3 hosts, verify arp responses OK
L2BD arp term - recreate BD1, readd 3 hosts, verify arp responses OK
L2BD arp term - 2 IP4 addrs per host OK
L2BD arp term - create and update 10 IP4-mac pairs OK
L2BD arp/ND term - hosts with both ip4/ip6 OK
L2BD ND term - Add and Del hosts, verify ND replies OK
L2BD ND term - Add and update IP+mac, verify ND replies OK
L2BD arp term - send garps, verify arp event reports OK
L2BD arp term - send duplicate garps, verify suppression OK
L2BD arp term - disable ip4 arp events,send garps, verify no events OK
L2BD ND term - send NS packets verify reports OK
L2BD ND term - send duplicate ns, verify suppression OK
L2BD ND term - disable ip4 arp events,send ns, verify no events OK
==============================================================================
TEST RESULTS:
Scheduled tests: 14
Executed tests: 14
Passed tests: 14
==============================================================================
Test run was successful
Change-Id: I6bb1ced11b88080ffaa845d22b0bc471c4f91683
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-30 12:03:04 -08:00
|
|
|
raise TypeError("Comparing VppMacAddress:%s"
|
2018-10-10 07:22:51 -07:00
|
|
|
"with unknown type: %s" %
|
|
|
|
(self, other))
|
|
|
|
return False
|