diff options
author | Reedip Banerjee <reedip.banerjee@nectechnologies.in> | 2015-11-11 12:19:02 +0530 |
---|---|---|
committer | abregman <abregman@redhat.com> | 2016-02-15 06:30:42 +0000 |
commit | 721b526b87cdf9635752a7c058369ec501480e48 (patch) | |
tree | e04f8822a65e2b67c80db98bbf702e6f2f29ad3a | |
parent | c1701c1d289beed3710b17653e386bb3fbffb0c7 (diff) | |
download | python-neutronclient-721b526b87cdf9635752a7c058369ec501480e48.tar.gz |
Fixed connection_limit and added UT
Due to a typo, the REST API attribute of connection_limit was
not accessed when creating a new lbaas-V2 listener.
This patch fixes the typo, so that the connection_limit can
be initialized when listener is created. Also, the previous
code did not have UT for connection_limit when the listener
was created. The same has been added here.
Closes-Bug: #1515112
Conflicts:
neutronclient/neutron/v2_0/lb/v2/listener.py
Change-Id: I71eef7b92de91edc1f3ce48f40c645bca704427d
(cherry picked from commit 9baa62c3c58f4d6187ab22fc3c04843efd283b55)
-rw-r--r-- | neutronclient/neutron/v2_0/lb/v2/listener.py | 5 | ||||
-rw-r--r-- | neutronclient/tests/unit/lb/v2/test_cli20_listener.py | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/neutronclient/neutron/v2_0/lb/v2/listener.py b/neutronclient/neutron/v2_0/lb/v2/listener.py index 46afc50..8dd2359 100644 --- a/neutronclient/neutron/v2_0/lb/v2/listener.py +++ b/neutronclient/neutron/v2_0/lb/v2/listener.py @@ -56,7 +56,8 @@ class CreateListener(neutronV20.CreateCommand): parser.add_argument( '--connection-limit', help=_('The maximum number of connections per second allowed for ' - 'the vip. Positive integer or -1 for unlimited (default).')) + 'the vip. Positive integer or -1 for unlimited (default).'), + type=int) parser.add_argument( '--description', help=_('Description of the listener.')) @@ -104,7 +105,7 @@ class CreateListener(neutronV20.CreateCommand): } neutronV20.update_dict(parsed_args, body[self.resource], - ['connection-limit', 'description', + ['connection_limit', 'description', 'loadbalancer_id', 'name', 'default_tls_container_ref', 'sni_container_refs', diff --git a/neutronclient/tests/unit/lb/v2/test_cli20_listener.py b/neutronclient/tests/unit/lb/v2/test_cli20_listener.py index 6ecac35..f4fca1d 100644 --- a/neutronclient/tests/unit/lb/v2/test_cli20_listener.py +++ b/neutronclient/tests/unit/lb/v2/test_cli20_listener.py @@ -49,17 +49,21 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base): loadbalancer = 'loadbalancer' protocol = 'TCP' protocol_port = '80' + connection_limit = 10 def_tls_cont_ref = '11111' args = ['--admin-state-down', '--protocol', protocol, '--protocol-port', protocol_port, '--loadbalancer', loadbalancer, '--default-tls-container-ref', def_tls_cont_ref, - '--sni-container-refs', '1111', '2222', '3333'] + '--sni-container-refs', '1111', '2222', '3333', + '--connection-limit', '10'] position_names = ['admin_state_up', 'protocol', 'protocol_port', 'loadbalancer_id', - 'default_tls_container_ref', 'sni_container_refs'] + 'default_tls_container_ref', 'sni_container_refs', + 'connection_limit'] position_values = [False, protocol, protocol_port, loadbalancer, - def_tls_cont_ref, ['1111', '2222', '3333']] + def_tls_cont_ref, ['1111', '2222', '3333'], + connection_limit] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource) |