* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package io.fd.honeycomb.translate.v3po.util;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
/**
- * Defines vlan tag rewrite config options for VPP
- *
- * TODO corresponding enum (defined in l2_vtr.h) should be defined in vpe.api
+ * Defines vlan tag rewrite config options for VPP.
+ * <p/>
+ * TODO HONEYCOMB-184 corresponding enum (defined in l2_vtr.h) should be defined in vpe.api
* (does vpp's IDL support enum type definition?)
* which would allow to generate this class in jvpp
*/
translate_2_to_1(2),
translate_2_to_2(2);
- private final static int MAX_INDEX = 3;
+ private static final int MAX_INDEX = 3;
+ private static TagRewriteOperation[][] translation = new TagRewriteOperation[][]{
+ {disabled, push_1, push_2},
+ {pop_1, translate_1_to_1, translate_1_to_2},
+ {pop_2, translate_2_to_1, translate_2_to_2}
+ };
private final int code;
private final byte popTags;
this.popTags = UnsignedBytes.checkedCast(popTags);
}
- private static TagRewriteOperation[][] translation = new TagRewriteOperation[][] {
- {disabled, push_1, push_2},
- {pop_1, translate_1_to_1, translate_1_to_2},
- {pop_2, translate_2_to_1, translate_2_to_2}
- };
-
/**
* Returns VPP tag rewrite operation for given number of tags to pop and tags to push.
- * @param toPop number of tags to pop (0..2)
+ *
+ * @param toPop number of tags to pop (0..2)
* @param toPush number of tags to push (0..2)
* @return vpp tag rewrite operation for given input parameters
*/
/**
* Returns VPP tag rewrite operation for given operation code.
+ *
* @param code VPP tag rewrite operation code
* @return vpp tag rewrite operation for given input parameter
*/
@Nullable
public static TagRewriteOperation get(@Nonnegative final int code) {
for (TagRewriteOperation operation : TagRewriteOperation.values()) {
- if (code == operation.code){
+ if (code == operation.code) {
return operation;
}
}