import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowStatsResponseConvertor;
private static MeterStatsResponseConvertor meterStatsConvertor = new MeterStatsResponseConvertor();
- public List<DataObject> translate(DeviceContext deviceContext, OfHeader msg) {
+ public List<DataObject> translate(final DeviceContext deviceContext, final OfHeader msg) {
- List<DataObject> listDataObject = new CopyOnWriteArrayList<DataObject>();
+ List<DataObject> listDataObject = new ArrayList<>();
OpenflowVersion ofVersion = OpenflowVersion.get(deviceContext.getPrimaryConnectionContext().getFeatures().getVersion());
final FeaturesReply features = deviceContext.getPrimaryConnectionContext().getFeatures();
if (msg instanceof MultipartReplyMessage) {
MultipartReplyMessage mpReply = (MultipartReplyMessage) msg;
- NodeId node = this.nodeIdFromDatapathId(features.getDatapathId());
+ NodeId node = SinglePurposeMultipartReplyTranslator.nodeIdFromDatapathId(features.getDatapathId());
switch (mpReply.getType()) {
case OFPMPFLOW: {
FlowsStatisticsUpdateBuilder message = new FlowsStatisticsUpdateBuilder();
statsBuilder.setPackets(packetsBuilder.build());
DurationBuilder durationBuilder = new DurationBuilder();
- if (portStats.getDurationSec() != null)
+ if (portStats.getDurationSec() != null) {
durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
- if (portStats.getDurationNsec() != null)
+ }
+ if (portStats.getDurationNsec() != null) {
durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
+ }
statsBuilder.setDuration(durationBuilder.build());
statsBuilder.setCollisionCount(portStats.getCollisions());
statsBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(statsBuilder.getNodeConnectorId()));
return listDataObject;
}
- private NodeId nodeIdFromDatapathId(BigInteger datapathId) {
+ private static NodeId nodeIdFromDatapathId(final BigInteger datapathId) {
String current = datapathId.toString();
return new NodeId("openflow:" + current);
}
- private TransactionId generateTransactionId(Long xid) {
+ private static TransactionId generateTransactionId(final Long xid) {
BigInteger bigIntXid = BigInteger.valueOf(xid);
return new TransactionId(bigIntXid);
-
}
/*
* Method returns the bitmap of actions supported by each group.
- * TODO: My recommendation would be, its good to have a respective model of
- * 'type bits', which will generate a class where all these flags will eventually
- * be stored as boolean. It will be convenient for application to check the
- * supported action, rather then doing bitmap operation.
+ *
* @param actionsSupported
* @return
*/
- private List<Long> getGroupActionsSupportBitmap(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType> actionsSupported) {
+ static List<Long> getGroupActionsSupportBitmap(final List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType> actionsSupported) {
List<Long> supportActionByGroups = new ArrayList<Long>();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType supportedActions : actionsSupported) {
long supportActionBitmap = 0;