Package com.cloud.network.nicira

Examples of com.cloud.network.nicira.NatRule


        assertTrue(a.getResult());
        verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(final Object argument) {
                final NatRule rule = (NatRule)argument;
                if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") && ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            }
        }));
View Full Code Here


        assertTrue(a.getResult());
        verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(final Object argument) {
                final NatRule rule = (NatRule)argument;
                if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") && ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            }
        }));
View Full Code Here

        assertTrue(a.getResult());
        verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(Object argument) {
                NatRule rule = (NatRule) argument;
                if (rule.getType().equals("DestinationNatRule") &&
                        ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") &&
                        ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            } }));
View Full Code Here

        assertTrue(a.getResult());
        verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(Object argument) {
                NatRule rule = (NatRule) argument;
                if (rule.getType().equals("DestinationNatRule") &&
                        ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") &&
                        ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            } }));
View Full Code Here

        assertTrue(a.getResult());
        verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(Object argument) {
                NatRule rule = (NatRule) argument;
                if (rule.getType().equals("DestinationNatRule") &&
                        ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") &&
                        ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            } }));
View Full Code Here

        assertTrue(a.getResult());
        verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(Object argument) {
                NatRule rule = (NatRule) argument;
                if (rule.getType().equals("DestinationNatRule") &&
                        ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
                    return true;
                }
                if (rule.getType().equals("SourceNatRule") &&
                        ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
                    return true;
                }
                return false;
            } }));
View Full Code Here

            for (StaticNatRuleTO rule : cmd.getRules()) {

                NatRule[] rulepair = generateStaticNatRulePair(rule.getDstIp(), rule.getSrcIp());

                NatRule incoming = null;
                NatRule outgoing = null;

                for (NatRule storedRule : existingRules.getResults()) {
                    if (storedRule.equalsIgnoreUuid(rulepair[1])) {
                        // The outgoing rule exists
                        outgoing = storedRule;
                        s_logger.debug("Found matching outgoing rule " + outgoing.getUuid());
                        if (incoming != null) {
                            break;
                        }
                    }
                    else if (storedRule.equalsIgnoreUuid(rulepair[0])) {
                        // The incoming rule exists
                        incoming = storedRule;
                        s_logger.debug("Found matching incoming rule " + incoming.getUuid());
                        if (outgoing != null) {
                            break;
                        }
                    }
                }
                if (incoming != null && outgoing != null) {
                    if (rule.revoked()) {
                        s_logger.debug("Deleting incoming rule " + incoming.getUuid());
                        _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());

                        s_logger.debug("Deleting outgoing rule " + outgoing.getUuid());
                        _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
                    }
                }
                else {
                    if (rule.revoked()) {
                        s_logger.warn("Tried deleting a rule that does not exist, " +
View Full Code Here

                    return new ConfigurePortForwardingRulesOnLogicalRouterAnswer(cmd, false, "Nicira NVP doesn't support port ranges for port forwarding");
                }

                NatRule[] rulepair = generatePortForwardingRulePair(rule.getDstIp(), rule.getDstPortRange(), rule.getSrcIp(), rule.getSrcPortRange(), rule.getProtocol());

                NatRule incoming = null;
                NatRule outgoing = null;

                for (NatRule storedRule : existingRules.getResults()) {
                    if (storedRule.equalsIgnoreUuid(rulepair[1])) {
                        // The outgoing rule exists
                        outgoing = storedRule;
                        s_logger.debug("Found matching outgoing rule " + outgoing.getUuid());
                        if (incoming != null) {
                            break;
                        }
                    }
                    else if (storedRule.equalsIgnoreUuid(rulepair[0])) {
                        // The incoming rule exists
                        incoming = storedRule;
                        s_logger.debug("Found matching incoming rule " + incoming.getUuid());
                        if (outgoing != null) {
                            break;
                        }
                    }
                }
                if (incoming != null && outgoing != null) {
                    if (rule.revoked()) {
                        s_logger.debug("Deleting incoming rule " + incoming.getUuid());
                        _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), incoming.getUuid());

                        s_logger.debug("Deleting outgoing rule " + outgoing.getUuid());
                        _niciraNvpApi.deleteLogicalRouterNatRule(cmd.getLogicalRouterUuid(), outgoing.getUuid());
                    }
                }
                else {
                    if (rule.revoked()) {
                        s_logger.warn("Tried deleting a rule that does not exist, " +
View Full Code Here

TOP

Related Classes of com.cloud.network.nicira.NatRule

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.