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 NeutronBug3812Tests {
14 public NeutronBug3812Tests(String base) {
18 public void check_bug3812() {
20 String urlN = base + "/networks";
21 String contentN = "{\"network\": {\"name\": \"test\", \"provider:physical_network\": \"\", "
22 + "\"router:external\": false, \"tenant_id\": \"04684ce029a6415ca8a9293a24f884b9\", "
23 + "\"admin_state_up\": true, \"shared\": false, \"provider:network_type\": \"vxlan\", "
24 + "\"id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\", \"provider:segmentation_id\": 2550}}";
25 ITNeutronE2E.test_create(urlN, contentN, "Bug 3812 Network Post Failed");
27 // create first subnet
28 String urlS = base + "/subnets";
29 String contentS1 = "{\"subnet\": {\"name\": \"s1\", \"enable_dhcp\": true, "
30 + "\"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\","
31 + " \"tenant_id\": \"04684ce029a6415ca8a9293a24f884b9\", \"dns_nameservers\": [], "
32 + "\"gateway_ip\": \"10.0.0.1\", \"ipv6_ra_mode\": \"\", \"allocation_pools\": "
33 + "[{\"start\": \"10.0.0.2\", \"end\": \"10.0.3.254\"}], \"host_routes\": [], \"shared\": false,"
34 + " \"ip_version\": 4, \"ipv6_address_mode\": \"\", \"cidr\": \"10.0.0.0/22\", "
35 + "\"id\": \"64605c41-688d-4548-97da-0f895943f840\", \"subnetpool_id\": \"\"}}";
36 ITNeutronE2E.test_create(urlS, contentS1, "Bug 3812 Subnet 1 Post Failed");
38 String urlP = base + "/ports";
39 String contentP1 = "{\"port\": {\"binding:host_id\": \"00000000-1111-2222-3333-444444444444\", "
40 + "\"allowed_address_pairs\": [], \"device_owner\": \"network:dhcp\", "
41 + "\"binding:profile\": {}, \"fixed_ips\": [{\"subnet_id\": \"64605c41-688d-4548-97da-0f895943f840\","
42 + " \"ip_address\": \"10.0.0.2\"}], \"id\": \"fcd1d7ab-8486-42a0-8f60-9d1a682aa00e\", "
43 + "\"security_groups\": [], "
44 + "\"device_id\": \"dhcp1c8f692f-b8db-5449-80ea-c9243b652e59-ec36ae5a-ff7f-4441-8229-179e5d5207a7\","
45 + " \"name\": \"\", \"admin_state_up\": true, "
46 + "\"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\","
47 + " \"tenant_id\": \"04684ce029a6415ca8a9293a24f884b9\", \"binding:vif_details\": {}, "
48 + "\"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"unbound\","
49 + " \"mac_address\": \"FA:16:3E:02:CB:DE\"}}";
50 ITNeutronE2E.test_create(urlP, contentP1, "Bug 3812 DHCP Port 1 Post Failed");
52 String urlP1 = urlP + "/fcd1d7ab-8486-42a0-8f60-9d1a682aa00e";
53 String contentP1M1 = "{\"port\": {\"binding:host_id\": \"00000000-1111-2222-3333-444444444444\", "
54 + "\"allowed_address_pairs\": [], \"extra_dhcp_opts\": [], \"device_owner\": \"network:dhcp\","
55 + " \"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\", \"binding:profile\": {},"
56 + " \"security_groups\": [], "
57 + "\"device_id\": \"dhcp1c8f692f-b8db-5449-80ea-c9243b652e59-ec36ae5a-ff7f-4441-8229-179e5d5207a7\","
58 + " \"name\": \"\", \"admin_state_up\": true, \"binding:vif_details\": "
59 + "{\"port_filter\": \"true\"}, \"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"ovs\"}}";
60 ITNeutronE2E.test_modify(urlP1, contentP1M1, "Bug 3812 DHCP Port 1 Put 1 Failed");
63 String contentS2 = "{\"subnet\": {\"name\": \"s2\", \"enable_dhcp\": true, "
64 + "\"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\", "
65 + "\"tenant_id\": \"04684ce029a6415ca8a9293a24f884b9\", "
66 + "\"dns_nameservers\": [], \"gateway_ip\": \"20.0.0.1\", "
67 + "\"ipv6_ra_mode\": \"\", \"allocation_pools\": "
68 + "[{\"start\": \"20.0.0.2\", \"end\": \"20.0.3.254\"}], "
69 + "\"host_routes\": [], \"shared\": false, \"ip_version\": 4, "
70 + "\"ipv6_address_mode\": \"\", \"cidr\": \"20.0.0.0/22\", "
71 + "\"id\": \"dd9b62eb-d9a3-42b5-b2f1-bffa43475614\", \"subnetpool_id\": \"\"}}";
72 ITNeutronE2E.test_create(urlS, contentS2, "Bug 3812 Subnet 2 Post Failed");
74 String contentP1M2 = "{\"port\": {\"binding:host_id\": \"00000000-1111-2222-3333-444444444444\", "
75 + "\"allowed_address_pairs\": [], \"extra_dhcp_opts\": [], \"device_owner\": \"network:dhcp\", "
76 + "\"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\", \"binding:profile\": {}, "
77 + "\"security_groups\": [], "
78 + "\"device_id\": \"dhcp1c8f692f-b8db-5449-80ea-c9243b652e59-ec36ae5a-ff7f-4441-8229-179e5d5207a7\","
79 + " \"name\": \"\", \"admin_state_up\": true, \"binding:vif_details\": "
80 + "{\"port_filter\": \"true\"}, \"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"ovs\"}}";
81 ITNeutronE2E.test_modify(urlP1, contentP1M2, "Bug 3812 DHCP Port Put 2 Failed");
83 // delete first subnet
84 String contentP1M3 = "{\"port\": {\"binding:host_id\": \"00000000-1111-2222-3333-444444444444\","
85 + " \"allowed_address_pairs\": [], \"extra_dhcp_opts\": [], \"device_owner\": \"network:dhcp\", "
86 + "\"binding:profile\": {}, \"network_id\": \"ec36ae5a-ff7f-4441-8229-179e5d5207a7\", "
87 + "\"security_groups\": [], "
88 + "\"device_id\": \"dhcp1c8f692f-b8db-5449-80ea-c9243b652e59-ec36ae5a-ff7f-4441-8229-179e5d5207a7\", "
89 + "\"name\": \"\", \"admin_state_up\": true, \"binding:vif_details\": "
90 + "{\"port_filter\": \"true\"}, \"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"ovs\"}}";
91 ITNeutronE2E.test_modify(urlP1, contentP1M3, "Bug 3812 DHCP Port Put 3 Failed");
93 String urlS1 = urlS + "/64605c41-688d-4548-97da-0f895943f840";
94 ITNeutronE2E.test_delete(urlS1, "Bug 3812 Subnet 1 Delete Failed");
96 String urlS2 = urlS + "/dd9b62eb-d9a3-42b5-b2f1-bffa43475614";
97 ITNeutronE2E.test_delete(urlS2, "Bug 3812 Subnet 2 Delete Failed");
100 public static void runTests(String base) {
101 NeutronBug3812Tests bugTest = new NeutronBug3812Tests(base);
102 bugTest.check_bug3812();