Clean up Cisco plugin config parameters
Change-Id: I3095f6aa0aa182592bd939ec59bac1820f15676f Fixes: bug 1201537
This commit is contained in:
parent
fbcc989a43
commit
3df809b0d1
|
@ -1,23 +1,13 @@
|
|||
[VLANS]
|
||||
vlan_start=100
|
||||
vlan_end=3000
|
||||
# (StrOpt) A short prefix to prepend to the VLAN number when creating a
|
||||
# VLAN interface. For example, if an interface is being created for
|
||||
# VLAN 2001 it will be named 'q-2001' using the default prefix.
|
||||
#
|
||||
# Example: vlan_name_prefix = vnet-
|
||||
vlan_name_prefix=q-
|
||||
|
||||
[PORTS]
|
||||
max_ports=100
|
||||
|
||||
[PORTPROFILES]
|
||||
max_port_profiles=65568
|
||||
|
||||
[NETWORKS]
|
||||
max_networks=65568
|
||||
|
||||
[MODEL]
|
||||
# (StrOpt) Period-separated module path to the model class to use for
|
||||
# the Cisco neutron plugin.
|
||||
#
|
||||
model_class=quantum.plugins.cisco.models.virt_phy_sw_v2.VirtualPhysicalSwitchModelV2
|
||||
|
||||
[SEGMENTATION]
|
||||
manager_class=quantum.plugins.cisco.segmentation.l2network_vlan_mgr_v2.L2NetworkVLANMgr
|
||||
|
||||
# IMPORTANT: Comment the following lines for production deployments
|
||||
[TEST]
|
||||
host=testhost
|
||||
|
|
|
@ -34,25 +34,6 @@ def initialize():
|
|||
db.configure_db()
|
||||
|
||||
|
||||
def create_vlanids():
|
||||
"""Prepopulates the vlan_bindings table"""
|
||||
LOG.debug(_("create_vlanids() called"))
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).one()
|
||||
except exc.MultipleResultsFound:
|
||||
pass
|
||||
except exc.NoResultFound:
|
||||
start = int(conf.VLAN_START)
|
||||
end = int(conf.VLAN_END)
|
||||
while start <= end:
|
||||
vlanid = l2network_models.VlanID(start)
|
||||
session.add(vlanid)
|
||||
start += 1
|
||||
session.flush()
|
||||
return
|
||||
|
||||
|
||||
def get_all_vlanids():
|
||||
"""Gets all the vlanids"""
|
||||
LOG.debug(_("get_all_vlanids() called"))
|
||||
|
|
|
@ -31,25 +31,6 @@ from quantum.plugins.openvswitch import ovs_models_v2
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_vlanids():
|
||||
"""Prepopulates the vlan_bindings table"""
|
||||
LOG.debug(_("create_vlanids() called"))
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(network_models_v2.VlanID).one()
|
||||
except exc.MultipleResultsFound:
|
||||
pass
|
||||
except exc.NoResultFound:
|
||||
start = int(conf.VLAN_START)
|
||||
end = int(conf.VLAN_END)
|
||||
while start <= end:
|
||||
vlanid = network_models_v2.VlanID(start)
|
||||
session.add(vlanid)
|
||||
start += 1
|
||||
session.flush()
|
||||
return
|
||||
|
||||
|
||||
def get_all_vlanids():
|
||||
"""Gets all the vlanids"""
|
||||
LOG.debug(_("get_all_vlanids() called"))
|
||||
|
|
|
@ -23,42 +23,19 @@ from quantum.plugins.cisco.common import cisco_configparser as confp
|
|||
|
||||
CONF_FILE = find_config_file({'plugin': 'cisco'}, "l2network_plugin.ini")
|
||||
CONF_PARSER_OBJ = confp.CiscoConfigParser(CONF_FILE)
|
||||
|
||||
|
||||
# Read the conf for the l2network_plugin
|
||||
SECTION_CONF = CONF_PARSER_OBJ['VLANS']
|
||||
VLAN_NAME_PREFIX = SECTION_CONF['vlan_name_prefix']
|
||||
VLAN_START = SECTION_CONF['vlan_start']
|
||||
VLAN_END = SECTION_CONF['vlan_end']
|
||||
|
||||
SECTION_CONF = CONF_PARSER_OBJ['PORTS']
|
||||
MAX_PORTS = SECTION_CONF['max_ports']
|
||||
|
||||
SECTION_CONF = CONF_PARSER_OBJ['NETWORKS']
|
||||
MAX_NETWORKS = SECTION_CONF['max_networks']
|
||||
|
||||
SECTION_CONF = CONF_PARSER_OBJ['MODEL']
|
||||
MODEL_CLASS = SECTION_CONF['model_class']
|
||||
|
||||
if 'TEST' in CONF_PARSER_OBJ.keys():
|
||||
TEST = CONF_PARSER_OBJ['TEST']
|
||||
|
||||
CONF_FILE = find_config_file({'plugin': 'cisco'}, "cisco_plugins.ini")
|
||||
|
||||
SECTION_CONF = CONF_PARSER_OBJ['SEGMENTATION']
|
||||
MANAGER_CLASS = SECTION_CONF['manager_class']
|
||||
|
||||
|
||||
CONF_PARSER_OBJ = confp.CiscoConfigParser(CONF_FILE)
|
||||
|
||||
# Read the config for the device plugins
|
||||
PLUGINS = CONF_PARSER_OBJ.walk(CONF_PARSER_OBJ.dummy)
|
||||
|
||||
CONF_FILE = find_config_file({'plugin': 'cisco'}, "db_conn.ini")
|
||||
|
||||
CONF_PARSER_OBJ = confp.CiscoConfigParser(CONF_FILE)
|
||||
|
||||
|
||||
# Read DB config for the Quantum DB
|
||||
SECTION_CONF = CONF_PARSER_OBJ['DATABASE']
|
||||
DB_NAME = SECTION_CONF['name']
|
||||
|
|
|
@ -474,18 +474,6 @@ class L2networkDBTest(base.BaseTestCase):
|
|||
self.teardown_vlanbinding()
|
||||
self.teardown_network()
|
||||
|
||||
def testm_test_vlanids(self):
|
||||
"""test vlanid methods"""
|
||||
l2network_db.create_vlanids()
|
||||
vlanids = l2network_db.get_all_vlanids()
|
||||
self.assertTrue(len(vlanids) > 0)
|
||||
vlanid = l2network_db.reserve_vlanid()
|
||||
used = l2network_db.is_vlanid_used(vlanid)
|
||||
self.assertTrue(used)
|
||||
used = l2network_db.release_vlanid(vlanid)
|
||||
self.assertFalse(used)
|
||||
#counting on default teardown here to clear db
|
||||
|
||||
def teardown_network(self):
|
||||
"""tearDown Network table"""
|
||||
LOG.debug("Tearing Down Network")
|
||||
|
|
Loading…
Reference in New Issue