blob: c2a519ba4bb685e724d7663bf9a7a69e943ed9d3 [file] [log] [blame]
Jian Li85060ac2016-02-04 09:58:56 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Jian Li85060ac2016-02-04 09:58:56 -08003 *
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 */
16package org.onosproject.cpman;
17
18import com.google.common.collect.ImmutableSet;
19
20import java.util.Set;
21
22import static org.onosproject.cpman.ControlMetricType.CPU_IDLE_TIME;
23import static org.onosproject.cpman.ControlMetricType.CPU_LOAD;
24import static org.onosproject.cpman.ControlMetricType.DISK_READ_BYTES;
25import static org.onosproject.cpman.ControlMetricType.DISK_WRITE_BYTES;
26import static org.onosproject.cpman.ControlMetricType.FLOW_MOD_PACKET;
27import static org.onosproject.cpman.ControlMetricType.FLOW_REMOVED_PACKET;
28import static org.onosproject.cpman.ControlMetricType.INBOUND_PACKET;
29import static org.onosproject.cpman.ControlMetricType.MEMORY_FREE;
30import static org.onosproject.cpman.ControlMetricType.MEMORY_FREE_RATIO;
31import static org.onosproject.cpman.ControlMetricType.MEMORY_USED;
32import static org.onosproject.cpman.ControlMetricType.MEMORY_USED_RATIO;
33import static org.onosproject.cpman.ControlMetricType.NW_INCOMING_BYTES;
34import static org.onosproject.cpman.ControlMetricType.NW_INCOMING_PACKETS;
35import static org.onosproject.cpman.ControlMetricType.NW_OUTGOING_BYTES;
36import static org.onosproject.cpman.ControlMetricType.NW_OUTGOING_PACKETS;
37import static org.onosproject.cpman.ControlMetricType.OUTBOUND_PACKET;
38import static org.onosproject.cpman.ControlMetricType.REPLY_PACKET;
39import static org.onosproject.cpman.ControlMetricType.REQUEST_PACKET;
40import static org.onosproject.cpman.ControlMetricType.SYS_CPU_TIME;
41import static org.onosproject.cpman.ControlMetricType.TOTAL_CPU_TIME;
42import static org.onosproject.cpman.ControlMetricType.USER_CPU_TIME;
43
44/**
45 * A set of resource type used in control plane.
46 */
47public 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}