Package net.juniper.contrail.api

Examples of net.juniper.contrail.api.ApiConnector.findById()


        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);
            }
        }
View Full Code Here


    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);
            }
        }
View Full Code Here

    private ServiceTemplate locateServiceTemplate(ModelController controller) {
        ServiceTemplate tmpl;
        try {
            ApiConnector api = controller.getApiAccessor();
            tmpl = (ServiceTemplate)api.findById(ServiceTemplate.class, _templateId);
        } catch (IOException ex) {
            s_logger.warn("service-template read", ex);
            throw new CloudRuntimeException("Unable to create service-template object", ex);
        }
        if (tmpl == null) {
View Full Code Here

            }
        }
        int count = 0;
        for (ObjectReference<T> childRef: childs) {
            @SuppressWarnings("unchecked")
            ApiObjectBase child = (ApiObjectBase) api.findById((Class<? extends ApiObjectBase>)childCls, childRef.getUuid());
            if (method != null) {
               method.invoke(this, child, syncLogMesg);
            } else {
                deleteDefault(child, childCls, syncLogMesg);
            }
View Full Code Here

        deleteInstanceIps(vnet.getInstanceIpBackRefs(), syncLogMesg);
       
        List<ObjectReference<ApiPropertyBase>> fipPools = vnet.getFloatingIpPools();
        if (fipPools != null && !fipPools.isEmpty()) {
            FloatingIpPool floatingIpPool = (FloatingIpPool) api.findById(FloatingIpPool.class, fipPools.get(0).getUuid());
            if (floatingIpPool != null ) {
                deleteFloatingIps(floatingIpPool.getFloatingIps(), syncLogMesg);
            }
        }
       
View Full Code Here

        if (list == null) {
            return;
        }
        final ApiConnector api = _manager.getApiConnector();
        for (ObjectReference<ApiPropertyBase> vmiRef: list) {
            VirtualMachineInterface vmi = (VirtualMachineInterface) api.findById(VirtualMachineInterface.class, vmiRef.getUuid());
            deleteInstanceIps(vmi.getInstanceIpBackRefs(), syncLogMesg);
            deleteFloatingIps(vmi.getFloatingIpBackRefs(), syncLogMesg);
            api.delete(VirtualMachineInterface.class, vmiRef.getUuid());
            syncLogMesg.append("VNC vmi: " + vmi.getUuid() + " deleted\n");
        }       
View Full Code Here

        if (policy == null) {
            try {
                String policyId = api.findByName(NetworkPolicy.class, _project, _name);
                if (policyId != null) {
                    policy = _policy = (NetworkPolicy) api.findById(NetworkPolicy.class, policyId);
                }
                if (policy == null) {
                    policy = new NetworkPolicy();
                    policy.setUuid(_uuid);
                    policy.setName(_name);
View Full Code Here

            if (vn == null) {
                vn = new VirtualNetwork();
                if (_projectId != null) {
                    Project project;
                    try {
                        project = (Project) api.findById(Project.class, _projectId);
                    } catch (IOException ex) {
                        s_logger.debug("project read", ex);
                        throw new CloudRuntimeException("Failed to read project", ex);                   
                    }
                    vn.setParent(project);
View Full Code Here

                String ipam_id = api.findByName(NetworkIpam.class, null, "default-network-ipam");
                if (ipam_id == null) {
                    s_logger.debug("could not find default-network-ipam");
                    return;
                }
                ipam = (NetworkIpam) api.findById(NetworkIpam.class, ipam_id);
                if (ipam == null) {
                    s_logger.debug("could not find NetworkIpam with ipam_id: " + ipam_id);
                    return;
                }
            } catch (IOException ex) {
View Full Code Here

    public void read(ModelController controller) {
        ApiConnector api = controller.getApiAccessor();
        VlanDao vlanDao = controller.getVlanDao();
        try {
            _vn = (VirtualNetwork) api.findById(VirtualNetwork.class, _uuid);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (_vn == null) {
            return;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.