blob: 864b4a485196e35950ea110c1b81f6b556d67779 [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;
daniel parkb5817102018-02-15 00:18:51 +090022import org.openstack4j.model.network.ExternalGateway;
Hyunsun Moon44aac662017-02-18 02:07:01 +090023import org.openstack4j.model.network.Network;
24import org.openstack4j.model.network.Port;
25import org.openstack4j.model.network.Subnet;
26
27import java.util.Set;
28
29/**
30 * Service for interacting with the inventory of OpenStack network and port.
31 */
32public interface OpenstackNetworkService
33 extends ListenerService<OpenstackNetworkEvent, OpenstackNetworkListener> {
34 /**
35 * Returns the network with the supplied network ID.
36 *
37 * @param networkId network id
38 * @return openstack network
39 */
40 Network network(String networkId);
41
42 /**
43 * Returns all networks registered in the service.
44 *
45 * @return set of networks
46 */
47 Set<Network> networks();
48
49 /**
50 * Returns the subnet with the supplied subnet ID.
51 *
52 * @param subnetId subnet id
53 * @return subnet
54 */
55 Subnet subnet(String subnetId);
56
57 /**
58 * Returns all subnets registered in the service.
59 *
60 * @return set of subnet
61 */
62 Set<Subnet> subnets();
63
64 /**
65 * Returns all subnets associated with the supplied network.
66 *
67 * @param networkId network id
68 * @return set of subnet
69 */
70 Set<Subnet> subnets(String networkId);
71
72 /**
73 * Returns the OpenStack port with the supplied port ID.
74 *
75 * @param portId openstack port id
76 * @return openstack port
77 */
78 Port port(String portId);
79
80 /**
81 * Returns the OpenStack port with the supplied ONOS port.
82 *
83 * @param port onos port
84 * @return openstack port
85 */
86 Port port(org.onosproject.net.Port port);
87
88 /**
89 * Returns all OpenStack ports registered in the service.
90 *
91 * @return set of ports
92 */
93 Set<Port> ports();
94
95 /**
daniel parkb5817102018-02-15 00:18:51 +090096 * Returns all OpenStack ports associated with supplied network.
97 *
Hyunsun Moon44aac662017-02-18 02:07:01 +090098 * @param networkId network id
99 * @return set of ports
100 */
101 Set<Port> ports(String networkId);
daniel parkb5817102018-02-15 00:18:51 +0900102
103 /**
Jian Lie6110b72018-07-06 19:06:36 +0900104 * Obtains a set of fixed IP addresses managed by the given network type.
105 *
106 * @param type network type (FLAT, VXLAN, VLAN, etc.)
107 * @return a set of fixed IP addresses
108 */
109 Set<IpPrefix> getFixedIpsByNetworkType(String type);
110
111 /**
daniel parkb5817102018-02-15 00:18:51 +0900112 * Returns external router mac with supplied external gateway.
113 *
114 * @param externalGateway external gateway information
115 * @return mac address
116 */
117 MacAddress externalPeerRouterMac(ExternalGateway externalGateway);
118
119 /**
120 * Returns external peer router with supplied ip address.
121 *
122 * @param ipAddress ip address
123 * @return external peer router
124 */
125 ExternalPeerRouter externalPeerRouter(IpAddress ipAddress);
126
127 /**
daniel park576969a2018-03-09 07:07:41 +0900128 * Returns external router with supplied external gateway.
129 *
130 * @param externalGateway external gateway information
131 * @return external router
132 */
133 ExternalPeerRouter externalPeerRouter(ExternalGateway externalGateway);
134
135 /**
daniel parkb5817102018-02-15 00:18:51 +0900136 * Returns external peer router list.
137 *
138 * @return external peer router list
139 */
140 Set<ExternalPeerRouter> externalPeerRouters();
141
Daniel Park577b69c2018-07-16 17:29:34 +0900142 /**
143 * Returns ip prefix with supplied port ID.
144 *
145 * @param portId openstack port id
146 * @return ip prefix
147 */
148 IpPrefix ipPrefix(String portId);
149
150 /**
151 * Returns network type with supplied network ID.
152 *
153 * @param netId openstack network id
154 * @return network type
155 */
156 String networkType(String netId);
157
158 /**
159 * Returns gateway ip address upplied port ID.
160 *
161 * @param portId openstack port id
162 * @return gateway ip address
163 */
164 String gatewayIp(String portId);
165
166
Hyunsun Moon44aac662017-02-18 02:07:01 +0900167}