Package net.juniper.contrail.api.types

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


        VnSubnetsType subnet = new VnSubnetsType();
        subnet.addIpamSubnets(new SubnetType("10.0.2.0", 24), "10.0.2.254");

        net.addNetworkIpam(ipam, subnet);

        VirtualMachine vncVm = new VirtualMachine();
        vncVm.setName("test-vnc-only-vm-1");
        try {
            assertTrue(_api.create(vncVm));
        } catch (IOException ex) {
            fail(ex.getMessage());
        }
View Full Code Here


    @Override
    public void update(ModelController controller) throws InternalErrorException, IOException {
        assert _initialized;
        ApiConnector api = controller.getApiAccessor();

        VirtualMachine vm = _vm;
        if (vm == null) {
            _vm = vm = (VirtualMachine)api.findById(VirtualMachine.class, _uuid);
            if (vm == null) {
                vm = new VirtualMachine();
                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);
                    }
                    vm.setParent(project);
                }
                vm.setName(_instanceName);
                vm.setUuid(_uuid);
            }
        }

        if (_serviceModel != null) {
            vm.setServiceInstance(_serviceModel.getServiceInstance());
        }

        if (_vm == null) {
            try {
                api.create(vm);
View Full Code Here

    @Override
    public void update(ModelController controller) throws InternalErrorException, IOException {
        assert _initialized;
        ApiConnector api = controller.getApiAccessor();

        VirtualMachine vm = _vm;
        if (vm == null) {
            _vm = vm = (VirtualMachine) api.findById(VirtualMachine.class, _uuid);
            if (vm == null) {
                vm = new VirtualMachine();
                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);                   
                    }
                    vm.setParent(project);
                }
                vm.setName(_instanceName);
                vm.setUuid(_uuid);
            }
        }

        if (_serviceModel != null) {
            vm.setServiceInstance(_serviceModel.getServiceInstance());
        }

        if (_vm == null) {
            try {
                api.create(vm);
View Full Code Here

        VnSubnetsType subnet = new VnSubnetsType();
        subnet.addIpamSubnets(new SubnetType("10.0.2.0", 24), "10.0.2.254");

        net.addNetworkIpam(ipam, subnet);

        VirtualMachine vncVm = new VirtualMachine();
        vncVm.setName("test-vnc-only-vm-1");
        try {
            assertTrue(_api.create(vncVm));
        } catch (IOException ex) {
            fail(ex.getMessage());
        }
View Full Code Here

            s_logger.error("Virtual Machine Interface : " + vmInterface.getDisplayName() +
                           "(" + vmRefs.size() + ")" + " associated virtual machines ");
        }

        ObjectReference<ApiPropertyBase> vmRef = vmRefs.get(0);
        VirtualMachine vm = (VirtualMachine) apiConnector.findById(
                VirtualMachine.class, vmRef.getUuid());
        boolean deleteVm = false;
        //if (vm.getVirtualMachineInterfaces().size() == 1) {
            deleteVm = true;
        //}
        // Extract VRouter IP address from display name
        String vrouterIpAddress = vm.getDisplayName();
        String vmInterfaceName = vmInterface.getName();
        String vmInterfaceDisplayName = vmInterface.getDisplayName();
        s_logger.info("Delete virtual machine interface: " + vmInterfaceName);
        String vmInterfaceUuid = vmInterface.getUuid();
        apiConnector.delete(VirtualMachineInterface.class,
                vmInterfaceUuid);
        if (deleteVm) {
            s_logger.info("Delete virtual machine: " + vm.getName());
            apiConnector.delete(VirtualMachine.class, vmRef.getUuid());     
        }
        // Unplug notification to vrouter
        if (vrouterIpAddress == null) {
            s_logger.info("Virtual machine interface: " + vmInterfaceUuid +
View Full Code Here

            throws IOException {
        DeleteVirtualMachineInternal(vmInfo.getVmInterfaceInfo());
    }
   
    public void DeleteVirtualMachine(String vmUuid) throws IOException {       
        VirtualMachine vm = (VirtualMachine) apiConnector.findById(
                VirtualMachine.class, vmUuid);
        apiConnector.read(vm);
        // Extract VRouter IP address from display name
        String vrouterIpAddress = vm.getDisplayName();
        List<ObjectReference<ApiPropertyBase>> vmInterfaceRefs =
                vm.getVirtualMachineInterfaces();
        assert vmInterfaceRefs.size() == 1 : "Virtual machine: " + vmUuid +
                " associated with more than one virtual machine interface";
        for (ObjectReference<ApiPropertyBase> vmInterfaceRef :
            vmInterfaceRefs) {
            String vmInterfaceUuid = vmInterfaceRef.getUuid();
View Full Code Here

        s_logger.info("CreateVirtualMachine : " + vmUuid + ", vrouterIpAddress: " + vrouterIpAddress + ", vlan: " + isolatedVlanId + "/" + primaryVlanId);
        VirtualNetwork network = (VirtualNetwork) apiConnector.findById(
                VirtualNetwork.class, vnUuid);
        apiConnector.read(network);
        // Virtual machine
        VirtualMachine vm = new VirtualMachine();
        vm.setName(vmUuid);
        vm.setUuid(vmUuid);
        // Encode VRouter IP address in display name
        if (vrouterIpAddress != null) {
            vm.setDisplayName(vrouterIpAddress);
        }
        apiConnector.create(vm);
        apiConnector.read(vm);

        // Virtual machine interface
View Full Code Here

        // Virtual network
        VirtualNetwork network = (VirtualNetwork) apiConnector.findById(
                VirtualNetwork.class, vnUuid);

        // Virtual machine
        VirtualMachine vm = (VirtualMachine) apiConnector.findById(
                VirtualMachine.class, vmUuid);

        // Virtual machine interface
        List<ObjectReference<ApiPropertyBase>> vmInterfaceRefs =
                vm.getVirtualMachineInterfaceBackRefs();
        VirtualMachineInterface vmInterface = null;
        for (ObjectReference<ApiPropertyBase> vmInterfaceRef :
                Utils.safe(vmInterfaceRefs)) {
            vmInterface = (VirtualMachineInterface)
                    apiConnector.findById(VirtualMachineInterface.class,
View Full Code Here

                    s_logger.error("Virtual Machine Interface : " + vmInterface.getDisplayName() +
                                   "(" + vmRefs.size() + ")" + " associated virtual machines ");
                }

                ObjectReference<ApiPropertyBase> vmRef = vmRefs.get(0);
                VirtualMachine vm = (VirtualMachine) apiConnector.findById(
                        VirtualMachine.class, vmRef.getUuid());
                apiConnector.read(vm);
                VncVirtualMachineInfo vmInfo = new VncVirtualMachineInfo(
                        vm, vmInterface);
                vmInfos.put(vm.getUuid(), vmInfo);
            }
            VncVirtualNetworkInfo vnInfo =
                    new VncVirtualNetworkInfo(vnName, vmInfos);
            vnInfos.put(vnUuid, vnInfo);
        }
View Full Code Here

        VnSubnetsType subnet = new VnSubnetsType();
        subnet.addIpamSubnets(new VnSubnetsType.IpamSubnetType(new SubnetType("10.0.1.0", 24), "10.0.1.254", null, UUID.randomUUID().toString(), false, null, null, false, null, null, net.getName() + "-subnet"));
        net.setNetworkIpam(ipam, subnet);

        VirtualMachine vm = new VirtualMachine();
        vm.setName("aa01");
        try {
            assertTrue(_api.create(vm));
        } catch (IOException ex) {
            fail(ex.getMessage());
        }
View Full Code Here

TOP

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

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.