Clean up code in Cisco Nexus plugin's _get_all_segmentation_ids

Bug #1180783 reported by Dane LeBlanc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Sahid Orentino

Bug Description

The implementation of the _get_all_segmentation_ids method in the Cisco Nexus plugin's virt_phy_sw_v2 module can be cleaned up. The six lines in the current implementation can be replaced with a single line. This was brought up in the review for blueprint cisco-plugin-exception-handling. The comment in that review explains:
 Unrelated to this change, but can we file a bug to clean this up? Replace 170-175 with:
             return ','.join(str(v_id) for v_id in cdb.get_ovs_vlans() if int(v_id) > 0)
Also, in the __init__ method for VirtualPhysicalSwitchModelV2 class in the same module, the '\n' can be removed from this line:
        LOG.debug(_("Loaded device plugin %s\n"),

Tags: cisco
tags: added: cisco
Changed in quantum:
importance: Undecided → Low
status: New → Triaged
Changed in neutron:
assignee: nobody → sahid (sahid-ferdjaoui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/46284

Changed in neutron:
status: Triaged → In Progress
Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

These methods are no longer used in the module:
  * _get_all_segmentation_ids (comment from Dane LeBlanc - https://review.openstack.org/#/c/46284/1/neutron/plugins/cisco/models/virt_phy_sw_v2.py)
  * _validate_vlan_id

Should we have to keep these?

If yes the method "_validate_vlan_id" can be review like that:
    def _validate_vlan_id(self, vlan_id):
        return (vlan_id and int(vlan_id) > 1)

Revision history for this message
Henry Gessau (gessau) wrote :

Both methods should be removed.

There is a common neutron function for checking vlan tags:
  neutron.common.utils.is_valid_vlan_tag

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/46284
Committed: http://github.com/openstack/neutron/commit/f342f25807442f0243011ba5fa331aacb013bcaf
Submitter: Jenkins
Branch: master

commit f342f25807442f0243011ba5fa331aacb013bcaf
Author: Sahid Orentino Ferdjaoui <email address hidden>
Date: Thu Sep 12 14:38:28 2013 +0200

    Clean up code of virt_phy_sw_v2 module

     Removes two methods not used:
     * _get_all_segmentation_ids
     * _validate_vlan_id

     About log formatting:
     * In the __init__, '\n' can be removed from this line:
         LOG.debug(_("Loaded device plugin %s\n"),

    Closes-Bug: 1180783

    Change-Id: Ic0aea7e8016f198e2ba245c710e12bc490720039

Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
milestone: none → havana-rc1
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Released → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.