def test_create_listener_with_all_params(self): """lbaas-listener-create with all params set.""" resource = 'listener' cmd_resource = 'lbaas_listener' cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' loadbalancer = 'loadbalancer' protocol = 'TCP' protocol_port = '80' def_tls_cont_id = '11111' args = [ '--admin-state-down', '--protocol', protocol, '--protocol-port', protocol_port, '--loadbalancer', loadbalancer, '--default-tls-container-id', def_tls_cont_id, '--sni-container-ids', '1111', '2222', '3333' ] position_names = [ 'admin_state_up', 'protocol', 'protocol_port', 'loadbalancer_id', 'default_tls_container_id', 'sni_container_ids' ] position_values = [ False, protocol, protocol_port, loadbalancer, def_tls_cont_id, ['1111', '2222', '3333'] ] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)
def test_create_listener_with_all_params(self): """lbaas-listener-create with all params set.""" resource = 'listener' cmd_resource = 'lbaas_listener' cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' loadbalancer = 'loadbalancer' protocol = 'TCP' protocol_port = '80' args = [ '--admin-state-down', '--protocol', protocol, '--protocol-port', protocol_port, '--loadbalancer', loadbalancer ] position_names = [ 'admin_state_up', 'protocol', 'protocol_port', 'loadbalancer_id' ] position_values = [False, protocol, protocol_port, loadbalancer] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)
def test_create_listener_with_mandatory_params(self): """lbaas-listener-create with mandatory params only.""" resource = 'listener' cmd_resource = 'lbaas_listener' cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' loadbalancer_id = 'loadbalancer' protocol = 'TCP' protocol_port = '80' args = ['--protocol', protocol, '--protocol-port', protocol_port, '--loadbalancer', loadbalancer_id] position_names = ['protocol', 'protocol_port', 'loadbalancer_id'] position_values = [protocol, protocol_port, loadbalancer_id, True] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)
def test_create_listener_with_no_loadbalancer_or_default_pool(self): # lbaas-listener-create without --default-pool or --loadbalancer. resource = 'listener' cmd_resource = 'lbaas_listener' cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' protocol = 'TCP' protocol_port = '80' args = ['--protocol', protocol, '--protocol-port', protocol_port] position_names = ['protocol', 'protocol_port'] position_values = [protocol, protocol_port, True] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource, no_api_call=True, expected_exception=exceptions.CommandError)
def test_create_listener_with_default_pool(self): # lbaas-listener-create with --default-pool and no --loadbalancer. resource = 'listener' cmd_resource = 'lbaas_listener' cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' default_pool_id = 'default-pool' protocol = 'TCP' protocol_port = '80' args = [ '--protocol', protocol, '--protocol-port', protocol_port, '--default-pool', default_pool_id ] position_names = ['protocol', 'protocol_port', 'default_pool_id'] position_values = [protocol, protocol_port, default_pool_id, True] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)