mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 7448: add forVirtualNetwork parameter to ListVLANIpRange. (by Alena)
This commit is contained in:
		
							parent
							
								
									b285bbb683
								
							
						
					
					
						commit
						e256a3a037
					
				@ -26,6 +26,7 @@ import com.cloud.api.ApiConstants;
 | 
			
		||||
import com.cloud.api.BaseListCmd;
 | 
			
		||||
import com.cloud.api.Implementation;
 | 
			
		||||
import com.cloud.api.Parameter;
 | 
			
		||||
import com.cloud.api.BaseCmd.CommandType;
 | 
			
		||||
import com.cloud.api.response.ListResponse;
 | 
			
		||||
import com.cloud.api.response.VlanIpRangeResponse;
 | 
			
		||||
import com.cloud.dc.Vlan;
 | 
			
		||||
@ -61,6 +62,9 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
 | 
			
		||||
    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range")
 | 
			
		||||
    private Long networkId;
 | 
			
		||||
    
 | 
			
		||||
    @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
 | 
			
		||||
    private Boolean forVirtualNetwork;
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////////// Accessors ///////////////////////
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
@ -93,12 +97,16 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
 | 
			
		||||
        return networkId;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public Boolean getForVirtualNetwork() {
 | 
			
		||||
		return forVirtualNetwork;
 | 
			
		||||
	}
 | 
			
		||||
    
 | 
			
		||||
   
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////// API Implementation///////////////////
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
	@Override
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return s_name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1390,6 +1390,9 @@ public class ManagementServerImpl implements ManagementServer {
 | 
			
		||||
        Long domainId = cmd.getDomainId();
 | 
			
		||||
        Long accountId = null;
 | 
			
		||||
        Long networkId = cmd.getNetworkId();
 | 
			
		||||
        Boolean forVirtual = cmd.getForVirtualNetwork();
 | 
			
		||||
        String vlanType = null;
 | 
			
		||||
        
 | 
			
		||||
        if (accountName != null && domainId != null) {
 | 
			
		||||
            Account account = _accountDao.findActiveAccount(accountName, domainId);
 | 
			
		||||
            if (account == null) {
 | 
			
		||||
@ -1399,6 +1402,14 @@ public class ManagementServerImpl implements ManagementServer {
 | 
			
		||||
            }
 | 
			
		||||
        } 
 | 
			
		||||
        
 | 
			
		||||
        if (forVirtual != null) {
 | 
			
		||||
        	if (forVirtual) {
 | 
			
		||||
        		vlanType = VlanType.VirtualNetwork.toString();
 | 
			
		||||
        	} else {
 | 
			
		||||
        		vlanType = VlanType.DirectAttached.toString();
 | 
			
		||||
        	}
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Filter searchFilter = new Filter(VlanVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
 | 
			
		||||
 | 
			
		||||
        Object id = cmd.getId();
 | 
			
		||||
@ -1411,7 +1422,9 @@ public class ManagementServerImpl implements ManagementServer {
 | 
			
		||||
        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
 | 
			
		||||
        sb.and("vlan", sb.entity().getVlanId(), SearchCriteria.Op.EQ);
 | 
			
		||||
        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
 | 
			
		||||
        sb.and("vlan", sb.entity().getVlanId(), SearchCriteria.Op.EQ);
 | 
			
		||||
        sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ);
 | 
			
		||||
        sb.and("vlanType", sb.entity().getVlanType(), SearchCriteria.Op.EQ);
 | 
			
		||||
       
 | 
			
		||||
        if (accountId != null) {
 | 
			
		||||
        	SearchBuilder<AccountVlanMapVO> accountVlanMapSearch = _accountVlanMapDao.createSearchBuilder();
 | 
			
		||||
@ -1455,6 +1468,9 @@ public class ManagementServerImpl implements ManagementServer {
 | 
			
		||||
        	if (podId != null) {
 | 
			
		||||
        		sc.setJoinParameters("podVlanMapSearch", "podId", podId);
 | 
			
		||||
        	}
 | 
			
		||||
        	if (vlanType != null) {
 | 
			
		||||
        		sc.setParameters("vlanType", vlanType);
 | 
			
		||||
        	}
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return _vlanDao.search(sc, searchFilter);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user