Search in sources :

Example 1 with PhysicalNetworkTrafficType

use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.

the class UpdateTrafficTypeCmd method execute.

@Override
public void execute() {
    PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
    if (result != null) {
        TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) TrafficTypeResponse(com.cloud.api.response.TrafficTypeResponse) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Example 2 with PhysicalNetworkTrafficType

use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.

the class ListTrafficTypesCmd method execute.

@Override
public void execute() {
    List<? extends PhysicalNetworkTrafficType> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
    ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
    List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
    for (PhysicalNetworkTrafficType trafficType : trafficTypes) {
        TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
        trafficTypesResponses.add(trafficTypeResponse);
    }
    response.setResponses(trafficTypesResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) TrafficTypeResponse(com.cloud.api.response.TrafficTypeResponse) ArrayList(java.util.ArrayList) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Example 3 with PhysicalNetworkTrafficType

use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.

the class AddTrafficTypeCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("TrafficType Id: " + getEntityId());
    PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId());
    if (result != null) {
        TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) TrafficTypeResponse(com.cloud.api.response.TrafficTypeResponse) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Example 4 with PhysicalNetworkTrafficType

use of com.cloud.network.PhysicalNetworkTrafficType in project cloudstack by apache.

the class ListTrafficTypesCmd method execute.

@Override
public void execute() {
    Pair<List<? extends PhysicalNetworkTrafficType>, Integer> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
    ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
    List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
    if (trafficTypes != null) {
        for (PhysicalNetworkTrafficType trafficType : trafficTypes.first()) {
            TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
            trafficTypesResponses.add(trafficTypeResponse);
        }
        response.setResponses(trafficTypesResponses, trafficTypes.second());
        response.setResponseName(getCommandName());
    }
    this.setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) TrafficTypeResponse(org.apache.cloudstack.api.response.TrafficTypeResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Example 5 with PhysicalNetworkTrafficType

use of com.cloud.network.PhysicalNetworkTrafficType in project cloudstack by apache.

the class AddTrafficTypeCmd method execute.

@Override
public void execute() {
    CallContext.current().setEventDetails("TrafficType Id: " + getEntityId());
    PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId());
    if (result != null) {
        TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) TrafficTypeResponse(org.apache.cloudstack.api.response.TrafficTypeResponse) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Aggregations

PhysicalNetworkTrafficType (com.cloud.network.PhysicalNetworkTrafficType)9 TrafficTypeResponse (com.cloud.api.response.TrafficTypeResponse)3 ArrayList (java.util.ArrayList)3 ServerApiException (org.apache.cloudstack.api.ServerApiException)3 TrafficTypeResponse (org.apache.cloudstack.api.response.TrafficTypeResponse)3 ServerApiException (com.cloud.api.ServerApiException)2 List (java.util.List)2 Answer (com.cloud.agent.api.Answer)1 OvsCreateTunnelAnswer (com.cloud.agent.api.OvsCreateTunnelAnswer)1 OvsFetchInterfaceAnswer (com.cloud.agent.api.OvsFetchInterfaceAnswer)1 OvsFetchInterfaceCommand (com.cloud.agent.api.OvsFetchInterfaceCommand)1 Commands (com.cloud.agent.manager.Commands)1 ListResponse (com.cloud.api.response.ListResponse)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)1 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 OvsTunnelInterfaceVO (com.cloud.network.ovs.dao.OvsTunnelInterfaceVO)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1