Browse Source

Add --provider to load balancer create

Story: 2004875
Task: 29143

Change-Id: Ie5543ab98c62163aec4123c443a80222083fe135
changes/62/633562/1
Carlos Goncalves 2 years ago
parent
commit
755924ae4b
3 changed files with 35 additions and 0 deletions
  1. +6
    -0
      octaviaclient/osc/v2/load_balancer.py
  2. +25
    -0
      octaviaclient/tests/unit/osc/v2/test_load_balancer.py
  3. +4
    -0
      releasenotes/notes/add-provider-load-balancer-create-4d151209dee32f81.yaml

+ 6
- 0
octaviaclient/osc/v2/load_balancer.py View File

@ -94,6 +94,12 @@ class CreateLoadBalancer(command.ShowOne):
help="Project for the load balancer (name or ID)."
)
parser.add_argument(
'--provider',
metavar='<provider>',
help="Provider name for the load balancer."
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',


+ 25
- 0
octaviaclient/tests/unit/osc/v2/test_load_balancer.py View File

@ -262,6 +262,31 @@ class TestLoadBalancerCreate(TestLoadBalancer):
self.api_mock.load_balancer_create.assert_called_with(
json={'loadbalancer': lb_info})
@mock.patch('octaviaclient.osc.v2.utils.get_loadbalancer_attrs')
def test_load_balancer_create_with_provider(self, mock_client):
provider = 'foobar'
lb_info = copy.deepcopy(self.lb_info)
lb_info.update({'provider': provider})
mock_client.return_value = lb_info
arglist = [
'--name', self._lb.name,
'--vip-network-id', self._lb.vip_network_id,
'--project', self._lb.project_id,
'--provider', provider,
]
verifylist = [
('name', self._lb.name),
('vip_network_id', self._lb.vip_network_id),
('project', self._lb.project_id),
('provider', provider),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.api_mock.load_balancer_create.assert_called_with(
json={'loadbalancer': lb_info})
@mock.patch('octaviaclient.osc.v2.utils.get_loadbalancer_attrs')
def test_load_balancer_create_missing_args(self, mock_client):
attrs_list = self.lb_info


+ 4
- 0
releasenotes/notes/add-provider-load-balancer-create-4d151209dee32f81.yaml View File

@ -0,0 +1,4 @@
---
features:
- |
Added --provider as optional argument to load balancer create.

Loading…
Cancel
Save