use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.add.message.grouping.bundle.inner.message.BundleFlowModCaseBuilder in project openflowplugin by opendaylight.
the class BundleAddMessageConverter method convertBundleFlowCase.
private BundleFlowModCase convertBundleFlowCase(final BundleInnerMessage messageCase, final VersionDatapathIdConvertorData data) throws ConversionException {
Optional<List<FlowModInputBuilder>> flowModInputs = Optional.empty();
final Class clazz = messageCase.getImplementedInterface();
if (clazz.equals(BundleAddFlowCase.class)) {
flowModInputs = CONVERTER_EXECUTOR.convert(new AddFlowInputBuilder(((BundleAddFlowCase) messageCase).getAddFlowCaseData()).build(), data);
} else if (clazz.equals(BundleUpdateFlowCase.class)) {
flowModInputs = CONVERTER_EXECUTOR.convert(new UpdatedFlowBuilder(((BundleUpdateFlowCase) messageCase).getUpdateFlowCaseData()).build(), data);
} else if (clazz.equals(BundleRemoveFlowCase.class)) {
flowModInputs = CONVERTER_EXECUTOR.convert(new RemoveFlowInputBuilder(((BundleRemoveFlowCase) messageCase).getRemoveFlowCaseData()).build(), data);
}
if (flowModInputs.isPresent()) {
if (flowModInputs.get().size() == 1) {
return new BundleFlowModCaseBuilder().setFlowModCaseData(new FlowModCaseDataBuilder(flowModInputs.get().get(0).setXid(xid).build()).build()).build();
} else {
throw new ConversionException("BundleFlowCase conversion unsuccessful - not able to convert to multiple flows.");
}
} else {
throw new ConversionException("BundleFlowCase conversion unsuccessful.");
}
}
Aggregations