Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public interface Ipv6AddressManager extends Manager {

public String acquireGuestIpv6Address(Network network, String requestedIpv6) throws InsufficientAddressCapacityException;

public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network);
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) throws InsufficientAddressCapacityException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,15 @@ protected boolean isIp6Taken(Network network, String requestedIpv6) {
* address information.
*/
@Override
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) {
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) throws InsufficientAddressCapacityException {
if (network.getIp6Gateway() != null) {
if (nic.getIPv6Address() == null) {
s_logger.debug("Found IPv6 CIDR " + network.getIp6Cidr() + " for Network " + network);
nic.setIPv6Cidr(network.getIp6Cidr());
nic.setIPv6Gateway(network.getIp6Gateway());

setNicPropertiesFromNetwork(nic, network);

IPv6Address ipv6addr = NetUtils.EUI64Address(network.getIp6Cidr(), nic.getMacAddress());
s_logger.info("Calculated IPv6 address " + ipv6addr + " using EUI-64 for NIC " + nic.getUuid());
nic.setIPv6Address(ipv6addr.toString());
Expand All @@ -217,4 +219,15 @@ public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Ne
}
}

private void setNicPropertiesFromNetwork(NicProfile nic, Network network) throws InsufficientAddressCapacityException {
if (nic.getBroadcastType() == null) {
nic.setBroadcastType(network.getBroadcastDomainType());
}
if (nic.getBroadCastUri() == null) {
nic.setBroadcastUri(network.getBroadcastUri());
}
if (nic.getMacAddress() == null) {
nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void setAcquireGuestIpv6AddressTest(boolean isIPAvailable, State state)
}

@Test
public void setNICIPv6AddressTest() {
public void setNICIPv6AddressTest() throws InsufficientAddressCapacityException {
NicProfile nic = new NicProfile();
Network network = mock(Network.class);
DataCenter dc = mock(DataCenter.class);
Expand Down