Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
Jian Li | 85060ac | 2016-02-04 09:58:56 -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 | package org.onosproject.cpman; |
| 17 | |
| 18 | import com.google.common.collect.ImmutableSet; |
| 19 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | import static org.onosproject.cpman.ControlMetricType.CPU_IDLE_TIME; |
| 23 | import static org.onosproject.cpman.ControlMetricType.CPU_LOAD; |
| 24 | import static org.onosproject.cpman.ControlMetricType.DISK_READ_BYTES; |
| 25 | import static org.onosproject.cpman.ControlMetricType.DISK_WRITE_BYTES; |
| 26 | import static org.onosproject.cpman.ControlMetricType.FLOW_MOD_PACKET; |
| 27 | import static org.onosproject.cpman.ControlMetricType.FLOW_REMOVED_PACKET; |
| 28 | import static org.onosproject.cpman.ControlMetricType.INBOUND_PACKET; |
| 29 | import static org.onosproject.cpman.ControlMetricType.MEMORY_FREE; |
| 30 | import static org.onosproject.cpman.ControlMetricType.MEMORY_FREE_RATIO; |
| 31 | import static org.onosproject.cpman.ControlMetricType.MEMORY_USED; |
| 32 | import static org.onosproject.cpman.ControlMetricType.MEMORY_USED_RATIO; |
| 33 | import static org.onosproject.cpman.ControlMetricType.NW_INCOMING_BYTES; |
| 34 | import static org.onosproject.cpman.ControlMetricType.NW_INCOMING_PACKETS; |
| 35 | import static org.onosproject.cpman.ControlMetricType.NW_OUTGOING_BYTES; |
| 36 | import static org.onosproject.cpman.ControlMetricType.NW_OUTGOING_PACKETS; |
| 37 | import static org.onosproject.cpman.ControlMetricType.OUTBOUND_PACKET; |
| 38 | import static org.onosproject.cpman.ControlMetricType.REPLY_PACKET; |
| 39 | import static org.onosproject.cpman.ControlMetricType.REQUEST_PACKET; |
| 40 | import static org.onosproject.cpman.ControlMetricType.SYS_CPU_TIME; |
| 41 | import static org.onosproject.cpman.ControlMetricType.TOTAL_CPU_TIME; |
| 42 | import static org.onosproject.cpman.ControlMetricType.USER_CPU_TIME; |
| 43 | |
| 44 | /** |
| 45 | * A set of resource type used in control plane. |
| 46 | */ |
| 47 | public final class ControlResource { |
| 48 | |
| 49 | private ControlResource() {} |
| 50 | |
| 51 | /** |
| 52 | * Control resource type. |
| 53 | */ |
| 54 | public enum Type { |
| 55 | /* CPU resource */ |
| 56 | CPU, |
| 57 | |
| 58 | /* Memory resource */ |
| 59 | MEMORY, |
| 60 | |
| 61 | /* Disk resource */ |
| 62 | DISK, |
| 63 | |
| 64 | /* Network resource */ |
| 65 | NETWORK, |
| 66 | |
| 67 | /* Control message resource */ |
| 68 | CONTROL_MESSAGE |
| 69 | } |
| 70 | |
| 71 | /* A collection of CPU related metric types */ |
| 72 | public static final Set<ControlMetricType> CPU_METRICS = |
| 73 | ImmutableSet.of(CPU_IDLE_TIME, CPU_LOAD, SYS_CPU_TIME, |
| 74 | USER_CPU_TIME, TOTAL_CPU_TIME); |
| 75 | |
| 76 | /* A collection of memory related metric types */ |
| 77 | public static final Set<ControlMetricType> MEMORY_METRICS = |
| 78 | ImmutableSet.of(MEMORY_FREE, MEMORY_FREE_RATIO, MEMORY_USED, |
| 79 | MEMORY_USED_RATIO); |
| 80 | |
| 81 | /* A collection of disk related metric types */ |
| 82 | public static final Set<ControlMetricType> DISK_METRICS = |
| 83 | ImmutableSet.of(DISK_READ_BYTES, DISK_WRITE_BYTES); |
| 84 | |
| 85 | /* A collection of network related metric types */ |
| 86 | public static final Set<ControlMetricType> NETWORK_METRICS = |
| 87 | ImmutableSet.of(NW_INCOMING_BYTES, NW_OUTGOING_BYTES, |
| 88 | NW_INCOMING_PACKETS, NW_OUTGOING_PACKETS); |
| 89 | |
| 90 | /* A collection of control message related metric types */ |
| 91 | public static final Set<ControlMetricType> CONTROL_MESSAGE_METRICS = |
| 92 | ImmutableSet.of(INBOUND_PACKET, OUTBOUND_PACKET, FLOW_MOD_PACKET, |
| 93 | FLOW_REMOVED_PACKET, REQUEST_PACKET, REPLY_PACKET); |
| 94 | } |