Followup fixes to FWaaS API patch

Fixes: bug #1206620

This adds the minor fixes which were suggested be fixed
as a followup to the FWaaS API patch.

Change-Id: I8112dcb4f750bb367dcc6464cda7a826b7be811e
This commit is contained in:
Sumit Naiksatam 2013-07-31 23:25:59 -07:00
parent 1230276b36
commit ab1a932872
2 changed files with 6 additions and 9 deletions

View File

@ -211,13 +211,10 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
def _get_min_max_ports_from_range(self, port_range): def _get_min_max_ports_from_range(self, port_range):
if not port_range: if not port_range:
return [None, None] return [None, None]
ports = port_range.split(':') min_port, sep, max_port = port_range.partition(":")
ports[0] = int(ports[0]) if not max_port:
if len(ports) < 2: max_port = min_port
ports.append(ports[0]) return [int(min_port), int(max_port)]
else:
ports[1] = int(ports[1])
return ports
def _get_port_range_from_min_max_ports(self, min_port, max_port): def _get_port_range_from_min_max_ports(self, min_port, max_port):
if not min_port: if not min_port:
@ -225,7 +222,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
if min_port == max_port: if min_port == max_port:
return str(min_port) return str(min_port)
else: else:
return str(min_port) + ':' + str(max_port) return '%d:%d' % (min_port, max_port)
def create_firewall(self, context, firewall): def create_firewall(self, context, firewall):
LOG.debug(_("create_firewall() called")) LOG.debug(_("create_firewall() called"))

View File

@ -86,7 +86,7 @@ class FirewallInvalidPortValue(qexception.InvalidInput):
class FirewallRuleInfoMissing(qexception.InvalidInput): class FirewallRuleInfoMissing(qexception.InvalidInput):
message = _("Missing rule info argument for insert/remove " message = _("Missing rule info argument for insert/remove "
"rule opertaion.") "rule operation.")
fw_valid_protocol_values = [None, constants.TCP, constants.UDP, constants.ICMP] fw_valid_protocol_values = [None, constants.TCP, constants.UDP, constants.ICMP]