Package net.juniper.contrail.api.types

Examples of net.juniper.contrail.api.types.FloatingIp


        assert _initialized;

        ApiConnector api = controller.getApiAccessor();
        ContrailManager manager = controller.getManager();
        FloatingIp fip = _fip;

        if (_fip == null) {
            _fip = fip = (FloatingIp)controller.getApiAccessor().findById(FloatingIp.class, _uuid);
            if (fip == null) {
                fip = new FloatingIp();
                fip.setUuid(_uuid);
                fip.setAddress(_addr);
                fip.setName(_name);
                fip.setParent(_fipPoolModel.getFloatingIpPool());
            }
        }

        IPAddressVO ipAddrVO = controller.getIPAddressDao().findById(_id);
        assert ipAddrVO != null : "can not find address object in db";
        Long vmId = ipAddrVO.getAssociatedWithVmId();
        Long networkId = ipAddrVO.getAssociatedWithNetworkId();
        if (vmId == null || networkId == null) {
            s_logger.debug("Floating ip is not yet associated to either vm or network");
            return;
        }
        NicVO nic = controller.getNicDao().findByNtwkIdAndInstanceId(networkId, vmId);
        assert nic != null : "can not find nic for the given network and vm in db";

        VMInstanceVO vm = controller.getVmDao().findById(vmId);
        assert vm != null : "can not find vm in db";

        VirtualMachineModel vmModel = manager.getDatabase().lookupVirtualMachine(vm.getUuid());
        assert vmModel != null : "can not find vm model";

        VMInterfaceModel vmiModel = vmModel.getVMInterface(nic.getUuid());
        assert vmiModel != null && vmiModel.getVMInterface() != null : "can not find virtual machine interface";

        fip.setVirtualMachineInterface(vmiModel.getVMInterface());

        if (_fip == null) {
            try {
                api.create(fip);
            } catch (Exception ex) {
View Full Code Here


        assert _initialized;

        ApiConnector api = controller.getApiAccessor();
        ContrailManager manager = controller.getManager();
        FloatingIp fip = _fip;

        if (_fip == null) {
            _fip = fip = (FloatingIp) controller.getApiAccessor().findById(FloatingIp.class, _uuid);
            if (fip == null) {
                fip = new FloatingIp();
                fip.setUuid(_uuid);
                fip.setAddress(_addr);
                fip.setName(_name);
                fip.setParent(_fipPoolModel.getFloatingIpPool());
            }
        }

        IPAddressVO ipAddrVO = controller.getIPAddressDao().findById(_id);
        assert ipAddrVO != null : "can not find address object in db";
        Long vmId = ipAddrVO.getAssociatedWithVmId();
        Long networkId = ipAddrVO.getAssociatedWithNetworkId();
        if (vmId == null || networkId == null) {
            s_logger.debug("Floating ip is not yet associated to either vm or network");
            return;
        }
        NicVO nic = controller.getNicDao().findByNtwkIdAndInstanceId(networkId, vmId);
        assert nic != null : "can not find nic for the given network and vm in db";

        VMInstanceVO vm = controller.getVmDao().findById(vmId);
        assert vm != null : "can not find vm in db";

        VirtualMachineModel vmModel = manager.getDatabase().lookupVirtualMachine(vm.getUuid());
        assert vmModel != null : "can not find vm model";

        VMInterfaceModel vmiModel = vmModel.getVMInterface(nic.getUuid());
        assert vmiModel != null && vmiModel.getVMInterface() != null : "can not find virtual machine interface";

        fip.setVirtualMachineInterface(vmiModel.getVMInterface());

        if (_fip == null) {
            try {
                api.create(fip);
            } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of net.juniper.contrail.api.types.FloatingIp

Copyright © 2018 www.massapicom. 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.