8cef5784548e5888b4e7504b5813ad5d9ece1144
[hc2vpp.git] /
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package io.fd.hc2vpp.lisp.translate.read.dump.executor.params;
18
19 import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
20 import javax.annotation.Nonnull;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev171013.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev171013.eid.table.grouping.eid.table.vni.table.VrfSubtable;
23
24 /**
25  * Parameters for dumping {@link VrfSubtable}/{@link BridgeDomainSubtable}
26  */
27 public final class SubtableDumpParams {
28
29     private final byte isL2;
30
31     private SubtableDumpParams(SubtableDumpParamsBuilder builder) {
32         this.isL2 = builder.isL2;
33     }
34
35     public byte isL2() {
36         return isL2;
37     }
38
39     @Override
40     public String toString() {
41         return "SubtableDumpParams{" +
42                 "isL2=" + isL2 +
43                 '}';
44     }
45
46     public enum MapLevel {
47         L2(1),
48         L3(0);
49
50         private final int value;
51
52         MapLevel(final int value) {
53             this.value = value;
54         }
55
56         public int getValue() {
57             return value;
58         }
59     }
60
61     public static final class SubtableDumpParamsBuilder implements ByteDataTranslator {
62
63         private byte isL2;
64
65         public SubtableDumpParamsBuilder setL2(@Nonnull final MapLevel mapLevel) {
66             isL2 = booleanToByte(MapLevel.L2.equals(mapLevel));
67             return this;
68         }
69
70         public SubtableDumpParams build() {
71             return new SubtableDumpParams(this);
72         }
73     }
74 }