Use prefixlen instead of parsing it from string

+use builtin prefixlen method instead of parsing it from string

Change-Id: I30f49e2c22ca6bdc5334848061054c6d8ac4fd51
Related-bug: #1571543
This commit is contained in:
Volodymyr Shypyguzov 2016-04-22 10:25:13 +03:00
parent ff59b9cf51
commit e35c3d8a9b
1 changed files with 1 additions and 2 deletions

View File

@ -2662,8 +2662,7 @@ class FuelWebClient(object):
if network['name'] != network_name:
continue
old_cidr = netaddr.IPNetwork(str(network['cidr']))
old_subnet_prefix = int(str(network['cidr']).split('/')[-1])
new_cidr = list(old_cidr.subnet(old_subnet_prefix + 1))[0]
new_cidr = list(old_cidr.subnet(old_cidr.prefixlen + 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))