From b113a0a2550781e3e76cc9d6f716ed57f8f06a11 Mon Sep 17 00:00:00 2001 From: Edgar Magana Date: Wed, 3 Aug 2011 13:29:43 -0700 Subject: [PATCH] Fixed an issue selecting the right port interface and also properly switching off the Nexus Interface --- .../cisco/nexus/cisco_nexus_network_driver.py | 12 ++++++++++-- quantum/plugins/cisco/nexus/cisco_nexus_plugin.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py b/quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py index 2e95409d35d..27e63ce4cb5 100644 --- a/quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py +++ b/quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py @@ -193,6 +193,12 @@ class CiscoNEXUSDriver(): print confstr mgr.edit_config(target='running', config=confstr) + def disable_switch_port(self, mgr, interface): + confstr = cmd_no_switchport % (interface) + confstr = exec_conf_prefix + confstr + exec_conf_postfix + print confstr + mgr.edit_config(target='running', config=confstr) + def enable_vlan_on_trunk_int(self, mgr, interface, vlanid): confstr = cmd_vlan_int_snippet % (interface, vlanid) confstr = exec_conf_prefix + confstr + exec_conf_postfix @@ -221,12 +227,14 @@ class CiscoNEXUSDriver(): with self.nxos_connect(nexus_host, 22, nexus_user, nexus_password) as m: self.enable_vlan(m, vlan_id, vlan_name) - self.enable_port_trunk(m, nexus_interface) + self.enable_vlan_on_trunk_int(m, nexus_interface, vlan_id) - def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password): + def delete_vlan(self, vlan_id, nexus_host, nexus_user, + nexus_password, nexus_interface): with self.nxos_connect(nexus_host, 22, nexus_user, nexus_password) as m: self.disable_vlan(m, vlan_id) + self.disable_switch_port(m, nexus_interface) def main(): diff --git a/quantum/plugins/cisco/nexus/cisco_nexus_plugin.py b/quantum/plugins/cisco/nexus/cisco_nexus_plugin.py index 349a69ca550..31baac47297 100644 --- a/quantum/plugins/cisco/nexus/cisco_nexus_plugin.py +++ b/quantum/plugins/cisco/nexus/cisco_nexus_plugin.py @@ -79,7 +79,7 @@ class NexusPlugin(object): vlan_id = self._get_vlan_id_for_network(tenant_id, net_id) if net: self._client.delete_vlan(str(vlan_id), self._nexus_ip, - self._nexus_username, self._nexus_password) + self._nexus_username, self._nexus_password, self._nexus_port) self._networks.pop(net_id) return net # Network not found