Search in sources :

Example 36 with ApiConnector

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

the class ServerDBSyncImpl method deleteInstanceIps.

private void deleteInstanceIps(List<ObjectReference<ApiPropertyBase>> list, StringBuffer syncLogMesg) throws IOException {
    if (list == null) {
        return;
    }
    final ApiConnector api = _manager.getApiConnector();
    for (ObjectReference<ApiPropertyBase> instIp : list) {
        api.delete(InstanceIp.class, instIp.getUuid());
        syncLogMesg.append("VNC instance ip: " + instIp.getUuid() + " deleted\n");
    }
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector) ApiPropertyBase(net.juniper.contrail.api.ApiPropertyBase)

Example 37 with ApiConnector

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

the class ServerDBSyncImpl method deleteFloatingIp.

public void deleteFloatingIp(FloatingIp vnc, StringBuffer syncLogMesg) throws IOException {
    final ApiConnector api = _manager.getApiConnector();
    syncLogMesg.append("fip# DB: none; VNC: " + vnc.getAddress() + "(" + vnc.getUuid() + "); action: delete\n");
    api.delete(vnc);
    syncLogMesg.append("fip# VNC: " + vnc.getUuid() + " deleted\n");
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector)

Example 38 with ApiConnector

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

the class ServerDBSyncImpl method deleteVirtualMachine.

public void deleteVirtualMachine(VirtualMachine vncVm, StringBuffer syncLogMesg) {
    final ApiConnector api = _manager.getApiConnector();
    syncLogMesg.append("VM# DB:none; VNC: " + vncVm.getName() + "/" + vncVm.getUuid() + "; action: delete\n");
    if (!_rwMode) {
        return;
    }
    try {
        if (!api.read(vncVm)) {
            return;
        }
        deleteVirtualMachineInterfaces(vncVm.getVirtualMachineInterfaces(), syncLogMesg);
        api.delete(VirtualMachine.class, vncVm.getUuid());
    } catch (IOException ex) {
        s_logger.warn("delete virtual-machine", ex);
        return;
    }
    syncLogMesg.append("VM# VNC: " + vncVm.getName() + " deleted\n");
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector) IOException(java.io.IOException)

Example 39 with ApiConnector

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

the class ServerDBSyncImpl method deleteServiceInstance.

public void deleteServiceInstance(ServiceInstance siObj, StringBuffer logMsg) {
    final ApiConnector api = _manager.getApiConnector();
    s_logger.debug("delete " + siObj.getQualifiedName());
    if (!_rwMode) {
        return;
    }
    try {
        api.delete(siObj);
    } catch (IOException ex) {
        s_logger.warn("service-instance delete", ex);
    }
}
Also used : ApiConnector(net.juniper.contrail.api.ApiConnector) IOException(java.io.IOException)

Example 40 with ApiConnector

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

the class ServerDBSyncImpl method createDomain.

@Override
public void createDomain(DomainVO db, StringBuffer syncLogMesg) throws IOException {
    final ApiConnector api = _manager.getApiConnector();
    net.juniper.contrail.api.types.Domain vnc = new net.juniper.contrail.api.types.Domain();
    vnc.setName(db.getName());
    vnc.setUuid(db.getUuid());
    if (!api.create(vnc)) {
        s_logger.error("Unable to create domain " + vnc.getName());
        syncLogMesg.append("Error: Virtual domain# VNC : Unable to create domain: " + vnc.getName() + "\n");
        return;
    }
    syncLogMesg.append("Domain# VNC: " + vnc.getName() + " created \n");
}
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