Random cleanups

Use 'if (' instead of 'if('

Use common util method for validating vlan tags

Change-Id: I26401e3d9c10b581793c1e8abcbcdf7a7ea304f0
This commit is contained in:
Gary Kotton 2015-11-19 05:39:24 -08:00
parent 43a52e0a58
commit 410af60a91
3 changed files with 13 additions and 18 deletions

View File

@ -537,12 +537,7 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
msg = _('Invalid binding:profile. parent_name "%s" must be '
'a string.') % parent_name
raise n_exc.InvalidInput(error_message=msg)
try:
# FIXME(arosen): use neutron.plugins.common.utils.is_valid_vlan_tag
tag = int(tag)
if(tag < 0 or tag > 4095):
raise ValueError
except ValueError:
if not n_utils.is_valid_vlan_tag(tag):
msg = _('Invalid binding:profile. tag "%s" must be '
'an int between 1 and 4096, inclusive.') % tag
raise n_exc.InvalidInput(error_message=msg)