2 * Copyright (C) 2015 IBM, Inc.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.neutron.e2etest;
11 public class NeutronLBPoolTests {
14 public NeutronLBPoolTests(String base) {
18 public void pool_collection_get_test() {
19 String url = base + "/lbaas/pools";
20 ITNeutronE2E.test_fetch(url, "LB Pool Collection GET failed");
23 //TODO handle SB check
24 public String singleton_lb_pool_create_test() {
25 String url = base + "/lbaas/pools";
26 String content = "{ \"pool\": { " + "\"admin_state_up\": true, " + "\"description\": \"simple pool\", "
27 + "\"healthmonitor_id\": null, " + "\"id\": \"12ff63af-4127-4074-a251-bcb2ecc53ebe\", "
28 + "\"lb_algorithm\": \"ROUND_ROBIN\", " + "\"listeners\": [ { "
29 + "\"id\": \"39de4d56-d663-46e5-85a1-5b9d5fa17829\" } ], " + "\"members\": [], "
30 + "\"name\": \"pool1\", " + "\"protocol\": \"HTTP\", " + "\"session_persistence\": { "
31 + "\"cookie_name\": \"my_cookie\", " + "\"type\": \"APP_COOKIE\" }, "
32 + "\"tenant_id\": \"b7c1a69e88bf4b21a8148f787aef2081\" } }";
33 ITNeutronE2E.test_create(url, content, "Singleton LB Pool Post Failed NB");
37 public void singleton_lb_pool_get_with_one_query_item_test(String createJsonString) {
38 String url = base + "/lbaas/pools";
39 ITNeutronE2E.test_fetch_with_one_query_item(url, createJsonString, "pools");
42 public void pool_update_test() {
43 String url = base + "/lbaas/pools/12ff63af-4127-4074-a251-bcb2ecc53ebe";
44 String content = " { \"pool\": { \"admin_state_up\": false," + "\"description\": \"pool two\","
45 + "\"healthmonitor_id\": null," + "\"id\": \"12ff63af-4127-4074-a251-bcb2ecc53ebe\","
46 + "\"lb_algorithm\": \"LEAST_CONNECTIONS\"," + "\"listeners\": [ {"
47 + "\"id\": \"39de4d56-d663-46e5-85a1-5b9d5fa17829\" } ]," + "\"members\": []," + "\"name\": \"pool2\","
48 + "\"protocol\": \"HTTP\"," + "\"session_persistence\": { \"cookie_name\": null,"
49 + "\"type\": \"HTTP_COOKIE\" }," + "\"tenant_id\": \"1a3e005cf9ce40308c900bcb08e5320c\" } }";
50 ITNeutronE2E.test_modify(url, content, "LB Pool Put Failed");
53 public void pool_element_get_test() {
54 String url = base + "/lbaas/pools/12ff63af-4127-4074-a251-bcb2ecc53ebe";
55 ITNeutronE2E.test_fetch(url, true, "LB Pool Element Get Failed");
58 public void pool_element_get_with_query_test() {
59 String url = base + "/lbaas/pools/12ff63af-4127-4074-a251-bcb2ecc53ebe"
60 + "?fields=id&fields=tenant_id&fields=name&fields=description"
61 + "&fields=lb_algorithm&fields=protocol&fields=healthmonitor_id"
62 + "&fields=members&fields=admin_state_up&fields=limit&fields=marker" + "&fields=page_reverse";
63 ITNeutronE2E.test_fetch(url, true, "LB Pool Element Get With Query Failed");
66 public void pool_element_negative_get_test() {
67 String url = base + "/lbaas/pools/12ff63af-4127-4074-a251-bcb2ecc53ebe";
68 ITNeutronE2E.test_fetch(url, false, "LB Pool Element Negative Get Failed");
71 public void pool_delete_test() {
72 String url = base + "/lbaas/pools/12ff63af-4127-4074-a251-bcb2ecc53ebe";
73 ITNeutronE2E.test_delete(url, "LB Pool Element Delete Failed");
76 public static void runTests(String base) {
77 NeutronLBPoolTests poolTester = new NeutronLBPoolTests(base);
78 String createJsonString = poolTester.singleton_lb_pool_create_test();
79 poolTester.singleton_lb_pool_get_with_one_query_item_test(createJsonString);
80 poolTester.pool_update_test();
81 poolTester.pool_element_get_test();
82 poolTester.pool_element_get_with_query_test();
83 poolTester.pool_collection_get_test();
84 poolTester.pool_delete_test();
85 poolTester.pool_element_negative_get_test();
86 // needed for pool member testing
87 poolTester.singleton_lb_pool_create_test();