blob: f93de3cf097a37ae39f20e3b9a09b5c78cb0deb3 [file] [log] [blame]
slowrdb071b22017-07-07 11:10:25 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
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 */
16package org.onosproject.artemis.impl.monitors;
17
18import org.onlab.packet.IpPrefix;
19
20/**
21 * Abstract class for Monitors.
22 */
23public abstract class Monitor {
24 /**
25 * Match enum type with monitor type inside configuration to map them.
26 */
27 public enum Types {
28 RIPE {
29 @Override
30 public String toString() {
31 return "ripe";
32 }
33 },
34 EXABGP {
35 @Override
36 public String toString() {
37 return "exabgp";
38 }
39 }
40 }
41
42 IpPrefix prefix;
43 Monitor(IpPrefix prefix) {
44 this.prefix = prefix;
45 }
46
47 /**
48 * Get prefix of the specific monitor.
49 *
50 * @return prefix
51 */
52 public IpPrefix getPrefix() {
53 return prefix;
54 }
55
56 /**
57 * Set prefix for monitor.
58 *
59 * @param prefix prefix
60 */
61 public void setPrefix(IpPrefix prefix) {
62 this.prefix = prefix;
63 }
64
65 /**
66 * Start monitor to begin capturing incoming BGP packets.
67 */
68 public abstract void startMonitor();
69
70 /**
71 * Stop monitor from capturing incoming BGP packets.
72 */
73 public abstract void stopMonitor();
74
75 /**
76 * Get type of monitor.
77 *
78 * @return enum type
79 */
80 public abstract Types getType();
81
82 /**
83 * Check if monitor is running.
84 *
85 * @return true if running
86 */
87 public abstract boolean isRunning();
88
89 /**
90 * Get host alias e.g. IP address, name.
91 *
92 * @return host alias
93 */
94 public abstract String getHost();
95
96 /**
97 * Set alias of host.
98 *
99 * @param host alias
100 */
101 public abstract void setHost(String host);
102}