use of com.cloud.legacymodel.dc.Vlan in project cosmic by MissionCriticalCloud.
the class NetworkModelImpl method getStartIpv6Address.
@Override
public String getStartIpv6Address(final long networkId) {
final List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
if (vlans == null) {
return null;
}
String startIpv6 = null;
// Get the start ip of first create vlan(not the lowest, because if you add a lower vlan, lowest vlan would change)
for (final Vlan vlan : vlans) {
if (vlan.getIp6Range() != null) {
startIpv6 = vlan.getIp6Range().split("-")[0];
break;
}
}
return startIpv6;
}
use of com.cloud.legacymodel.dc.Vlan in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method runDedicatePublicIpRangePostiveTest.
void runDedicatePublicIpRangePostiveTest() throws Exception {
final TransactionLegacy txn = TransactionLegacy.open("runDedicatePublicIpRangePostiveTest");
when(configurationMgr._vlanDao.findById(anyLong())).thenReturn(vlan);
when(configurationMgr._accountVlanMapDao.listAccountVlanMapsByAccount(anyLong())).thenReturn(null);
final DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", null, null, NetworkType.Advanced, null, null, null, null);
when(configurationMgr._zoneDao.findById(anyLong())).thenReturn(dc);
final List<IPAddressVO> ipAddressList = new ArrayList<>();
final IPAddressVO ipAddress = new IPAddressVO(new Ip(NetUtils.ip2Long("75.75.75.75")), 1, 0xaabbccddeeffL, 10, false);
ipAddressList.add(ipAddress);
when(configurationMgr._publicIpAddressDao.listByVlanId(anyLong())).thenReturn(ipAddressList);
try {
final Vlan result = configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
Assert.assertNotNull(result);
} catch (final Exception e) {
s_logger.info("exception in testing runDedicatePublicIpRangePostiveTest message: " + e.toString());
} finally {
txn.close("runDedicatePublicIpRangePostiveTest");
}
}
Aggregations