checkstyle: TypeName
[neutron.git] / integration / test / src / test / java / org / opendaylight / neutron / e2etest / TempestPortsIpV6TestJSON.java
1 /*
2  * Copyright (C) 2015 IBM, Inc.
3  *
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
7  */
8
9 package org.opendaylight.neutron.e2etest;
10
11 public class TempestPortsIpV6TestJSON {
12     String base;
13
14     public TempestPortsIpV6TestJSON(String base) {
15         this.base = base;
16     }
17
18     public void test_create_port_in_allowed_allocation_pools() {
19         // create network
20         String urlN = base + "/networks";
21         String contentN = " {\"network\": {\"status\": \"ACTIVE\", \"subnets\": [], \"name\":"
22                 + " \"test-network--1850822235\", \"router:external\": false, "
23                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"admin_state_up\": true,"
24                 + " \"mtu\": 0, \"shared\": false, \"port_security_enabled\": true, "
25                 + "\"id\": \"114ddf69-8ccd-46bb-92fb-bc3e921318d4\"}}";
26         ITNeutronE2E.test_create(urlN, contentN, "test_create_port_in_allowed_allocation_pools Network Post Failed");
27
28         // create subnet
29         String urlS = base + "/subnets";
30         String contentS1 = "{\"subnet\": {\"name\": \"\", \"enable_dhcp\": true, "
31                 + "\"network_id\": \"114ddf69-8ccd-46bb-92fb-bc3e921318d4\", "
32                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"dns_nameservers\": [], "
33                 + "\"gateway_ip\": \"2003::1\", \"ipv6_ra_mode\": null, "
34                 + "\"allocation_pools\": [{\"start\": \"2003::4\", \"end\": \"2003::6\"}], \"host_routes\": [], "
35                 + "\"ip_version\": 6, \"ipv6_address_mode\": null, \"cidr\": \"2003::/64\", "
36                 + "\"id\": \"77c68c25-72a6-415b-a6f0-886fe26f1b02\", \"subnetpool_id\": null}}";
37         ITNeutronE2E.test_create(urlS, contentS1, "test_create_port_in_allowed_allocation_pools Subnet Post Failed");
38
39         String urlP = base + "/ports";
40         String contentP1 = "{ \"port\": {\"status\": \"ACTIVE\", \"binding:host_id\": \"odl-devstack\","
41                 + " \"allowed_address_pairs\": [], \"extra_dhcp_opts\": [], \"device_owner\": \"network:dhcp\","
42                 + " \"port_security_enabled\": false, \"binding:profile\": {}, \"fixed_ips\": "
43                 + "[{\"subnet_id\": \"77c68c25-72a6-415b-a6f0-886fe26f1b02\", \"ip_address\": \"2003::5\"}], "
44                 + "\"id\": \"7d8f5c18-fcde-471e-8a64-3dfd249cae92\", \"security_groups\": [], "
45                 + "\"device_id\": \"dhcpff2867ff-b137-5086-a214-70bb12c3ea19-114ddf69-8ccd-46bb-92fb-bc3e921318d4\", "
46                 + "\"name\": \"\", \"admin_state_up\": true, \"network_id\": \"114ddf69-8ccd-46bb-92fb-bc3e921318d4\", "
47                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"binding:vif_details\": "
48                 + "{\"port_filter\": \"true\"}, \"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"ovs\", "
49                 + "\"mac_address\": \"fa:16:3e:09:db:75\"}}";
50         ITNeutronE2E.test_create(urlP, contentP1, "test_create_port_in_allowed_allocation_pools Port Post Failed");
51
52         String contentP2 = "{\"port\": {\"binding:host_id\": \"\", \"allowed_address_pairs\": [], "
53                 + "\"device_owner\": \"\", \"port_security_enabled\": true, \"binding:profile\": {}, "
54                 + "\"fixed_ips\": [{\"subnet_id\": \"77c68c25-72a6-415b-a6f0-886fe26f1b02\", "
55                 + "\"ip_address\": \"2003::4\"}], \"id\": \"856c48ea-fd3a-4ee2-b0c6-bf86f8813888\", "
56                 + "\"security_groups\": [{\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", "
57                 + "\"description\": \"Default security group\", \"id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\","
58                 + " \"security_group_rules\": [{\"remote_group_id\": \"\", \"direction\": \"egress\", "
59                 + "\"remote_ip_prefix\": \"\", \"protocol\": \"\", \"ethertype\": \"IPv6\", "
60                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"port_range_max\": \"\", "
61                 + "\"port_range_min\": \"\", \"id\": \"7b506947-9f16-444e-b027-33a11aaed6bb\", "
62                 + "\"security_group_id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\"}, "
63                 + "{\"remote_group_id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\", "
64                 + "\"direction\": \"ingress\", \"remote_ip_prefix\": \"\", \"protocol\": \"\", "
65                 + "\"ethertype\": \"IPv6\", \"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", "
66                 + "\"port_range_max\": \"\", \"port_range_min\": \"\", "
67                 + "\"id\": \"7ba1a85b-3e05-44b5-90dd-0c50fe01ac46\", "
68                 + "\"security_group_id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\"}, {\"remote_group_id\": "
69                 + "\"111f2d2d-4fe3-4679-b43a-17857ce91cab\", \"direction\": \"ingress\", "
70                 + "\"remote_ip_prefix\": \"\", \"protocol\": \"\", \"ethertype\": \"IPv4\", "
71                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"port_range_max\": \"\", "
72                 + "\"port_range_min\": \"\", \"id\": \"7f1ad334-7588-4ab5-ab02-d1080d401f66\", "
73                 + "\"security_group_id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\"}, {\"remote_group_id\": \"\", "
74                 + "\"direction\": \"egress\", \"remote_ip_prefix\": \"\", \"protocol\": \"\", \"ethertype\": \"IPv4\", "
75                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"port_range_max\": \"\", "
76                 + "\"port_range_min\": \"\", \"id\": \"862f79a2-f96c-4b64-8fbe-50a77b38bd77\", "
77                 + "\"security_group_id\": \"111f2d2d-4fe3-4679-b43a-17857ce91cab\"}], \"name\": \"default\"}], "
78                 + "\"device_id\": \"\", \"name\": \"\", \"admin_state_up\": true, "
79                 + "\"network_id\": \"114ddf69-8ccd-46bb-92fb-bc3e921318d4\", "
80                 + "\"tenant_id\": \"4c1be4874f0048fc8205acffe2821cd3\", \"binding:vif_details\": {}, "
81                 + "\"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"unbound\","
82                 + " \"mac_address\": \"FA:16:3E:66:B1:38\"}}";
83         ITNeutronE2E.test_create(urlP, contentP2, "test_create_port_in_allowed_allocation_pools Port Post 2 Failed");
84
85     }
86
87     public static void runTests(String base) {
88         TempestPortsIpV6TestJSON tpv6runner = new TempestPortsIpV6TestJSON(base);
89         tpv6runner.test_create_port_in_allowed_allocation_pools();
90     }
91 }