# This will be the address at which Quantum sends and receives configuration\r
# information via SSHv2.\r
nexus_ip_address=10.0.0.1\r
-# Port number on the Nexus switch to which the UCSM 6120 is connected\r
-# Use shortened interface syntax, e.g. "3/23" not "Ethernet3/23".\r
-nexus_port=3/23\r
+# Port numbers on the Nexus switch to each one of the UCSM 6120s is connected\r
+# Use shortened interface syntax, e.g. "1/10" not "Ethernet1/10".\r
+nexus_first_port=1/10\r
+nexus_second_port=1/11\r
#Port number where the SSH will be running at Nexus Switch, e.g.: 22 (Default) \r
nexus_ssh_port=22\r
\r
[SWITCH]
# Change the following to reflect the Nexus switch details
nexus_ip_address=<put_nexus_switch_ip_address_here>
-#Port number of the Interface connected from the Nexus 7K Switch to UCSM 6120, e.g.: 3/23
-nexus_port=<put_interface_name_here>
+#Interfaces connected from the Nexus 7K Switch to the two UCSM 6120s, e.g.: 1/10 and 1/11
+nexus_first_port=<put_interface_name_here>
+nexus_second_port=<put_interface_name_here>
#Port number where the SSH will be running at the Nexus Switch, e.g.: 22 (Default)
nexus_ssh_port=22
SECTION = CP['SWITCH']
NEXUS_IP_ADDRESS = SECTION['nexus_ip_address']
-NEXUS_PORT = SECTION['nexus_port']
+NEXUS_FIRST_PORT = SECTION['nexus_first_port']
+NEXUS_SECOND_PORT = SECTION['nexus_second_port']
NEXUS_SSH_PORT = SECTION['nexus_ssh_port']
SECTION = CP['DRIVER']
mgr.edit_config(target='running', config=confstr)
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
- nexus_password, nexus_interface, nexus_ssh_port):
+ nexus_password, nexus_first_interface,
+ nexus_second_interface, nexus_ssh_port):
"""
Creates a VLAN and Enable on trunk mode an interface on Nexus Switch
given the VLAN ID and Name and Interface Number
with self.nxos_connect(nexus_host, int(nexus_ssh_port), nexus_user,
nexus_password) as man:
self.enable_vlan(man, vlan_id, vlan_name)
- self.enable_vlan_on_trunk_int(man, nexus_interface, vlan_id)
+ self.enable_vlan_on_trunk_int(man, nexus_first_interface, vlan_id)
+ self.enable_vlan_on_trunk_int(man, nexus_second_interface, vlan_id)
- def delete_vlan(self, vlan_id, nexus_host, nexus_user,
- nexus_password, nexus_interface, nexus_ssh_port):
+ def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,
+ nexus_first_interface, nexus_second_interface,
+ nexus_ssh_port):
"""
Delete a VLAN and Disables trunk mode an interface on Nexus Switch
given the VLAN ID and Interface Number
with self.nxos_connect(nexus_host, int(nexus_ssh_port), nexus_user,
nexus_password) as man:
self.disable_vlan(man, vlan_id)
- self.disable_switch_port(man, nexus_interface)
+ self.disable_switch_port(man, nexus_first_interface)
+ self.disable_switch_port(man, nexus_second_interface)
from quantum.plugins.cisco.common import cisco_credentials as cred
from quantum.plugins.cisco.l2device_plugin_base import L2DevicePluginBase
from quantum.plugins.cisco.nexus import cisco_nexus_configuration as conf
+from quantum.plugins.cisco.db import nexus_db as nxos_db
LOG.basicConfig(level=LOG.WARN)
LOG.getLogger(const.LOGGER_COMPONENT_NAME)
self._nexus_ip = conf.NEXUS_IP_ADDRESS
self._nexus_username = cred.Store.getUsername(conf.NEXUS_IP_ADDRESS)
self._nexus_password = cred.Store.getPassword(conf.NEXUS_IP_ADDRESS)
- self._nexus_port = conf.NEXUS_PORT
+ self._nexus_first_port = conf.NEXUS_FIRST_PORT
+ self._nexus_second_port = conf.NEXUS_SECOND_PORT
self._nexus_ssh_port = conf.NEXUS_SSH_PORT
def get_all_networks(self, tenant_id):
"""
LOG.debug("NexusPlugin:create_network() called\n")
self._client.create_vlan(vlan_name, str(vlan_id), self._nexus_ip,
- self._nexus_username, self._nexus_password, self._nexus_port,
+ self._nexus_username, self._nexus_password,
+ self._nexus_first_port, self._nexus_second_port,
self._nexus_ssh_port)
+ nxos_db.add_nexusport_binding(self._nexus_first_port, str(vlan_id))
+ nxos_db.add_nexusport_binding(self._nexus_second_port, str(vlan_id))
new_net_dict = {const.NET_ID: net_id,
const.NET_NAME: net_name,
from the relevant interfaces
"""
LOG.debug("NexusPlugin:delete_network() called\n")
- net = self._networks.get(net_id)
vlan_id = self._get_vlan_id_for_network(tenant_id, net_id)
+ ports_id = nxos_db.get_nexusport_binding(vlan_id)
+ LOG.debug("NexusPlugin: Interfaces to be disassociated: %s" % ports_id)
+ nxos_db.remove_nexusport_binding(vlan_id)
+ net = self._networks.get(net_id)
if net:
self._client.delete_vlan(str(vlan_id), self._nexus_ip,
- self._nexus_username, self._nexus_password, self._nexus_port,
+ self._nexus_username, self._nexus_password,
+ self._nexus_first_port, self._nexus_second_port,
self._nexus_ssh_port)
self._networks.pop(net_id)
return net
from quantum.common import exceptions as exc
from quantum.plugins.cisco.common import cisco_constants as const
from quantum.plugins.cisco.nexus import cisco_nexus_plugin
+from quantum.plugins.cisco.db import l2network_db as cdb
LOG = logging.getLogger('quantum.tests.test_nexus')
self.vlan_id = 267
self.port_id = "9"
self._cisco_nexus_plugin = cisco_nexus_plugin.NexusPlugin()
+ cdb.initialize()
def test_create_network(self, net_tenant_id=None, network_name=None,
network_id=None, net_vlan_name=None,
new_net_dict = self._cisco_nexus_plugin.create_network(
tenant_id, net_name, net_id, vlan_name, vlan_id)
-
self.assertEqual(new_net_dict[const.NET_ID], self.net_id)
self.assertEqual(new_net_dict[const.NET_NAME], self.net_name)
self.assertEqual(new_net_dict[const.NET_VLAN_NAME], self.vlan_name)