Search in sources :

Example 6 with ObjectReference

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

the class ServiceInstanceModel method build.

/**
     * Recreate the model object from the Contrail API which is the master for this type of object.
     * @param siObj
     */
public void build(ModelController controller, ServiceInstance siObj) {
    ApiConnector api = controller.getApiAccessor();
    _serviceInstance = siObj;
    _fqName = StringUtils.join(siObj.getQualifiedName(), ':');
    ServiceInstanceType props = siObj.getProperties();
    // TODO: read management network names and cache network objects.
    ObjectReference ref = siObj.getServiceTemplate().get(0);
    if (ref != null) {
        try {
            ServiceTemplate tmpl = (ServiceTemplate) api.findById(ServiceTemplate.class, ref.getUuid());
            _templateId = tmpl.getUuid();
        } catch (IOException ex) {
            s_logger.warn("service-template read", ex);
        }
    }
}
Also used : ServiceInstanceType(net.juniper.contrail.api.types.ServiceInstanceType) ObjectReference(net.juniper.contrail.api.ObjectReference) ApiConnector(net.juniper.contrail.api.ApiConnector) ServiceTemplate(net.juniper.contrail.api.types.ServiceTemplate) IOException(java.io.IOException)

Aggregations

ObjectReference (net.juniper.contrail.api.ObjectReference)6 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 ApiConnector (net.juniper.contrail.api.ApiConnector)4 VirtualNetworkPolicyType (net.juniper.contrail.api.types.VirtualNetworkPolicyType)3 VlanDao (com.cloud.dc.dao.VlanDao)2 HashSet (java.util.HashSet)2 FloatingIpPool (net.juniper.contrail.api.types.FloatingIpPool)2 VnSubnetsType (net.juniper.contrail.api.types.VnSubnetsType)2 VlanVO (com.cloud.dc.VlanVO)1 InternalErrorException (com.cloud.exception.InternalErrorException)1 NetworkVO (com.cloud.network.dao.NetworkVO)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ImmutableList (com.google.common.collect.ImmutableList)1 List (java.util.List)1 ConfigurationException (javax.naming.ConfigurationException)1 FloatingIp (net.juniper.contrail.api.types.FloatingIp)1 ServiceInstanceType (net.juniper.contrail.api.types.ServiceInstanceType)1 ServiceTemplate (net.juniper.contrail.api.types.ServiceTemplate)1 VirtualNetwork (net.juniper.contrail.api.types.VirtualNetwork)1