blob: 83a6fa2602fb69d04e884e8bfede5a3cd8ad0208 [file] [log] [blame]
Esin Karaman971fb7f2017-12-28 13:44:52 +00001/*
2 * Copyright 2018-present Open Networking Foundation
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
18package org.onosproject.drivers.bmv2.api.runtime;
19
20import com.fasterxml.jackson.annotation.JsonCreator;
21import com.fasterxml.jackson.annotation.JsonProperty;
22
23/**
24 * Represents mc group list retrieved from BMv2 PRE.
25 */
26public final class Bmv2PreJsonGroups {
27 public final L1Handle[] l1handles;
28 public final L2Handle[] l2handles;
29 public final Lag[] lags;
30 public final Mgrp[] mgrps;
31
32 @JsonCreator
33 public Bmv2PreJsonGroups(@JsonProperty("l1_handles") L1Handle[] l1handles,
34 @JsonProperty("l2_handles") L2Handle[] l2handles,
35 @JsonProperty("lags") Lag[] lags,
36 @JsonProperty("mgrps") Mgrp[] mgrps) {
37 this.l1handles = l1handles;
38 this.l2handles = l2handles;
39 this.lags = lags;
40 this.mgrps = mgrps;
41 }
42
43 public static final class L1Handle {
44 public final int handle;
45 public final int l2handle;
46 public final int rid;
47
48 @JsonCreator
49 public L1Handle(@JsonProperty("handle") int handle,
50 @JsonProperty("l2_handle") int l2handle,
51 @JsonProperty("rid") int rid) {
52 this.handle = handle;
53 this.l2handle = l2handle;
54 this.rid = rid;
55 }
56 }
57
58 public static final class L2Handle {
59 public final int handle;
60 public final int[] lags;
61 public final int[] ports;
62
63 @JsonCreator
64 public L2Handle(@JsonProperty("handle") int handle,
65 @JsonProperty("lags") int[] lags,
66 @JsonProperty("ports") int[] ports) {
67 this.handle = handle;
68 this.lags = lags;
69 this.ports = ports;
70 }
71 }
72
73 public static final class Lag {
74 //lag is not used for now
75 @JsonCreator
76 public Lag() {
77 }
78 }
79
80 public static final class Mgrp {
81 public final int id;
82 public final int[] l1handles;
83
84 @JsonCreator
85 public Mgrp(@JsonProperty("id") int id, @JsonProperty("l1_handles") int[] l1handles) {
86 this.id = id;
87 this.l1handles = l1handles;
88 }
89 }
90}
91