private final List<ListenableFuture<List<Optional<FlowCapableNode>>>> lastFillFutures = new ArrayList<>();
private final Consumer<Flow> flowConsumer;
- public DeviceFlowRegistryImpl(final short version, final DataBroker dataBroker, final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
+ public DeviceFlowRegistryImpl(final short version,
+ final DataBroker dataBroker,
+ final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
this.dataBroker = dataBroker;
this.instanceIdentifier = instanceIdentifier;
final InstanceIdentifier<FlowCapableNode> path = instanceIdentifier.augmentation(FlowCapableNode.class);
// First, try to fill registry with flows from DS/Configuration
- final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> configFuture = fillFromDatastore(LogicalDatastoreType.CONFIGURATION, path);
+ final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> configFuture =
+ fillFromDatastore(LogicalDatastoreType.CONFIGURATION, path);
// Now, try to fill registry with flows from DS/Operational
// in case of cluster fail over, when clients are not using DS/Configuration
// for adding flows, but only RPCs
- final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> operationalFuture = fillFromDatastore(LogicalDatastoreType.OPERATIONAL, path);
+ final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> operationalFuture =
+ fillFromDatastore(LogicalDatastoreType.OPERATIONAL, path);
// And at last, chain and return futures created above.
// Also, cache this future, so call to DeviceFlowRegistry.close() will be able
// to cancel this future immediately if it will be still in progress
- final ListenableFuture<List<Optional<FlowCapableNode>>> lastFillFuture = Futures.allAsList(Arrays.asList(configFuture, operationalFuture));
+ final ListenableFuture<List<Optional<FlowCapableNode>>> lastFillFuture =
+ Futures.allAsList(Arrays.asList(configFuture, operationalFuture));
lastFillFutures.add(lastFillFuture);
return lastFillFuture;
}
- private CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> fillFromDatastore(final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<FlowCapableNode> path) {
+ private CheckedFuture<Optional<FlowCapableNode>, ReadFailedException>
+ fillFromDatastore(final LogicalDatastoreType logicalDatastoreType,
+ final InstanceIdentifier<FlowCapableNode> path) {
// Create new read-only transaction
final ReadOnlyTransaction transaction = dataBroker.newReadOnlyTransaction();
}
@Override
- public void onFailure(Throwable t) {
+ public void onFailure(Throwable throwable) {
// Even when read operation failed, close the transaction
transaction.close();
}
try {
if (LOG.isTraceEnabled()) {
LOG.trace("Storing flowDescriptor with table ID : {} and flow ID : {} for flow hash : {}",
- flowDescriptor.getTableKey().getId(), flowDescriptor.getFlowId().getValue(), flowRegistryKey.hashCode());
+ flowDescriptor.getTableKey().getId(),
+ flowDescriptor.getFlowId().getValue(),
+ flowRegistryKey.hashCode());
}
flowRegistry.put(flowRegistryKey, flowDescriptor);
} catch (IllegalArgumentException ex) {
if (LOG.isWarnEnabled()) {
- LOG.warn("Flow with flow ID {} already exists in table {}, generating alien flow ID", flowDescriptor.getFlowId().getValue(),
+ LOG.warn("Flow with flow ID {} already exists in table {}, generating alien flow ID",
+ flowDescriptor.getFlowId().getValue(),
flowDescriptor.getTableKey().getId());
}
public void store(final FlowRegistryKey flowRegistryKey) {
if (Objects.isNull(retrieveDescriptor(flowRegistryKey))) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Flow descriptor for flow hash : {} not found, generating alien flow ID", flowRegistryKey.hashCode());
+ LOG.debug("Flow descriptor for flow hash : {} not found, generating alien flow ID",
+ flowRegistryKey.hashCode());
}
// We do not found flow in flow registry, that means it do not have any ID already assigned, so we need
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
/**
- * This class serves as factory for creating {@link org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor}
- * Created by Martin Bobak <mbobak@cisco.com> on 9.4.2015.
+ * This class serves as factory for creating
+ * {@link org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor}.
*/
public class FlowDescriptorFactory {
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- FlowDescriptorDto that = (FlowDescriptorDto) o;
- return Objects.equal(flowId, that.flowId) &&
- Objects.equal(tableKey, that.tableKey);
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object == null || getClass() != object.getClass()) {
+ return false;
+ }
+ FlowDescriptorDto that = (FlowDescriptorDto) object;
+ return Objects.equal(flowId, that.flowId) && Objects.equal(tableKey, that.tableKey);
}
@Override
//TODO: mandatory flow input values (or default values) should be specified via yang model
final short tableId = Preconditions.checkNotNull(flow.getTableId(), "flow tableId must not be null");
final int priority = MoreObjects.firstNonNull(flow.getPriority(), OFConstants.DEFAULT_FLOW_PRIORITY);
- final BigInteger cookie = MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
- final Match match = MatchNormalizationUtil.normalizeMatch(MoreObjects.firstNonNull(flow.getMatch(), OFConstants.EMPTY_MATCH), version);
+ final BigInteger cookie =
+ MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
+ final Match match = MatchNormalizationUtil
+ .normalizeMatch(MoreObjects.firstNonNull(flow.getMatch(), OFConstants.EMPTY_MATCH), version);
return new FlowRegistryKeyDto(tableId, priority, cookie, match);
}
}
@Override
- public boolean equals(final Object o) {
- if (this == o) {
+ public boolean equals(final Object object) {
+ if (this == object) {
return true;
}
- if (o == null || !(o instanceof FlowRegistryKey)) {
+ if (object == null || !(object instanceof FlowRegistryKey)) {
return false;
}
- final FlowRegistryKey that = (FlowRegistryKey) o;
+ final FlowRegistryKey that = (FlowRegistryKey) object;
- return getPriority() == that.getPriority() &&
- getTableId() == that.getTableId() &&
- getCookie().equals(that.getCookie()) &&
- getMatch().equals(that.getMatch());
+ return getPriority() == that.getPriority()
+ && getTableId() == that.getTableId()
+ && getCookie().equals(that.getCookie())
+ && getMatch().equals(that.getMatch());
}
@Override
return match;
}
}
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;
-/**
- * Created by tkubas on 4/27/15.
- */
public class AggregatedFlowStatisticsTranslator implements MessageTranslator<MultipartReply, AggregatedFlowStatistics> {
@Override
- public AggregatedFlowStatistics translate(final MultipartReply input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
+ public AggregatedFlowStatistics translate(final MultipartReply input,
+ final DeviceInfo deviceInfo,
+ final Object connectionDistinguisher) {
AggregatedFlowStatisticsBuilder aggregatedFlowStatisticsBuilder = new AggregatedFlowStatisticsBuilder();
MultipartReplyAggregateCase caseBody = (MultipartReplyAggregateCase)input.getMultipartReplyBody();
import org.slf4j.LoggerFactory;
/**
- * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
+ * Translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions).
*/
-public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
+public class FlowRemovedTranslator implements MessageTranslator
+ <FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
private final ConvertorExecutor convertorExecutor;
private static final Logger LOG = LoggerFactory.getLogger(FlowRemovedTranslator.class);
+
public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
this.convertorExecutor = convertorExecutor;
}
}
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved
+ translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
FlowRemovedBuilder flowRemovedBld = new FlowRemovedBuilder()
.setMatch(translateMatch(input, deviceInfo).build())
.setCookie(new FlowCookie(input.getCookie()))
.setPriority(input.getPriority())
.setTableId(translateTableId(input));
- if(Objects.nonNull(input.getReason())) {
+ if (Objects.nonNull(input.getReason())) {
flowRemovedBld.setReason(translateReason(input));
}
}
protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
+ final VersionDatapathIdConvertorData datapathIdConvertorData =
+ new VersionDatapathIdConvertorData(deviceInfo.getVersion());
datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
/**
- * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
+ * Translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions).
*/
public class FlowRemovedV10Translator extends FlowRemovedTranslator {
@Override
protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
+ final VersionDatapathIdConvertorData datapathIdConvertorData =
+ new VersionDatapathIdConvertorData(deviceInfo.getVersion());
datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
-/**
- * Created by tkubas on 4/1/15.
- */
public class PacketReceivedTranslator implements MessageTranslator<PacketInMessage, PacketReceived> {
private final ConvertorExecutor convertorExecutor;
}
@Override
- public PacketReceived translate(final PacketInMessage input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
+ public PacketReceived translate(final PacketInMessage input,
+ final DeviceInfo deviceInfo,
+ final Object connectionDistinguisher) {
PacketReceivedBuilder packetReceivedBuilder = new PacketReceivedBuilder();
BigInteger datapathId = deviceInfo.getDatapathId();
}
if (input.getMatch() != null) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch = getPacketInMatch(input, datapathId);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch =
+ getPacketInMatch(input, datapathId);
packetReceivedBuilder.setMatch(packetInMatch);
}
}
@VisibleForTesting
- org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(input.getVersion());
+ org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match
+ getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
+
+ final VersionDatapathIdConvertorData datapathIdConvertorData =
+ new VersionDatapathIdConvertorData(input.getVersion());
datapathIdConvertorData.setDatapathId(datapathId);
- final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
- final MatchBuilder matchBuilder = matchOptional.isPresent() ?
- new MatchBuilder(matchOptional.get().build()) :
- new MatchBuilder();
+ final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder>
+ matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
+ final MatchBuilder matchBuilder = matchOptional.isPresent()
+ ? new MatchBuilder(matchOptional.get().build())
+ : new MatchBuilder();
- final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match> matchExtensionWrap =
- MatchExtensionHelper.processAllExtensions(
+ final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match>
+ matchExtensionWrap = MatchExtensionHelper.processAllExtensions(
input.getMatch().getMatchEntry(),
OpenflowVersion.get(input.getVersion()),
MatchPath.PACKETRECEIVED_MATCH);
if (matchExtensionWrap != null) {
- matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(), matchExtensionWrap.getAugmentationObject());
+ matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
+ matchExtensionWrap.getAugmentationObject());
}
return matchBuilder.build();
import org.opendaylight.openflowplugin.openflow.md.util.PortTranslatorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * @author tkubas
- */
public class PortUpdateTranslator implements MessageTranslator<PortGrouping, FlowCapableNodeConnector> {
private static final Logger LOG = LoggerFactory.getLogger(PortUpdateTranslator.class);
builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
- builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
+ builder.setQueue(Collections
+ .<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
}
if (input instanceof PortStatusMessage) {
if (((PortStatusMessage) input).getReason() != null) {
builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
- }else {
+ } else {
LOG.debug("PortStatus Message has reason as null");
}
}
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
-/**
- * Created by Martin Bobak <mbobak@cisco.com> on 3.4.2015.
- */
public class TranslatorLibraryBuilder {
private final Map<TranslatorKey, MessageTranslator<?, ?>> translators = new HashMap<>();
@Before
public void setUp() throws Exception {
- nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
+ nodeInstanceIdentifier =
+ InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
- deviceFlowRegistry = new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodeInstanceIdentifier);
+ deviceFlowRegistry =
+ new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodeInstanceIdentifier);
final FlowAndStatisticsMapList flowStats = TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flowStats);
descriptor = FlowDescriptorFactory.create(key.getTableId(), new FlowId("ut:1"));
.setTable(Collections.singletonList(table))
.build();
- final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = testFill(path, flowCapableNode);
+ final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = fillRegistry(path, flowCapableNode);
final FlowRegistryKey key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flow);
InOrder order = inOrder(dataBroker, readOnlyTransaction);
public void testFailedFill() throws Exception {
final InstanceIdentifier<FlowCapableNode> path = nodeInstanceIdentifier.augmentation(FlowCapableNode.class);
- testFill(path, null);
+ fillRegistry(path, null);
- testFill(path, new FlowCapableNodeBuilder()
+ fillRegistry(path, new FlowCapableNodeBuilder()
.setTable(null)
.build());
- testFill(path, new FlowCapableNodeBuilder()
+ fillRegistry(path, new FlowCapableNodeBuilder()
.setTable(Collections.singletonList(null))
.build());
- testFill(path, new FlowCapableNodeBuilder()
+ fillRegistry(path, new FlowCapableNodeBuilder()
.setTable(Collections.singletonList(new TableBuilder()
.setFlow(null)
.build()))
.build());
- testFill(path, new FlowCapableNodeBuilder()
+ fillRegistry(path, new FlowCapableNodeBuilder()
.setTable(Collections.singletonList(new TableBuilder()
.setFlow(Collections.singletonList(null))
.build()))
.build());
- testFill(path, new FlowCapableNodeBuilder()
+ fillRegistry(path, new FlowCapableNodeBuilder()
.setTable(Collections.singletonList(new TableBuilder()
.setFlow(Collections.singletonList(new FlowBuilder()
.setId(null)
Assert.assertEquals(1, deviceFlowRegistry.getAllFlowDescriptors().size());
}
- private Map<FlowRegistryKey, FlowDescriptor> testFill(final InstanceIdentifier<FlowCapableNode> path,
- final FlowCapableNode flowCapableNode) throws Exception {
- when(readOnlyTransaction.read(any(), any())).thenReturn(Futures.immediateCheckedFuture(Optional.fromNullable(flowCapableNode)));
+ private Map<FlowRegistryKey, FlowDescriptor> fillRegistry(final InstanceIdentifier<FlowCapableNode> path,
+ final FlowCapableNode flowCapableNode) throws Exception {
+ when(readOnlyTransaction.read(any(), any()))
+ .thenReturn(Futures.immediateCheckedFuture(Optional.fromNullable(flowCapableNode)));
deviceFlowRegistry.fill().get();
return deviceFlowRegistry.getAllFlowDescriptors();
}
//store new key
final String alienPrefix = "#UF$TABLE*2-";
- final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, TestFlowHelper.createFlowAndStatisticsMapListBuilder(2).build());
+ final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3,
+ TestFlowHelper.createFlowAndStatisticsMapListBuilder(2).build());
deviceFlowRegistry.store(key2);
newFlowId = deviceFlowRegistry.retrieveDescriptor(key2).getFlowId();
private static final Logger LOG = LoggerFactory.getLogger(FlowRegistryKeyFactoryTest.class);
- private static final FlowsStatisticsUpdateBuilder FLOWS_STATISTICS_UPDATE_BUILDER = new FlowsStatisticsUpdateBuilder();
+ private static final FlowsStatisticsUpdateBuilder FLOWS_STATISTICS_UPDATE_BUILDER =
+ new FlowsStatisticsUpdateBuilder();
@Mock
private DeviceContext deviceContext;
@Mock
@Test
public void testEqualsNegative() throws Exception {
- final FlowAndStatisticsMapList flowStatisticsMapList1 = TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
+ final FlowAndStatisticsMapList flowStatisticsMapList1 =
+ TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
final FlowRegistryKey key1 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowStatisticsMapList1);
FlowRegistryKey key2;
try {
FlowRegistryKeyFactory.create(deviceInfo.getVersion(), fb1.build());
Assert.fail("hash creation should have failed because of NPE");
- } catch (Exception e) {
+ } catch (NullPointerException e) {
// expected
Assert.assertEquals("flow tableId must not be null", e.getMessage());
}
fb2.setPriority(null);
try {
FlowRegistryKeyFactory.create(deviceInfo.getVersion(), fb2.build());
- } catch (Exception e) {
+ } catch (NullPointerException e) {
// not expected
Assert.fail("no exception was expected while hash was creating.");
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
/**
- * flow building helper
+ * Flow building helper.
*/
public class TestFlowHelper {
/**
- * @param i data seed
+ * Creates flow and statistics builder.
+ * @param index data seed
* @return flow stats builder with dummy content
*/
- protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int i) {
+ protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int index) {
FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
- flowAndStatisticsMapListBuilder.setPriority(i);
- flowAndStatisticsMapListBuilder.setTableId((short) i);
+ flowAndStatisticsMapListBuilder.setPriority(index);
+ flowAndStatisticsMapListBuilder.setTableId((short) index);
flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
- MatchBuilder matchBuilder = new MatchBuilder();
-
EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
- MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + i);
+ MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + index);
ethernetSourceBuilder.setAddress(macAddress);
ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
- ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + i + ":00:00"));
+ ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + index + ":00:00"));
ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
+ MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder;
/**
- * Test of {@link AggregatedFlowStatisticsTranslator}
+ * Test of {@link AggregatedFlowStatisticsTranslator}.
*/
@RunWith(MockitoJUnitRunner.class)
public class AggregatedFlowStatisticsTranslatorTest {
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
/**
- * Test of {@link AggregatedFlowStatisticsTranslator}
+ * Test of {@link AggregatedFlowStatisticsTranslator}.
*/
@RunWith(MockitoJUnitRunner.class)
public class FlowRemovedTranslatorTest {
@Test
public void testTranslate() throws Exception {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(false);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage =
+ buildMessage(false);
final FlowRemoved flowRemoved = translator.translate(flowRemovedMessage, deviceInfo, null);
assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue());
@Test
public void testTranslateV10() throws Exception {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(true);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage =
+ buildMessage(true);
final FlowRemoved flowRemoved = translatorV10.translate(flowRemovedMessage, deviceInfo, null);
assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue());
assertEquals((short)0, flowRemoved.getTableId().shortValue());
}
- private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved buildMessage(boolean isV10) {
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved
+ buildMessage(boolean isV10) {
FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder()
.setCookie(BigInteger.ONE)
.setReason(FlowRemovedReason.OFPRRGROUPDELETE)
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-/**
- * Created by tkubas on 4/1/15.
- */
-
@RunWith(MockitoJUnitRunner.class)
public class PacketReceivedTranslatorTest {
ConvertorManager convertorManager;
- static final Long PORT_NO = 5l;
- static final Long PORT_NO_DS = 6l;
+ static final Long PORT_NO = 5L;
+ static final Long PORT_NO_DS = 6L;
static final String DATA = "Test_Data";
- static final Long PORT_NUM_VALUE = 11l;
+ static final Long PORT_NUM_VALUE = 11L;
@Before
public void setUp() throws Exception {
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
/**
- * Test of {@link PortUpdateTranslator}
+ * Test of {@link PortUpdateTranslator}.
*/
@RunWith(MockitoJUnitRunner.class)
public class PortUpdateTranslatorTest {
@Mock
private DeviceContext deviceContext;
@Mock
- private DeviceState deviceState;
- @Mock
private DeviceInfo deviceInfo;
private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig portConfig;
.getDefaultInstance("hundredGbFd");
- final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
+ final FlowCapableNodeConnector nodeConnector =
+ portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
commonCheck(nodeConnector);
null, false, false, null, null, null, null, null
);
- final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
+ final FlowCapableNodeConnector nodeConnector =
+ portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
commonCheck(nodeConnector);