Search in sources :

Example 6 with ApiConnector

use of net.juniper.contrail.api.ApiConnector in project cloudstack by apache.

the class InstanceIpModel method delete.

@Override
public void delete(ModelController controller) throws IOException {
    ApiConnector api = controller.getApiAccessor();
    if (_uuid != null) {
        api.delete(InstanceIp.class, _uuid);
    }
    _uuid = null;
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector)

Example 7 with ApiConnector

use of net.juniper.contrail.api.ApiConnector in project cloudstack by apache.

the class NetworkPolicyModel method delete.

@Override
public void delete(ModelController controller) throws IOException {
    ApiConnector api = controller.getApiAccessor();
    if (_policy != null) {
        api.delete(_policy);
        _policy = null;
    }
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector)

Example 8 with ApiConnector

use of net.juniper.contrail.api.ApiConnector in project cloudstack by apache.

the class ServiceInstanceModel method delete.

@Override
public void delete(ModelController controller) throws IOException {
    ApiConnector api = controller.getApiAccessor();
    clearServicePolicy(controller);
    if (_serviceInstance != null) {
        api.delete(_serviceInstance);
    }
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector)

Example 9 with ApiConnector

use of net.juniper.contrail.api.ApiConnector in project cloudstack by apache.

the class ServiceInstanceModel method createServiceInstance.

private ServiceInstance createServiceInstance(ModelController controller) {
    Project project = null;
    if (_projectId != null) {
        try {
            ApiConnector api = controller.getApiAccessor();
            project = (Project) api.findById(Project.class, _projectId);
        } catch (IOException ex) {
            s_logger.warn("project read", ex);
            throw new CloudRuntimeException("Unable to create service-instance object", ex);
        }
    }
    ServiceInstance si_obj = new ServiceInstance();
    if (project != null) {
        si_obj.setParent(project);
    }
    si_obj.setName(getName());
    si_obj.setServiceTemplate(_tmpl);
    si_obj.setProperties(new ServiceInstanceType(false, _mgmtName, _leftName, null, _rightName, null, new ServiceInstanceType.ServiceScaleOutType(1, false)));
    try {
        ApiConnector api = controller.getApiAccessor();
        api.create(si_obj);
    } catch (IOException ex) {
        s_logger.warn("service-instance create", ex);
        throw new CloudRuntimeException("Unable to create service-instance object", ex);
    }
    return si_obj;
}
Also used : Project(net.juniper.contrail.api.types.Project) ServiceInstanceType(net.juniper.contrail.api.types.ServiceInstanceType) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ApiConnector(net.juniper.contrail.api.ApiConnector) ServiceInstance(net.juniper.contrail.api.types.ServiceInstance) IOException(java.io.IOException)

Example 10 with ApiConnector

use of net.juniper.contrail.api.ApiConnector in project cloudstack by apache.

the class VMInterfaceModel method delete.

@Override
public void delete(ModelController controller) throws IOException {
    for (ModelObject successor : successors()) {
        successor.delete(controller);
    }
    ApiConnector api = controller.getApiAccessor();
    api.delete(VirtualMachineInterface.class, _uuid);
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector)

Aggregations

ApiConnector (net.juniper.contrail.api.ApiConnector)44 IOException (java.io.IOException)26 InternalErrorException (com.cloud.exception.InternalErrorException)15 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)9 ArrayList (java.util.ArrayList)8 NetworkVO (com.cloud.network.dao.NetworkVO)6 List (java.util.List)6 VMInstanceVO (com.cloud.vm.VMInstanceVO)5 ContrailManagerImpl (org.apache.cloudstack.network.contrail.management.ContrailManagerImpl)5 VlanDao (com.cloud.dc.dao.VlanDao)4 ApiConnectorMock (net.juniper.contrail.api.ApiConnectorMock)4 ObjectReference (net.juniper.contrail.api.ObjectReference)4 ServiceInstance (net.juniper.contrail.api.types.ServiceInstance)4 VirtualMachineInterface (net.juniper.contrail.api.types.VirtualMachineInterface)4 VirtualNetwork (net.juniper.contrail.api.types.VirtualNetwork)4 ContrailManager (org.apache.cloudstack.network.contrail.management.ContrailManager)4 Test (org.junit.Test)4 VlanVO (com.cloud.dc.VlanVO)3 NicVO (com.cloud.vm.NicVO)3 UserVmDao (com.cloud.vm.dao.UserVmDao)3