2 * Copyright (c) 2017 HPE, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.statistics;
10 import java.math.BigInteger;
11 import java.util.HashMap;
14 public class ElementCountersRequest {
16 private ElementCountersDirection direction;
17 private String portId;
18 private BigInteger dpn;
20 private Map<String, Map<String, String>> filters;
22 public ElementCountersRequest(String portId) {
24 filters = new HashMap<>();
27 public void setElementCountersDirection(ElementCountersDirection elementCountersDirection) {
28 this.direction = elementCountersDirection;
31 public String getPortId() {
35 public ElementCountersDirection getDirection() {
39 public Map<String, Map<String, String>> getFilters() {
43 public void addFilterGroup(String filterGroupName) {
44 filters.put(filterGroupName, new HashMap<>());
47 public Map<String, String> getFilterGroup(String filterGroupName) {
48 return filters.get(filterGroupName);
51 public void addFilterToFilterGroup(String filterGroupName, String filterName, String value) {
52 if (filters.get(filterGroupName) == null) {
53 addFilterGroup(filterGroupName);
55 filters.get(filterGroupName).put(filterName, value);
58 public String getFilterFromFilterGroup(String filterGroupName, String filterName) {
59 if (filters.containsKey(filterGroupName)) {
60 return filters.get(filterGroupName).get(filterName);
66 public int getLportTag() {
70 public void setLportTag(int lportTag) {
71 this.lportTag = lportTag;
74 public BigInteger getDpn() {
78 public void setDpn(BigInteger dpn) {
82 public boolean isFilterGroupExist(String filterGroupName) {
83 return filters.containsKey(filterGroupName);
86 public boolean isFilterExist(String filterGroupName, String filterName) {
87 if (!isFilterGroupExist(filterGroupName)) {
91 return filters.get(filterGroupName).containsKey(filterName);
95 public int hashCode() {
98 result = prime * result + ((direction == null) ? 0 : direction.hashCode());
99 result = prime * result + ((dpn == null) ? 0 : dpn.hashCode());
100 result = prime * result + ((filters == null) ? 0 : filters.hashCode());
101 result = prime * result + lportTag;
102 result = prime * result + ((portId == null) ? 0 : portId.hashCode());
107 public boolean equals(Object obj) {
114 if (getClass() != obj.getClass()) {
117 ElementCountersRequest other = (ElementCountersRequest) obj;
118 if (direction != other.direction) {
122 if (other.dpn != null) {
125 } else if (!dpn.equals(other.dpn)) {
128 if (filters == null) {
129 if (other.filters != null) {
132 } else if (!filters.equals(other.filters)) {
135 if (lportTag != other.lportTag) {
138 if (portId == null) {
139 if (other.portId != null) {
142 } else if (!portId.equals(other.portId)) {
149 public String toString() {
150 return "ElementCountersRequest [direction=" + direction + ", portId=" + portId + ", dpn=" + dpn + ", lportTag="
151 + lportTag + ", filters=" + filters + "]";