Get rid of py26 references: OrderedDict, httplib, xml testing
Change-Id: I44315e0663a7c0c82110b933b68e2b747f548859
This commit is contained in:
parent
208ebafb1d
commit
c5310e05ae
@ -637,13 +637,8 @@ class HTTPSConnectionWithValidation(httplib.HTTPSConnection):
|
|||||||
combined_cert = None
|
combined_cert = None
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
try:
|
sock = socket.create_connection((self.host, self.port),
|
||||||
sock = socket.create_connection((self.host, self.port),
|
self.timeout, self.source_address)
|
||||||
self.timeout, self.source_address)
|
|
||||||
except AttributeError:
|
|
||||||
# python 2.6 doesn't have the source_address attribute
|
|
||||||
sock = socket.create_connection((self.host, self.port),
|
|
||||||
self.timeout)
|
|
||||||
if self._tunnel_host:
|
if self._tunnel_host:
|
||||||
self.sock = sock
|
self.sock = sock
|
||||||
self._tunnel()
|
self._tunnel()
|
||||||
|
@ -25,7 +25,6 @@ errors due to duplicate configuration definitions.
|
|||||||
|
|
||||||
import logging as std_logging
|
import logging as std_logging
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
@ -97,10 +96,6 @@ class BaseTestCase(sub_base.SubBaseTestCase):
|
|||||||
fake_use_fatal_exceptions))
|
fake_use_fatal_exceptions))
|
||||||
|
|
||||||
self.setup_rpc_mocks()
|
self.setup_rpc_mocks()
|
||||||
|
|
||||||
if sys.version_info < (2, 7) and getattr(self, 'fmt', '') == 'xml':
|
|
||||||
raise self.skipException('XML Testing Skipped in Py26')
|
|
||||||
|
|
||||||
self.setup_config()
|
self.setup_config()
|
||||||
|
|
||||||
def setup_rpc_mocks(self):
|
def setup_rpc_mocks(self):
|
||||||
|
@ -26,11 +26,6 @@ from neutron.plugins.common import constants
|
|||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from neutron.tests import tools
|
from neutron.tests import tools
|
||||||
|
|
||||||
try:
|
|
||||||
OrderedDict = collections.OrderedDict
|
|
||||||
except AttributeError:
|
|
||||||
import ordereddict
|
|
||||||
OrderedDict = ordereddict.OrderedDict
|
|
||||||
|
|
||||||
OVS_LINUX_KERN_VERS_WITHOUT_VXLAN = "3.12.0"
|
OVS_LINUX_KERN_VERS_WITHOUT_VXLAN = "3.12.0"
|
||||||
|
|
||||||
@ -244,26 +239,30 @@ class OVS_Lib_Test(base.BaseTestCase):
|
|||||||
lsw_id = 18
|
lsw_id = 18
|
||||||
cidr = '192.168.1.0/24'
|
cidr = '192.168.1.0/24'
|
||||||
|
|
||||||
flow_dict_1 = OrderedDict([('priority', 2),
|
flow_dict_1 = collections.OrderedDict([
|
||||||
('dl_src', 'ca:fe:de:ad:be:ef'),
|
('priority', 2),
|
||||||
('actions', 'strip_vlan,output:0')])
|
('dl_src', 'ca:fe:de:ad:be:ef'),
|
||||||
flow_dict_2 = OrderedDict([('priority', 1),
|
('actions', 'strip_vlan,output:0')])
|
||||||
('actions', 'normal')])
|
flow_dict_2 = collections.OrderedDict([
|
||||||
flow_dict_3 = OrderedDict([('priority', 2),
|
('priority', 1),
|
||||||
('actions', 'drop')])
|
('actions', 'normal')])
|
||||||
flow_dict_4 = OrderedDict([('priority', 2),
|
flow_dict_3 = collections.OrderedDict([
|
||||||
('in_port', ofport),
|
('priority', 2),
|
||||||
('actions', 'drop')])
|
('actions', 'drop')])
|
||||||
flow_dict_5 = OrderedDict([
|
flow_dict_4 = collections.OrderedDict([
|
||||||
|
('priority', 2),
|
||||||
|
('in_port', ofport),
|
||||||
|
('actions', 'drop')])
|
||||||
|
flow_dict_5 = collections.OrderedDict([
|
||||||
('priority', 4),
|
('priority', 4),
|
||||||
('in_port', ofport),
|
('in_port', ofport),
|
||||||
('dl_vlan', vid),
|
('dl_vlan', vid),
|
||||||
('actions', "strip_vlan,set_tunnel:%s,normal" % (lsw_id))])
|
('actions', "strip_vlan,set_tunnel:%s,normal" % (lsw_id))])
|
||||||
flow_dict_6 = OrderedDict([
|
flow_dict_6 = collections.OrderedDict([
|
||||||
('priority', 3),
|
('priority', 3),
|
||||||
('tun_id', lsw_id),
|
('tun_id', lsw_id),
|
||||||
('actions', "mod_vlan_vid:%s,output:%s" % (vid, ofport))])
|
('actions', "mod_vlan_vid:%s,output:%s" % (vid, ofport))])
|
||||||
flow_dict_7 = OrderedDict([
|
flow_dict_7 = collections.OrderedDict([
|
||||||
('priority', 4),
|
('priority', 4),
|
||||||
('nw_src', cidr),
|
('nw_src', cidr),
|
||||||
('proto', 'arp'),
|
('proto', 'arp'),
|
||||||
@ -320,10 +319,11 @@ class OVS_Lib_Test(base.BaseTestCase):
|
|||||||
self.execute.assert_has_calls(expected_calls)
|
self.execute.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
def test_add_flow_timeout_set(self):
|
def test_add_flow_timeout_set(self):
|
||||||
flow_dict = OrderedDict([('priority', 1),
|
flow_dict = collections.OrderedDict([
|
||||||
('hard_timeout', 1000),
|
('priority', 1),
|
||||||
('idle_timeout', 2000),
|
('hard_timeout', 1000),
|
||||||
('actions', 'normal')])
|
('idle_timeout', 2000),
|
||||||
|
('actions', 'normal')])
|
||||||
|
|
||||||
self.br.add_flow(**flow_dict)
|
self.br.add_flow(**flow_dict)
|
||||||
self.execute.assert_called_once_with(
|
self.execute.assert_called_once_with(
|
||||||
@ -333,7 +333,7 @@ class OVS_Lib_Test(base.BaseTestCase):
|
|||||||
root_helper=self.root_helper)
|
root_helper=self.root_helper)
|
||||||
|
|
||||||
def test_add_flow_default_priority(self):
|
def test_add_flow_default_priority(self):
|
||||||
flow_dict = OrderedDict([('actions', 'normal')])
|
flow_dict = collections.OrderedDict([('actions', 'normal')])
|
||||||
|
|
||||||
self.br.add_flow(**flow_dict)
|
self.br.add_flow(**flow_dict)
|
||||||
self.execute.assert_called_once_with(
|
self.execute.assert_called_once_with(
|
||||||
|
@ -512,9 +512,6 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
|||||||
con = self.sm.HTTPSConnectionWithValidation(
|
con = self.sm.HTTPSConnectionWithValidation(
|
||||||
'www.example.org', 443, timeout=90)
|
'www.example.org', 443, timeout=90)
|
||||||
con.source_address = '127.0.0.1'
|
con.source_address = '127.0.0.1'
|
||||||
if not hasattr(con, 'set_tunnel'):
|
|
||||||
# no tunnel support in py26
|
|
||||||
return
|
|
||||||
con.set_tunnel('myproxy.local', 3128)
|
con.set_tunnel('myproxy.local', 3128)
|
||||||
con.request("GET", "/")
|
con.request("GET", "/")
|
||||||
self.socket_mock.assert_has_calls([mock.call(
|
self.socket_mock.assert_has_calls([mock.call(
|
||||||
|
@ -39,12 +39,6 @@ from neutron import manager
|
|||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from neutron.tests.unit import test_extension_security_group as test_sg
|
from neutron.tests.unit import test_extension_security_group as test_sg
|
||||||
|
|
||||||
try:
|
|
||||||
OrderedDict = collections.OrderedDict
|
|
||||||
except AttributeError:
|
|
||||||
import ordereddict
|
|
||||||
OrderedDict = ordereddict.OrderedDict
|
|
||||||
|
|
||||||
FAKE_PREFIX = {const.IPv4: '10.0.0.0/24',
|
FAKE_PREFIX = {const.IPv4: '10.0.0.0/24',
|
||||||
const.IPv6: '2001:db8::/64'}
|
const.IPv6: '2001:db8::/64'}
|
||||||
FAKE_IP = {const.IPv4: '10.0.0.1',
|
FAKE_IP = {const.IPv4: '10.0.0.1',
|
||||||
@ -1210,10 +1204,9 @@ class SecurityGroupAgentEnhancedRpcTestCase(
|
|||||||
super(SecurityGroupAgentEnhancedRpcTestCase, self).setUp(
|
super(SecurityGroupAgentEnhancedRpcTestCase, self).setUp(
|
||||||
defer_refresh_firewall=defer_refresh_firewall)
|
defer_refresh_firewall=defer_refresh_firewall)
|
||||||
fake_sg_info = {
|
fake_sg_info = {
|
||||||
'security_groups':
|
'security_groups': collections.OrderedDict([
|
||||||
OrderedDict([
|
('fake_sgid2', []),
|
||||||
('fake_sgid2', []),
|
('fake_sgid1', [{'remote_group_id': 'fake_sgid2'}])]),
|
||||||
('fake_sgid1', [{'remote_group_id': 'fake_sgid2'}])]),
|
|
||||||
'sg_member_ips': {'fake_sgid2': {'IPv4': [], 'IPv6': []}},
|
'sg_member_ips': {'fake_sgid2': {'IPv4': [], 'IPv6': []}},
|
||||||
'devices': self.firewall.ports}
|
'devices': self.firewall.ports}
|
||||||
self.agent.plugin_rpc.security_group_info_for_devices.return_value = (
|
self.agent.plugin_rpc.security_group_info_for_devices.return_value = (
|
||||||
|
@ -9,7 +9,6 @@ discover
|
|||||||
fixtures>=0.3.14
|
fixtures>=0.3.14
|
||||||
mock>=1.0
|
mock>=1.0
|
||||||
python-subunit>=0.0.18
|
python-subunit>=0.0.18
|
||||||
ordereddict
|
|
||||||
requests-mock>=0.5.1 # Apache-2.0
|
requests-mock>=0.5.1 # Apache-2.0
|
||||||
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||||
oslosphinx>=2.2.0 # Apache-2.0
|
oslosphinx>=2.2.0 # Apache-2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user