Bump hacking
hacking 3.2.x is quite old. Bump it to the version currently used by neutron. Change-Id: I69b4633b46a84d9dd7c6995a76379cf1072a304c
This commit is contained in:
parent
57e1270e16
commit
0309145258
@ -21,8 +21,9 @@ import numbers
|
||||
from os_ken.base import app_manager
|
||||
|
||||
from os_ken.controller import ofp_event
|
||||
from os_ken.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER,\
|
||||
DEAD_DISPATCHER
|
||||
from os_ken.controller.handler import CONFIG_DISPATCHER
|
||||
from os_ken.controller.handler import DEAD_DISPATCHER
|
||||
from os_ken.controller.handler import MAIN_DISPATCHER
|
||||
from os_ken.controller.handler import set_ev_cls
|
||||
|
||||
from . import event
|
||||
|
@ -29,8 +29,9 @@ from os_ken import utils
|
||||
from os_ken.controller import ofp_event
|
||||
from os_ken.controller.controller import OpenFlowController
|
||||
from os_ken.controller.handler import set_ev_handler
|
||||
from os_ken.controller.handler import HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER,\
|
||||
MAIN_DISPATCHER
|
||||
from os_ken.controller.handler import CONFIG_DISPATCHER
|
||||
from os_ken.controller.handler import HANDSHAKE_DISPATCHER
|
||||
from os_ken.controller.handler import MAIN_DISPATCHER
|
||||
from os_ken.ofproto import ofproto_parser
|
||||
|
||||
|
||||
|
@ -159,7 +159,7 @@ VRRP_V2_MAX_ADVER_INT_MAX = 0xff
|
||||
|
||||
|
||||
def is_ipv6(ip_address):
|
||||
assert type(ip_address) == str
|
||||
assert isinstance(ip_address, str)
|
||||
try:
|
||||
addrconv.ipv4.text_to_bin(ip_address)
|
||||
except:
|
||||
@ -595,11 +595,11 @@ class vrrpv3(vrrp):
|
||||
@staticmethod
|
||||
def serialize_static(vrrp_, prev):
|
||||
if isinstance(prev, ipv4.ipv4):
|
||||
assert type(vrrp_.ip_addresses[0]) == str
|
||||
assert isinstance(vrrp_.ip_addresses[0], str)
|
||||
conv = addrconv.ipv4.text_to_bin
|
||||
ip_address_pack_raw = vrrpv3._IPV4_ADDRESS_PACK_STR_RAW
|
||||
elif isinstance(prev, ipv6.ipv6):
|
||||
assert type(vrrp_.ip_addresses[0]) == str
|
||||
assert isinstance(vrrp_.ip_addresses[0], str)
|
||||
conv = addrconv.ipv6.text_to_bin
|
||||
ip_address_pack_raw = vrrpv3._IPV6_ADDRESS_PACK_STR_RAW
|
||||
else:
|
||||
|
@ -438,7 +438,7 @@ class Destination(object, metaclass=abc.ABCMeta):
|
||||
if (path.source == source and
|
||||
path.source_version_num < source_ver_num):
|
||||
# If this peer is source of any paths, remove those path.
|
||||
del(self._known_path_list[path_idx])
|
||||
del self._known_path_list[path_idx]
|
||||
removed_paths.append(path)
|
||||
return removed_paths
|
||||
|
||||
@ -485,7 +485,7 @@ class Destination(object, metaclass=abc.ABCMeta):
|
||||
# If we do not have any old but one new path
|
||||
# it becomes best path.
|
||||
self._known_path_list.append(self._new_path_list[0])
|
||||
del(self._new_path_list[0])
|
||||
del self._new_path_list[0]
|
||||
return self._known_path_list[0], BPR_ONLY_PATH
|
||||
|
||||
# If we have a new version of old/known path we use it and delete old
|
||||
@ -496,7 +496,7 @@ class Destination(object, metaclass=abc.ABCMeta):
|
||||
self._known_path_list.extend(self._new_path_list)
|
||||
|
||||
# Clear new paths as we copied them.
|
||||
del(self._new_path_list[:])
|
||||
del self._new_path_list[:]
|
||||
|
||||
# If we do not have any paths to this destination, then we do not have
|
||||
# new best path.
|
||||
@ -528,7 +528,7 @@ class Destination(object, metaclass=abc.ABCMeta):
|
||||
if not self._known_path_list:
|
||||
LOG.debug('Found %s withdrawals for path(s) that did not get'
|
||||
' installed.', len(self._withdraw_list))
|
||||
del(self._withdraw_list[:])
|
||||
del self._withdraw_list[:]
|
||||
return
|
||||
|
||||
# If we have some known paths and some withdrawals, we find matches and
|
||||
|
@ -51,7 +51,7 @@ class OutgoingRoute(object):
|
||||
'next_sink_out_route', 'prev_sink_out_route')
|
||||
|
||||
def __init__(self, path, for_route_refresh=False):
|
||||
assert(path)
|
||||
assert path
|
||||
|
||||
self.sink = None
|
||||
|
||||
|
@ -66,24 +66,24 @@ class CircularListType(object):
|
||||
self.list_type.node_init(self.head)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if(name == self.list_type.next_name):
|
||||
if name == self.list_type.next_name:
|
||||
return self._next_slot_
|
||||
|
||||
if(name == self.list_type.prev_name):
|
||||
if name == self.list_type.prev_name:
|
||||
return self._prev_slot_
|
||||
|
||||
raise AttributeError(name)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if(name in CircularListType.List.__slots__):
|
||||
if name in CircularListType.List.__slots__:
|
||||
object.__setattr__(self, name, value)
|
||||
return
|
||||
|
||||
if(name == self.list_type.next_name):
|
||||
if name == self.list_type.next_name:
|
||||
self._next_slot_ = value
|
||||
return
|
||||
|
||||
if(name == self.list_type.prev_name):
|
||||
if name == self.list_type.prev_name:
|
||||
self._prev_slot_ = value
|
||||
return
|
||||
|
||||
@ -124,7 +124,7 @@ class CircularListType(object):
|
||||
def pop_first(self):
|
||||
"""Remove the first item in the list and return it."""
|
||||
node = self.list_type.node_next(self.head)
|
||||
if(node is self.head):
|
||||
if node is self.head:
|
||||
return None
|
||||
|
||||
self.remove(node)
|
||||
@ -141,7 +141,7 @@ class CircularListType(object):
|
||||
# current node safely.
|
||||
node = self.list_type.node_next(self.head)
|
||||
next = self.list_type.node_next(node)
|
||||
while(node is not self.head):
|
||||
while node is not self.head:
|
||||
yield node
|
||||
|
||||
node = next
|
||||
|
@ -79,11 +79,11 @@ class TestOfproto_Parser(unittest.TestCase):
|
||||
self.bufFeaturesReply)
|
||||
LOG.debug(msg)
|
||||
|
||||
self.assertTrue(isinstance(msg, ofproto_v1_0_parser.OFPSwitchFeatures))
|
||||
self.assertIsInstance(msg, ofproto_v1_0_parser.OFPSwitchFeatures)
|
||||
LOG.debug(msg.ports[65534])
|
||||
self.assertTrue(isinstance(msg.ports[1], ofproto_v1_0_parser.OFPPhyPort))
|
||||
self.assertTrue(isinstance(msg.ports[2], ofproto_v1_0_parser.OFPPhyPort))
|
||||
self.assertTrue(isinstance(msg.ports[65534], ofproto_v1_0_parser.OFPPhyPort))
|
||||
self.assertIsInstance(msg.ports[1], ofproto_v1_0_parser.OFPPhyPort)
|
||||
self.assertIsInstance(msg.ports[2], ofproto_v1_0_parser.OFPPhyPort)
|
||||
self.assertIsInstance(msg.ports[65534], ofproto_v1_0_parser.OFPPhyPort)
|
||||
|
||||
def testPacketIn(self):
|
||||
(version,
|
||||
@ -98,7 +98,7 @@ class TestOfproto_Parser(unittest.TestCase):
|
||||
xid,
|
||||
self.bufPacketIn)
|
||||
LOG.debug(msg)
|
||||
self.assertTrue(isinstance(msg, ofproto_v1_0_parser.OFPPacketIn))
|
||||
self.assertIsInstance(msg, ofproto_v1_0_parser.OFPPacketIn)
|
||||
|
||||
def test_check_msg_len(self):
|
||||
(version,
|
||||
|
@ -259,13 +259,13 @@ class Test_Parser_OFPMatch(testscenarios.WithScenarios, unittest.TestCase):
|
||||
match.serialize(b, 0)
|
||||
match2 = match.parser(bytes(b), 0)
|
||||
for k, v in d.items():
|
||||
self.assertTrue(k in match)
|
||||
self.assertTrue(k in match2)
|
||||
self.assertIn(k, match)
|
||||
self.assertIn(k, match2)
|
||||
self.assertEqual(match[k], v)
|
||||
self.assertEqual(match2[k], v)
|
||||
for k, v in match.iteritems():
|
||||
self.assertTrue(k in d)
|
||||
self.assertIn(k, d)
|
||||
self.assertEqual(d[k], v)
|
||||
for k, v in match2.iteritems():
|
||||
self.assertTrue(k in d)
|
||||
self.assertIn(k, d)
|
||||
self.assertEqual(d[k], v)
|
||||
|
@ -176,13 +176,13 @@ class Test_Parser_OFPStats(testscenarios.WithScenarios, unittest.TestCase):
|
||||
stats.serialize(b, 0)
|
||||
stats2 = stats.parser(bytes(b), 0)
|
||||
for k, v in d.items():
|
||||
self.assertTrue(k in stats)
|
||||
self.assertTrue(k in stats2)
|
||||
self.assertIn(k, stats)
|
||||
self.assertIn(k, stats2)
|
||||
self.assertEqual(stats[k], v)
|
||||
self.assertEqual(stats2[k], v)
|
||||
for k, v in stats.iteritems():
|
||||
self.assertTrue(k in d)
|
||||
self.assertIn(k, d)
|
||||
self.assertEqual(d[k], v)
|
||||
for k, v in stats2.iteritems():
|
||||
self.assertTrue(k in d)
|
||||
self.assertIn(k, d)
|
||||
self.assertEqual(d[k], v)
|
||||
|
@ -94,23 +94,23 @@ class TestBFD(unittest.TestCase):
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertEqual(type(next(i)), ipv4.ipv4)
|
||||
self.assertEqual(type(next(i)), udp.udp)
|
||||
self.assertEqual(type(bfd.bfd.parser(next(i))[0]), bfd.bfd)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), ipv4.ipv4)
|
||||
self.assertIsInstance(next(i), udp.udp)
|
||||
self.assertIsInstance(bfd.bfd.parser(next(i))[0], bfd.bfd)
|
||||
|
||||
def test_parse_with_auth_simple(self):
|
||||
buf = self.data_auth_simple
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertEqual(type(next(i)), ipv4.ipv4)
|
||||
self.assertEqual(type(next(i)), udp.udp)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), ipv4.ipv4)
|
||||
self.assertIsInstance(next(i), udp.udp)
|
||||
|
||||
bfd_obj = bfd.bfd.parser(next(i))[0]
|
||||
self.assertEqual(type(bfd_obj), bfd.bfd)
|
||||
self.assertEqual(type(bfd_obj.auth_cls), bfd.SimplePassword)
|
||||
self.assertIsInstance(bfd_obj, bfd.bfd)
|
||||
self.assertIsInstance(bfd_obj.auth_cls, bfd.SimplePassword)
|
||||
self.assertTrue(bfd_obj.authenticate(self.auth_keys))
|
||||
|
||||
def test_parse_with_auth_md5(self):
|
||||
@ -118,13 +118,13 @@ class TestBFD(unittest.TestCase):
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertEqual(type(next(i)), ipv4.ipv4)
|
||||
self.assertEqual(type(next(i)), udp.udp)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), ipv4.ipv4)
|
||||
self.assertIsInstance(next(i), udp.udp)
|
||||
|
||||
bfd_obj = bfd.bfd.parser(next(i))[0]
|
||||
self.assertEqual(type(bfd_obj), bfd.bfd)
|
||||
self.assertEqual(type(bfd_obj.auth_cls), bfd.KeyedMD5)
|
||||
self.assertIsInstance(bfd_obj, bfd.bfd)
|
||||
self.assertIsInstance(bfd_obj.auth_cls, bfd.KeyedMD5)
|
||||
self.assertTrue(bfd_obj.authenticate(self.auth_keys))
|
||||
|
||||
def test_parse_with_auth_sha1(self):
|
||||
@ -132,13 +132,13 @@ class TestBFD(unittest.TestCase):
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertEqual(type(next(i)), ipv4.ipv4)
|
||||
self.assertEqual(type(next(i)), udp.udp)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), ipv4.ipv4)
|
||||
self.assertIsInstance(next(i), udp.udp)
|
||||
|
||||
bfd_obj = bfd.bfd.parser(next(i))[0]
|
||||
self.assertEqual(type(bfd_obj), bfd.bfd)
|
||||
self.assertEqual(type(bfd_obj.auth_cls), bfd.KeyedSHA1)
|
||||
self.assertIsInstance(bfd_obj, bfd.bfd)
|
||||
self.assertIsInstance(bfd_obj.auth_cls, bfd.KeyedSHA1)
|
||||
self.assertTrue(bfd_obj.authenticate(self.auth_keys))
|
||||
|
||||
def test_serialize(self):
|
||||
|
@ -130,11 +130,11 @@ class Test_dhcp_offer(unittest.TestCase):
|
||||
corrupt_buf = self.buf[:-4]
|
||||
pkt, _, rest = dhcp.dhcp.parser(corrupt_buf)
|
||||
|
||||
self.assertTrue(isinstance(pkt, dhcp.dhcp))
|
||||
self.assertTrue(isinstance(pkt.options, dhcp.options))
|
||||
self.assertIsInstance(pkt, dhcp.dhcp)
|
||||
self.assertIsInstance(pkt.options, dhcp.options)
|
||||
for opt in pkt.options.option_list[:-1]:
|
||||
self.assertTrue(isinstance(opt, dhcp.option))
|
||||
self.assertTrue(isinstance(pkt.options.option_list[-1], bytes))
|
||||
self.assertIsInstance(opt, dhcp.option)
|
||||
self.assertIsInstance(pkt.options.option_list[-1], bytes)
|
||||
|
||||
buf = pkt.serialize()
|
||||
self.assertEqual(str(buf), str(corrupt_buf))
|
||||
|
@ -70,8 +70,8 @@ class TestLLDPMandatoryTLV(unittest.TestCase):
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertEqual(type(next(i)), lldp.lldp)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), lldp.lldp)
|
||||
|
||||
def test_tlv(self):
|
||||
tlv = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS,
|
||||
@ -246,9 +246,9 @@ class TestLLDPOptionalTLV(unittest.TestCase):
|
||||
pkt = packet.Packet(buf)
|
||||
i = iter(pkt)
|
||||
|
||||
self.assertEqual(type(next(i)), ethernet.ethernet)
|
||||
self.assertIsInstance(next(i), ethernet.ethernet)
|
||||
lldp_pkt = next(i)
|
||||
self.assertEqual(type(lldp_pkt), lldp.lldp)
|
||||
self.assertIsInstance(lldp_pkt, lldp.lldp)
|
||||
|
||||
tlvs = lldp_pkt.tlvs
|
||||
|
||||
|
@ -368,7 +368,7 @@ class TestPacket(unittest.TestCase):
|
||||
self.assertEqual(packet_utils.checksum(t), 0)
|
||||
|
||||
# payload
|
||||
self.assertTrue('payload' in protocols)
|
||||
self.assertIn('payload', protocols)
|
||||
self.assertEqual(self.payload, protocols['payload'])
|
||||
|
||||
# to string
|
||||
@ -518,7 +518,7 @@ class TestPacket(unittest.TestCase):
|
||||
self.assertEqual(packet_utils.checksum(t), 0)
|
||||
|
||||
# payload
|
||||
self.assertTrue('payload' in protocols)
|
||||
self.assertIn('payload', protocols)
|
||||
self.assertEqual(self.payload, protocols['payload'])
|
||||
|
||||
# to string
|
||||
@ -939,7 +939,7 @@ class TestPacket(unittest.TestCase):
|
||||
self.assertEqual(packet_utils.checksum(t), 0x62)
|
||||
|
||||
# payload
|
||||
self.assertTrue('payload' in protocols)
|
||||
self.assertIn('payload', protocols)
|
||||
self.assertEqual(self.payload, protocols['payload'])
|
||||
|
||||
# to string
|
||||
@ -1071,7 +1071,7 @@ class TestPacket(unittest.TestCase):
|
||||
self.assertEqual(packet_utils.checksum(t), 0x62)
|
||||
|
||||
# payload
|
||||
self.assertTrue('payload' in protocols)
|
||||
self.assertIn('payload', protocols)
|
||||
self.assertEqual(self.payload, protocols['payload'])
|
||||
|
||||
# to string
|
||||
@ -1544,7 +1544,7 @@ class TestPacket(unittest.TestCase):
|
||||
i = ipv4.ipv4()
|
||||
u = udp.udp(self.src_port, self.dst_port)
|
||||
pkt = e / i / u
|
||||
self.assertTrue(isinstance(pkt, packet.Packet))
|
||||
self.assertTrue(isinstance(pkt.protocols[0], ethernet.ethernet))
|
||||
self.assertTrue(isinstance(pkt.protocols[1], ipv4.ipv4))
|
||||
self.assertTrue(isinstance(pkt.protocols[2], udp.udp))
|
||||
self.assertIsInstance(pkt, packet.Packet)
|
||||
self.assertIsInstance(pkt.protocols[0], ethernet.ethernet)
|
||||
self.assertIsInstance(pkt.protocols[1], ipv4.ipv4)
|
||||
self.assertIsInstance(pkt.protocols[2], udp.udp)
|
||||
|
@ -133,13 +133,13 @@ class Test_itag(unittest.TestCase):
|
||||
|
||||
e = p.get_protocols(ethernet.ethernet)
|
||||
self.assertTrue(e)
|
||||
self.assertTrue(isinstance(e, list))
|
||||
self.assertIsInstance(e, list)
|
||||
self.assertEqual(e[0].ethertype, ether.ETH_TYPE_8021AD)
|
||||
self.assertEqual(e[1].ethertype, ether.ETH_TYPE_8021AD)
|
||||
|
||||
sv = p.get_protocols(vlan.svlan)
|
||||
self.assertTrue(sv)
|
||||
self.assertTrue(isinstance(sv, list))
|
||||
self.assertIsInstance(sv, list)
|
||||
self.assertEqual(sv[0].ethertype, ether.ETH_TYPE_8021Q)
|
||||
self.assertEqual(sv[1].ethertype, ether.ETH_TYPE_8021Q)
|
||||
|
||||
|
@ -465,10 +465,10 @@ class LLDPPacket(object):
|
||||
pkt = packet.Packet(data)
|
||||
i = iter(pkt)
|
||||
eth_pkt = next(i)
|
||||
assert type(eth_pkt) == ethernet.ethernet
|
||||
assert isinstance(eth_pkt, ethernet.ethernet)
|
||||
|
||||
lldp_pkt = next(i)
|
||||
if type(lldp_pkt) != lldp.lldp:
|
||||
if not isinstance(lldp_pkt, lldp.lldp):
|
||||
raise LLDPPacket.LLDPUnknownFormat()
|
||||
|
||||
tlv_chassis_id = lldp_pkt.tlvs[0]
|
||||
|
@ -1,4 +1,4 @@
|
||||
hacking>=3.2.0,<3.3.0 # Apache-2.0
|
||||
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||
|
||||
coverage>=4.4.1 # Apache-2.0
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
|
Loading…
Reference in New Issue
Block a user