mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	Implemented list by trafficType in listNetworks command
This commit is contained in:
		
							parent
							
								
									cdc1b6db23
								
							
						
					
					
						commit
						620e7e0305
					
				@ -63,6 +63,9 @@ public class ListNetworksCmd extends BaseListCmd {
 | 
			
		||||
    
 | 
			
		||||
    @Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if network is default, false otherwise")
 | 
			
		||||
    private Boolean isDefault;
 | 
			
		||||
    
 | 
			
		||||
    @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="type of the traffic")
 | 
			
		||||
    private String trafficType;
 | 
			
		||||
   
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////////// Accessors ///////////////////////
 | 
			
		||||
@ -100,6 +103,10 @@ public class ListNetworksCmd extends BaseListCmd {
 | 
			
		||||
        return isDefault;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTrafficType() {
 | 
			
		||||
        return trafficType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
    /////////////// API Implementation///////////////////
 | 
			
		||||
    /////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
@ -1216,6 +1216,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
 | 
			
		||||
                Account systemAccount = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
 | 
			
		||||
                
 | 
			
		||||
                BroadcastDomainType broadcastDomainType = null;
 | 
			
		||||
                boolean isNetworkDefault = false;
 | 
			
		||||
                if (offering.getTrafficType() == TrafficType.Management) {
 | 
			
		||||
                    broadcastDomainType = BroadcastDomainType.Native;
 | 
			
		||||
                } else if (offering.getTrafficType() == TrafficType.Control) {
 | 
			
		||||
@ -1228,13 +1229,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (offering.getTrafficType() == TrafficType.Guest) {
 | 
			
		||||
                    if (zone.getNetworkType() == NetworkType.Basic) {
 | 
			
		||||
                        isNetworkDefault = true;
 | 
			
		||||
                        broadcastDomainType = BroadcastDomainType.Native;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                userNetwork.setBroadcastDomainType(broadcastDomainType);
 | 
			
		||||
                _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, true, false); 
 | 
			
		||||
                _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, true, isNetworkDefault); 
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1444,6 +1444,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
 | 
			
		||||
        Long domainId = cmd.getDomainId();
 | 
			
		||||
        String accountName = cmd.getAccountName();
 | 
			
		||||
        String type = cmd.getType();
 | 
			
		||||
        String trafficType = cmd.getTrafficType();
 | 
			
		||||
        Boolean isSystem = cmd.getIsSystem();
 | 
			
		||||
        Boolean isShared = cmd.getIsShared();
 | 
			
		||||
        Boolean isDefault = cmd.isDefault();
 | 
			
		||||
@ -1535,6 +1536,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
 | 
			
		||||
            sc.addAnd("isDefault", SearchCriteria.Op.EQ, isDefault);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if (trafficType != null) {
 | 
			
		||||
            sc.addAnd("trafficType", SearchCriteria.Op.EQ, trafficType);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        List<NetworkVO> networks =  _networksDao.search(sc, searchFilter);
 | 
			
		||||
        
 | 
			
		||||
        return networks;
 | 
			
		||||
 | 
			
		||||
@ -752,7 +752,8 @@ public class ConfigurationServerImpl implements ConfigurationServer {
 | 
			
		||||
                    
 | 
			
		||||
                    BroadcastDomainType broadcastDomainType = null;
 | 
			
		||||
                    TrafficType trafficType= offering.getTrafficType();
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
                    boolean isNetworkDefault = false;
 | 
			
		||||
                    if (trafficType == TrafficType.Management || trafficType == TrafficType.Storage) {
 | 
			
		||||
                        broadcastDomainType = BroadcastDomainType.Native;
 | 
			
		||||
                    } else if (trafficType == TrafficType.Control) {
 | 
			
		||||
@ -765,6 +766,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
 | 
			
		||||
                        }
 | 
			
		||||
                    } else if (offering.getTrafficType() == TrafficType.Guest) {
 | 
			
		||||
                        if (zone.getNetworkType() == NetworkType.Basic) {
 | 
			
		||||
                            isNetworkDefault = true;
 | 
			
		||||
                            broadcastDomainType = BroadcastDomainType.Native;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            continue;
 | 
			
		||||
@ -772,7 +774,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
 | 
			
		||||
                    }
 | 
			
		||||
                    
 | 
			
		||||
                    if (broadcastDomainType != null) {
 | 
			
		||||
                        NetworkVO network = new NetworkVO(id, trafficType, null, mode, broadcastDomainType, networkOfferingId, zoneId, domainId, accountId, related, null, null, true, false);
 | 
			
		||||
                        NetworkVO network = new NetworkVO(id, trafficType, null, mode, broadcastDomainType, networkOfferingId, zoneId, domainId, accountId, related, null, null, true, isNetworkDefault);
 | 
			
		||||
                        network.setGuruName(guruNames.get(network.getTrafficType()));
 | 
			
		||||
                        network.setDns1(zone.getDns1());
 | 
			
		||||
                        network.setDns2(zone.getDns2());
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user