def test_create_l2p_inject_default_route_false(self):
        self.driver.enable_metadata_opt = False
        l3p = self.create_l3_policy(name='myl3',
                                    ip_pool='192.168.0.0/16')['l3_policy']
        l2p = self.create_l2_policy(name='myl2',
                                    l3_policy_id=l3p['id'],
                                    inject_default_route=False)['l2_policy']
        ptg = self.create_policy_target_group(
            name="ptg1", l2_policy_id=l2p['id'])['policy_target_group']
        pt1 = self.create_policy_target(
            policy_target_group_id=ptg['id'])['policy_target']
        self._bind_port_to_host(pt1['port_id'], 'h1')
        sub = self._get_object('subnets', ptg['subnets'][0],
                               self.api)

        # Add one more host_route to the subnet
        more_host_routes = [{'destination': '172.16.0.0/24',
                             'nexthop': '10.0.2.2'}]
        data = {'subnet': {'host_routes': more_host_routes}}
        req = self.new_update_request('subnets', data, sub['subnet']['id'])
        res = self.deserialize(self.fmt, req.get_response(self.api))
        self.assertEqual(sorted(res['subnet']['host_routes']),
                         sorted(more_host_routes))

        with self.port(subnet=sub, device_owner='network:dhcp',
                       tenant_id='onetenant') as dhcp:
            dhcp = dhcp['port']
            details = self.driver.get_gbp_details(
                context.get_admin_context(),
                device='tap%s' % pt1['port_id'], host='h1')

            self.assertEqual(1, len(details['subnets']))
            # Verify that DNS nameservers are correctly set
            self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],
                             details['subnets'][0]['dns_nameservers'])
            # Verify Default route via GW is not present
            self.assertFalse({'destination': '0.0.0.0/0',
                             'nexthop': '192.168.0.1'} in
                            details['subnets'][0]['host_routes'])

            # Verify Metadata route via DHCP is not present
            self.assertFalse(
                {'destination': '169.254.169.254/16',
                 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in
                details['subnets'][0]['host_routes'])

            # Verify only extra route is present
            self.assertEqual(1, len(details['subnets'][0]['host_routes']))
            self.assertTrue(
                {'destination': '172.16.0.0/24',
                 'nexthop': '10.0.2.2'} in
                details['subnets'][0]['host_routes'])
            self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],
                             details['subnets'][0]['dhcp_server_ips'])
            # Verify gateway_ip is not set
            self.assertFalse(details['subnets'][0] in 'gateway_ip')
dataset/ETHPy150Open openstack/group-based-policy/gbpservice/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py/TestPolicyTarget.test_create_l2p_inject_default_route_false/swapped operands of `in`