Package com.cloud.utils.net

Examples of com.cloud.utils.net.Ip


                checkRuleAndUserVm(rule, vm, caller);
            }


            // Verify that vm has nic in the network
            Ip dstIp = rule.getDestinationIpAddress();
            guestNic = _networkModel.getNicInNetwork(vmId, networkId);
            if (guestNic == null || guestNic.getIp4Address() == null) {
                throw new InvalidParameterValueException("Vm doesn't belong to network associated with ipAddress");
            } else {
                dstIp = new Ip(guestNic.getIp4Address());
            }

            if (vmIp != null) {
                //vm ip is passed so it can be primary or secondary ip addreess.
                if (!dstIp.equals(vmIp)) {
                    //the vm ip is secondary ip to the nic.
                    // is vmIp is secondary ip or not
                    NicSecondaryIp secondaryIp = _nicSecondaryDao.findByIp4AddressAndNicId(vmIp.toString(), guestNic.getId());
                    if (secondaryIp == null) {
                        throw new InvalidParameterValueException("IP Address is not in the VM nic's network ");
View Full Code Here


        HostVO hostVO = mock(HostVO.class);
        when(hostVO.getId()).thenReturn(1L);
        when(_hostDao.findById(anyLong())).thenReturn(hostVO);

        Ip ip = mock(Ip.class);
        when(ip.addr()).thenReturn("1.2.3.4");

        PublicIp publicIp = mock(PublicIp.class);
        when(publicIp.getAddress()).thenReturn(ip);
        when(publicIp.getState()).thenReturn(IpAddress.State.Releasing);
        when(publicIp.getAccountId()).thenReturn(1L);
View Full Code Here

        when(network.getDataCenterId()).thenReturn(1L);
        when(network.getBroadcastUri()).thenReturn(uri);
        when(network.getCidr()).thenReturn("1.1.1.0/24");
        when(network.getState()).thenReturn(Network.State.Implemented);

        Ip ip = mock(Ip.class);
        when(ip.addr()).thenReturn("1.2.3.4");

        IpAddress ipAddress = mock(IpAddress.class);
        when(ipAddress.getAddress()).thenReturn(ip);

        when(_networkModel.getIp(anyLong())).thenReturn(ipAddress);
View Full Code Here

        when(network.getDataCenterId()).thenReturn(1L);
        when(network.getBroadcastUri()).thenReturn(uri);
        when(network.getCidr()).thenReturn("1.1.1.0/24");
        when(network.getState()).thenReturn(Network.State.Implemented);

        Ip ip = mock(Ip.class);
        when(ip.addr()).thenReturn("1.2.3.4");

        IpAddress ipAddress = mock(IpAddress.class);
        when(ipAddress.getAddress()).thenReturn(ip);
        when(ipAddress.getVlanId()).thenReturn(1L);
View Full Code Here

        when(network.getDataCenterId()).thenReturn(1L);
        when(network.getBroadcastUri()).thenReturn(uri);
        when(network.getCidr()).thenReturn("1.1.1.0/24");
        when(network.getState()).thenReturn(Network.State.Implemented);

        Ip ip = mock(Ip.class);
        when(ip.addr()).thenReturn("1.2.3.4");

        IpAddress ipAddress = mock(IpAddress.class);
        when(ipAddress.getAddress()).thenReturn(ip);
        when(ipAddress.getVlanId()).thenReturn(1L);
View Full Code Here

                // Re-apply load balancing rules
                for (LoadBalancerVO lb : lbs) {
                    List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
                    List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
                    List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId());
                    Ip sourceIp = _networkModel.getPublicIpAddress(lb.getSourceIpAddressId()).getAddress();
                    LbSslCert sslCert = _lbMgr.getLbSslCert(lb.getId());
                    LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList, sourceIp, sslCert, lb.getLbProtocol());
                    lbRules.add(loadBalancing);
                }
            }
View Full Code Here

                    for (LoadBalancerVO lb : lbs) {
                        List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
                        List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
                        List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId());
                        LbSslCert sslCert = _lbMgr.getLbSslCert(lb.getId());
                        Ip sourceIp = _networkModel.getPublicIpAddress(lb.getSourceIpAddressId()).getAddress();
                        LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList, sourceIp,
                                sslCert, lb.getLbProtocol());

                        lbRules.add(loadBalancing);
                    }
View Full Code Here

                for (LoadBalancerVO lb : lbs) {
                    List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
                    List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
                    List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId());
                    LbSslCert sslCert = _lbMgr.getLbSslCert(lb.getId());
                    Ip sourceIp = _networkModel.getPublicIpAddress(lb.getSourceIpAddressId()).getAddress();
                    LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList, sourceIp, sslCert, lb.getLbProtocol());
                    lbRules.add(loadBalancing);
                }
                return sendLBRules(router, lbRules, network.getId());
            }
View Full Code Here

                        ("Unable to find available public IP addresses", DataCenter.class, zone.getId());
                ex.addProxyObject("data_center", zone.getId(), "zoneId");
                throw ex;
            }
            UserContext.current().setEventDetails("Ip Id: " + ip.getId());
            Ip ipAddress = ip.getAddress();

            s_logger.debug("Got " + ipAddress + " to assign for account " + ipOwner.getId() + " in zone " + zone.getId());

            txn.commit();
        } finally {
View Full Code Here

                checkRuleAndUserVm(rule, vm, caller);
            }


            // Verify that vm has nic in the network
            Ip dstIp = rule.getDestinationIpAddress();
            Nic guestNic = _networkMgr.getNicInNetwork(vmId, networkId);
            if (guestNic == null || guestNic.getIp4Address() == null) {
                throw new InvalidParameterValueException("Vm doesn't belong to network associated with ipAddress");
            } else {
                dstIp = new Ip(guestNic.getIp4Address());
            }
           
            //if start port and end port are passed in, and they are not equal to each other, perform the validation
            boolean validatePortRange = false;
            if (rule.getSourcePortStart().intValue() != rule.getSourcePortEnd().intValue()
View Full Code Here

TOP

Related Classes of com.cloud.utils.net.Ip

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.