Fix update_network_cidr method

subnet() method of netaddr.IPNetwork expects size of subnets to be returned
so we should pass to it subnet of the smaller size, not 1

Change-Id: Id6b7e8e43419d224cc1c3202ffd253664245d5d4
Closes-Bug: #1571543
This commit is contained in:
Volodymyr Shypyguzov 2016-04-19 11:30:20 +03:00
parent 48fcef2830
commit e3d38cef19
1 changed files with 2 additions and 1 deletions

View File

@ -2661,7 +2661,8 @@ class FuelWebClient(object):
if network['name'] != network_name:
continue
old_cidr = netaddr.IPNetwork(str(network['cidr']))
new_cidr = list(old_cidr.subnet(1))[0]
old_subnet_prefix = int(str(network['cidr']).split('/')[-1])
new_cidr = list(old_cidr.subnet(old_subnet_prefix + 1))[0]
assert_not_equal(old_cidr, new_cidr,
'Can\t create a subnet using default cidr {0} '
'for {1} network!'.format(old_cidr, network_name))