blob: 08d405e96b5b0e70b8c536f718bae21c4702f505 [file] [log] [blame]
CNlucius74fd4942015-07-20 14:28:04 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
CNlucius74fd4942015-07-20 14:28:04 +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.ovsdb.controller;
17
Hyunsun Moon5fb20a52015-09-25 17:02:33 -070018import org.onlab.packet.IpAddress;
19import org.onlab.packet.TpPort;
20
CNlucius74fd4942015-07-20 14:28:04 +080021import java.util.List;
jaegonkim1af0ae52017-01-01 10:46:55 +090022import java.util.function.Consumer;
CNlucius74fd4942015-07-20 14:28:04 +080023
24/**
BitOhenry264f35a2015-11-03 20:58:39 +080025 * Abstraction of an ovsdb controller. Serves as an one stop shop for obtaining
CNlucius74fd4942015-07-20 14:28:04 +080026 * OvsdbNode and (un)register listeners on ovsdb events and ovsdb node events.
27 */
28public interface OvsdbController {
29
30 /**
31 * Adds Node Event Listener.
32 *
33 * @param listener node listener
34 */
35 void addNodeListener(OvsdbNodeListener listener);
36
37 /**
38 * Removes Node Event Listener.
39 *
40 * @param listener node listener
41 */
42 void removeNodeListener(OvsdbNodeListener listener);
43
44 /**
45 * Adds ovsdb event listener.
46 *
47 * @param listener event listener
48 */
49 void addOvsdbEventListener(OvsdbEventListener listener);
50
51 /**
52 * Removes ovsdb event listener.
53 *
54 * @param listener event listener
55 */
56 void removeOvsdbEventListener(OvsdbEventListener listener);
57
58 /**
59 * Gets all the nodes information.
60 *
61 * @return the list of node id
62 */
63 List<OvsdbNodeId> getNodeIds();
64
65 /**
BitOhenry264f35a2015-11-03 20:58:39 +080066 * Gets an ovsdb client by node identifier.
CNlucius74fd4942015-07-20 14:28:04 +080067 *
68 * @param nodeId node identifier
69 * @return OvsdbClient ovsdb node information
70 */
71 OvsdbClientService getOvsdbClient(OvsdbNodeId nodeId);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -070072
73 /**
74 * Connect to the ovsdb server with given ip address and port number.
75 *
76 * @param ip ip address
77 * @param port port number
78 */
79 void connect(IpAddress ip, TpPort port);
jaegonkim1af0ae52017-01-01 10:46:55 +090080
81 /**
82 * Connect to the ovsdb server with given ip address, port number, and connection failure handler.
83 *
84 * @param ip ip address
85 * @param port port number
86 * @param failhandler connection failure handler
87 */
88 void connect(IpAddress ip, TpPort port, Consumer<Exception> failhandler);
CNlucius74fd4942015-07-20 14:28:04 +080089}