use neutron_lib's get_random_mac
Neutron-lib 1.1.0 is now out and contains the get_random_mac definition[1]. This patch moves neutron references over to the neutron-lib version. NeutronLibImpact [1] ee0f5b2ab27c828cfedb771735d237a968423da2 Change-Id: I28a2a1d85a85461f7a4344b86d18da7f68066c95
This commit is contained in:
@@ -36,6 +36,7 @@ from eventlet.green import subprocess
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_const
|
||||
from neutron_lib.utils import helpers
|
||||
from neutron_lib.utils import net
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@@ -107,13 +108,13 @@ def log_opt_values(log):
|
||||
cfg.CONF.log_opt_values(log, logging.DEBUG)
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message="Use get_random_mac from neutron_lib.utils.net",
|
||||
version="Pike",
|
||||
removal_version="Queens"
|
||||
)
|
||||
def get_random_mac(base_mac):
|
||||
mac = [int(base_mac[0], 16), int(base_mac[1], 16),
|
||||
int(base_mac[2], 16), random.randint(0x00, 0xff),
|
||||
random.randint(0x00, 0xff), random.randint(0x00, 0xff)]
|
||||
if base_mac[3] != '00':
|
||||
mac[3] = int(base_mac[3], 16)
|
||||
return ':'.join(["%02x" % x for x in mac])
|
||||
return net.get_random_mac(base_mac)
|
||||
|
||||
|
||||
def get_dhcp_agent_device_id(network_id, host):
|
||||
|
||||
Reference in New Issue
Block a user