← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1703254] [NEW] When subnet allocation pool is updated, existing ports should be validated

 

Public bug reported:

When allocation pool of a subnet is modified in such a way that an
existing port is outside of it (via its fixed ip), the update should
fail. Currently this causes port to be present and its fixed_ip
attribute becomes invalid when allocation pool is updated.

This bug is found in ongoing Pike version. It may exist in previous
versions as well.

The following is the script to reproduce this problem :

Create a network, subnet, port. And then update subnet's allocation pool in such  a way the port is outside of it. Subnet update should fail.
Subnet is created with allocation pool 10.0.0.2 to 10.0.0.254. Port created with ip 10.0.0.250. Subnet allocation pool is then modified to 10.0.0.2 to 10.0.0.200.  Port becomes orphan and is outside of ip allocation pool.

hostname=`hostname`
token=`openstack token issue -c id -f value`
project=`openstack token issue -c project_id -f value`

curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token: $token"
-X POST "https://$hostname/powervc/openstack/network/v2.0/networks"; -d
'{"network":{"name":"MyNetwork","provider:network_type":"vlan","provider:physical_network":"default","provider:segmentation_id":100,"mtu":1500,"shared":false}}'

echo

net=`openstack network show 'MyNetwork' -c id -f value`
net=\"$net\"

echo $net

body='{"subnet":{"name":"SridharSubnet","network_id":'"$net"',"cidr":"10.0.0.0/24","enable_dhcp":false,"ip_version":"4","gateway_ip":"10.0.0.1","dns_nameservers":[],"allocation_pools":[{"start":"10.0.0.2","end":"10.0.0.254"}]}}'

echo

curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token: $token"
-X POST "https://$hostname/powervc/openstack/network/v2.0/subnets"; -d
$body

subnet=`openstack subnet show 'SridharSubnet' -c id -f value`
echo $subnet

body='{"port":{"network_id":'"$net"',"device_id":"Lock","device_owner":"PowerVC:Sridhar","fixed_ips":[{"ip_address":"10.0.0.250"}]}}'

curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token: $token"
-X POST "https://$hostname/powervc/openstack/network/v2.0/ports"; -d
$body

body='{"subnet":{"allocation_pools":[{"start":"10.0.0.2","end":"10.0.0.200"}]}}'

curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token: $token"
-X PUT
"https://$hostname/powervc/openstack/network/v2.0/subnets/$subnet"; -d
$body

** Affects: neutron
     Importance: Undecided
     Assignee: Sridhar Venkat (svenkat)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Sridhar Venkat (svenkat)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1703254

Title:
  When subnet allocation pool is updated, existing ports should be
  validated

Status in neutron:
  New

Bug description:
  When allocation pool of a subnet is modified in such a way that an
  existing port is outside of it (via its fixed ip), the update should
  fail. Currently this causes port to be present and its fixed_ip
  attribute becomes invalid when allocation pool is updated.

  This bug is found in ongoing Pike version. It may exist in previous
  versions as well.

  The following is the script to reproduce this problem :

  Create a network, subnet, port. And then update subnet's allocation pool in such  a way the port is outside of it. Subnet update should fail.
  Subnet is created with allocation pool 10.0.0.2 to 10.0.0.254. Port created with ip 10.0.0.250. Subnet allocation pool is then modified to 10.0.0.2 to 10.0.0.200.  Port becomes orphan and is outside of ip allocation pool.

  hostname=`hostname`
  token=`openstack token issue -c id -f value`
  project=`openstack token issue -c project_id -f value`

  curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token:
  $token" -X POST
  "https://$hostname/powervc/openstack/network/v2.0/networks"; -d
  '{"network":{"name":"MyNetwork","provider:network_type":"vlan","provider:physical_network":"default","provider:segmentation_id":100,"mtu":1500,"shared":false}}'

  echo

  net=`openstack network show 'MyNetwork' -c id -f value`
  net=\"$net\"

  echo $net

  body='{"subnet":{"name":"SridharSubnet","network_id":'"$net"',"cidr":"10.0.0.0/24","enable_dhcp":false,"ip_version":"4","gateway_ip":"10.0.0.1","dns_nameservers":[],"allocation_pools":[{"start":"10.0.0.2","end":"10.0.0.254"}]}}'

  echo

  curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token:
  $token" -X POST
  "https://$hostname/powervc/openstack/network/v2.0/subnets"; -d $body

  subnet=`openstack subnet show 'SridharSubnet' -c id -f value`
  echo $subnet

  body='{"port":{"network_id":'"$net"',"device_id":"Lock","device_owner":"PowerVC:Sridhar","fixed_ips":[{"ip_address":"10.0.0.250"}]}}'

  curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token:
  $token" -X POST
  "https://$hostname/powervc/openstack/network/v2.0/ports"; -d $body

  body='{"subnet":{"allocation_pools":[{"start":"10.0.0.2","end":"10.0.0.200"}]}}'

  curl -1 -k -H "Content-Type: application/json" -H "X-Auth-Token:
  $token" -X PUT
  "https://$hostname/powervc/openstack/network/v2.0/subnets/$subnet"; -d
  $body

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1703254/+subscriptions


Follow ups