blob: 279bbbd08ea5068a96f64f2eff222b47b55fe42a [file] [log] [blame]
Hyunsun Moon44aac662017-02-18 02:07:01 +09001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon44aac662017-02-18 02:07:01 +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.openstacknetworking.api;
17
daniel parkb5817102018-02-15 00:18:51 +090018import org.onlab.packet.IpAddress;
Jian Lie6110b72018-07-06 19:06:36 +090019import org.onlab.packet.IpPrefix;
daniel parkb5817102018-02-15 00:18:51 +090020import org.onlab.packet.MacAddress;
Hyunsun Moon44aac662017-02-18 02:07:01 +090021import org.onosproject.event.ListenerService;
SONA Project6bc5c4a2018-12-14 23:49:52 +090022import org.onosproject.openstacknetworking.api.OpenstackNetwork.Type;
daniel parkb5817102018-02-15 00:18:51 +090023import org.openstack4j.model.network.ExternalGateway;
Hyunsun Moon44aac662017-02-18 02:07:01 +090024import org.openstack4j.model.network.Network;
25import org.openstack4j.model.network.Port;
26import org.openstack4j.model.network.Subnet;
27
28import java.util.Set;
29
30/**
31 * Service for interacting with the inventory of OpenStack network and port.
32 */
33public interface OpenstackNetworkService
34 extends ListenerService<OpenstackNetworkEvent, OpenstackNetworkListener> {
35 /**
36 * Returns the network with the supplied network ID.
37 *
38 * @param networkId network id
39 * @return openstack network
40 */
41 Network network(String networkId);
42
43 /**
SONA Project6bc5c4a2018-12-14 23:49:52 +090044 * Returns the network type with the supplied network ID.
45 *
46 * @param networkId network id
47 * @return openstack network type
48 */
49 Type networkType(String networkId);
50
51 /**
Hyunsun Moon44aac662017-02-18 02:07:01 +090052 * Returns all networks registered in the service.
53 *
54 * @return set of networks
55 */
56 Set<Network> networks();
57
58 /**
59 * Returns the subnet with the supplied subnet ID.
60 *
61 * @param subnetId subnet id
62 * @return subnet
63 */
64 Subnet subnet(String subnetId);
65
66 /**
67 * Returns all subnets registered in the service.
68 *
69 * @return set of subnet
70 */
71 Set<Subnet> subnets();
72
73 /**
74 * Returns all subnets associated with the supplied network.
75 *
76 * @param networkId network id
77 * @return set of subnet
78 */
79 Set<Subnet> subnets(String networkId);
80
81 /**
82 * Returns the OpenStack port with the supplied port ID.
83 *
84 * @param portId openstack port id
85 * @return openstack port
86 */
87 Port port(String portId);
88
89 /**
90 * Returns the OpenStack port with the supplied ONOS port.
91 *
92 * @param port onos port
93 * @return openstack port
94 */
95 Port port(org.onosproject.net.Port port);
96
97 /**
98 * Returns all OpenStack ports registered in the service.
99 *
100 * @return set of ports
101 */
102 Set<Port> ports();
103
104 /**
daniel parkb5817102018-02-15 00:18:51 +0900105 * Returns all OpenStack ports associated with supplied network.
106 *
Hyunsun Moon44aac662017-02-18 02:07:01 +0900107 * @param networkId network id
108 * @return set of ports
109 */
110 Set<Port> ports(String networkId);
daniel parkb5817102018-02-15 00:18:51 +0900111
112 /**
Jian Lie6110b72018-07-06 19:06:36 +0900113 * Obtains a set of fixed IP addresses managed by the given network type.
114 *
115 * @param type network type (FLAT, VXLAN, VLAN, etc.)
116 * @return a set of fixed IP addresses
117 */
118 Set<IpPrefix> getFixedIpsByNetworkType(String type);
119
120 /**
daniel parkb5817102018-02-15 00:18:51 +0900121 * Returns external router mac with supplied external gateway.
122 *
123 * @param externalGateway external gateway information
124 * @return mac address
125 */
126 MacAddress externalPeerRouterMac(ExternalGateway externalGateway);
127
128 /**
129 * Returns external peer router with supplied ip address.
130 *
131 * @param ipAddress ip address
132 * @return external peer router
133 */
134 ExternalPeerRouter externalPeerRouter(IpAddress ipAddress);
135
136 /**
daniel park576969a2018-03-09 07:07:41 +0900137 * Returns external router with supplied external gateway.
138 *
139 * @param externalGateway external gateway information
140 * @return external router
141 */
142 ExternalPeerRouter externalPeerRouter(ExternalGateway externalGateway);
143
144 /**
daniel parkb5817102018-02-15 00:18:51 +0900145 * Returns external peer router list.
146 *
147 * @return external peer router list
148 */
149 Set<ExternalPeerRouter> externalPeerRouters();
150
Daniel Park577b69c2018-07-16 17:29:34 +0900151 /**
152 * Returns ip prefix with supplied port ID.
153 *
154 * @param portId openstack port id
155 * @return ip prefix
156 */
157 IpPrefix ipPrefix(String portId);
158
159 /**
Jian Lic38e9032018-08-09 17:08:38 +0900160 * Returns gateway ip address with supplied port ID.
Daniel Park577b69c2018-07-16 17:29:34 +0900161 *
162 * @param portId openstack port id
163 * @return gateway ip address
164 */
165 String gatewayIp(String portId);
166
Jian Li0b93b002018-07-31 13:41:08 +0900167 /**
168 * Returns network segment ID with supplied network ID.
169 *
170 * @param netId openstack network ID
171 * @return network segment ID
172 */
173 String segmentId(String netId);
Hyunsun Moon44aac662017-02-18 02:07:01 +0900174}