fixed model tests to clean-up after rebase
This commit is contained in:
@@ -27,7 +27,7 @@ class BirdManager(base.Manager):
|
||||
def restart(self):
|
||||
try:
|
||||
utils.execute(['/etc/rc.d/bird', 'stop'], self.root_helper)
|
||||
except: #pragma nocover
|
||||
except: # pragma no cover
|
||||
# failure is ok here
|
||||
pass
|
||||
utils.execute(['/etc/rc.d/bird', 'start'], self.root_helper)
|
||||
@@ -77,7 +77,6 @@ def _build_kernel_config():
|
||||
return textwrap.dedent(config).strip()
|
||||
|
||||
|
||||
|
||||
def _build_device_config():
|
||||
return 'protocol device {\n scan time 10;\n}'
|
||||
|
||||
|
||||
@@ -668,9 +668,10 @@ class Configuration(ModelBase):
|
||||
|
||||
def _format_ext_rule(ext_if):
|
||||
return [
|
||||
('pass on %s inet6 proto tcp from %s:network to %s:network port 179' %
|
||||
(ext_if, ext_if, ext_if)),
|
||||
'pass out quick on %s proto udp to any port %d' % (ext_if, defaults.DNS)
|
||||
('pass on %s inet6 proto tcp from %s:network to %s:network port 179' %
|
||||
(ext_if, ext_if, ext_if)),
|
||||
('pass out quick on %s proto udp to any port %d' %
|
||||
(ext_if, defaults.DNS))
|
||||
]
|
||||
|
||||
|
||||
@@ -735,6 +736,7 @@ def _format_metadata_rule(int_if):
|
||||
return ('pass in quick on %(ifname)s proto tcp to %(dest_addr)s port http '
|
||||
'rdr-to 127.0.0.1 port %(local_port)d') % args
|
||||
|
||||
|
||||
def _format_floating_ip(ext_if, floating_ips):
|
||||
bin_nat = [
|
||||
('pass on %s from %s to any binat-to %s' %
|
||||
|
||||
@@ -95,4 +95,3 @@ class SystemAPITestCase(TestCase):
|
||||
|
||||
self.assertEqual(result.status_code, 200)
|
||||
self.assertTrue(json.loads(result.data))
|
||||
|
||||
|
||||
@@ -84,4 +84,3 @@ class DnsmasqTestCase(TestCase):
|
||||
mock.call(['/etc/rc.d/dnsmasq', 'stop'], 'sudo'),
|
||||
mock.call(['/etc/rc.d/dnsmasq', 'start'], 'sudo')
|
||||
])
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ class InterfaceModelTestCase(TestCase):
|
||||
self.assertTrue(iface.is_up)
|
||||
|
||||
def test_aliases(self):
|
||||
addr1 = netaddr.IPNetwork('192.168.1.1/24')
|
||||
addr2 = netaddr.IPNetwork('192.168.1.2/24')
|
||||
addr1 = netaddr.IPNetwork('192.168.1.1/24')
|
||||
addr2 = netaddr.IPNetwork('192.168.1.2/24')
|
||||
|
||||
iface = models.Interface(ifname='ge0', addresses=[str(addr1)])
|
||||
iface.aliases = [addr2]
|
||||
@@ -599,7 +599,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net, int_net]},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
('pass in quick on ge1 proto tcp to 169.254.169.254 port '
|
||||
'http rdr-to 127.0.0.1 port 9601'),
|
||||
@@ -625,7 +626,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net, int_net]},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
('pass in quick on ge1 proto tcp to 169.254.169.254 port '
|
||||
'http rdr-to 127.0.0.1 port 9601'),
|
||||
@@ -644,7 +646,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net, int_net]},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
'pass quick proto tcp from ge1:network to ge1 port { 22 }',
|
||||
'pass quick proto tcp from ge1 to ge1:network port 9697',
|
||||
@@ -661,7 +664,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net], 'address_book': ab},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
'table <foo> persist {192.168.1.1/24}'
|
||||
]
|
||||
@@ -678,7 +682,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net], 'anchors': [anchor]},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
'anchor foo {\npass proto tcp to port 22\n}'
|
||||
]
|
||||
@@ -693,7 +698,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net], 'labels': label},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
'match out on egress to {192.168.1.0/24} label "foo"'
|
||||
]
|
||||
@@ -735,7 +741,8 @@ class ConfigurationTestCase(TestCase):
|
||||
self._pf_config_test_helper(
|
||||
{'networks': [ext_net, int_net], 'floating_ips': [fip]},
|
||||
[
|
||||
'pass on ge0 inet6 proto tcp from ge0:network to ge0:network port 179',
|
||||
('pass on ge0 inet6 proto tcp from ge0:network to ge0:network '
|
||||
'port 179'),
|
||||
'pass out quick on ge0 proto udp to any port 53',
|
||||
('pass in quick on ge1 proto tcp to 169.254.169.254 port '
|
||||
'http rdr-to 127.0.0.1 port 9601'),
|
||||
@@ -748,6 +755,6 @@ class ConfigurationTestCase(TestCase):
|
||||
'pass in on ge1 proto udp to any port {53}',
|
||||
'pass inet6 proto tcp to ge1:network port {22}',
|
||||
'pass on ge0 from 10.0.0.1 to any binat-to 9.9.9.9',
|
||||
'pass out on ge1 to 10.0.0.1'
|
||||
]
|
||||
)
|
||||
>>>>>>> 32eb250... update for floating ip support
|
||||
|
||||
Reference in New Issue
Block a user