String url = base + "/sfc/flowclassifiers";
String content = "{ \"flowclassifier\" : { \"name\": \"flowclassifier1\", "
+ "\"ethertype\": \"IPv4\", "
- + "\"protocol\": \"UDP\", "
+ + "\"protocol\": \"udp\", "
+ "\"source_port_range_min\": 100, "
+ "\"source_port_range_max\": 200, "
+ "\"destination_port_range_min\": 100, "
String url = base + "/sfc/flowclassifiers/4e8e5957-649f-477b-9e5b-f1f75b21c03c";
String content = "{ \"flowclassifier\" : { \"name\": \"flowclassifier1\", "
+ "\"ethertype\": \"IPv4\", "
- + "\"protocol\": \"UDP\", "
+ + "\"protocol\": \"udp\", "
+ "\"source_port_range_min\": 100, "
+ "\"source_port_range_max\": 200, "
+ "\"destination_port_range_min\": 100, "
ITNeutronE2E.test_fetch(url, false, "SFC flowclassifier Element negative GET failed");
}
+ public void test_bug_6865() {
+ String url = base + "/sfc/flowclassifiers";
+ String content = "{ \"flowclassifier\" : { \"name\": \"flowclassifier-bug-6865\", "
+ + "\"ethertype\": \"IPv4\", "
+ + "\"protocol\": \"TCP\", "
+ + "\"source_port_range_min\": 100, "
+ + "\"source_port_range_max\": 200, "
+ + "\"destination_port_range_min\": 100, "
+ + "\"destination_port_range_max\": 200, "
+ + "\"source_ip_prefix\": \"10.0.0.0/24\", "
+ + "\"destination_ip_prefix\": \"11.0.0.0/24\", "
+ + "\"logical_source_port\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
+ + "\"logical_destination_port\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
+ + "\"l7_parameters\": [ "
+ + "{ "
+ + "\"Key\": \"value\" "
+ + "} "
+ + "], "
+ + "\"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\", "
+ + "\"id\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\" } }";
+ ITNeutronE2E.test_create(url, 400, content, "SFC Flowclassifier Bug 6865 regressed");
+ }
+
public static void runTests(String base) {
NeutronSFCFlowClassifierTests sfc_flowclassifier_tester = new NeutronSFCFlowClassifierTests(base);
String createJsonString = sfc_flowclassifier_tester.singleton_sfc_flowclassifier_create_test();
sfc_flowclassifier_tester.sfc_flowclassifier_modify_test();
sfc_flowclassifier_tester.sfc_flowclassifier_delete_test();
sfc_flowclassifier_tester.sfc_flowclassifier_element_negative_get_test();
+ sfc_flowclassifier_tester.test_bug_6865();
}
}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.neutron.northbound.api.BadRequestException;
import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD;
import org.opendaylight.neutron.spi.NeutronSFCFlowClassifier;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
private static final ImmutableBiMap<Class<? extends ProtocolBase>,
String> PROTOCOL_MAP = new ImmutableBiMap.Builder<Class<? extends ProtocolBase>, String>()
- .put(ProtocolTcp.class, "TCP").put(ProtocolUdp.class, "UDP").put(ProtocolIcmp.class, "ICMP")
+ .put(ProtocolTcp.class, "tcp").put(ProtocolUdp.class, "udp").put(ProtocolIcmp.class, "icmp")
.build();
NeutronSFCFlowClassifierInterface(DataBroker db) {
}
if (neutronClassifier.getProtocol() != null) {
final ImmutableBiMap<String, Class<? extends ProtocolBase>> mapper = PROTOCOL_MAP.inverse();
- result.setProtocol(mapper.get(neutronClassifier.getProtocol()));
+ Class<? extends ProtocolBase> protocol = mapper.get(neutronClassifier.getProtocol());
+ if (protocol != null) {
+ result.setProtocol(protocol);
+ } else {
+ throw new BadRequestException("Protocol {" + neutronClassifier.getProtocol() + "} is not supported");
+ }
}
if (neutronClassifier.getSourcePortRangeMin() != null) {
result.setSourcePortRangeMin(neutronClassifier.getSourcePortRangeMin());