blob: f7c16ba7062c4d00c61eaedd34c8a5fa402afdbd [file] [log] [blame]
Daniel Parka7d6e9f2016-01-18 17:54:14 +09001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Daniel Parka7d6e9f2016-01-18 17:54:14 +09003 *
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.openstacknode;
17
Hyunsun Moon34bbe172016-06-28 19:18:40 -070018import org.onlab.packet.IpAddress;
Hyunsun Moon05d9b262016-07-03 18:38:44 -070019import org.onosproject.event.ListenerService;
Hyunsun Moon34bbe172016-06-28 19:18:40 -070020import org.onosproject.net.DeviceId;
21import org.onosproject.net.PortNumber;
22
Daniel Parka7d6e9f2016-01-18 17:54:14 +090023import java.util.List;
Hyunsun Moon34bbe172016-06-28 19:18:40 -070024import java.util.Optional;
25import java.util.Set;
Daniel Parka7d6e9f2016-01-18 17:54:14 +090026
27/**
28 * Handles the bootstrap request for compute/gateway node.
29 */
Hyunsun Moon05d9b262016-07-03 18:38:44 -070030public interface OpenstackNodeService
31 extends ListenerService<OpenstackNodeEvent, OpenstackNodeListener> {
Daniel Parka7d6e9f2016-01-18 17:54:14 +090032
Hyunsun Moon34bbe172016-06-28 19:18:40 -070033 enum NodeType {
Daniel Parka7d6e9f2016-01-18 17:54:14 +090034 /**
35 * Compute or Gateway Node.
36 */
Hyunsun Moon34bbe172016-06-28 19:18:40 -070037 COMPUTE,
38 GATEWAY
Daniel Parka7d6e9f2016-01-18 17:54:14 +090039 }
Hyunsun Moon34bbe172016-06-28 19:18:40 -070040
Daniel Parka7d6e9f2016-01-18 17:54:14 +090041 /**
Hyunsun Moon34bbe172016-06-28 19:18:40 -070042 * Adds or updates a new node to the service.
Daniel Parka7d6e9f2016-01-18 17:54:14 +090043 *
44 * @param node openstack node
45 */
Hyunsun Moon34bbe172016-06-28 19:18:40 -070046 void addOrUpdateNode(OpenstackNode node);
Daniel Parka7d6e9f2016-01-18 17:54:14 +090047
48 /**
Hyunsun Moon05d9b262016-07-03 18:38:44 -070049 * Bootstraps node with INIT state.
50 *
51 * @param node openstack node
52 */
53 void processInitState(OpenstackNode node);
54
55 /**
56 * Bootstraps node with DEVICE_CREATED state.
57 *
58 * @param node openstack node
59 */
60 void processDeviceCreatedState(OpenstackNode node);
61
62 /**
63 * Bootstraps node with COMPLETE state.
64 *
65 * @param node openstack node
66 */
67 void processCompleteState(OpenstackNode node);
68
69 /**
70 * Bootstraps node with INCOMPLETE state.
71 *
72 * @param node openstack node
73 */
74 void processIncompleteState(OpenstackNode node);
75
76 /**
Daniel Parka7d6e9f2016-01-18 17:54:14 +090077 * Deletes a node from the service.
78 *
79 * @param node openstack node
80 */
81 void deleteNode(OpenstackNode node);
82
83 /**
Hyunsun Moon34bbe172016-06-28 19:18:40 -070084 * Returns all nodes known to the service.
Daniel Parka7d6e9f2016-01-18 17:54:14 +090085 *
Daniel Parka7d6e9f2016-01-18 17:54:14 +090086 * @return list of nodes
87 */
Hyunsun Moon34bbe172016-06-28 19:18:40 -070088 List<OpenstackNode> nodes();
Daniel Parka7d6e9f2016-01-18 17:54:14 +090089
90 /**
Hyunsun Moon34bbe172016-06-28 19:18:40 -070091 * Returns all nodes in complete state.
Daniel Parka7d6e9f2016-01-18 17:54:14 +090092 *
Hyunsun Moon34bbe172016-06-28 19:18:40 -070093 * @return set of nodes
Daniel Parka7d6e9f2016-01-18 17:54:14 +090094 */
Hyunsun Moon34bbe172016-06-28 19:18:40 -070095 Set<OpenstackNode> completeNodes();
96
97 /**
Hyunsun Moon34bbe172016-06-28 19:18:40 -070098 * Returns data network IP address of a given integration bridge device.
99 *
100 * @param intBridgeId integration bridge device id
101 * @return ip address; empty value otherwise
102 */
103 Optional<IpAddress> dataIp(DeviceId intBridgeId);
104
105 /**
106 * Returns tunnel port number of a given integration bridge device.
107 *
108 * @param intBridgeId integration bridge device id
109 * @return port number; or empty value
110 */
111 Optional<PortNumber> tunnelPort(DeviceId intBridgeId);
112
113 /**
114 * Returns router bridge device ID connected to a given integration bridge.
115 * It returns valid value only if the node type is GATEWAY.
116 *
117 * @param intBridgeId device id of the integration bridge
118 * @return device id of a router bridge; or empty value
119 */
120 Optional<DeviceId> routerBridge(DeviceId intBridgeId);
121
122 /**
123 * Returns port number connected to the router bridge.
124 * It returns valid value only if the node type is GATEWAY.
125 *
126 * @param intBridgeId integration bridge device id
127 * @return port number; or empty value
128 */
129 Optional<PortNumber> externalPort(DeviceId intBridgeId);
Daniel Parka7d6e9f2016-01-18 17:54:14 +0900130}