Skip to content

Commit 4a914aa

Browse files
shwstpprweizhouapacheDaanHoogland
authored
network: ipv6 static routes (#5786)
* wip Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * IPv6: configure VR of isolated networks * IPv6: add default IPv6 route in VR of isolated networks * Reformat server/src/main/java/com/cloud/network/NetworkServiceImpl.java * IPv6: update network to offering which support IPv6 * IPv6: update vm nic ipv6 address when update network to new offering * IPv6: configure VPC VR to support multiple tiers with IPv6 * IPv6: add RDNSS in radvd.conf * IPv6/UI: support ipv6 protocols in Network ACL * wip Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes for diagnostics Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * more import fromo #5594 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * IPv6: fix wrong public ipv6 in VPC VR * changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * Update server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com> * ui: fix add ipv6 prefix labels, message Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: label fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * logging fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * minor ui refactor Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ip6 events Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ip6 usage Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * unused Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * slaac based public ip Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * remove unused Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * diagnostics fix for vr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * firewall changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * alert and show ipv6 usage Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * change for network response Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ipv6 network test Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: fix ipaddress listing Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * wip Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix simulator Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test and fixes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test temp change revert Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fixes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * use uuid Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * event syntax fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * wip Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * review comments Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * assign vlan public IP for dualstack only if both protocols present on same vlan Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * internetprotocol in networkofferingresponse Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * add tcp, udp Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * support vpc with ipv6 only on same vlan - adds new internet protocol param to createVpcOffering API - When DualStack internet protocol is selected for the VPC offering, tiers with network with or without IPv6 support can be deployed. - When IPv4 internet protocol is used for the VPC offering, tiers with network with only IPv4 support can be deployed Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * change and fix allow VPC with IPv4 protocol to deploy tiers with IPv6 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui fixes Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix multiple routes, network guest ipv6 gateway Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * address review comments Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * stop radvd on backup VR Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix router redundant status with ipv6 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * disable radvd for backup vr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * correctly set ipv6 in redundant router case Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * remove unused code Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix connection Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: don't show all protocol for egress Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix guest ipv6 for redundant VRs Redundant VRs will not be assigned an IPv6 by ACS and guest netwrok gateway will be added as IPv6 for guest interface by systemvm scripts during setting redundant state of the VR. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix missing ipv6 on redundant vr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix syntax Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: fix vpc tier redirect to show details When redirecting to VPC tier, details tab should be active by default Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * restart radvd on primary redundant vr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * check for ipv6 values Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * remove old ui change Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix condition Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * remove gateway from backup vr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * network upgrade fail early when IPv6 network cannot be allocated fail before shutting down the network Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix radvd not running on RVR Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * prepare radvd.conf once Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix job polling Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix RVR for vpc with ipv6 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix ipv6 network acls Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * Update CsConfig.py * add check Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test: vpc offering test Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test: add negative tests for guest prefix, public range Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * add default ipv6 route for primary Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix dadfailed on vpc rvr Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: fix add iprange form, dedicate action visibility Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix adding, deleting ipv6 range Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix failing test Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix missing destination cidr in ipv6 firewall Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix ipv6 nftables rules Allow storing linger IPv6 CIDRs in DB Specify all port range for TC{, UDP protocol rules withot ports Fix adding nft rules by creating chains first Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix icmpv6 type, code Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix icmp type, code Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test: add more for ipv6 network Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * add warning message for egress policy in ipv6 fw rule Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui,server: update ipv6 vlan range Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * subnet operations inside transaction Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * server: persistent public IPv6 for network Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * ui: fix action alignment Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix vpc acl for tiers Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix removing network placeholder nic Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix acl rules for ip version Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix placeholder nic and nd-neighbor block issue Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * test for redundant nw Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix ping Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * systemvm: uprgade to debian 11.3.0 * ipv6: enable ipv6 in sysctl config in bootstrap.sh * VR: fix KeyError: 'nic_ip6_cidr' * build fix for latest event changes Signed-off-by: Abhishek Kumar <abhishek.kumar@shapeblue.com> Co-authored-by: Wei Zhou <weizhou@apache.org> Co-authored-by: dahn <daan.hoogland@gmail.com>
1 parent a9bbcf8 commit 4a914aa

File tree

148 files changed

+7618
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+7618
-606
lines changed

api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, Firewa
155155
rule.getIcmpType(),
156156
rule.getIcmpCode());
157157
this.trafficType = trafficType;
158+
if (FirewallRule.Purpose.Ipv6Firewall.equals(purpose)) {
159+
this.destCidrList = rule.getDestinationCidrList();
160+
}
158161
}
159162

160163
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType,

api/src/main/java/com/cloud/agent/api/to/NetworkTO.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class NetworkTO {
3939
protected boolean isSecurityGroupEnabled;
4040
protected String name;
4141
protected String ip6address;
42+
protected String ip6gateway;
4243
protected String ip6cidr;
4344

4445
public NetworkTO() {
@@ -68,6 +69,10 @@ public void setIp6Address(String addr) {
6869
this.ip6address = addr;
6970
}
7071

72+
public void setIp6Gateway(String gateway) {
73+
this.ip6gateway = gateway;
74+
}
75+
7176
public void setIp6Cidr(String cidr) {
7277
this.ip6cidr = cidr;
7378
}
@@ -161,6 +166,10 @@ public String getIp6Address() {
161166
return ip6address;
162167
}
163168

169+
public String getIp6Gateway() {
170+
return ip6gateway;
171+
}
172+
164173
public String getIp6Cidr() {
165174
return ip6cidr;
166175
}

api/src/main/java/com/cloud/capacity/Capacity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public interface Capacity extends InternalIdentity, Identity {
3030
public static final short CAPACITY_TYPE_VLAN = 7;
3131
public static final short CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8;
3232
public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9;
33+
public static final short CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = 10;
3334
public static final short CAPACITY_TYPE_GPU = 19;
3435

3536
public static final short CAPACITY_TYPE_CPU_CORE = 90;

api/src/main/java/com/cloud/configuration/ConfigurationService.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020

2121
import org.apache.cloudstack.api.command.admin.config.ResetCfgCmd;
2222
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
23+
import org.apache.cloudstack.api.command.admin.network.CreateGuestNetworkIpv6PrefixCmd;
2324
import org.apache.cloudstack.api.command.admin.network.CreateManagementNetworkIpRangeCmd;
2425
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
26+
import org.apache.cloudstack.api.command.admin.network.DeleteGuestNetworkIpv6PrefixCmd;
2527
import org.apache.cloudstack.api.command.admin.network.DeleteManagementNetworkIpRangeCmd;
2628
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
29+
import org.apache.cloudstack.api.command.admin.network.ListGuestNetworkIpv6PrefixesCmd;
2730
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
2831
import org.apache.cloudstack.api.command.admin.network.UpdatePodManagementNetworkIpRangeCmd;
2932
import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
@@ -51,6 +54,7 @@
5154
import org.apache.cloudstack.region.PortableIpRange;
5255

5356
import com.cloud.dc.DataCenter;
57+
import com.cloud.dc.DataCenterGuestIpv6Prefix;
5458
import com.cloud.dc.Pod;
5559
import com.cloud.dc.Vlan;
5660
import com.cloud.domain.Domain;
@@ -223,6 +227,21 @@ public interface ConfigurationService {
223227
*/
224228
void updatePodIpRange(UpdatePodManagementNetworkIpRangeCmd cmd) throws ConcurrentOperationException;
225229

230+
/**
231+
* Creates a new IPv6 prefix for a zone. Needs to be >= /64.
232+
*/
233+
DataCenterGuestIpv6Prefix createDataCenterGuestIpv6Prefix(CreateGuestNetworkIpv6PrefixCmd cmd);
234+
235+
/**
236+
* Lists IPv6 prefixes for a zone.
237+
*/
238+
List<? extends DataCenterGuestIpv6Prefix> listDataCenterGuestIpv6Prefixes(ListGuestNetworkIpv6PrefixesCmd cmd);
239+
240+
/**
241+
* Deletes an existing IPv6 prefix.
242+
*/
243+
boolean deleteDataCenterGuestIpv6Prefix(DeleteGuestNetworkIpv6PrefixCmd cmd);
244+
226245
/**
227246
* Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
228247
*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.dc;
19+
20+
import java.util.Date;
21+
22+
import org.apache.cloudstack.acl.InfrastructureEntity;
23+
import org.apache.cloudstack.api.Identity;
24+
import org.apache.cloudstack.api.InternalIdentity;
25+
26+
public interface DataCenterGuestIpv6Prefix extends InfrastructureEntity, InternalIdentity, Identity {
27+
Long getDataCenterId();
28+
29+
String getPrefix();
30+
31+
Date getCreated();
32+
}

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.apache.cloudstack.usage.Usage;
3333

3434
import com.cloud.dc.DataCenter;
35+
import com.cloud.dc.DataCenterGuestIpv6Prefix;
3536
import com.cloud.dc.Pod;
3637
import com.cloud.dc.StorageNetworkIpRange;
3738
import com.cloud.dc.Vlan;
@@ -150,6 +151,10 @@ public class EventTypes {
150151
public static final String EVENT_FIREWALL_CLOSE = "FIREWALL.CLOSE";
151152
public static final String EVENT_FIREWALL_UPDATE = "FIREWALL.UPDATE";
152153

154+
public static final String EVENT_NET_IP6_ASSIGN = "NET.IP6ASSIGN";
155+
public static final String EVENT_NET_IP6_RELEASE = "NET.IP6RELEASE";
156+
public static final String EVENT_NET_IP6_UPDATE = "NET.IP6UPDATE";
157+
153158
public static final String EVENT_FIREWALL_EGRESS_OPEN = "FIREWALL.EGRESS.OPEN";
154159
public static final String EVENT_FIREWALL_EGRESS_CLOSE = "FIREWALL.EGRESS.CLOSE";
155160
public static final String EVENT_FIREWALL_EGRESS_UPDATE = "FIREWALL.EGRESS.UPDATE";
@@ -334,6 +339,9 @@ public class EventTypes {
334339
public static final String EVENT_MANAGEMENT_IP_RANGE_DELETE = "MANAGEMENT.IP.RANGE.DELETE";
335340
public static final String EVENT_MANAGEMENT_IP_RANGE_UPDATE = "MANAGEMENT.IP.RANGE.UPDATE";
336341

342+
public static final String EVENT_GUEST_IP6_PREFIX_CREATE = "GUEST.IP6.PREFIX.CREATE";
343+
public static final String EVENT_GUEST_IP6_PREFIX_DELETE = "GUEST.IP6.PREFIX.DELETE";
344+
337345
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
338346
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
339347
public static final String EVENT_STORAGE_IP_RANGE_UPDATE = "STORAGE.IP.RANGE.UPDATE";
@@ -482,6 +490,11 @@ public class EventTypes {
482490
public static final String EVENT_NETWORK_ACL_ITEM_UPDATE = "NETWORK.ACL.ITEM.UPDATE";
483491
public static final String EVENT_NETWORK_ACL_ITEM_DELETE = "NETWORK.ACL.ITEM.DELETE";
484492

493+
// IPv6 firewall rule
494+
public static final String EVENT_IPV6_FIREWALL_RULE_CREATE = "IPV6.FIREWALL.RULE.CREATE";
495+
public static final String EVENT_IPV6_FIREWALL_RULE_UPDATE = "IPV6.FIREWALL.RULE.UPDATE";
496+
public static final String EVENT_IPV6_FIREWALL_RULE_DELETE = "IPV6.FIREWALL.RULE.DELETE";
497+
485498
// VPC offerings
486499
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
487500
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
@@ -704,6 +717,9 @@ public class EventTypes {
704717
entityEventDetails.put(EVENT_FIREWALL_EGRESS_OPEN, FirewallRule.class);
705718
entityEventDetails.put(EVENT_FIREWALL_EGRESS_CLOSE, FirewallRule.class);
706719
entityEventDetails.put(EVENT_FIREWALL_EGRESS_UPDATE, FirewallRule.class);
720+
entityEventDetails.put(EVENT_NET_IP6_ASSIGN, Network.class);
721+
entityEventDetails.put(EVENT_NET_IP6_RELEASE, Network.class);
722+
entityEventDetails.put(EVENT_NET_IP6_UPDATE, Network.class);
707723

708724
// Nic Events
709725
entityEventDetails.put(EVENT_NIC_CREATE, Nic.class);
@@ -845,6 +861,9 @@ public class EventTypes {
845861
entityEventDetails.put(EVENT_MANAGEMENT_IP_RANGE_CREATE, Pod.class);
846862
entityEventDetails.put(EVENT_MANAGEMENT_IP_RANGE_DELETE, Pod.class);
847863

864+
entityEventDetails.put(EVENT_GUEST_IP6_PREFIX_CREATE, DataCenterGuestIpv6Prefix.class);
865+
entityEventDetails.put(EVENT_GUEST_IP6_PREFIX_DELETE, DataCenterGuestIpv6Prefix.class);
866+
848867
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class);
849868
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class);
850869
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.network;
19+
20+
import org.apache.cloudstack.api.Identity;
21+
import org.apache.cloudstack.api.InternalIdentity;
22+
23+
public interface Ipv6GuestPrefixSubnetNetworkMap extends Identity, InternalIdentity {
24+
enum State {
25+
Allocating, // The subnet will be assigned to a network
26+
Allocated, // The subnet is in use.
27+
Free // The subnet is ready to be allocated.
28+
}
29+
30+
long getPrefixId();
31+
32+
String getSubnet();
33+
34+
Long getNetworkId();
35+
36+
State getState();
37+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.network;
18+
19+
import java.util.List;
20+
21+
import org.apache.cloudstack.api.command.user.ipv6.CreateIpv6FirewallRuleCmd;
22+
import org.apache.cloudstack.api.command.user.ipv6.ListIpv6FirewallRulesCmd;
23+
import org.apache.cloudstack.api.command.user.ipv6.UpdateIpv6FirewallRuleCmd;
24+
import org.apache.cloudstack.api.response.VpcResponse;
25+
import org.apache.cloudstack.framework.config.ConfigKey;
26+
import org.apache.cloudstack.framework.config.Configurable;
27+
28+
import com.cloud.dc.DataCenter;
29+
import com.cloud.dc.DataCenterGuestIpv6Prefix;
30+
import com.cloud.dc.Vlan;
31+
import com.cloud.exception.InsufficientAddressCapacityException;
32+
import com.cloud.exception.NetworkRuleConflictException;
33+
import com.cloud.exception.ResourceAllocationException;
34+
import com.cloud.network.rules.FirewallRule;
35+
import com.cloud.network.vpc.Vpc;
36+
import com.cloud.utils.Pair;
37+
import com.cloud.utils.component.PluggableService;
38+
import com.cloud.vm.Nic;
39+
import com.cloud.vm.NicProfile;
40+
41+
public interface Ipv6Service extends PluggableService, Configurable {
42+
43+
public static final int IPV6_SLAAC_CIDR_NETMASK = 64;
44+
45+
static final ConfigKey<Boolean> Ipv6OfferingCreationEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class,
46+
"ipv6.offering.enabled",
47+
"false",
48+
"Indicates whether creation of IPv6 network/VPC offering is enabled or not.",
49+
true);
50+
51+
static final ConfigKey<Integer> Ipv6PrefixSubnetCleanupInterval = new ConfigKey<Integer>("Advanced", Integer.class,
52+
"network.ipv6.prefix.subnet.cleanup.interval",
53+
"1800",
54+
"Determines how long (in seconds) to wait before deallocating prefix subnets which are in Allocating state. The default value = 1800 seconds.",
55+
true);
56+
57+
Pair<Integer, Integer> getUsedTotalIpv6SubnetForPrefix(DataCenterGuestIpv6Prefix prefix);
58+
59+
Pair<Integer, Integer> getUsedTotalIpv6SubnetForZone(long zoneId);
60+
61+
Pair<String, String> preAllocateIpv6SubnetForNetwork(long zoneId) throws ResourceAllocationException;
62+
63+
void assignIpv6SubnetToNetwork(String subnet, long networkId);
64+
65+
void releaseIpv6SubnetForNetwork(long networkId);
66+
67+
List<String> getAllocatedIpv6FromVlanRange(Vlan vlan);
68+
69+
Nic assignPublicIpv6ToNetwork(Network network, Nic nic);
70+
71+
void updateNicIpv6(NicProfile nic, DataCenter dc, Network network) throws InsufficientAddressCapacityException;
72+
73+
void releasePublicIpv6ForNic(Network network, String nicIpv6Address);
74+
75+
List<String> getPublicIpv6AddressesForNetwork(Network network);
76+
77+
void updateIpv6RoutesForVpcResponse(Vpc vpc, VpcResponse response);
78+
79+
void checkNetworkIpv6Upgrade(Network network) throws InsufficientAddressCapacityException, ResourceAllocationException;
80+
81+
FirewallRule updateIpv6FirewallRule(UpdateIpv6FirewallRuleCmd updateIpv6FirewallRuleCmd);
82+
83+
Pair<List<? extends FirewallRule>,Integer> listIpv6FirewallRules(ListIpv6FirewallRulesCmd listIpv6FirewallRulesCmd);
84+
85+
boolean revokeIpv6FirewallRule(Long id);
86+
87+
FirewallRule createIpv6FirewallRule(CreateIpv6FirewallRuleCmd createIpv6FirewallRuleCmd) throws NetworkRuleConflictException;
88+
89+
FirewallRule getIpv6FirewallRule(Long entityId);
90+
91+
boolean applyIpv6FirewallRule(long id);
92+
93+
void removePublicIpv6PlaceholderNics(Network network);
94+
}

api/src/main/java/com/cloud/network/Network.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@
2222
import java.util.Date;
2323
import java.util.List;
2424

25-
import com.cloud.exception.InvalidParameterValueException;
26-
import org.apache.commons.lang3.StringUtils;
27-
import org.apache.commons.lang.builder.ToStringBuilder;
28-
import org.apache.commons.lang.builder.ToStringStyle;
29-
3025
import org.apache.cloudstack.acl.ControlledEntity;
3126
import org.apache.cloudstack.api.Displayable;
3227
import org.apache.cloudstack.api.Identity;
3328
import org.apache.cloudstack.api.InternalIdentity;
29+
import org.apache.commons.lang.builder.ToStringBuilder;
30+
import org.apache.commons.lang.builder.ToStringStyle;
31+
import org.apache.commons.lang3.StringUtils;
3432

33+
import com.cloud.exception.InvalidParameterValueException;
3534
import com.cloud.network.Networks.BroadcastDomainType;
3635
import com.cloud.network.Networks.Mode;
3736
import com.cloud.network.Networks.TrafficType;
@@ -79,6 +78,22 @@ static PVlanType fromValue(String type) {
7978
}
8079
}
8180

81+
enum Routing {
82+
Static, Dynamic;
83+
84+
public static Routing fromValue(String type) {
85+
if (StringUtils.isBlank(type)) {
86+
return null;
87+
} else if (type.equalsIgnoreCase("Static")) {
88+
return Static;
89+
} else if (type.equalsIgnoreCase("Dynamic")) {
90+
return Dynamic;
91+
} else {
92+
throw new InvalidParameterValueException("Unexpected Routing type : " + type);
93+
}
94+
}
95+
}
96+
8297
String updatingInSequence = "updatingInSequence";
8398
String hideIpAddressUsage = "hideIpAddressUsage";
8499

api/src/main/java/com/cloud/network/rules/FirewallRule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
public interface FirewallRule extends ControlledEntity, Identity, InternalIdentity, Displayable {
2727
enum Purpose {
28-
Firewall, PortForwarding, LoadBalancing, Vpn, StaticNat, NetworkACL,
28+
Firewall, PortForwarding, LoadBalancing, Vpn, StaticNat, NetworkACL, Ipv6Firewall,
2929
}
3030

3131
enum FirewallRuleType {

0 commit comments

Comments
 (0)