/**
- * Copyright (c) 2013-2015 Ericsson. and others. All rights reserved.
+ * Copyright (c) 2013, 2015 Ericsson. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
import static org.opendaylight.openflowjava.util.ByteBufUtils.macAddressToString;
+
import com.google.common.base.Optional;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import javax.annotation.Nonnull;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
private static final short PROTO_TCP = 6;
private static final short PROTO_UDP = 17;
private static final short PROTO_ICMPV4 = 1;
- private static final String noIp = "0.0.0.0/0";
+ private static final String NO_IP = "0.0.0.0/0";
@Override
public List<MatchEntry> convert(
* @return
* @author avishnoi@in.ibm.com
*/
- public static Match fromOFMatchV10ToSALMatch(final MatchV10 swMatch, final BigInteger datapathid, final OpenflowVersion ofVersion) {
+ public static MatchBuilder fromOFMatchV10ToSALMatch(@Nonnull final MatchV10 swMatch, @Nonnull final BigInteger datapathid, @Nonnull final OpenflowVersion ofVersion) {
MatchBuilder matchBuilder = new MatchBuilder();
EthernetMatchBuilder ethMatchBuilder = new EthernetMatchBuilder();
VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + "32";
}
- if (!noIp.equals(ipv4PrefixStr)) {
+ if (!NO_IP.equals(ipv4PrefixStr)) {
ipv4MatchBuilder.setIpv4Source(new Ipv4Prefix(ipv4PrefixStr));
matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
}
ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + "32";
}
- if (!noIp.equals(ipv4PrefixStr)) {
+ if (!NO_IP.equals(ipv4PrefixStr)) {
ipv4MatchBuilder.setIpv4Destination(new Ipv4Prefix(ipv4PrefixStr));
matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
}
matchBuilder.setIpMatch(ipMatchBuilder.build());
}
- return matchBuilder.build();
+ return matchBuilder;
}
/**
* @author avishnoi@in.ibm.com
*/
public static MatchBuilder fromOFMatchToSALMatch(
- final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match swMatch,
- final BigInteger datapathid, final OpenflowVersion ofVersion) {
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match swMatch,
+ @Nonnull final BigInteger datapathid, @Nonnull final OpenflowVersion ofVersion) {
return OfMatchToSALMatchConvertor(swMatch.getMatchEntry(), datapathid, ofVersion);
}
if (mplsBos.shortValue() != 0) {
isBos = true;
}
- mplsBosBuilder.setBos(new Boolean(isBos));
+ mplsBosBuilder.setBos(isBos);
mplsBosCaseBuilder.setMplsBos(mplsBosBuilder.build());
matchEntryBuilder.setMatchEntryValue(mplsBosCaseBuilder.build());
}
-// /**
-// * Method converts OF SetField action to SAL SetFiled action.
-// *
-// * @param action
-// * @param ofVersion current ofp version
-// * @return
-// */
-// public static SetField fromOFSetFieldToSALSetFieldAction(
-// final Action action, OpenflowVersion ofVersion) {
-// logger.debug("Converting OF SetField action to SAL SetField action");
-// SetFieldBuilder setField = new SetFieldBuilder();
-// OxmFieldsAction oxmFields = action.getAugmentation(OxmFieldsAction.class);
-// MatchBuilder match = OfMatchToSALMatchConvertor(oxmFields.getMatchEntry(), null, ofVersion);
-// setField.fieldsFrom(match.build());
-// return setField.build();
-// }
+
/**
* Method converts OF SetField action to SAL SetFiled action.