'Test that we can successfully update with sane params.
This will create a subnet with specified allocation_pools
Then issue an update (PUT) to update these using correct
(i.e. non erroneous) params. Finally retrieve the updated
subnet and verify.'

def _test_update_subnet_allocation_pools(self, with_gateway_ip=False):

    allocation_pools = [{'start': '192.168.0.2', 'end': '192.168.0.254'}]
    with self.network() as network:
        with self.subnet(network=network, allocation_pools=allocation_pools, cidr='192.168.0.0/24') as subnet:
            data = {'subnet': {'allocation_pools': [{'start': '192.168.0.10', 'end': '192.168.0.20'}, {'start': '192.168.0.30', 'end': '192.168.0.40'}]}}
            if with_gateway_ip:
                data['subnet']['gateway_ip'] = '192.168.0.9'
            req = self.new_update_request('subnets', data, subnet['subnet']['id'])
            res = req.get_response(self.api)
            self.assertEqual(200, res.status_code)
            self._verify_updated_subnet_allocation_pools(res, with_gateway_ip)
            req = self.new_show_request('subnets', subnet['subnet']['id'], self.fmt)
            res = req.get_response(self.api)
            self._verify_updated_subnet_allocation_pools(res, with_gateway_ip)
