Daniele Moro | 94660a0 | 2019-12-02 12:02:07 -0800 | [diff] [blame] | 1 | /* |
Joey Armstrong | 0964a2c | 2023-01-05 14:26:05 -0500 | [diff] [blame] | 2 | * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Daniele Moro | 94660a0 | 2019-12-02 12:02:07 -0800 | [diff] [blame] | 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 org.opencord.bng.cli; |
| 18 | |
| 19 | import org.onosproject.net.behaviour.BngProgrammable.BngCounterType; |
| 20 | |
| 21 | /** |
| 22 | * Utilities to print counter names in CLI output. |
| 23 | */ |
| 24 | public final class BngCliUtils { |
| 25 | |
| 26 | private BngCliUtils() { |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Prints a nicer counter name on CLI output. |
| 31 | * |
| 32 | * @param counterName The counter type to be converted |
| 33 | * @return The string representing the counter |
| 34 | */ |
| 35 | static String niceCounterName(BngCounterType counterName) { |
| 36 | switch (counterName) { |
| 37 | case CONTROL_PLANE: |
| 38 | return "Upstream Control"; |
| 39 | case DOWNSTREAM_RX: |
| 40 | return "Downstream Received"; |
| 41 | case DOWNSTREAM_TX: |
| 42 | return "Downstream Transmitted"; |
| 43 | case UPSTREAM_DROPPED: |
| 44 | return "Upstream Dropped"; |
| 45 | case UPSTREAM_TX: |
| 46 | return "Upstream Terminated"; |
| 47 | default: |
| 48 | return "UNKNOWN"; |
| 49 | } |
| 50 | } |
| 51 | } |