Merge lp:~emagana/neutron/plugin-framework-nx-os into lp:~cisco-openstack/neutron/plugin-framework

Proposed by Edgar Magana
Status: Merged
Merged at revision: 42
Proposed branch: lp:~emagana/neutron/plugin-framework-nx-os
Merge into: lp:~cisco-openstack/neutron/plugin-framework
Diff against target: 479 lines (+315/-18)
5 files modified
quantum/plugins/cisco/README (+29/-7)
quantum/plugins/cisco/common/cisco_configuration.py (+10/-0)
quantum/plugins/cisco/l2network_plugin.py (+19/-3)
quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py (+236/-0)
quantum/plugins/cisco/nexus/cisco_nexus_plugin.py (+21/-8)
To merge this branch: bzr merge lp:~emagana/neutron/plugin-framework-nx-os
Reviewer Review Type Date Requested Status
Sumit Naiksatam (community) Approve
Ram Durairaj Pending
Review via email: mp+70106@code.launchpad.net

Description of the change

Nexus OS driver integration
VLAN configuration to Nexus 7K Switch

To post a comment you must log in.
Revision history for this message
Sumit Naiksatam (snaiksat) wrote :

Approving the request as per Ram's suggestion.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'quantum/plugins/cisco/README'
--- quantum/plugins/cisco/README 2011-08-01 03:31:42 +0000
+++ quantum/plugins/cisco/README 2011-08-02 04:45:54 +0000
@@ -7,6 +7,7 @@
7* UCS B200 series blades with M81KR VIC installed.7* UCS B200 series blades with M81KR VIC installed.
8* UCSM 2.0 (Capitola) Build 2308* UCSM 2.0 (Capitola) Build 230
9* RHEL 6.19* RHEL 6.1
10* ncclcient v0.3.1 - Python library for NETCONF clients (http://schmizz.net/ncclient/)
10* UCS & VIC installation (support for KVM) - please consult the accompanying installation guide available at:11* UCS & VIC installation (support for KVM) - please consult the accompanying installation guide available at:
11http://wikicentral.cisco.com/display/GROUP/SAVBU+Palo+VM-FEX+for+Linux+KVM12http://wikicentral.cisco.com/display/GROUP/SAVBU+Palo+VM-FEX+for+Linux+KVM
12* To run Quantum on RHEL, you will need to have the correct version of python-routes (version 1.12.3 or later). The RHEL 6.1 package contains an older version. Do the following and check your python-routes version:13* To run Quantum on RHEL, you will need to have the correct version of python-routes (version 1.12.3 or later). The RHEL 6.1 package contains an older version. Do the following and check your python-routes version:
@@ -37,7 +38,7 @@
37common/cisco_utils.py38common/cisco_utils.py
38__init__.py39__init__.py
39ucs/get-vif.sh40ucs/get-vif.sh
40* Configure the L2 Network Pllugin:41* Configure the L2 Network Plugin:
41 + In cisco_configuration.py, 42 + In cisco_configuration.py,
42 - change the UCSM IP in the following statement to your UCSM IP43 - change the UCSM IP in the following statement to your UCSM IP
43 flags.DEFINE_string('ucsm_ip_address', "172.20.231.27", 'IP address of UCSM')44 flags.DEFINE_string('ucsm_ip_address', "172.20.231.27", 'IP address of UCSM')
@@ -57,12 +58,33 @@
57 flags.DEFINE_string('profile_name_prefix', "q-", 'Prefix of the name given to the port profile')58 flags.DEFINE_string('profile_name_prefix', "q-", 'Prefix of the name given to the port profile')
58 - Change the path to reflect the location of the get-vif.sh script, if you have followed the instructions in this README, this location should be the same as that of your other plugin modules59 - Change the path to reflect the location of the get-vif.sh script, if you have followed the instructions in this README, this location should be the same as that of your other plugin modules
59 flags.DEFINE_string('get_next_vif', "/root/sumit/quantum/quantum/plugins/cisco/get-vif.sh", 'This is the location of the script to get the next available dynamic nic')60 flags.DEFINE_string('get_next_vif', "/root/sumit/quantum/quantum/plugins/cisco/get-vif.sh", 'This is the location of the script to get the next available dynamic nic')
60 + In cisco_credentials.py, 61
61 - Change the following stucture to reflect the correct UCS and Nova DB details. Your UCSM_IP_ADDRESS has to match the ucsmm_ip_addresss which you provided in the cisco_configuration file earlier. Similarly, your NOVA_DATABSE_IP has to match the db_server_ip which you provided earlier. DB_USERNAME and DB_PASSWORD are those which you provided for the Nova MySQL DB when you setup OpenStack62 + In cisco_credentials.py,
62 _creds_dictionary = {63 - Change the following structure to reflect the correct UCS, N7K and Nova DB details. Your UCSM_IP_ADDRESS has to match the ucsmm_ip_addresss which you provided in the cisco_configuration file earlier. Similarly, your NOVA_DATABSE_IP has to match the db_server_ip which you provided earlier. DB_USERNAME and DB_PASSWORD are those which you provided for the Nova MySQL DB when you setup OpenStack
63 'UCSM_IP_ADDRESS':["UCSM_USERNAME", "UCSM_PASSWORD"],64 N7K_IP_ADDRESS has to match with your Nexus 7k switch IP Address, N7K_USERNAME is the administrator user-name and N7K_PASSWORD is the password.
64 'NOVA_DATABASE_IP':["DB_USERNAME", "DB_PASSWORD"]65 _creds_dictionary = {
65 }66 'UCSM_IP_ADDRESS':["UCSM_USERNAME", "UCSM_PASSWORD"],
67 'NOVA_DATABASE_IP':["DB_USERNAME", "DB_PASSWORD"]
68 }
69
70* Configure the L2 Network Plugin with Nexus OS Driver for testing VLANs CRUD on Nexus 7k Switch. Making these changes requires one Nexus 7K Switch connected to the UCSM and the ncclient patch not just the regular library, otherwise the system will fail.
71 + In cisco_configuration.py,
72 - change the NEXUS 7K IP in the following statement to your N7K Switch IP
73 flags.DEFINE_string('nexus_ip_address', "172.20.231.61", 'IP address of N7K')
74 - change the NEXUS Interface in the following statement to the interface number in your N7K which is connected to your UCSM UpLink port
75 flags.DEFINE_string('nexus_port', "3/23", 'Port number of the Interface connected from the Nexus 7K Switch to UCSM 6120')
76 - change NEXUS Driver Flag to "on" in the following statement
77 flags.DEFINE_string('nexus_driver_active', "off", 'Flag to activate Nexus OS Driver')
78
79 + In cisco_credentials.py,
80 - Change the following structure to reflect the correct UCS, N7K and Nova DB details. Your UCSM_IP_ADDRESS has to match the ucsmm_ip_addresss which you provided in the cisco_configuration file earlier. Similarly, your NOVA_DATABSE_IP has to match the db_server_ip which you provided earlier. DB_USERNAME and DB_PASSWORD are those which you provided for the Nova MySQL DB when you setup OpenStack
81 N7K_IP_ADDRESS has to match with your Nexus 7k switch IP Address, N7K_USERNAME is the administrator user-name and N7K_PASSWORD is the password.
82 _creds_dictionary = {
83 'UCSM_IP_ADDRESS':["UCSM_USERNAME", "UCSM_PASSWORD"],
84 'N7K_IP_ADDRESS':["N7K_USERNAME", "N7K_PASSWORD"],
85 'NOVA_DATABASE_IP':["DB_USERNAME", "DB_PASSWORD"]
86 }
87
66* Start the Quantum service88* Start the Quantum service
6789
68** Additional installation required on Nova Compute:90** Additional installation required on Nova Compute:
6991
=== modified file 'quantum/plugins/cisco/common/cisco_configuration.py'
--- quantum/plugins/cisco/common/cisco_configuration.py 2011-07-31 18:38:26 +0000
+++ quantum/plugins/cisco/common/cisco_configuration.py 2011-08-02 04:45:54 +0000
@@ -15,6 +15,7 @@
15# under the License.15# under the License.
16#16#
17# @author: Sumit Naiksatam, Cisco Systems, Inc.17# @author: Sumit Naiksatam, Cisco Systems, Inc.
18# @author: Edgar Magana, Cisco Systems, Inc.
18#19#
19from quantum.common import flags20from quantum.common import flags
2021
@@ -26,6 +27,12 @@
26#27#
27flags.DEFINE_string('ucsm_ip_address', "172.20.231.27", 'IP address of \28flags.DEFINE_string('ucsm_ip_address', "172.20.231.27", 'IP address of \
28 UCSM')29 UCSM')
30flags.DEFINE_string('nexus_ip_address', "172.20.231.61", 'IP address of \
31 Nexus Switch')
32flags.DEFINE_string('nexus_port', "3/23", 'Port number of the Interface \
33 connected from the Nexus Switch to UCSM 6120')
34flags.DEFINE_string('nexus_driver_active', "off", 'Flag to activate Nexus OS\
35 Driver')
29flags.DEFINE_string('db_server_ip', "127.0.0.1", 'IP address of nova DB \36flags.DEFINE_string('db_server_ip', "127.0.0.1", 'IP address of nova DB \
30 server')37 server')
31flags.DEFINE_string('nova_host_name', "openstack-0203", 'nova cloud \38flags.DEFINE_string('nova_host_name', "openstack-0203", 'nova cloud \
@@ -68,6 +75,9 @@
6875
69# Inventory items76# Inventory items
70UCSM_IP_ADDRESS = FLAGS.ucsm_ip_address77UCSM_IP_ADDRESS = FLAGS.ucsm_ip_address
78NEXUS_IP_ADDRESS = FLAGS.nexus_ip_address
79NEXUS_DRIVER_ACTIVE = FLAGS.nexus_driver_active
80NEXUS_PORT = FLAGS.nexus_port
71DB_SERVER_IP = FLAGS.db_server_ip81DB_SERVER_IP = FLAGS.db_server_ip
72NOVA_HOST_NAME = FLAGS.nova_host_name82NOVA_HOST_NAME = FLAGS.nova_host_name
7383
7484
=== modified file 'quantum/plugins/cisco/l2network_plugin.py'
--- quantum/plugins/cisco/l2network_plugin.py 2011-07-31 18:38:26 +0000
+++ quantum/plugins/cisco/l2network_plugin.py 2011-08-02 04:45:54 +0000
@@ -15,6 +15,7 @@
15# under the License.15# under the License.
16#16#
17# @author: Sumit Naiksatam, Cisco Systems, Inc.17# @author: Sumit Naiksatam, Cisco Systems, Inc.
18# @author: Edgar Magana, Cisco Systems, Inc.
18#19#
1920
20import logging as LOG21import logging as LOG
@@ -65,8 +66,13 @@
65 new_net_id = self._get_unique_net_id(tenant_id)66 new_net_id = self._get_unique_net_id(tenant_id)
66 vlan_id = self._get_vlan_for_tenant(tenant_id, net_name)67 vlan_id = self._get_vlan_for_tenant(tenant_id, net_name)
67 vlan_name = self._get_vlan_name(new_net_id, str(vlan_id))68 vlan_name = self._get_vlan_name(new_net_id, str(vlan_id))
68 self._nexus_plugin.create_network(tenant_id, net_name, new_net_id,69 nexus_driver_flag = conf.NEXUS_DRIVER_ACTIVE
70 if nexus_driver_flag == 'on':
71 LOG.debug("Nexus OS Driver called\n")
72 self._nexus_plugin.create_network(tenant_id, net_name, new_net_id,
69 vlan_name, vlan_id)73 vlan_name, vlan_id)
74 else:
75 LOG.debug("No Nexus OS Driver available\n")
70 self._ucs_plugin.create_network(tenant_id, net_name, new_net_id,76 self._ucs_plugin.create_network(tenant_id, net_name, new_net_id,
71 vlan_name, vlan_id)77 vlan_name, vlan_id)
72 new_net_dict = {const.NET_ID: new_net_id,78 new_net_dict = {const.NET_ID: new_net_id,
@@ -88,12 +94,17 @@
88 """94 """
89 LOG.debug("delete_network() called\n")95 LOG.debug("delete_network() called\n")
90 net = self._networks.get(net_id)96 net = self._networks.get(net_id)
97 nexus_driver_flag = conf.NEXUS_DRIVER_ACTIVE
91 # TODO (Sumit) : Verify that no attachments are plugged into the98 # TODO (Sumit) : Verify that no attachments are plugged into the
92 # network99 # network
93 if net:100 if net:
94 # TODO (Sumit) : Before deleting the network, make sure all the101 # TODO (Sumit) : Before deleting the network, make sure all the
95 # ports associated with this network are also deleted102 # ports associated with this network are also deleted
96 self._nexus_plugin.delete_network(tenant_id, net_id)103 if nexus_driver_flag == 'on':
104 LOG.debug("Nexus OS Driver called\n")
105 self._nexus_plugin.delete_network(tenant_id, net_id)
106 else:
107 LOG.debug("No Nexus OS Driver available\n")
97 self._ucs_plugin.delete_network(tenant_id, net_id)108 self._ucs_plugin.delete_network(tenant_id, net_id)
98 self._networks.pop(net_id)109 self._networks.pop(net_id)
99 tenant = self._get_tenant(tenant_id)110 tenant = self._get_tenant(tenant_id)
@@ -118,7 +129,12 @@
118 Virtual Network.129 Virtual Network.
119 """130 """
120 LOG.debug("rename_network() called\n")131 LOG.debug("rename_network() called\n")
121 self._nexus_plugin.rename_network(tenant_id, net_id)132 nexus_driver_flag = conf.NEXUS_DRIVER_ACTIVE
133 if nexus_driver_flag == 'on':
134 LOG.debug("Nexus OS Driver called\n")
135 self._nexus_plugin.rename_network(tenant_id, net_id)
136 else:
137 LOG.debug("No Nexus OS Driver available\n")
122 self._ucs_plugin.rename_network(tenant_id, net_id)138 self._ucs_plugin.rename_network(tenant_id, net_id)
123 network = self._get_network(tenant_id, net_id)139 network = self._get_network(tenant_id, net_id)
124 network[const.NET_NAME] = new_name140 network[const.NET_NAME] = new_name
125141
=== added file 'quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py'
--- quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py 1970-01-01 00:00:00 +0000
+++ quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py 2011-08-02 04:45:54 +0000
@@ -0,0 +1,236 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2#
3# Copyright 2011 Cisco Systems, Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16#
17# @author: Debojyoti Dutta, Cisco Systems, Inc.
18# @author: Edgar Magana, Cisco Systems Inc.
19#
20"""
21Implements a Nexus-OS NETCONF over SSHv2 API Client
22"""
23
24import logging as LOG
25import string
26import subprocess
27
28from quantum.plugins.cisco.common import cisco_configuration as conf
29from quantum.plugins.cisco.common import cisco_constants as const
30from quantum.plugins.cisco.common import cisco_exceptions as cexc
31
32from ncclient import manager
33
34LOG.basicConfig(level=LOG.WARN)
35LOG.getLogger(const.LOGGER_COMPONENT_NAME)
36
37
38# The following are standard strings, messages used to communicate with Nexus,
39#only place holder values change for each message
40exec_conf_prefix = """
41 <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
42 <configure xmlns="http://www.cisco.com/nxos:1.0:vlan_mgr_cli">
43 <__XML__MODE__exec_configure>
44"""
45
46
47exec_conf_postfix = """
48 </__XML__MODE__exec_configure>
49 </configure>
50 </config>
51"""
52
53
54cmd_vlan_conf_snippet = """
55 <vlan>
56 <vlan-id-create-delete>
57 <__XML__PARAM_value>%s</__XML__PARAM_value>
58 <__XML__MODE_vlan>
59 <name>
60 <vlan-name>%s</vlan-name>
61 </name>
62 <state>
63 <vstate>active</vstate>
64 </state>
65 <no>
66 <shutdown/>
67 </no>
68 </__XML__MODE_vlan>
69 </vlan-id-create-delete>
70 </vlan>
71"""
72
73cmd_no_vlan_conf_snippet = """
74 <no>
75 <vlan>
76 <vlan-id-create-delete>
77 <__XML__PARAM_value>%s</__XML__PARAM_value>
78 </vlan-id-create-delete>
79 </vlan>
80 </no>
81"""
82
83cmd_vlan_int_snippet = """
84 <interface>
85 <ethernet>
86 <interface>%s</interface>
87 <__XML__MODE_if-ethernet-switch>
88 <switchport></switchport>
89 <switchport>
90 <trunk>
91 <allowed>
92 <vlan>
93 <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans>
94 <allow-vlans>%s</allow-vlans>
95 </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans>
96 </vlan>
97 </allowed>
98 </trunk>
99 </switchport>
100 </__XML__MODE_if-ethernet-switch>
101 </ethernet>
102 </interface>
103"""
104
105cmd_port_trunk = """
106 <interface>
107 <ethernet>
108 <interface>%s</interface>
109 <__XML__MODE_if-ethernet-switch>
110 <switchport></switchport>
111 <switchport>
112 <mode>
113 <trunk>
114 </trunk>
115 </mode>
116 </switchport>
117 </__XML__MODE_if-ethernet-switch>
118 </ethernet>
119 </interface>
120"""
121
122cmd_no_switchport = """
123 <interface>
124 <ethernet>
125 <interface>%s</interface>
126 <__XML__MODE_if-ethernet-switch>
127 <no>
128 <switchport>
129 </switchport>
130 </no>
131 </__XML__MODE_if-ethernet-switch>
132 </ethernet>
133 </interface>
134"""
135
136
137cmd_no_vlan_int_snippet = """
138 <interface>
139 <ethernet>
140 <interface>%s</interface>
141 <__XML__MODE_if-ethernet-switch>
142 <switchport></switchport>
143 <no>
144 <switchport>
145 <trunk>
146 <allowed>
147 <vlan>
148 <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans>
149 <allow-vlans>%s</allow-vlans>
150 </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans>
151 </vlan>
152 </allowed>
153 </trunk>
154 </switchport>
155 </no>
156 </__XML__MODE_if-ethernet-switch>
157 </ethernet>
158 </interface>
159"""
160
161
162filter_show_vlan_brief_snippet = """
163 <show xmlns="http://www.cisco.com/nxos:1.0:vlan_mgr_cli">
164 <vlan>
165 <brief/>
166 </vlan>
167 </show> """
168
169
170class CiscoNEXUSDriver():
171
172 def __init__(self):
173 pass
174
175 def nxos_connect(self, nexus_host, port, nexus_user, nexus_password):
176 m = manager.connect(host=nexus_host, port=22, username=nexus_user,
177 password=nexus_password)
178 return m
179
180 def enable_vlan(self, mgr, vlanid, vlanname):
181 confstr = cmd_vlan_conf_snippet % (vlanid, vlanname)
182 confstr = exec_conf_prefix + confstr + exec_conf_postfix
183 mgr.edit_config(target='running', config=confstr)
184
185 def disable_vlan(self, mgr, vlanid):
186 confstr = cmd_no_vlan_conf_snippet % vlanid
187 confstr = exec_conf_prefix + confstr + exec_conf_postfix
188 mgr.edit_config(target='running', config=confstr)
189
190 def enable_port_trunk(self, mgr, interface):
191 confstr = cmd_port_trunk % (interface)
192 confstr = exec_conf_prefix + confstr + exec_conf_postfix
193 print confstr
194 mgr.edit_config(target='running', config=confstr)
195
196 def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
197 confstr = cmd_vlan_int_snippet % (interface, vlanid)
198 confstr = exec_conf_prefix + confstr + exec_conf_postfix
199 print confstr
200 mgr.edit_config(target='running', config=confstr)
201
202 def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
203 confstr = cmd_no_vlan_int_snippet % (interface, vlanid)
204 confstr = exec_conf_prefix + confstr + exec_conf_postfix
205 print confstr
206 mgr.edit_config(target='running', config=confstr)
207
208 def test_nxos_api(self, host, user, password):
209 with self.nxos_connect(host, port=22, user=user,
210 password=password) as m:
211 #enable_vlan(m, '100', 'ccn1')
212 #enable_vlan_on_trunk_int(m, '2/1', '100')
213 #disable_vlan_on_trunk_int(m, '2/1', '100')
214 #disable_vlan(m, '100')
215 result = m.get(("subtree", filter_show_vlan_brief_snippet))
216 print result
217
218 def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
219 nexus_password, nexus_interface):
220 #TODO (Edgar) Move the SSH port to the configuration file
221 with self.nxos_connect(nexus_host, 22, nexus_user,
222 nexus_password) as m:
223 self.enable_vlan(m, vlan_id, vlan_name)
224 self.enable_port_trunk(m, nexus_interface)
225
226 def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password):
227 with self.nxos_connect(nexus_host, 22, nexus_user,
228 nexus_password) as m:
229 self.disable_vlan(m, vlan_id)
230
231
232def main():
233 client = CiscoNEXUSDriver()
234
235if __name__ == '__main__':
236 main()
0237
=== modified file 'quantum/plugins/cisco/nexus/cisco_nexus_plugin.py'
--- quantum/plugins/cisco/nexus/cisco_nexus_plugin.py 2011-07-31 18:38:26 +0000
+++ quantum/plugins/cisco/nexus/cisco_nexus_plugin.py 2011-08-02 04:45:54 +0000
@@ -15,6 +15,7 @@
15# under the License.15# under the License.
16#16#
17# @author: Sumit Naiksatam, Cisco Systems, Inc.17# @author: Sumit Naiksatam, Cisco Systems, Inc.
18# @author: Edgar Magana, Cisco Systems, Inc.
18#19#
19import logging as LOG20import logging as LOG
2021
@@ -25,6 +26,8 @@
25from quantum.plugins.cisco.common import cisco_exceptions as cexc26from quantum.plugins.cisco.common import cisco_exceptions as cexc
26from quantum.plugins.cisco.common import cisco_utils as cutil27from quantum.plugins.cisco.common import cisco_utils as cutil
2728
29from quantum.plugins.cisco.nexus import cisco_nexus_network_driver
30
28LOG.basicConfig(level=LOG.WARN)31LOG.basicConfig(level=LOG.WARN)
29LOG.getLogger(const.LOGGER_COMPONENT_NAME)32LOG.getLogger(const.LOGGER_COMPONENT_NAME)
3033
@@ -33,10 +36,12 @@
33 _networks = {}36 _networks = {}
3437
35 def __init__(self):38 def __init__(self):
36 """39 self._client = cisco_nexus_network_driver.CiscoNEXUSDriver()
37 Initialize the Nexus driver here40 #TODO (Edgar) Using just one Nexus 7K Switch and Port
38 """41 self._nexus_ip = conf.NEXUS_IP_ADDRESS
39 pass42 self._nexus_username = cred.Store.getUsername(conf.NEXUS_IP_ADDRESS)
43 self._nexus_password = cred.Store.getPassword(conf.NEXUS_IP_ADDRESS)
44 self._nexus_port = conf.NEXUS_PORT
4045
41 def get_all_networks(self, tenant_id):46 def get_all_networks(self, tenant_id):
42 """47 """
@@ -53,8 +58,9 @@
53 for this VLAN58 for this VLAN
54 """59 """
55 LOG.debug("NexusPlugin:create_network() called\n")60 LOG.debug("NexusPlugin:create_network() called\n")
56 # TODO (Sumit): Call the nexus driver here to create the VLAN, and61 self._client.create_vlan(vlan_name, str(vlan_id), self._nexus_ip,
57 # configure the appropriate interfaces62 self._nexus_username, self._nexus_password, self._nexus_port)
63
58 new_net_dict = {const.NET_ID: net_id,64 new_net_dict = {const.NET_ID: net_id,
59 const.NET_NAME: net_name,65 const.NET_NAME: net_name,
60 const.NET_PORTS: {},66 const.NET_PORTS: {},
@@ -70,9 +76,10 @@
70 """76 """
71 LOG.debug("NexusPlugin:delete_network() called\n")77 LOG.debug("NexusPlugin:delete_network() called\n")
72 net = self._networks.get(net_id)78 net = self._networks.get(net_id)
79 vlan_id = self._get_vlan_id_for_network(tenant_id, net_id)
73 if net:80 if net:
74 # TODO (Sumit): Call the nexus driver here to create the VLAN,81 self._client.delete_vlan(str(vlan_id), self._nexus_ip,
75 # and configure the appropriate interfaces82 self._nexus_username, self._nexus_password)
76 self._networks.pop(net_id)83 self._networks.pop(net_id)
77 return net84 return net
78 # Network not found85 # Network not found
@@ -91,6 +98,7 @@
91 Updates the symbolic name belonging to a particular98 Updates the symbolic name belonging to a particular
92 Virtual Network.99 Virtual Network.
93 """100 """
101 #TODO (Edgar) We need to add an update method in the Nexus Driver
94 LOG.debug("NexusPlugin:rename_network() called\n")102 LOG.debug("NexusPlugin:rename_network() called\n")
95 network = self._get_network(tenant_id, net_id)103 network = self._get_network(tenant_id, net_id)
96 network[const.NET_NAME] = new_name104 network[const.NET_NAME] = new_name
@@ -145,6 +153,11 @@
145 """153 """
146 LOG.debug("NexusPlugin:unplug_interface() called\n")154 LOG.debug("NexusPlugin:unplug_interface() called\n")
147155
156 def _get_vlan_id_for_network(self, tenant_id, network_id):
157 net = self._get_network(tenant_id, network_id)
158 vlan_id = net[const.NET_VLAN_ID]
159 return vlan_id
160
148 def _get_network(self, tenant_id, network_id):161 def _get_network(self, tenant_id, network_id):
149 network = self._networks.get(network_id)162 network = self._networks.get(network_id)
150 if not network:163 if not network:

Subscribers

People subscribed via source and target branches