blob: 33b9c5ea0be255df3e9ba0f315b8d8e0e4fc5ab4 [file] [log] [blame]
Lee Yongjae7c27bb42017-11-17 12:00:45 +09001/*
Jian Lic7efc1d2018-08-23 16:37:34 +09002 * Copyright 2018-present Open Networking Foundation
Lee Yongjae7c27bb42017-11-17 12:00:45 +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 */
Jian Lic7efc1d2018-08-23 16:37:34 +090016package org.onosproject.simplefabric.api;
Lee Yongjae7c27bb42017-11-17 12:00:45 +090017
18import org.onlab.packet.IpAddress;
Lee Yongjae7c27bb42017-11-17 12:00:45 +090019import org.onlab.packet.MacAddress;
20import org.onlab.packet.VlanId;
21import org.onosproject.core.ApplicationId;
22import org.onosproject.event.ListenerService;
23import org.onosproject.net.intf.Interface;
24import org.onosproject.net.ConnectPoint;
25import org.onosproject.net.Host;
26
27import java.io.OutputStream;
28import java.util.Set;
29import java.util.Collection;
30
31/**
32 * Provides information about the routing configuration.
33 */
34public interface SimpleFabricService
35 extends ListenerService<SimpleFabricEvent, SimpleFabricListener> {
36
Lee Yongjae7c27bb42017-11-17 12:00:45 +090037 /**
38 * Gets appId.
39 *
40 * @return appId of simple fabric app
41 */
Jian Lie2d87512018-08-23 17:33:05 +090042 ApplicationId appId();
Lee Yongjae7c27bb42017-11-17 12:00:45 +090043
44 /**
Jian Lie2d87512018-08-23 17:33:05 +090045 * Gets all the fabric networks.
Lee Yongjae7c27bb42017-11-17 12:00:45 +090046 *
Jian Lie2d87512018-08-23 17:33:05 +090047 * @return all the fabric networks
Lee Yongjae7c27bb42017-11-17 12:00:45 +090048 */
Jian Lie2d87512018-08-23 17:33:05 +090049 Collection<FabricNetwork> fabricNetworks();
Lee Yongjae7c27bb42017-11-17 12:00:45 +090050
51 /**
Jian Lie2d87512018-08-23 17:33:05 +090052 * Retrieves the entire set of fabricSubnets configuration.
Lee Yongjae7c27bb42017-11-17 12:00:45 +090053 *
Jian Lie2d87512018-08-23 17:33:05 +090054 * @return all the fabricSubnets
Lee Yongjae7c27bb42017-11-17 12:00:45 +090055 */
Jian Lie2d87512018-08-23 17:33:05 +090056 Set<FabricSubnet> defaultFabricSubnets();
Lee Yongjae7c27bb42017-11-17 12:00:45 +090057
58 /**
59 * Retrieves the entire set of static routes to outer networks.
60 *
61 * @return the set of static routes to outer networks.
62 */
Jian Lie2d87512018-08-23 17:33:05 +090063 Set<FabricRoute> fabricRoutes();
Lee Yongjae7c27bb42017-11-17 12:00:45 +090064
65 /**
Jian Lie2d87512018-08-23 17:33:05 +090066 * Evaluates whether a MAC is of virtual gateway MAC addresses.
Lee Yongjae7c27bb42017-11-17 12:00:45 +090067 *
Jian Lie2d87512018-08-23 17:33:05 +090068 * @param mac the MAC address to evaluate
69 * @return true if the mac is of any virtual gateway MAC address of fabricSubnets
Lee Yongjae7c27bb42017-11-17 12:00:45 +090070 */
Jian Lie2d87512018-08-23 17:33:05 +090071 boolean isVirtualGatewayMac(MacAddress mac);
Lee Yongjae7c27bb42017-11-17 12:00:45 +090072
73 /**
Jian Lie2d87512018-08-23 17:33:05 +090074 * Evaluates whether an interface belongs to fabric network or not.
Lee Yongjae7c27bb42017-11-17 12:00:45 +090075 *
76 * @param intf the interface to evaluate
Jian Lie2d87512018-08-23 17:33:05 +090077 * @return true if the interface belongs to fabric network, otherwise false
Lee Yongjae7c27bb42017-11-17 12:00:45 +090078 */
Jian Lie2d87512018-08-23 17:33:05 +090079 boolean isFabricNetworkInterface(Interface intf);
Lee Yongjae7c27bb42017-11-17 12:00:45 +090080
81 /**
Jian Lie2d87512018-08-23 17:33:05 +090082 * Finds virtual gateway MAC address for local subnet virtual gateway IP.
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +090083 *
Jian Lie2d87512018-08-23 17:33:05 +090084 * @param ip the IP to check for virtual gateway IP
85 * @return MAC address of virtual gateway
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +090086 */
Jian Lie2d87512018-08-23 17:33:05 +090087 MacAddress vMacForIp(IpAddress ip);
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +090088
89 /**
Jian Lie2d87512018-08-23 17:33:05 +090090 * Finds the L2 fabric network with given port and vlanId.
Lee Yongjae7c27bb42017-11-17 12:00:45 +090091 *
92 * @param port the port to be matched
93 * @param vlanId the vlanId to be matched
94 * @return the L2 Network for specific port and vlanId or null
95 */
Jian Lie2d87512018-08-23 17:33:05 +090096 FabricNetwork fabricNetwork(ConnectPoint port, VlanId vlanId);
Lee Yongjae7c27bb42017-11-17 12:00:45 +090097
98 /**
Jian Lie2d87512018-08-23 17:33:05 +090099 * Finds the fabric network by its name.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900100 *
101 * @param name the name to be matched
Jian Lie2d87512018-08-23 17:33:05 +0900102 * @return the fabric network
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900103 */
Jian Lie2d87512018-08-23 17:33:05 +0900104 FabricNetwork fabricNetwork(String name);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900105
106 /**
Jian Lie2d87512018-08-23 17:33:05 +0900107 * Finds the FabricSubnet which contains the given IP address.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900108 *
Jian Lie2d87512018-08-23 17:33:05 +0900109 * @param ipAddress the IP address to be matched
110 * @return the FabricSubnet
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900111 */
Jian Lie2d87512018-08-23 17:33:05 +0900112 FabricSubnet fabricSubnet(IpAddress ipAddress);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900113
114 /**
Jian Lie2d87512018-08-23 17:33:05 +0900115 * Finds the FabricRoute which contains the given IP address.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900116 *
Jian Lie2d87512018-08-23 17:33:05 +0900117 * @param ipAddress the IP address to be matched
118 * @return the FabricRoute
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900119 */
Jian Lie2d87512018-08-23 17:33:05 +0900120 FabricRoute fabricRoute(IpAddress ipAddress);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900121
122 /**
Jian Lie2d87512018-08-23 17:33:05 +0900123 * Finds the network interface which associated with the host.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900124 *
125 * @param host the host
Jian Lie2d87512018-08-23 17:33:05 +0900126 * @return the interface associated with the host
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900127 */
Jian Lie2d87512018-08-23 17:33:05 +0900128 Interface hostInterface(Host host);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900129
130 /**
Jian Lie2d87512018-08-23 17:33:05 +0900131 * Sends neighbour query (ARP or NDP) to find host location.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900132 *
Jian Lie2d87512018-08-23 17:33:05 +0900133 * @param ip the IP address to resolve
134 * @return true if request MAC packets are emitted, false otherwise
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900135 */
136 boolean requestMac(IpAddress ip);
137
138 /**
Jian Lie2d87512018-08-23 17:33:05 +0900139 * Sends dump event to all SimpleFabricListeners to dump info on the subject.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900140 *
141 * @param subject the subject to dump
142 * @param out the output stream to dump
143 */
144 void dumpToStream(String subject, OutputStream out);
145
146 /**
Jian Lie2d87512018-08-23 17:33:05 +0900147 * Triggers to send refresh notification to all sub modules.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900148 */
149 void triggerRefresh();
150
151 /**
Jian Lie2d87512018-08-23 17:33:05 +0900152 * Triggers to send flush notification to all sub modules.
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900153 */
154 void triggerFlush();
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900155}