From 2299e3beff62a23b56a3879b99d1177cdedb3959 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 26 Jan 2017 14:35:55 +0000 Subject: [PATCH] Randomize default subnet CIDR in vimconn_openstack. Fixes bug 179 Signed-off-by: garciadeblas --- vimconn_openstack.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vimconn_openstack.py b/vimconn_openstack.py index 61d4b438..f9a2185c 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -34,6 +34,7 @@ import logging import netaddr import time import yaml +import random from novaclient import client as nClient_v2, exceptions as nvExceptions, api_versions as APIVersion import keystoneclient.v2_0.client as ksClient_v2 @@ -305,8 +306,9 @@ class vimconnector(vimconn.vimconnector): if not ip_profile: ip_profile = {} if 'subnet_address' not in ip_profile: - #Fake subnet is required - ip_profile['subnet_address'] = "192.168.111.0/24" + #Fake subnet is required + subnet_rand = random.randint(0, 255) + ip_profile['subnet_address'] = "192.168.{}.0/24".format(subnet_rand) if 'ip_version' not in ip_profile: ip_profile['ip_version'] = "IPv4" subnet={"name":net_name+"-subnet", -- 2.25.1