]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Change all occurences of no_delete to do_delete
authorAssaf Muller <amuller@redhat.com>
Sun, 4 May 2014 15:26:43 +0000 (18:26 +0300)
committerAssaf Muller <amuller@redhat.com>
Sun, 13 Jul 2014 11:09:26 +0000 (14:09 +0300)
Previously, ports, networks and subnets had a do_delete=True
parameter. By default, these resources were deleted at the
end of the context manager scope. All other resources used
a different semantic: no_delete=False.

This caused confusing situations such as:
with self.subnet(network, do_delete=False) as subnet:
    with self.security_group(no_delete=True) as sg:
        pass

Now all resources use the same do_delete semantic.

Closes-Bug: #1336196
Change-Id: I4627481813f714819efe85831e2a55975ea71ed4

28 files changed:
neutron/tests/unit/bigswitch/test_restproxy_plugin.py
neutron/tests/unit/bigswitch/test_router_db.py
neutron/tests/unit/db/firewall/test_db_firewall.py
neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py
neutron/tests/unit/db/metering/test_db_metering.py
neutron/tests/unit/db/vpn/test_db_vpnaas.py
neutron/tests/unit/ml2/test_ml2_plugin.py
neutron/tests/unit/nec/test_nec_plugin.py
neutron/tests/unit/nec/test_packet_filter.py
neutron/tests/unit/nuage/test_nuage_plugin.py
neutron/tests/unit/openvswitch/test_agent_scheduler.py
neutron/tests/unit/services/firewall/test_fwaas_plugin.py
neutron/tests/unit/services/loadbalancer/drivers/embrane/test_plugin_driver.py
neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py
neutron/tests/unit/services/loadbalancer/drivers/test_agent_driver_base.py
neutron/tests/unit/services/loadbalancer/test_agent_scheduler.py
neutron/tests/unit/services/metering/test_metering_plugin.py
neutron/tests/unit/test_db_plugin.py
neutron/tests/unit/test_extension_extraroute.py
neutron/tests/unit/test_extension_security_group.py
neutron/tests/unit/test_l3_plugin.py
neutron/tests/unit/vmware/extensions/test_qosqueues.py
neutron/tests/unit/vmware/test_nsx_plugin.py
neutron/tests/unit/vmware/vshield/test_firewall_driver.py
neutron/tests/unit/vmware/vshield/test_fwaas_plugin.py
neutron/tests/unit/vmware/vshield/test_lbaas_plugin.py
neutron/tests/unit/vmware/vshield/test_loadbalancer_driver.py
neutron/tests/unit/vmware/vshield/test_vpnaas_plugin.py

index 63f2aa482a801388b6cda1c6d0e6a9192546152d..81b37496185da42c709c3107cf7567962704c56b 100644 (file)
@@ -88,7 +88,7 @@ class TestBigSwitchProxyPortsV2(test_plugin.TestPortsV2,
             with self.subnet(network=net, do_delete=False) as sub:
                 with self.port(
                     subnet=sub,
-                    no_delete=True,
+                    do_delete=False,
                     device_owner=constants.DEVICE_OWNER_ROUTER_INTF
                 ) as port:
                     # router ports should be immediately active
index 39483b23c5029efb0e2e71a318318a1162e9075a..9fbbb8347e61eb6688f7475247207eba3dd1696a 100644 (file)
@@ -92,7 +92,7 @@ class RouterDBTestCase(RouterDBTestBase,
         with self.router() as r:
             with self.subnet() as s:
                 with self.subnet(cidr='10.0.10.0/24') as s1:
-                    with self.port(subnet=s1, no_delete=True) as p:
+                    with self.port(subnet=s1, do_delete=False) as p:
                         self._router_interface_action('add',
                                                       r['router']['id'],
                                                       None,
@@ -111,7 +111,7 @@ class RouterDBTestCase(RouterDBTestBase,
     def test_router_remove_router_interface_wrong_port_returns_404(self):
         with self.router() as r:
             with self.subnet() as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -257,7 +257,7 @@ class RouterDBTestCase(RouterDBTestBase,
     def test_router_remove_interface_wrong_subnet_returns_400(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.10.0/24') as s:
-                with self.port(no_delete=True) as p:
+                with self.port(do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -276,7 +276,7 @@ class RouterDBTestCase(RouterDBTestBase,
     def test_router_remove_interface_wrong_port_returns_404(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.10.0/24'):
-                with self.port(no_delete=True) as p:
+                with self.port(do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
index 0470bfd960eaccd82f32107c0471ef046802c749..1c1483d1dcab15b595534d5c228596ea3caf235b 100644 (file)
@@ -175,7 +175,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
     def firewall_policy(self, fmt=None, name='firewall_policy1',
                         description=DESCRIPTION, shared=True,
                         firewall_rules=None, audited=True,
-                        no_delete=False, **kwargs):
+                        do_delete=True, **kwargs):
         if firewall_rules is None:
             firewall_rules = []
         if not fmt:
@@ -187,7 +187,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
             raise webob.exc.HTTPClientError(code=res.status_int)
         firewall_policy = self.deserialize(fmt or self.fmt, res)
         yield firewall_policy
-        if not no_delete:
+        if do_delete:
             self._delete('firewall_policies',
                          firewall_policy['firewall_policy']['id'])
 
@@ -225,7 +225,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
                       source_port=SOURCE_PORT,
                       destination_port=DESTINATION_PORT,
                       action=ACTION, enabled=ENABLED,
-                      no_delete=False, **kwargs):
+                      do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         res = self._create_firewall_rule(fmt, name, shared, protocol,
@@ -237,7 +237,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
             raise webob.exc.HTTPClientError(code=res.status_int)
         firewall_rule = self.deserialize(fmt or self.fmt, res)
         yield firewall_rule
-        if not no_delete:
+        if do_delete:
             self._delete('firewall_rules',
                          firewall_rule['firewall_rule']['id'])
 
@@ -261,7 +261,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
     @contextlib.contextmanager
     def firewall(self, fmt=None, name='firewall_1', description=DESCRIPTION,
                  firewall_policy_id=None, admin_state_up=True,
-                 no_delete=False, **kwargs):
+                 do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         res = self._create_firewall(fmt, name, description, firewall_policy_id,
@@ -270,7 +270,7 @@ class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
             raise webob.exc.HTTPClientError(code=res.status_int)
         firewall = self.deserialize(fmt or self.fmt, res)
         yield firewall
-        if not no_delete:
+        if do_delete:
             self._delete('firewalls', firewall['firewall']['id'])
 
     def _rule_action(self, action, id, firewall_rule_id, insert_before=None,
@@ -504,7 +504,7 @@ class TestFirewallDBPlugin(FirewallPluginDbTestCase):
 
     def test_delete_firewall_policy(self):
         ctx = context.get_admin_context()
-        with self.firewall_policy(no_delete=True) as fwp:
+        with self.firewall_policy(do_delete=False) as fwp:
             fwp_id = fwp['firewall_policy']['id']
             req = self.new_delete_request('firewall_policies', fwp_id)
             res = req.get_response(self.ext_api)
@@ -516,7 +516,7 @@ class TestFirewallDBPlugin(FirewallPluginDbTestCase):
     def test_delete_firewall_policy_with_rule(self):
         ctx = context.get_admin_context()
         attrs = self._get_test_firewall_policy_attrs()
-        with self.firewall_policy(no_delete=True) as fwp:
+        with self.firewall_policy(do_delete=False) as fwp:
             fwp_id = fwp['firewall_policy']['id']
             with self.firewall_rule(name='fwr1') as fr:
                 fr_id = fr['firewall_rule']['id']
@@ -722,7 +722,7 @@ class TestFirewallDBPlugin(FirewallPluginDbTestCase):
 
     def test_delete_firewall_rule(self):
         ctx = context.get_admin_context()
-        with self.firewall_rule(no_delete=True) as fwr:
+        with self.firewall_rule(do_delete=False) as fwr:
             fwr_id = fwr['firewall_rule']['id']
             req = self.new_delete_request('firewall_rules', fwr_id)
             res = req.get_response(self.ext_api)
@@ -817,7 +817,7 @@ class TestFirewallDBPlugin(FirewallPluginDbTestCase):
         with self.firewall_policy() as fwp:
             fwp_id = fwp['firewall_policy']['id']
             with self.firewall(firewall_policy_id=fwp_id,
-                               no_delete=True) as fw:
+                               do_delete=False) as fw:
                 fw_id = fw['firewall']['id']
                 req = self.new_delete_request('firewalls', fw_id)
                 res = req.get_response(self.ext_api)
index bc541c7c84f1c2b020fd1d6ab7359b7483cbf764..8acb95d2ff001477b4137467267dccc9e6ff5dc3 100644 (file)
@@ -197,7 +197,7 @@ class LoadBalancerTestMixin(object):
     @contextlib.contextmanager
     def vip(self, fmt=None, name='vip1', pool=None, subnet=None,
             protocol='HTTP', protocol_port=80, admin_state_up=True,
-            no_delete=False, **kwargs):
+            do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
 
@@ -219,12 +219,12 @@ class LoadBalancerTestMixin(object):
                     )
                 vip = self.deserialize(fmt or self.fmt, res)
                 yield vip
-                if not no_delete:
+                if do_delete:
                     self._delete('vips', vip['vip']['id'])
 
     @contextlib.contextmanager
     def pool(self, fmt=None, name='pool1', lb_method='ROUND_ROBIN',
-             protocol='HTTP', admin_state_up=True, no_delete=False,
+             protocol='HTTP', admin_state_up=True, do_delete=True,
              **kwargs):
         if not fmt:
             fmt = self.fmt
@@ -240,12 +240,12 @@ class LoadBalancerTestMixin(object):
             )
         pool = self.deserialize(fmt or self.fmt, res)
         yield pool
-        if not no_delete:
+        if do_delete:
             self._delete('pools', pool['pool']['id'])
 
     @contextlib.contextmanager
     def member(self, fmt=None, address='192.168.1.100', protocol_port=80,
-               admin_state_up=True, no_delete=False, **kwargs):
+               admin_state_up=True, do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         res = self._create_member(fmt,
@@ -259,14 +259,14 @@ class LoadBalancerTestMixin(object):
             )
         member = self.deserialize(fmt or self.fmt, res)
         yield member
-        if not no_delete:
+        if do_delete:
             self._delete('members', member['member']['id'])
 
     @contextlib.contextmanager
     def health_monitor(self, fmt=None, type='TCP',
                        delay=30, timeout=10, max_retries=3,
                        admin_state_up=True,
-                       no_delete=False, **kwargs):
+                       do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         res = self._create_health_monitor(fmt,
@@ -295,7 +295,7 @@ class LoadBalancerTestMixin(object):
             for arg in http_related_attributes:
                 self.assertIsNone(the_health_monitor.get(arg))
         yield health_monitor
-        if not no_delete:
+        if do_delete:
             self._delete('health_monitors', the_health_monitor['id'])
 
 
@@ -535,7 +535,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
 
     def test_delete_vip(self):
         with self.pool():
-            with self.vip(no_delete=True) as vip:
+            with self.vip(do_delete=False) as vip:
                 req = self.new_delete_request('vips',
                                               vip['vip']['id'])
                 res = req.get_response(self.ext_api)
@@ -705,8 +705,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
             self._delete('members', member1['member']['id'])
 
     def test_delete_pool(self):
-        with self.pool(no_delete=True) as pool:
-            with self.member(no_delete=True,
+        with self.pool(do_delete=False) as pool:
+            with self.member(do_delete=False,
                              pool_id=pool['pool']['id']):
                 req = self.new_delete_request('pools',
                                               pool['pool']['id'])
@@ -714,7 +714,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
                 self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
 
     def test_delete_pool_preserve_state(self):
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             with self.vip(pool=pool):
                 req = self.new_delete_request('pools',
                                               pool['pool']['id'])
@@ -881,7 +881,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
         with self.pool() as pool:
             pool_id = pool['pool']['id']
             with self.member(pool_id=pool_id,
-                             no_delete=True) as member:
+                             do_delete=False) as member:
                 req = self.new_delete_request('members',
                                               member['member']['id'])
                 res = req.get_response(self.ext_api)
@@ -1008,7 +1008,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
                 self.assertEqual(res['health_monitor'][k], v)
 
     def test_delete_healthmonitor(self):
-        with self.health_monitor(no_delete=True) as monitor:
+        with self.health_monitor(do_delete=False) as monitor:
             ctx = context.get_admin_context()
             qry = ctx.session.query(ldb.HealthMonitor)
             qry = qry.filter_by(id=monitor['health_monitor']['id'])
index 6185ca727a546bc14cd1cb818ff3024b71b15ef2..fba83339afeb679ce86ef2a1f2a23812d53e647d 100644 (file)
@@ -90,20 +90,20 @@ class MeteringPluginDbTestCaseMixin(object):
 
     @contextlib.contextmanager
     def metering_label(self, name='label', description='desc',
-                       fmt=None, no_delete=False, **kwargs):
+                       fmt=None, do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         metering_label = self._make_metering_label(fmt, name,
                                                    description, **kwargs)
         yield metering_label
-        if not no_delete:
+        if do_delete:
             self._delete('metering-labels',
                          metering_label['metering_label']['id'])
 
     @contextlib.contextmanager
     def metering_label_rule(self, metering_label_id=None, direction='ingress',
                             remote_ip_prefix='10.0.0.0/24',
-                            excluded='false', fmt=None, no_delete=False):
+                            excluded='false', fmt=None, do_delete=True):
         if not fmt:
             fmt = self.fmt
         metering_label_rule = self._make_metering_label_rule(fmt,
@@ -112,7 +112,7 @@ class MeteringPluginDbTestCaseMixin(object):
                                                              remote_ip_prefix,
                                                              excluded)
         yield metering_label_rule
-        if not no_delete:
+        if do_delete:
             self._delete('metering-label-rules',
                          metering_label_rule['metering_label_rule']['id'])
 
@@ -155,7 +155,7 @@ class MeteringPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
         description = 'my metering label'
 
         with self.metering_label(name, description,
-                                 no_delete=True) as metering_label:
+                                 do_delete=False) as metering_label:
             metering_label_id = metering_label['metering_label']['id']
             self._delete('metering-labels', metering_label_id, 204)
 
@@ -206,7 +206,7 @@ class MeteringPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
                                           direction,
                                           remote_ip_prefix,
                                           excluded,
-                                          no_delete=True) as label_rule:
+                                          do_delete=False) as label_rule:
                 rule_id = label_rule['metering_label_rule']['id']
                 self._delete('metering-label-rules', rule_id, 204)
 
index 771345b9172f7e9b810d78b4e4978a613742441f..33aea24e95b0aaaa03199ac747abe0b9fbccd24d 100644 (file)
@@ -106,7 +106,7 @@ class VPNTestMixin(object):
                   lifetime_value=3600,
                   ike_version='v1',
                   pfs='group5',
-                  no_delete=False,
+                  do_delete=True,
                   **kwargs):
         if not fmt:
             fmt = self.fmt
@@ -124,7 +124,7 @@ class VPNTestMixin(object):
             raise webob.exc.HTTPClientError(code=res.status_int)
         ikepolicy = self.deserialize(fmt or self.fmt, res)
         yield ikepolicy
-        if not no_delete:
+        if do_delete:
             self._delete('ikepolicies', ikepolicy['ikepolicy']['id'])
 
     def _create_ipsecpolicy(self, fmt,
@@ -168,7 +168,7 @@ class VPNTestMixin(object):
                     lifetime_units='seconds',
                     lifetime_value=3600,
                     pfs='group5',
-                    no_delete=False, **kwargs):
+                    do_delete=True, **kwargs):
         if not fmt:
             fmt = self.fmt
         res = self._create_ipsecpolicy(fmt,
@@ -185,7 +185,7 @@ class VPNTestMixin(object):
             raise webob.exc.HTTPClientError(code=res.status_int)
         ipsecpolicy = self.deserialize(fmt or self.fmt, res)
         yield ipsecpolicy
-        if not no_delete:
+        if do_delete:
             self._delete('ipsecpolicies', ipsecpolicy['ipsecpolicy']['id'])
 
     def _create_vpnservice(self, fmt, name,
@@ -217,7 +217,7 @@ class VPNTestMixin(object):
                    subnet=None,
                    router=None,
                    admin_state_up=True,
-                   no_delete=False,
+                   do_delete=True,
                    plug_subnet=True,
                    external_subnet_cidr='192.168.100.0/24',
                    external_router=True,
@@ -256,7 +256,7 @@ class VPNTestMixin(object):
             if res.status_int < 400:
                 yield vpnservice
 
-            if not no_delete and vpnservice.get('vpnservice'):
+            if do_delete and vpnservice.get('vpnservice'):
                 self._delete('vpnservices',
                              vpnservice['vpnservice']['id'])
             if plug_subnet:
@@ -340,7 +340,7 @@ class VPNTestMixin(object):
                               vpnservice=None,
                               ikepolicy=None,
                               ipsecpolicy=None,
-                              admin_state_up=True, no_delete=False,
+                              admin_state_up=True, do_delete=True,
                               **kwargs):
         if not fmt:
             fmt = self.fmt
@@ -379,7 +379,7 @@ class VPNTestMixin(object):
             )
             yield ipsec_site_connection
 
-            if not no_delete:
+            if do_delete:
                 self._delete(
                     'ipsec-site-connections',
                     ipsec_site_connection[
@@ -475,7 +475,7 @@ class TestVpnaas(VPNPluginDbTestCase):
 
     def test_delete_ikepolicy(self):
         """Test case to delete an ikepolicy."""
-        with self.ikepolicy(no_delete=True) as ikepolicy:
+        with self.ikepolicy(do_delete=False) as ikepolicy:
             req = self.new_delete_request('ikepolicies',
                                           ikepolicy['ikepolicy']['id'])
             res = req.get_response(self.ext_api)
@@ -667,7 +667,7 @@ class TestVpnaas(VPNPluginDbTestCase):
 
     def test_delete_ipsecpolicy(self):
         """Test case to delete an ipsecpolicy."""
-        with self.ipsecpolicy(no_delete=True) as ipsecpolicy:
+        with self.ipsecpolicy(do_delete=False) as ipsecpolicy:
             req = self.new_delete_request('ipsecpolicies',
                                           ipsecpolicy['ipsecpolicy']['id'])
             res = req.get_response(self.ext_api)
@@ -980,7 +980,7 @@ class TestVpnaas(VPNPluginDbTestCase):
     def test_delete_vpnservice(self):
         """Test case to delete a vpnservice."""
         with self.vpnservice(name='vpnserver',
-                             no_delete=True) as vpnservice:
+                             do_delete=False) as vpnservice:
             req = self.new_delete_request('vpnservices',
                                           vpnservice['vpnservice']['id'])
             res = req.get_response(self.ext_api)
@@ -1226,7 +1226,7 @@ class TestVpnaas(VPNPluginDbTestCase):
     def test_delete_ipsec_site_connection(self):
         """Test case to delete a ipsec_site_connection."""
         with self.ipsec_site_connection(
-                no_delete=True) as ipsec_site_connection:
+                do_delete=False) as ipsec_site_connection:
             req = self.new_delete_request(
                 'ipsec-site-connections',
                 ipsec_site_connection['ipsec_site_connection']['id']
index 05a212dcae64db9ccbbd08812b02a81873676fbb..929d5dbd2da129cb9bceb59d2cb7ca24665864c4 100644 (file)
@@ -141,7 +141,7 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
         l3plugin = manager.NeutronManager.get_service_plugins().get(
             service_constants.L3_ROUTER_NAT)
         with contextlib.nested(
-            self.port(no_delete=True),
+            self.port(do_delete=False),
             mock.patch.object(l3plugin, 'disassociate_floatingips'),
             mock.patch.object(l3plugin, 'notify_routers_updated')
         ) as (port, disassociate_floatingips, notify):
index 0a012b7935b240a8d94a50932da760bc0760abc0..593d869cb947a18caa20e02a6fce518abebe735d 100644 (file)
@@ -890,7 +890,7 @@ class TestNecPluginOfcManager(NecPluginV2TestCase):
     def _test_delete_port_for_disappeared_ofc_port(self, raised_exc):
         self.ofc.set_raise_exc('delete_ofc_port', raised_exc)
 
-        with self.port(no_delete=True) as port:
+        with self.port(do_delete=False) as port:
             port_id = port['port']['id']
 
             portinfo = {'id': port_id, 'port_no': 123}
index b87a9255a3a6c678ba5713e8dafc61035da01ee7..24c2f9aa14fe4a52c41bc1b2a12bf6e885cc7791 100644 (file)
@@ -552,7 +552,7 @@ class TestNecPluginPacketFilter(TestNecPluginPacketFilterBase):
                    expected_code=webob.exc.HTTPNotFound.code)
 
     def test_auto_delete_pf_in_port_deletion(self):
-        with self.port(no_delete=True) as port:
+        with self.port(do_delete=False) as port:
             network = self._show('networks', port['port']['network_id'])
 
             with self.packet_filter_on_network(network=network) as pfn:
index afbc91bb9a63f85d346423b70f069bf147fa2620..5ec9028eba79bfdc0b152b56aadf29f5d26098d2 100644 (file)
@@ -254,7 +254,7 @@ class TestNuageExtrarouteTestCase(NuagePluginV2TestCase,
     def test_router_update_with_dup_destination_address(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
index 04ef593b5aec53a53ecec3e0b1bfc5203aedb8c6..e520a63817c7080d28bfb36be7e242b9a7acae2b 100644 (file)
@@ -507,7 +507,7 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
                              cidr='10.0.1.0/24',
                              do_delete=False) as subnet1:
                 pass
-            with self.port(subnet=subnet1, no_delete=True) as port2:
+            with self.port(subnet=subnet1, do_delete=False) as port2:
                 pass
         dhcp_agents = self._list_dhcp_agents_hosting_network(
             port2['port']['network_id'])
@@ -1106,12 +1106,12 @@ class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
                              do_delete=False) as subnet1:
                 if owner:
                     with self.port(subnet=subnet1,
-                                   no_delete=True,
+                                   do_delete=False,
                                    device_owner=owner) as port:
                         return [net1, subnet1, port]
                 else:
                     with self.port(subnet=subnet1,
-                                   no_delete=True) as port:
+                                   do_delete=False) as port:
                         return [net1, subnet1, port]
 
     def _notification_mocks(self, hosts, net, subnet, port):
index 512abdb46a8074a35d42a6ca4431e75496a49da5..de05d0caa13b0724b6c0f8d06605597af7676b60 100644 (file)
@@ -85,7 +85,7 @@ class TestFirewallCallbacks(test_db_firewall.FirewallPluginDbTestCase):
             fwp_id = fwp['firewall_policy']['id']
             with self.firewall(firewall_policy_id=fwp_id,
                                admin_state_up=test_db_firewall.ADMIN_STATE_UP,
-                               no_delete=True) as fw:
+                               do_delete=False) as fw:
                 fw_id = fw['firewall']['id']
                 with ctx.session.begin(subtransactions=True):
                     fw_db = self.plugin._get_firewall(ctx, fw_id)
@@ -347,7 +347,7 @@ class TestFirewallPluginBase(test_db_firewall.TestFirewallDBPlugin):
         with self.firewall_policy() as fwp:
             fwp_id = fwp['firewall_policy']['id']
             with self.firewall(firewall_policy_id=fwp_id,
-                               no_delete=True) as fw:
+                               do_delete=False) as fw:
                 fw_id = fw['firewall']['id']
                 req = self.new_delete_request('firewalls', fw_id)
                 res = req.get_response(self.ext_api)
index 7838a1517ad95eb25d11a07bcdff78b97525e6b0..f356e8768dec2c838bef23b4255dce8e4d6a14f4 100644 (file)
@@ -58,7 +58,7 @@ class TestLoadBalancerPlugin(test_db_loadbalancer.TestLoadBalancer,
         self.skip("App cookie persistence not supported.")
 
     def test_pool_port(self):
-        with self.port(no_delete=True) as port:
+        with self.port(do_delete=False) as port:
             with self.pool() as pool:
                 h_db.add_pool_port(context.get_admin_context(),
                                    pool['pool']['id'], port['port']['id'])
index bd3a435a0ff56a21008f9b3f4291bece9350e494..4edda4527e0a8c75b95bea34d152ed247e856774 100644 (file)
@@ -194,7 +194,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
         """Test the rest call failure handling by Exception raising."""
         with self.network(do_delete=False) as network:
             with self.subnet(network=network, do_delete=False) as subnet:
-                with self.pool(no_delete=True,
+                with self.pool(do_delete=False,
                                provider='radware',
                                subnet_id=subnet['subnet']['id']) as pool:
                     vip_data = {
@@ -384,7 +384,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
     def test_update_vip(self):
         with self.subnet() as subnet:
             with self.pool(provider='radware',
-                           no_delete=True,
+                           do_delete=False,
                            subnet_id=subnet['subnet']['id']) as pool:
                 vip_data = {
                     'name': 'vip1',
@@ -474,17 +474,17 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
 
         with self.network(do_delete=False) as network:
             with self.subnet(network=network, do_delete=False) as subnet:
-                with self.pool(no_delete=True,
+                with self.pool(do_delete=False,
                                provider='radware',
                                subnet_id=subnet['subnet']['id']) as pool:
                     with contextlib.nested(
                         self.member(pool_id=pool['pool']['id'],
-                                    no_delete=True),
+                                    do_delete=False),
                         self.member(pool_id=pool['pool']['id'],
                                     address='192.168.1.101',
-                                    no_delete=True),
-                        self.health_monitor(no_delete=True),
-                        self.vip(pool=pool, subnet=subnet, no_delete=True)
+                                    do_delete=False),
+                        self.health_monitor(do_delete=False),
+                        self.vip(pool=pool, subnet=subnet, do_delete=False)
                     ) as (mem1, mem2, hm, vip):
 
                         plugin.create_pool_health_monitor(
@@ -518,7 +518,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
     def test_delete_vip(self):
         with self.subnet() as subnet:
             with self.pool(provider='radware',
-                           no_delete=True,
+                           do_delete=False,
                            subnet_id=subnet['subnet']['id']) as pool:
                 vip_data = {
                     'name': 'vip1',
@@ -558,7 +558,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
         with self.subnet(cidr='10.0.0.0/24') as subnet:
             with self.subnet(cidr='10.0.1.0/24') as pool_subnet:
                 with self.pool(provider='radware',
-                               no_delete=True,
+                               do_delete=False,
                                subnet_id=pool_subnet['subnet']['id']) as pool:
                     vip_data = {
                         'name': 'vip1',
@@ -614,7 +614,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
     def test_delete_pool_with_vip(self):
         with self.subnet() as subnet:
             with self.pool(provider='radware',
-                           no_delete=True,
+                           do_delete=False,
                            subnet_id=subnet['subnet']['id']) as pool:
                 with self.vip(pool=pool, subnet=subnet):
                     self.assertRaises(loadbalancer.PoolInUse,
@@ -829,7 +829,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
             with self.pool(provider='radware',
                            subnet_id=subnet['subnet']['id']) as p:
                 with self.member(pool_id=p['pool']['id'],
-                                 no_delete=True) as m:
+                                 do_delete=False) as m:
                     with self.vip(pool=p, subnet=subnet):
 
                         # Reset mock and
@@ -870,7 +870,8 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
     def test_delete_member_without_vip(self):
         with self.subnet():
             with self.pool(provider='radware') as p:
-                with self.member(pool_id=p['pool']['id'], no_delete=True) as m:
+                with self.member(pool_id=p['pool']['id'],
+                                 do_delete=False) as m:
                     self.plugin_instance.delete_member(
                         context.get_admin_context(), m['member']['id']
                     )
@@ -915,7 +916,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
 
     def test_delete_pool_hm_with_vip(self):
         with self.subnet() as subnet:
-            with self.health_monitor(no_delete=True) as hm:
+            with self.health_monitor(do_delete=False) as hm:
                 with self.pool(provider='radware',
                                subnet_id=subnet['subnet']['id']) as pool:
                     with self.vip(pool=pool, subnet=subnet):
index 8f332e7df5bf8b2592e16974edb9df90b165dadd..72eb78bbd5fd23400597a80c7271384cf1beb09c 100644 (file)
@@ -563,7 +563,8 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
     def test_delete_vip(self):
         with self.subnet() as subnet:
             with self.pool(subnet=subnet) as pool:
-                with self.vip(pool=pool, subnet=subnet, no_delete=True) as vip:
+                with self.vip(pool=pool, subnet=subnet,
+                              do_delete=False) as vip:
                     ctx = context.get_admin_context()
                     self.plugin_instance.delete_vip(ctx, vip['vip']['id'])
                     vip['vip']['status'] = 'PENDING_DELETE'
@@ -615,7 +616,7 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
                     mock.ANY, old_pool, updated, 'host')
 
     def test_delete_pool(self):
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             req = self.new_delete_request('pools',
                                           pool['pool']['id'])
             res = req.get_response(self.ext_api)
@@ -662,7 +663,7 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
         with self.pool() as pool:
             pool_id = pool['pool']['id']
             with self.member(pool_id=pool_id,
-                             no_delete=True) as member:
+                             do_delete=False) as member:
                 req = self.new_delete_request('members',
                                               member['member']['id'])
                 res = req.get_response(self.ext_api)
index 5ee947944bf6fd2caf8f8aad57ee2788f4ceff93..1d78c03d2fb8efad0eac4446088d2e54e03593d8 100644 (file)
@@ -186,7 +186,7 @@ class LBaaSAgentSchedulerTestCase(test_agent_ext_plugin.AgentDBTestMixIn,
 
     def test_pool_unscheduling_on_pool_deletion(self):
         self._register_agent_states(lbaas_agents=True)
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             lbaas_agent = self._get_lbaas_agent_hosting_pool(
                 pool['pool']['id'])
             self.assertIsNotNone(lbaas_agent)
index 04ac8d2d7d86e16b628c91173c0b0954a5192271..c97559d8d9aca88869f66368fbe6059f52de78fb 100644 (file)
@@ -246,7 +246,7 @@ class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase,
     def test_delete_metering_label_does_not_clear_router_tenant_id(self):
         tenant_id = '654f6b9d-0f36-4ae5-bd1b-01616794ca60'
         with self.metering_label(tenant_id=tenant_id,
-                                 no_delete=True) as metering_label:
+                                 do_delete=False) as metering_label:
             with self.router(tenant_id=tenant_id, set_context=True) as r:
                 router = self._show('routers', r['router']['id'])
                 self.assertEqual(tenant_id, router['router']['tenant_id'])
index c196b8afbd0b9d178da56665f15b65bd8b295c5a..426033384aae07540a2d892e92a33d780eaac102 100644 (file)
@@ -524,10 +524,6 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
                                      admin_state_up, **kwargs)
         yield network
         if do_delete:
-            # The do_delete parameter allows you to control whether the
-            # created network is immediately deleted again. Therefore, this
-            # function is also usable in tests, which require the creation
-            # of many networks.
             self._delete('networks', network['network']['id'])
 
     @contextlib.contextmanager
@@ -562,13 +558,13 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
                 self._delete('subnets', subnet['subnet']['id'])
 
     @contextlib.contextmanager
-    def port(self, subnet=None, fmt=None, no_delete=False,
+    def port(self, subnet=None, fmt=None, do_delete=True,
              **kwargs):
         with optional_ctx(subnet, self.subnet) as subnet_to_use:
             net_id = subnet_to_use['subnet']['network_id']
             port = self._make_port(fmt or self.fmt, net_id, **kwargs)
             yield port
-            if not no_delete:
+            if do_delete:
                 self._delete('ports', port['port']['id'])
 
     def _test_list_with_sort(self, resource,
@@ -1065,7 +1061,7 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
             self.assertEqual(port['port']['id'], sport['port']['id'])
 
     def test_delete_port(self):
-        with self.port(no_delete=True) as port:
+        with self.port(do_delete=False) as port:
             self._delete('ports', port['port']['id'])
             self._show('ports', port['port']['id'],
                        expected_code=webob.exc.HTTPNotFound.code)
@@ -1669,8 +1665,8 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
         ctx = context.get_admin_context()
         with self.subnet() as subnet:
             with contextlib.nested(
-                self.port(subnet=subnet, device_id='owner1', no_delete=True),
-                self.port(subnet=subnet, device_id='owner1', no_delete=True),
+                self.port(subnet=subnet, device_id='owner1', do_delete=False),
+                self.port(subnet=subnet, device_id='owner1', do_delete=False),
                 self.port(subnet=subnet, device_id='owner2'),
             ) as (p1, p2, p3):
                 network_id = subnet['subnet']['network_id']
@@ -1687,7 +1683,7 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
         ctx = context.get_admin_context()
         with self.subnet() as subnet:
             with contextlib.nested(
-                self.port(subnet=subnet, device_id='owner1', no_delete=True),
+                self.port(subnet=subnet, device_id='owner1', do_delete=False),
                 self.port(subnet=subnet, device_id='owner1'),
                 self.port(subnet=subnet, device_id='owner2'),
             ) as (p1, p2, p3):
index d7a60425749fdfc06938f699c94a222df13ed34f..b34fe61ec990e975cea184f068b778d1bf1d4fee 100644 (file)
@@ -76,7 +76,7 @@ class ExtraRouteDBTestCaseBase(object):
         routes = [{'destination': '135.207.0.0/16', 'nexthop': '10.0.1.3'}]
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     body = self._routes_update_prepare(r['router']['id'],
                                                        None, p['port']['id'],
                                                        routes)
@@ -93,7 +93,7 @@ class ExtraRouteDBTestCaseBase(object):
                    'nexthop': '10.0.1.5'}]
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._routes_update_prepare(r['router']['id'],
                                                 None, p['port']['id'], routes)
                     body = self._update('routers', r['router']['id'],
@@ -107,7 +107,7 @@ class ExtraRouteDBTestCaseBase(object):
                    'nexthop': '10.0.1.3'}]
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     body = self._routes_update_prepare(r['router']['id'],
                                                        None, p['port']['id'],
                                                        routes)
@@ -131,7 +131,7 @@ class ExtraRouteDBTestCaseBase(object):
                    'nexthop': '10.0.1.5'}]
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     body = self._routes_update_prepare(r['router']['id'],
                                                        None, p['port']['id'],
                                                        routes)
@@ -150,8 +150,8 @@ class ExtraRouteDBTestCaseBase(object):
                 self.router(),
                 self.subnet(cidr='10.0.0.0/24')) as (r1, r2, s):
             with contextlib.nested(
-                    self.port(subnet=s, no_delete=True),
-                    self.port(subnet=s, no_delete=True)) as (p1, p2):
+                    self.port(subnet=s, do_delete=False),
+                    self.port(subnet=s, do_delete=False)) as (p1, p2):
                 body = self._routes_update_prepare(r1['router']['id'],
                                                    None, p1['port']['id'],
                                                    routes1)
@@ -180,7 +180,7 @@ class ExtraRouteDBTestCaseBase(object):
                         'nexthop': '10.0.1.5'}]
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     body = self._routes_update_prepare(r['router']['id'],
                                                        None, p['port']['id'],
                                                        routes_orig)
@@ -198,7 +198,7 @@ class ExtraRouteDBTestCaseBase(object):
     def _test_malformed_route(self, routes):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -230,7 +230,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_nexthop_is_port_ip(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -252,7 +252,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_router_update_with_too_many_routes(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -281,7 +281,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_router_update_with_dup_address(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -306,7 +306,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_router_update_with_invalid_ip_address(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -345,7 +345,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_router_update_with_invalid_nexthop_ip(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -368,7 +368,7 @@ class ExtraRouteDBTestCaseBase(object):
     def test_router_update_with_nexthop_is_outside_port_subnet(self):
         with self.router() as r:
             with self.subnet(cidr='10.0.1.0/24') as s:
-                with self.port(subnet=s, no_delete=True) as p:
+                with self.port(subnet=s, do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
index 69999153ebf07162445b049efd9e80d44eb372ad..478d4a31ddd20209d49ae5c1dbd3b75afa1d9c72 100644 (file)
@@ -117,12 +117,12 @@ class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
 
     @contextlib.contextmanager
     def security_group(self, name='webservers', description='webservers',
-                       fmt=None, no_delete=False):
+                       fmt=None, do_delete=True):
         if not fmt:
             fmt = self.fmt
         security_group = self._make_security_group(fmt, name, description)
         yield security_group
-        if not no_delete:
+        if do_delete:
             self._delete('security-groups',
                          security_group['security_group']['id'])
 
@@ -132,7 +132,7 @@ class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
                             direction='ingress', protocol=const.PROTO_NAME_TCP,
                             port_range_min='22', port_range_max='22',
                             remote_ip_prefix=None, remote_group_id=None,
-                            fmt=None, no_delete=False, ethertype=const.IPv4):
+                            fmt=None, do_delete=True, ethertype=const.IPv4):
         if not fmt:
             fmt = self.fmt
         rule = self._build_security_group_rule(security_group_id,
@@ -144,7 +144,7 @@ class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
                                                ethertype=ethertype)
         security_group_rule = self._make_security_group_rule(self.fmt, rule)
         yield security_group_rule
-        if not no_delete:
+        if do_delete:
             self._delete('security-group-rules',
                          security_group_rule['security_group_rule']['id'])
 
@@ -546,7 +546,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase):
     def test_delete_security_group(self):
         name = 'webservers'
         description = 'my webservers'
-        with self.security_group(name, description, no_delete=True) as sg:
+        with self.security_group(name, description, do_delete=False) as sg:
             remote_group_id = sg['security_group']['id']
             self._delete('security-groups', remote_group_id,
                          webob.exc.HTTPNoContent.code)
index 3b776fbb30a11a05d95f40001d6afd682dd3e55a..b978747ef0ca8340fa1fa824025f3d0e4a92f1a6 100644 (file)
@@ -769,7 +769,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
 
     def test_router_add_interface_port(self):
         with self.router() as r:
-            with self.port(no_delete=True) as p:
+            with self.port(do_delete=False) as p:
                 body = self._router_interface_action('add',
                                                      r['router']['id'],
                                                      None,
@@ -794,7 +794,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
                               'roles': []}
             tdict.return_value = admin_context
             with self.router() as r:
-                with self.port(no_delete=True) as p:
+                with self.port(do_delete=False) as p:
                     tdict.return_value = tenant_context
                     err_code = exc.HTTPNotFound.code
                     self._router_interface_action('add',
@@ -843,7 +843,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
     def test_router_add_interface_dup_subnet2_returns_400(self):
         with self.router() as r:
             with self.subnet() as s:
-                with self.port(subnet=s, no_delete=True) as p1:
+                with self.port(subnet=s, do_delete=False) as p1:
                     with self.port(subnet=s) as p2:
                         self._router_interface_action('add',
                                                       r['router']['id'],
@@ -1067,7 +1067,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
     def test_router_remove_interface_wrong_subnet_returns_400(self):
         with self.router() as r:
             with self.subnet() as s:
-                with self.port(no_delete=True) as p:
+                with self.port(do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -1085,7 +1085,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
 
     def test_router_remove_interface_returns_200(self):
         with self.router() as r:
-            with self.port(no_delete=True) as p:
+            with self.port(do_delete=False) as p:
                 body = self._router_interface_action('add',
                                                      r['router']['id'],
                                                      None,
@@ -1099,7 +1099,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
     def test_router_remove_interface_wrong_port_returns_404(self):
         with self.router() as r:
             with self.subnet():
-                with self.port(no_delete=True) as p:
+                with self.port(do_delete=False) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
                                                   None,
@@ -1710,7 +1710,7 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
 
     def test_l3_agent_routers_query_interfaces(self):
         with self.router() as r:
-            with self.port(no_delete=True) as p:
+            with self.port(do_delete=False) as p:
                 self._router_interface_action('add',
                                               r['router']['id'],
                                               None,
@@ -1734,7 +1734,7 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
         with self.router() as r:
             with self.subnet(cidr='9.0.1.0/24') as subnet:
                 with self.port(subnet=subnet,
-                               no_delete=True,
+                               do_delete=False,
                                fixed_ips=[{'ip_address': '9.0.1.3'}]) as p:
                     self._router_interface_action('add',
                                                   r['router']['id'],
@@ -1822,7 +1822,7 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
         self._test_notify_op_agent(self._test_router_gateway_op_agent)
 
     def _test_interfaces_op_agent(self, r, notifyApi):
-        with self.port(no_delete=True) as p:
+        with self.port(do_delete=False) as p:
             self._router_interface_action('add',
                                           r['router']['id'],
                                           None,
index 6b5d53ba6f97b642de23c921a2aafe3d6dc9f60c..729fbb9e763a41262139c0f79a3a6321fe63b476 100644 (file)
@@ -59,7 +59,7 @@ class TestQoSQueue(test_nsx_plugin.NsxPluginV2TestCase):
 
     @contextlib.contextmanager
     def qos_queue(self, name='foo', min='0', max='10',
-                  qos_marking=None, dscp='0', default=None, no_delete=False):
+                  qos_marking=None, dscp='0', default=None, do_delete=True):
 
         body = {'qos_queue': {'tenant_id': 'tenant',
                               'name': name,
@@ -79,7 +79,7 @@ class TestQoSQueue(test_nsx_plugin.NsxPluginV2TestCase):
 
         yield qos_queue
 
-        if not no_delete:
+        if do_delete:
             self._delete('qos-queues',
                          qos_queue['qos_queue']['id'])
 
@@ -128,11 +128,11 @@ class TestQoSQueue(test_nsx_plugin.NsxPluginV2TestCase):
             self.assertEqual(net1['network'][ext_qos.QUEUE],
                              q1['qos_queue']['id'])
             device_id = "00fff4d0-e4a8-4a3a-8906-4c4cdafb59f1"
-            with self.port(device_id=device_id, do_delete=False) as p:
+            with self.port(device_id=device_id) as p:
                 self.assertEqual(len(p['port'][ext_qos.QUEUE]), 36)
 
     def test_create_shared_queue_networks(self):
-        with self.qos_queue(default=True, no_delete=True) as q1:
+        with self.qos_queue(default=True, do_delete=False) as q1:
             res = self._create_network('json', 'net1', True,
                                        arg_list=(ext_qos.QUEUE,),
                                        queue_id=q1['qos_queue']['id'])
@@ -159,7 +159,7 @@ class TestQoSQueue(test_nsx_plugin.NsxPluginV2TestCase):
             self._delete('ports', port2['port']['id'])
 
     def test_remove_queue_in_use_fail(self):
-        with self.qos_queue(no_delete=True) as q1:
+        with self.qos_queue(do_delete=False) as q1:
             res = self._create_network('json', 'net1', True,
                                        arg_list=(ext_qos.QUEUE,),
                                        queue_id=q1['qos_queue']['id'])
@@ -186,7 +186,7 @@ class TestQoSQueue(test_nsx_plugin.NsxPluginV2TestCase):
                                  new_q['qos_queue']['id'])
 
     def test_update_port_adding_device_id(self):
-        with self.qos_queue(no_delete=True) as q1:
+        with self.qos_queue(do_delete=False) as q1:
             res = self._create_network('json', 'net1', True,
                                        arg_list=(ext_qos.QUEUE,),
                                        queue_id=q1['qos_queue']['id'])
index 21b28513aaf4d69932e3182dc05e0676f7fea264..b214add033671cac71ae2fd0a0b8d3bc6d9e8401 100644 (file)
@@ -995,7 +995,7 @@ class TestL3NatTestCase(L3NatTest,
 
     def test_router_add_interface_port_removes_security_group(self):
         with self.router() as r:
-            with self.port(no_delete=True) as p:
+            with self.port(do_delete=False) as p:
                 body = self._router_interface_action('add',
                                                      r['router']['id'],
                                                      None,
index 0002ab97dc364baff1dca074800d7dfb5d1475a9..91cffc3badb4e620042b2434aaf67804bd8148e5 100644 (file)
@@ -102,14 +102,14 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
         ctx = context.get_admin_context()
         name = 'firewall'
         with contextlib.nested(self.firewall_rule(name='fwr1',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr2',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr3',
-                                                  no_delete=True)) as fr:
+                                                  do_delete=False)) as fr:
             fw_rule_ids = [r['firewall_rule']['id'] for r in fr]
             with self.firewall_policy(firewall_rules=fw_rule_ids,
-                                      no_delete=True) as fwp:
+                                      do_delete=False) as fwp:
                 fwp_id = fwp['firewall_policy']['id']
                 with self.firewall(name=name,
                                    firewall_policy_id=fwp_id) as firewall:
@@ -126,14 +126,14 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
         ctx = context.get_admin_context()
         name = 'new_firewall'
         with contextlib.nested(self.firewall_rule(name='fwr1',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr2',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr3',
-                                                  no_delete=True)) as fr:
+                                                  do_delete=False)) as fr:
             fw_rule_ids = [r['firewall_rule']['id'] for r in fr]
             with self.firewall_policy(firewall_rules=fw_rule_ids,
-                                      no_delete=True) as fwp:
+                                      do_delete=False) as fwp:
                 fwp_id = fwp['firewall_policy']['id']
                 with self.firewall(name=name,
                                    firewall_policy_id=fwp_id) as firewall:
@@ -161,14 +161,14 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
         ctx = context.get_admin_context()
         name = 'firewall'
         with contextlib.nested(self.firewall_rule(name='fwr1',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr2',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr3',
-                                                  no_delete=True)) as fr:
+                                                  do_delete=False)) as fr:
             fw_rule_ids = [r['firewall_rule']['id'] for r in fr]
             with self.firewall_policy(firewall_rules=fw_rule_ids,
-                                      no_delete=True) as fwp:
+                                      do_delete=False) as fwp:
                 fwp_id = fwp['firewall_policy']['id']
                 with self.firewall(name=name,
                                    firewall_policy_id=fwp_id) as firewall:
@@ -185,10 +185,10 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
         ctx = context.get_admin_context()
         name = 'new_firewall'
         with contextlib.nested(self.firewall_rule(name='fwr1',
-                                                  no_delete=True)) as fr:
+                                                  do_delete=False)) as fr:
             fw_rule_ids = [r['firewall_rule']['id'] for r in fr]
             with self.firewall_policy(firewall_rules=fw_rule_ids,
-                                      no_delete=True) as fwp:
+                                      do_delete=False) as fwp:
                 fwp_id = fwp['firewall_policy']['id']
                 with self.firewall(name=name,
                                    firewall_policy_id=fwp_id) as firewall:
@@ -218,12 +218,12 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
         ctx = context.get_admin_context()
         name = 'new_firewall'
         with contextlib.nested(self.firewall_rule(name='fwr1',
-                                                  no_delete=True),
+                                                  do_delete=False),
                                self.firewall_rule(name='fwr2',
-                                                  no_delete=True)) as fr:
+                                                  do_delete=False)) as fr:
             fw_rule_ids = [r['firewall_rule']['id'] for r in fr]
             with self.firewall_policy(firewall_rules=fw_rule_ids,
-                                      no_delete=True) as fwp:
+                                      do_delete=False) as fwp:
                 fwp_id = fwp['firewall_policy']['id']
                 with self.firewall(name=name,
                                    firewall_policy_id=fwp_id) as firewall:
@@ -251,20 +251,20 @@ class TestEdgeFwDriver(VcnsDriverTestCase):
                     ctx, fw_create['id'])
                 self.driver.update_firewall(ctx, VSE_ID, fw_create)
                 with contextlib.nested(self.firewall_rule(name='fwr0',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(name='fwr1',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(name='fwr2',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(name='fwr3',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(name='fwr4',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(name='fwr5',
-                                                          no_delete=True),
+                                                          do_delete=False),
                                        self.firewall_rule(
                                            name='fwr6',
-                                           no_delete=True)) as fwr:
+                                           do_delete=False)) as fwr:
                     # test insert when rule list is empty
                     fwr0_id = fwr[0]['firewall_rule']['id']
                     self._rule_action('insert', fwp_id, fwr0_id,
index ff54be72aee04da2d9c6feb8367ad9c91a7d4a97..b96844c0349cc064c8159baf186e800e15505257 100644 (file)
@@ -187,7 +187,7 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
                 firewall_policy_id=fwp_id,
                 router_id=self._create_and_get_router(),
                 admin_state_up=test_db_firewall.ADMIN_STATE_UP,
-                no_delete=True) as fw:
+                do_delete=False) as fw:
                 fw_id = fw['firewall']['id']
                 with ctx.session.begin(subtransactions=True):
                     req = self.new_delete_request('firewalls', fw_id)
index a6737cfb88001139c4f6fd180c26231af989037d..bd9fe937f1199ca2eff15de912e2d6d0e56d3a76 100644 (file)
@@ -279,7 +279,7 @@ class TestLoadbalancerPlugin(
             )
             with self.vip(
                 router_id=self._create_and_get_router(),
-                pool=pool, subnet=subnet, no_delete=True) as vip:
+                pool=pool, subnet=subnet, do_delete=False) as vip:
                 req = self.new_delete_request('vips', vip['vip']['id'])
                 res = req.get_response(self.ext_api)
                 self.assertEqual(res.status_int, 204)
@@ -508,7 +508,7 @@ class TestLoadbalancerPlugin(
                 router_id=self._create_and_get_router(),
                 pool=pool, subnet=subnet):
                 with self.member(pool_id=pool_id,
-                                 no_delete=True) as member:
+                                 do_delete=False) as member:
                     req = self.new_delete_request('members',
                                                   member['member']['id'])
                     res = req.get_response(self.ext_api)
index 27027f38cc5b101069b8dd4dbd7f18f3c53b9479..257276407cb3cda482b341443af22b2085bfdd17 100644 (file)
@@ -96,7 +96,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_create_and_get_vip(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             self.pool_id = pool['pool']['id']
             POOL_MAP_INFO['pool_id'] = pool['pool']['id']
             vcns_db.add_vcns_edge_pool_binding(ctx.session, POOL_MAP_INFO)
@@ -109,7 +109,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_create_two_vips_with_same_name(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             self.pool_id = pool['pool']['id']
             POOL_MAP_INFO['pool_id'] = pool['pool']['id']
             vcns_db.add_vcns_edge_pool_binding(ctx.session, POOL_MAP_INFO)
@@ -210,7 +210,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_update_vip(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             self.pool_id = pool['pool']['id']
             POOL_MAP_INFO['pool_id'] = pool['pool']['id']
             vcns_db.add_vcns_edge_pool_binding(ctx.session, POOL_MAP_INFO)
@@ -233,7 +233,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_delete_vip(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as pool:
+        with self.pool(do_delete=False) as pool:
             self.pool_id = pool['pool']['id']
             POOL_MAP_INFO['pool_id'] = pool['pool']['id']
             vcns_db.add_vcns_edge_pool_binding(ctx.session, POOL_MAP_INFO)
@@ -249,7 +249,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
     #Test Pool Operation
     def test_create_and_get_pool(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as p:
+        with self.pool(do_delete=False) as p:
             self.pool_id = p['pool']['id']
             pool_create = p['pool']
             self.driver.create_pool(ctx, VSE_ID, pool_create, [])
@@ -259,7 +259,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_create_two_pools_with_same_name(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as p:
+        with self.pool(do_delete=False) as p:
             self.pool_id = p['pool']['id']
             pool_create = p['pool']
             self.driver.create_pool(ctx, VSE_ID, pool_create, [])
@@ -269,7 +269,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_update_pool(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as p:
+        with self.pool(do_delete=False) as p:
             self.pool_id = p['pool']['id']
             pool_create = p['pool']
             self.driver.create_pool(ctx, VSE_ID, pool_create, [])
@@ -286,7 +286,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_delete_pool(self):
         ctx = context.get_admin_context()
-        with self.pool(no_delete=True) as p:
+        with self.pool(do_delete=False) as p:
             self.pool_id = p['pool']['id']
             pool_create = p['pool']
             self.driver.create_pool(ctx, VSE_ID, pool_create, [])
@@ -299,7 +299,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_create_and_get_monitor(self):
         ctx = context.get_admin_context()
-        with self.health_monitor(no_delete=True) as m:
+        with self.health_monitor(do_delete=False) as m:
             monitor_create = m['health_monitor']
             self.driver.create_health_monitor(ctx, VSE_ID, monitor_create)
             monitor_get = self.driver.get_health_monitor(
@@ -309,7 +309,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_update_health_monitor(self):
         ctx = context.get_admin_context()
-        with self.health_monitor(no_delete=True) as m:
+        with self.health_monitor(do_delete=False) as m:
             monitor_create = m['health_monitor']
             self.driver.create_health_monitor(
                 ctx, VSE_ID, monitor_create)
@@ -328,7 +328,7 @@ class TestEdgeLbDriver(VcnsDriverTestCase):
 
     def test_delete_health_monitor(self):
         ctx = context.get_admin_context()
-        with self.health_monitor(no_delete=True) as m:
+        with self.health_monitor(do_delete=False) as m:
             monitor_create = m['health_monitor']
             self.driver.create_health_monitor(ctx, VSE_ID, monitor_create)
             self.driver.delete_health_monitor(
index 8d8f115ec9683f548974efb7d2aa1cf3b8f3a53d..b6e1fa20c85a2b742dc79d144ec8c4f8961983e9 100644 (file)
@@ -170,7 +170,7 @@ class TestVpnPlugin(test_db_vpnaas.VPNTestMixin,
                 with self.vpnservice(name='vpnservice',
                                      subnet=subnet,
                                      router=router,
-                                     no_delete=True) as vpnservice:
+                                     do_delete=False) as vpnservice:
                     req = self.new_delete_request(
                         'vpnservices', vpnservice['vpnservice']['id'])
                     res = req.get_response(self.ext_api)
@@ -385,7 +385,7 @@ class TestVpnPlugin(test_db_vpnaas.VPNTestMixin,
     def test_delete_ipsec_site_connection(self):
         """Test case to delete a ipsec_site_connection."""
         with self.ipsec_site_connection(
-                no_delete=True) as ipsec_site_connection:
+                do_delete=False) as ipsec_site_connection:
             req = self.new_delete_request(
                 'ipsec-site-connections',
                 ipsec_site_connection['ipsec_site_connection']['id']