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 import java.io.OutputStreamWriter;
13 import java.lang.Thread;
15 import java.net.HttpURLConnection;
18 import org.junit.Assert;
20 public class NeutronSecurityRuleTests {
23 public NeutronSecurityRuleTests(String base) {
27 public void securityRule_collection_get_test() {
28 String url = base + "/security-group-rules";
29 ITNeutronE2E.test_fetch(url, "Security Rule Collection GET failed");
32 public void singleton_sr_create_test() {
33 String url = base + "/security-group-rules";
34 String content = " {\"security_group_rule\": " +
35 "{\"remote_group_id\": null, \"direction\": \"ingress\", " +
36 "\"remote_ip_prefix\": null, \"protocol\": \"tcp\", " +
37 "\"ethertype\": \"IPv6\", \"tenant_id\": " +
38 "\"00f340c7c3b34ab7be1fc690c05a0275\", \"port_range_max\": 77, " +
39 "\"port_range_min\": 77, " +
40 "\"id\": \"9b4be7fa-e56e-40fb-9516-1f0fa9185669\", " +
41 "\"security_group_id\": " +
42 "\"b60490fe-60a5-40be-af63-1d641381b784\"}}";
43 ITNeutronE2E.test_create(url, content, "Security Rule Singleton Post Failed");
46 public void sr_element_get_test() {
47 String url = base + "/security-group-rules/9b4be7fa-e56e-40fb-9516-1f0fa9185669";
48 ITNeutronE2E.test_fetch(url, true, "Security Rule Element Get Failed");
51 public void sr_delete_test() {
52 String url = base + "/security-group-rules/9b4be7fa-e56e-40fb-9516-1f0fa9185669";
53 ITNeutronE2E.test_delete(url, "Security Rule Delete Failed");
56 public void sr_element_negative_get_test() {
57 String url = base + "/security-group-rules/9b4be7fa-e56e-40fb-9516-1f0fa9185669";
58 ITNeutronE2E.test_fetch(url, false, "Security Rule Element Negative Get Failed");
61 public static void runTests(String base) {
62 NeutronSecurityRuleTests securityRule_tester = new NeutronSecurityRuleTests(base);
63 securityRule_tester.securityRule_collection_get_test();
64 securityRule_tester.singleton_sr_create_test();
65 securityRule_tester.sr_element_get_test();
66 securityRule_tester.sr_delete_test();
67 securityRule_tester.sr_element_negative_get_test();