Browse code

Remove the Cisco Nexus monolithic plugin support

The Cisco Nexus monolithic plugin does not work without the Open
vSwitch plugin. The Open vSwitch plugin is scheduled to be removed
as per #1323729. This patch removes the Nexus Hardware switch
related code from devstack. The N1KV virtual switch related code
will still remain in the tree as it doesn't depend on Open vSwitch
plugin.

Closes-Bug: #1350387
Change-Id: I82ebb09c64589fc9b7bb790982541bc87c66e6e3

Pritesh Kothari authored on 2014/09/16 01:29:55
Showing 1 changed files
... ...
@@ -20,38 +20,12 @@ Q_CISCO_PLUGIN_VXLAN_ID_RANGES=${Q_CISCO_PLUGIN_VXLAN_ID_RANGES:-5000:10000}
20 20
 # Specify the VLAN range
21 21
 Q_CISCO_PLUGIN_VLAN_RANGES=${Q_CISCO_PLUGIN_VLAN_RANGES:-vlan:1:4094}
22 22
 
23
-# Specify ncclient package information
24
-NCCLIENT_DIR=$DEST/ncclient
25
-NCCLIENT_VERSION=${NCCLIENT_VERSION:-0.3.1}
26
-NCCLIENT_REPO=${NCCLIENT_REPO:-git://github.com/CiscoSystems/ncclient.git}
27
-NCCLIENT_BRANCH=${NCCLIENT_BRANCH:-master}
28
-
29 23
 # This routine put a prefix on an existing function name
30 24
 function _prefix_function {
31 25
     declare -F $1 > /dev/null || die "$1 doesn't exist"
32 26
     eval "$(echo "${2}_${1}()"; declare -f ${1} | tail -n +2)"
33 27
 }
34 28
 
35
-function _has_ovs_subplugin {
36
-    local subplugin
37
-    for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
38
-        if [[ "$subplugin" == "openvswitch" ]]; then
39
-            return 0
40
-        fi
41
-    done
42
-    return 1
43
-}
44
-
45
-function _has_nexus_subplugin {
46
-    local subplugin
47
-    for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
48
-        if [[ "$subplugin" == "nexus" ]]; then
49
-            return 0
50
-        fi
51
-    done
52
-    return 1
53
-}
54
-
55 29
 function _has_n1kv_subplugin {
56 30
     local subplugin
57 31
     for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
... ...
@@ -62,27 +36,6 @@ function _has_n1kv_subplugin {
62 62
     return 1
63 63
 }
64 64
 
65
-# This routine populates the cisco config file with the information for
66
-# a particular nexus switch
67
-function _config_switch {
68
-    local cisco_cfg_file=$1
69
-    local switch_ip=$2
70
-    local username=$3
71
-    local password=$4
72
-    local ssh_port=$5
73
-    shift 5
74
-
75
-    local section="NEXUS_SWITCH:$switch_ip"
76
-    iniset $cisco_cfg_file $section username $username
77
-    iniset $cisco_cfg_file $section password $password
78
-    iniset $cisco_cfg_file $section ssh_port $ssh_port
79
-
80
-    while [[ ${#@} != 0 ]]; do
81
-        iniset  $cisco_cfg_file $section $1 $2
82
-        shift 2
83
-    done
84
-}
85
-
86 65
 # Prefix openvswitch plugin routines with "ovs" in order to differentiate from
87 66
 # cisco plugin routines. This means, ovs plugin routines will coexist with cisco
88 67
 # plugin routines in this script.
... ...
@@ -98,73 +51,17 @@ _prefix_function neutron_plugin_configure_service ovs
98 98
 _prefix_function neutron_plugin_setup_interface_driver ovs
99 99
 _prefix_function has_neutron_plugin_security_group ovs
100 100
 
101
-# Check the version of the installed ncclient package
102
-function check_ncclient_version {
103
-python << EOF
104
-version = '$NCCLIENT_VERSION'
105
-import sys
106
-try:
107
-    import pkg_resources
108
-    import ncclient
109
-    module_version = pkg_resources.get_distribution('ncclient').version
110
-    if version != module_version:
111
-        sys.exit(1)
112
-except:
113
-    sys.exit(1)
114
-EOF
115
-}
116
-
117
-# Install the ncclient package
118
-function install_ncclient {
119
-    git_clone $NCCLIENT_REPO $NCCLIENT_DIR $NCCLIENT_BRANCH
120
-    (cd $NCCLIENT_DIR; sudo python setup.py install)
121
-}
122
-
123
-# Check if the required version of ncclient has been installed
124
-function is_ncclient_installed {
125
-    # Check if the Cisco ncclient repository exists
126
-    if [[ -d $NCCLIENT_DIR ]]; then
127
-        remotes=$(cd $NCCLIENT_DIR; git remote -v | grep fetch | awk '{ print $2}')
128
-        for remote in $remotes; do
129
-            if [[ $remote == $NCCLIENT_REPO ]]; then
130
-                break;
131
-            fi
132
-        done
133
-        if [[ $remote != $NCCLIENT_REPO ]]; then
134
-            return 1
135
-        fi
136
-    else
137
-        return 1
138
-    fi
139
-
140
-    # Check if the ncclient is installed with the right version
141
-    if ! check_ncclient_version; then
142
-        return 1
143
-    fi
144
-    return 0
145
-}
146
-
147 101
 function has_neutron_plugin_security_group {
148
-    if _has_ovs_subplugin; then
149
-        ovs_has_neutron_plugin_security_group
150
-    else
151
-        return 1
152
-    fi
102
+    return 1
153 103
 }
154 104
 
155 105
 function is_neutron_ovs_base_plugin {
156
-    # Cisco uses OVS if openvswitch subplugin is deployed
157
-    _has_ovs_subplugin
158 106
     return
159 107
 }
160 108
 
161 109
 # populate required nova configuration parameters
162 110
 function neutron_plugin_create_nova_conf {
163
-    if _has_ovs_subplugin; then
164
-        ovs_neutron_plugin_create_nova_conf
165
-    else
166
-        _neutron_ovs_base_configure_nova_vif_driver
167
-    fi
111
+    _neutron_ovs_base_configure_nova_vif_driver
168 112
 }
169 113
 
170 114
 function neutron_plugin_install_agent_packages {
... ...
@@ -177,32 +74,14 @@ function neutron_plugin_configure_common {
177 177
     # setup default subplugins
178 178
     if [ ! -v Q_CISCO_PLUGIN_SUBPLUGINS ]; then
179 179
         declare -ga Q_CISCO_PLUGIN_SUBPLUGINS
180
-        Q_CISCO_PLUGIN_SUBPLUGINS=(openvswitch nexus)
181
-    fi
182
-    if _has_ovs_subplugin; then
183
-        ovs_neutron_plugin_configure_common
184
-        Q_PLUGIN_EXTRA_CONF_PATH=etc/neutron/plugins/cisco
185
-        Q_PLUGIN_EXTRA_CONF_FILES=(cisco_plugins.ini)
186
-        # Copy extra config files to /etc so that they can be modified
187
-        # later according to Cisco-specific localrc settings.
188
-        mkdir -p /$Q_PLUGIN_EXTRA_CONF_PATH
189
-        local f
190
-        local extra_conf_file
191
-        for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
192
-            extra_conf_file=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
193
-            cp $NEUTRON_DIR/$extra_conf_file /$extra_conf_file
194
-        done
195
-    else
196
-        Q_PLUGIN_CONF_PATH=etc/neutron/plugins/cisco
197
-        Q_PLUGIN_CONF_FILENAME=cisco_plugins.ini
180
+        Q_CISCO_PLUGIN_SUBPLUGINS=(n1kv)
198 181
     fi
182
+    Q_PLUGIN_CONF_PATH=etc/neutron/plugins/cisco
183
+    Q_PLUGIN_CONF_FILENAME=cisco_plugins.ini
199 184
     Q_PLUGIN_CLASS="neutron.plugins.cisco.network_plugin.PluginV2"
200 185
 }
201 186
 
202 187
 function neutron_plugin_configure_debug_command {
203
-    if _has_ovs_subplugin; then
204
-        ovs_neutron_plugin_configure_debug_command
205
-    fi
206 188
 }
207 189
 
208 190
 function neutron_plugin_configure_dhcp_agent {
... ...
@@ -210,53 +89,6 @@ function neutron_plugin_configure_dhcp_agent {
210 210
 }
211 211
 
212 212
 function neutron_plugin_configure_l3_agent {
213
-    if _has_ovs_subplugin; then
214
-        ovs_neutron_plugin_configure_l3_agent
215
-    fi
216
-}
217
-
218
-function _configure_nexus_subplugin {
219
-    local cisco_cfg_file=$1
220
-
221
-    # Install a known compatible ncclient from the Cisco repository if necessary
222
-    if ! is_ncclient_installed; then
223
-        # Preserve the two global variables
224
-        local offline=$OFFLINE
225
-        local reclone=$RECLONE
226
-        # Change their values to allow installation
227
-        OFFLINE=False
228
-        RECLONE=yes
229
-        install_ncclient
230
-        # Restore their values
231
-        OFFLINE=$offline
232
-        RECLONE=$reclone
233
-    fi
234
-
235
-    # Setup default nexus switch information
236
-    if [ ! -v Q_CISCO_PLUGIN_SWITCH_INFO ]; then
237
-        declare -A Q_CISCO_PLUGIN_SWITCH_INFO
238
-        HOST_NAME=$(hostname)
239
-        Q_CISCO_PLUGIN_SWITCH_INFO=([1.1.1.1]=stack:stack:22:${HOST_NAME}:1/10)
240
-    else
241
-        iniset $cisco_cfg_file CISCO nexus_driver neutron.plugins.cisco.nexus.cisco_nexus_network_driver_v2.CiscoNEXUSDriver
242
-    fi
243
-
244
-    # Setup the switch configurations
245
-    local nswitch
246
-    local sw_info
247
-    local segment
248
-    local sw_info_array
249
-    declare -i count=0
250
-    for nswitch in ${!Q_CISCO_PLUGIN_SWITCH_INFO[@]}; do
251
-        sw_info=${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]}
252
-        sw_info_array=${sw_info//:/ }
253
-        sw_info_array=( $sw_info_array )
254
-        count=${#sw_info_array[@]}
255
-        if [[ $count < 5 || $(( ($count-3) % 2 )) != 0 ]]; then
256
-            die $LINENO "Incorrect switch configuration: ${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]}"
257
-        fi
258
-        _config_switch $cisco_cfg_file $nswitch ${sw_info_array[@]}
259
-    done
260 213
 }
261 214
 
262 215
 # Configure n1kv plugin
... ...
@@ -279,48 +111,29 @@ function _configure_n1kv_subplugin {
279 279
 }
280 280
 
281 281
 function neutron_plugin_configure_plugin_agent {
282
-    if _has_ovs_subplugin; then
283
-        ovs_neutron_plugin_configure_plugin_agent
284
-    fi
285 282
 }
286 283
 
287 284
 function neutron_plugin_configure_service {
288 285
     local subplugin
289 286
     local cisco_cfg_file
290 287
 
291
-    if _has_ovs_subplugin; then
292
-        ovs_neutron_plugin_configure_service
293
-        cisco_cfg_file=/${Q_PLUGIN_EXTRA_CONF_FILES[0]}
294
-    else
295
-        cisco_cfg_file=/$Q_PLUGIN_CONF_FILE
296
-    fi
288
+    cisco_cfg_file=/$Q_PLUGIN_CONF_FILE
297 289
 
298 290
     # Setup the [CISCO_PLUGINS] section
299 291
     if [[ ${#Q_CISCO_PLUGIN_SUBPLUGINS[@]} > 2 ]]; then
300 292
         die $LINENO "At most two subplugins are supported."
301 293
     fi
302 294
 
303
-    if _has_ovs_subplugin && _has_n1kv_subplugin; then
304
-        die $LINENO "OVS subplugin and n1kv subplugin cannot coexist"
305
-    fi
306
-
307 295
     # Setup the subplugins
308
-    inicomment $cisco_cfg_file CISCO_PLUGINS nexus_plugin
309 296
     inicomment $cisco_cfg_file CISCO_PLUGINS vswitch_plugin
310 297
     inicomment $cisco_cfg_file CISCO_TEST host
311 298
     for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
312 299
         case $subplugin in
313
-            nexus) iniset $cisco_cfg_file CISCO_PLUGINS nexus_plugin neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin;;
314
-            openvswitch) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2;;
315 300
             n1kv) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2;;
316 301
             *) die $LINENO "Unsupported cisco subplugin: $subplugin";;
317 302
         esac
318 303
     done
319 304
 
320
-    if _has_nexus_subplugin; then
321
-        _configure_nexus_subplugin $cisco_cfg_file
322
-    fi
323
-
324 305
     if _has_n1kv_subplugin; then
325 306
         _configure_n1kv_subplugin $cisco_cfg_file
326 307
     fi