Search in sources :

Example 11 with Vlan

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;
}
Also used : Vlan(com.cloud.legacymodel.dc.Vlan) VlanVO(com.cloud.dc.VlanVO)

Example 12 with Vlan

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");
    }
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) TransactionLegacy(com.cloud.utils.db.TransactionLegacy) Ip(com.cloud.legacymodel.network.Ip) ArrayList(java.util.ArrayList) IPAddressVO(com.cloud.network.dao.IPAddressVO) Vlan(com.cloud.legacymodel.dc.Vlan) InvalidParameterValueException(com.cloud.legacymodel.exceptions.InvalidParameterValueException) CloudRuntimeException(com.cloud.legacymodel.exceptions.CloudRuntimeException)

Aggregations

Vlan (com.cloud.legacymodel.dc.Vlan)12 VlanVO (com.cloud.dc.VlanVO)4 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)4 InvalidParameterValueException (com.cloud.legacymodel.exceptions.InvalidParameterValueException)4 ArrayList (java.util.ArrayList)4 VlanIpRangeResponse (com.cloud.api.response.VlanIpRangeResponse)3 Network (com.cloud.legacymodel.network.Network)3 ServerApiException (com.cloud.api.ServerApiException)2 HostPodVO (com.cloud.dc.HostPodVO)2 IpAddress (com.cloud.network.IpAddress)2 TransactionStatus (com.cloud.utils.db.TransactionStatus)2 List (java.util.List)2 ListResponse (com.cloud.api.response.ListResponse)1 SystemVmResponse (com.cloud.api.response.SystemVmResponse)1 Zone (com.cloud.db.model.Zone)1 DataCenterVO (com.cloud.dc.DataCenterVO)1 DedicatedResourceVO (com.cloud.dc.DedicatedResourceVO)1 HostVO (com.cloud.host.HostVO)1 ConfigurePortForwardingRulesOnLogicalRouterAnswer (com.cloud.legacymodel.communication.answer.ConfigurePortForwardingRulesOnLogicalRouterAnswer)1 ConfigurePortForwardingRulesOnLogicalRouterCommand (com.cloud.legacymodel.communication.command.ConfigurePortForwardingRulesOnLogicalRouterCommand)1