2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
19 import java.util.Arrays;
22 * Parameters for executing dump of mappings
24 public final class MappingsDumpParams {
26 private final byte eidSet;
27 private final byte prefixLength;
28 private final int vni;
29 private final byte eidType;
30 private final byte[] eid;
31 private final byte filter;
33 private MappingsDumpParams(MappingsDumpParamsBuilder builder) {
34 this.eidSet = builder.eidSet;
35 this.prefixLength = builder.prefixLength;
36 this.vni = builder.vni;
37 this.eidType = builder.eidType;
38 this.eid = builder.eid;
39 this.filter = builder.filter;
43 public byte getEidSet() {
47 public byte getPrefixLength() {
55 public byte getEidType() {
59 public byte[] getEid() {
63 public final byte getFilter() {
68 public String toString() {
69 return "MappingsDumpParams{" +
71 ", prefixLength=" + prefixLength +
73 ", eidType=" + eidType +
74 ", eid=" + Arrays.toString(eid) +
75 ", filter=" + filter +
80 * Type of requested mapping eid
87 private final int value;
89 private EidType(final int value) {
93 public static final EidType valueOf(int value) {
102 throw new IllegalArgumentException("Illegal value");
106 public final int getValue() {
112 * Type of requested mapping
114 public enum FilterType {
119 private final int value;
121 private FilterType(final int value) {
125 public final int getValue() {
130 public enum QuantityType {
134 private final int value;
136 private QuantityType(final int value) {
140 public final int getValue() {
145 public static final class MappingsDumpParamsBuilder {
147 private byte prefixLength;
149 private byte eidType;
153 public static final MappingsDumpParamsBuilder newInstance() {
154 return new MappingsDumpParamsBuilder();
157 public MappingsDumpParamsBuilder setEidSet(final QuantityType quantityType) {
158 this.eidSet = (byte) quantityType.getValue();
162 public MappingsDumpParamsBuilder setPrefixLength(final byte prefixLength) {
163 this.prefixLength = prefixLength;
167 public MappingsDumpParamsBuilder setVni(final int vni) {
172 public MappingsDumpParamsBuilder setEidType(final EidType eidType) {
173 this.eidType = (byte) eidType.getValue();
177 public MappingsDumpParamsBuilder setEid(final byte[] eid) {
182 public MappingsDumpParamsBuilder setFilter(final FilterType filterType) {
183 this.filter = (byte) filterType.getValue();
187 public MappingsDumpParams build() {
188 return new MappingsDumpParams(this);