= salBundleService.controlBundle(closeBundleInput);
/* Open a new bundle on the switch */
- ListenableFuture<RpcResult<ControlBundleOutput>> openBundle =
- Futures.transformAsync(closeBundle,
- rpcResult -> salBundleService.controlBundle(openBundleInput),
- service);
+ ListenableFuture<RpcResult<ControlBundleOutput>> openBundle
+ = Futures.transformAsync(closeBundle, rpcResult -> {
+ if (rpcResult.isSuccessful()) {
+ LOG.debug("Existing bundle is successfully closed for device {}", dpnId);
+ }
+ return salBundleService.controlBundle(openBundleInput);
+ }, service);
/* Push groups and flows via bundle add messages */
ListenableFuture<RpcResult<AddBundleMessagesOutput>> deleteAllFlowGroupsFuture
= Futures.transformAsync(openBundle, rpcResult -> {
if (rpcResult.isSuccessful()) {
+ LOG.debug("Open bundle is successful for device {}", dpnId);
return salBundleService.addBundleMessages(deleteAllFlowGroupsInput);
}
return Futures.immediateFuture(null);
actions = ((WriteActionsCase)instruction.getInstruction())
.getWriteActions().nonnullAction().values();
}
- for (Action action : actions) {
- if (action.getAction().implementedInterface()
- .equals(ActionType.GROUP_ACTION.getActionType())) {
- return ((GroupActionCase) action.getAction()).getGroupAction()
- .getGroupId();
+ if (actions != null) {
+ for (Action action : actions) {
+ if (action.getAction().implementedInterface().equals(ActionType.GROUP_ACTION.getActionType())) {
+ return ((GroupActionCase) action.getAction()).getGroupAction().getGroupId();
+ }
}
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleControlOnf;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleControlOnfBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.bundle.control.onf.OnfControlGroupingDataBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Converter for BundleControl messages (ONF approved extension #230).
ConverterMessageToOFJava<BundleControlSal, BundleControlOnf, ExtensionConvertorData>,
ConvertorMessageFromOFJava<BundleControlOnf, MessagePath> {
+ private static final Logger LOG = LoggerFactory.getLogger(BundleControlConverter.class);
+
@Override
public BundleControlOnf convert(final BundleControlSal experimenterMessageCase, final ExtensionConvertorData data) {
+ LOG.trace("Converting the bundle control message for device {} with xid {} and type {}",
+ data.getDatapathId(), data.getXid(), experimenterMessageCase.getSalControlData().getType());
return new BundleControlOnfBuilder().setOnfControlGroupingData(
new OnfControlGroupingDataBuilder(experimenterMessageCase.getSalControlData()).build()).build();
}
*/
package org.opendaylight.openflowplugin.extension.onf.converter;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
+import org.opendaylight.openflowplugin.extension.api.ExtensionConvertorData;
import org.opendaylight.openflowplugin.extension.api.path.MessagePath;
import org.opendaylight.openflowplugin.extension.onf.BundleTestUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleControlOnfBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.bundle.control.onf.OnfControlGroupingDataBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
/**
* Test for {@link org.opendaylight.openflowplugin.extension.onf.converter.BundleControlConverter}.
private void testConvertDown(final boolean withProperty) {
final BundleControlSal original = createOFPMessage(withProperty);
- final BundleControlOnf converted = converter.convert(original, null);
+ final ExtensionConvertorData data = new ExtensionConvertorData((short)1);
+ data.setXid(Uint32.valueOf(0L));
+ data.setDatapathId(Uint64.valueOf(BigInteger.ONE));
+ final BundleControlOnf converted = converter.convert(original, data);
testConvert(original, converted, withProperty);
}
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Simple bundle extension service.
*/
public class SalBundleServiceImpl implements SalBundleService {
-
+ private static final Logger LOG = LoggerFactory.getLogger(SalBundleServiceImpl.class);
private final SalExperimenterMessageService experimenterMessageService;
public SalBundleServiceImpl(final SalExperimenterMessageService experimenterMessageService) {
@Override
public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
+ LOG.debug("Control message for device {} and bundle type {}", input.getNode(), input.getType());
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
experimenterInputBuilder.setNode(input.getNode());
experimenterInputBuilder.setExperimenterMessageOfChoice(
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.experimenter.core.message.ExperimenterMessageOfChoice;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SalExperimenterMessageServiceImpl extends AbstractSimpleService<SendExperimenterInput,
SendExperimenterOutput> implements SalExperimenterMessageService {
-
+ private static final Logger LOG = LoggerFactory.getLogger(SalExperimenterMessageServiceImpl.class);
private final ExtensionConverterProvider extensionConverterProvider;
public SalExperimenterMessageServiceImpl(final RequestContextStack requestContextStack,
ExtensionConvertorData> messageConverter = extensionConverterProvider.getMessageConverter(key);
if (messageConverter == null) {
+ LOG.warn("Unable to find message converter for experimenter xid {} for device {}", xid,
+ extractDatapathId(input.getNode()));
throw new ServiceException(new ConverterNotFoundException(key.toString()));
}
final ExperimenterInputBuilder experimenterInputBld;
.setVersion(getVersion())
.setXid(xid.getValue());
} catch (ConversionException e) {
+ LOG.warn("Error while building experimenter message with id {} and xid {} for device {}",
+ messageConverter.getExperimenterId(), xid, extractDatapathId(input.getNode()), e);
throw new ServiceException(e);
}