def test_create_pool_with_mandatory_params(self): """lbaas-pool-create with mandatory params only.""" resource = 'pool' cmd_resource = 'lbaas_pool' cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' lb_algorithm = 'ROUND_ROBIN' listener = 'listener' protocol = 'TCP' args = [ '--lb-algorithm', lb_algorithm, '--protocol', protocol, '--listener', listener ] position_names = [ 'admin_state_up', 'lb_algorithm', 'protocol', 'listener_id' ] position_values = [True, lb_algorithm, protocol, listener] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)
def test_create_pool_with_all_params(self): """lbaas-pool-create with all params set.""" resource = 'pool' cmd_resource = 'lbaas_pool' cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' lb_algorithm = 'ROUND_ROBIN' listener = 'listener' protocol = 'TCP' description = 'description' session_persistence_str = 'type=APP_COOKIE,cookie_name=1234' session_persistence = {'type': 'APP_COOKIE', 'cookie_name': '1234'} name = 'my-pool' args = [ '--lb-algorithm', lb_algorithm, '--protocol', protocol, '--description', description, '--session-persistence', session_persistence_str, '--admin-state-down', '--name', name, '--listener', listener ] position_names = [ 'lb_algorithm', 'protocol', 'description', 'session_persistence', 'admin_state_up', 'name', 'listener_id' ] position_values = [ lb_algorithm, protocol, description, session_persistence, False, name, listener ] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource)
def test_create_pool_with_no_listener_or_loadbalancer(self): """lbaas-pool-create with no listener or loadbalancer.""" resource = 'pool' cmd_resource = 'lbaas_pool' cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None) my_id = 'my-id' lb_algorithm = 'ROUND_ROBIN' protocol = 'TCP' args = ['--lb-algorithm', lb_algorithm, '--protocol', protocol] position_names = ['admin_state_up', 'lb_algorithm', 'protocol'] position_values = [True, lb_algorithm, protocol] 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)