def _test_nat_bd_subnet_created_deleted(self, shared):
        self._mock_external_dict([('supported', '192.168.0.2/24')])
        es = self.create_external_segment(name='supported',
            expected_res_status=webob.exc.HTTPCreated.code,
            shared=shared)['external_segment']
        nat_pool = self.create_nat_pool(
            external_segment_id=es['id'],
            ip_version=4, ip_pool='192.168.1.0/24', shared=shared,
            expected_res_status=webob.exc.HTTPCreated.code)['nat_pool']
        owner = es['tenant_id'] if not shared else self.common_tenant
        mgr = self.driver.apic_manager

        if self.nat_enabled:
            mgr.ensure_subnet_created_on_apic.assert_called_with(
                owner, "NAT-bd-%s" % es['id'], '192.168.1.1/24')
        else:
            self.assertFalse(mgr.ensure_subnet_created_on_apic.called)

        self.delete_nat_pool(nat_pool['id'],
            expected_res_status=webob.exc.HTTPNoContent.code)
        if self.nat_enabled:
            mgr.ensure_subnet_deleted_on_apic.assert_called_with(
                owner, "NAT-bd-%s" % es['id'], '192.168.1.1/24')
        else:
            self.assertFalse(mgr.ensure_subnet_deleted_on_apic.called)
dataset/ETHPy150Open openstack/group-based-policy/gbpservice/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py/TestNatPool._test_nat_bd_subnet_created_deleted/original