From e35c3d8a9b6615f2a08e4db37f3af3283e9b2c58 Mon Sep 17 00:00:00 2001 From: Volodymyr Shypyguzov Date: Fri, 22 Apr 2016 10:25:13 +0300 Subject: [PATCH] Use prefixlen instead of parsing it from string +use builtin prefixlen method instead of parsing it from string Change-Id: I30f49e2c22ca6bdc5334848061054c6d8ac4fd51 Related-bug: #1571543 --- fuelweb_test/models/fuel_web_client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fuelweb_test/models/fuel_web_client.py b/fuelweb_test/models/fuel_web_client.py index 43ec3931f..5b9edfa27 100644 --- a/fuelweb_test/models/fuel_web_client.py +++ b/fuelweb_test/models/fuel_web_client.py @@ -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))