'When port gets IP address from fixed IP range it
shall be checked if it\'s from subnets range.'

@decorators.idempotent_id('98244d88-d990-4570-91d4-6b25d70d08af')
def test_dhcp_stateful_fixedips_outrange(self):

    kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful', 'ipv6_address_mode': 'dhcpv6-stateful'}
    subnet = self.create_subnet(self.network, **kwargs)
    ip_range = netaddr.IPRange(subnet['allocation_pools'][0]['start'], subnet['allocation_pools'][0]['end'])
    for i in range(1, 3):
        ip = netaddr.IPAddress((ip_range.last + i)).format()
        self.assertRaises(lib_exc.BadRequest, self.create_port, self.network, fixed_ips=[{'subnet_id': subnet['id'], 'ip_address': ip}])
