ITNeutronE2E.test_fetch(url, false, "Security Rule Element Negative Get Failed");
}
+ public void bug4043_ipv4_test() {
+ String url = base + "/security-group-rules";
+ String content = " {\"security_group_rule\": " +
+ "{\"remote_group_id\": null, \"direction\": \"ingress\", " +
+ "\"remote_ip_prefix\": \"10.10.10.10/16\", \"protocol\": \"tcp\", " +
+ "\"ethertype\": \"IPv4\", \"tenant_id\": " +
+ "\"00f340c7c3b34ab7be1fc690c05a0275\", \"port_range_max\": 77, " +
+ "\"port_range_min\": 77, " +
+ "\"id\": \"01234567-0123-0123-0123-01234567890a\", " +
+ "\"security_group_id\": " +
+ "\"b60490fe-60a5-40be-af63-1d641381b784\"}}";
+ ITNeutronE2E.test_create(url, content, "Security Rule bug4043 IPv4 Failed");
+
+ url = url + "/01234567-0123-0123-0123-01234567890a";
+ ITNeutronE2E.test_delete(url, "Security Rule Delete Failed");
+ }
+
+ public void bug4043_ipv6_test() {
+ String url = base + "/security-group-rules";
+ String content = " {\"security_group_rule\": " +
+ "{\"remote_group_id\": null, \"direction\": \"ingress\", " +
+ "\"remote_ip_prefix\": \"fe80::1/10\", \"protocol\": \"tcp\", " +
+ "\"ethertype\": \"IPv6\", \"tenant_id\": " +
+ "\"00f340c7c3b34ab7be1fc690c05a0275\", \"port_range_max\": 77, " +
+ "\"port_range_min\": 77, " +
+ "\"id\": \"01234567-0123-0123-0123-01234567890a\", " +
+ "\"security_group_id\": " +
+ "\"b60490fe-60a5-40be-af63-1d641381b784\"}}";
+ ITNeutronE2E.test_create(url, content, "Security Rule Bug4043 IPv6 Failed");
+
+ url = url + "/01234567-0123-0123-0123-01234567890a";
+ ITNeutronE2E.test_delete(url, "Security Rule Delete Failed");
+ }
+
public static void runTests(String base) {
NeutronSecurityRuleTests securityRule_tester = new NeutronSecurityRuleTests(base);
securityRule_tester.securityRule_collection_get_test();
securityRule_tester.sr_element_get_test();
securityRule_tester.sr_delete_test();
securityRule_tester.sr_element_negative_get_test();
+ securityRule_tester.bug4043_ipv4_test();
+ securityRule_tester.bug4043_ipv6_test();
}
}
import org.opendaylight.neutron.spi.NeutronCRUDInterfaces;
import org.opendaylight.neutron.spi.NeutronSecurityGroup;
import org.opendaylight.neutron.spi.NeutronSecurityRule;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev160807.DirectionBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev160807.DirectionEgress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev160807.DirectionIngress;
answer.setSecurityRemoteGroupID(rule.getRemoteGroupId().getValue());
}
if (rule.getRemoteIpPrefix() != null) {
- answer.setSecurityRuleRemoteIpPrefix(rule.getRemoteIpPrefix());
+ answer.setSecurityRuleRemoteIpPrefix(new String(rule.getRemoteIpPrefix().getValue()));
}
if (rule.getProtocol() != null) {
answer.setSecurityRuleProtocol(PROTOCOL_MAP.get(rule.getProtocol()));
securityRuleBuilder.setRemoteGroupId(toUuid(securityRule.getSecurityRemoteGroupID()));
}
if (securityRule.getSecurityRuleRemoteIpPrefix() != null) {
- securityRuleBuilder.setRemoteIpPrefix(securityRule.getSecurityRuleRemoteIpPrefix());
+ IpPrefix ipPrefix = new IpPrefix(securityRule.getSecurityRuleRemoteIpPrefix().toCharArray());
+ securityRuleBuilder.setRemoteIpPrefix(ipPrefix);
}
if (securityRule.getSecurityRuleProtocol() != null) {
ImmutableBiMap<String, Class<? extends ProtocolBase>> mapper =