Package org.apache.provisionr.api.network

Examples of org.apache.provisionr.api.network.Rule


    @Test
    public void testConvertTcpIpPermissionToRuleAndBack() {
        IpPermission expected = new IpPermission().withFromPort(1).withToPort(1024)
            .withIpProtocol("tcp").withIpRanges("0.0.0.0/0");

        Rule rule = ConvertIpPermissionToRule.FUNCTION.apply(expected);
        assertNotNull(rule);

        assertThat(rule.getCidr()).isEqualTo("0.0.0.0/0");
        assertThat(rule.getProtocol()).isEqualTo(Protocol.TCP);

        assertThat(rule.getPorts().lowerEndpoint()).isEqualTo(1);
        assertThat(rule.getPorts().upperEndpoint()).isEqualTo(1024);

        IpPermission actual = ConvertRuleToIpPermission.FUNCTION.apply(rule);
        assertThat(actual).isEqualTo(expected);
    }
View Full Code Here


    @Test
    public void testConvertIcmpPermissionToRule() {
        IpPermission expected = new IpPermission().withIpProtocol("icmp")
            .withFromPort(-1).withToPort(-1).withIpRanges("0.0.0.0/0");

        Rule rule = ConvertIpPermissionToRule.FUNCTION.apply(expected);
        assertNotNull(rule);

        assertThat(rule.getProtocol()).isEqualTo(Protocol.ICMP);
        assertThat(rule.getCidr()).isEqualTo("0.0.0.0/0");

        IpPermission actual = ConvertRuleToIpPermission.FUNCTION.apply(rule);
        assertThat(actual).isEqualTo(expected);
    }
View Full Code Here

            .ICMPCode(SecurityGroups.DEFAULT_ICMP_CODE)
            .ICMPType(SecurityGroups.DEFAULT_ICMP_TYPE)
            .CIDR("10.0.0.0/24")
            .build();

        Rule rule = ConvertIngressRuleToRule.FUNCTION.apply(ingressRule);
        assertThat(rule.getProtocol()).isEqualTo(Protocol.ICMP);
        assertThat(rule.getCidr()).isEqualTo(ingressRule.getCIDR());
    }
View Full Code Here

            .startPort(22)
            .endPort(22)
            .CIDR("0.0.0.1/24")
            .build();

        Rule rule = ConvertIngressRuleToRule.FUNCTION.apply(ingressRule);
        assertThat(rule.getProtocol()).isEqualTo(Protocol.TCP);
        assertThat(rule.getCidr()).isEqualTo(ingressRule.getCIDR());
        assertThat(rule.getPorts().lowerEndpoint()).isEqualTo(ingressRule.getStartPort());
        assertThat(rule.getPorts().upperEndpoint()).isEqualTo(ingressRule.getEndPort());
    }
View Full Code Here

TOP

Related Classes of org.apache.provisionr.api.network.Rule

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.