blob: 2687c9d885feed51863006b8de137ca8073a6fff [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 */
42 ApplicationId getAppId();
43
44 /**
45 * Gets all the l2Networks.
46 *
47 * @return all the l2Networks
48 */
49 Collection<L2Network> getL2Networks();
50
51 /**
52 * Retrieves the entire set of ipSubnets configuration.
53 *
54 * @return all the ipSubnets
55 */
56 Set<IpSubnet> getIpSubnets();
57
58 /**
59 * Retrieves the entire set of static routes to outer networks.
60 *
61 * @return the set of static routes to outer networks.
62 */
63 Set<Route> getBorderRoutes();
64
65 /**
Lee Yongjae7c27bb42017-11-17 12:00:45 +090066 * Evaluates whether a mac is of Virtual Gateway Mac Addresses.
67 *
68 * @param mac the MacAddress to evaluate
69 * @return true if the mac is of any Vitrual Gateway Mac Address of ipSubnets
70 */
71 boolean isVMac(MacAddress mac);
72
73 /**
74 * Evaluates whether an Interface belongs to l2Networks.
75 *
76 * @param intf the interface to evaluate
77 * @return true if the inteface belongs to l2Networks configed, otherwise false
78 */
79 boolean isL2NetworkInterface(Interface intf);
80
81 /**
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +090082 * Find Virtual Gateway Mac Address for Local Subnet Virtual Gateway Ip.
83 *
84 * @param ip the ip to check for Virtual Gateway Ip
85 * @return mac address of virtual gateway
86 */
87 MacAddress findVMacForIp(IpAddress ip);
88
89 /**
Lee Yongjae7c27bb42017-11-17 12:00:45 +090090 * Finds the L2 Network with given port and vlanId.
91 *
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 */
96 L2Network findL2Network(ConnectPoint port, VlanId vlanId);
97
98 /**
99 * Finds the L2 Network of the name.
100 *
101 * @param name the name to be matched
102 * @return the L2 Network for specific name
103 */
104 L2Network findL2Network(String name);
105
106 /**
107 * Finds the IpSubnet containing the ipAddress.
108 *
109 * @param ipAddress the ipAddress to be matched
110 * @return the IpSubnet for specific ipAddress
111 */
112 IpSubnet findIpSubnet(IpAddress ipAddress);
113
114 /**
115 * Finds the Border Route containing the ipAddress.
116 * ASSUME: ipAddress is out of ipSubnets
117 *
118 * @param ipAddress the ipAddress to be matched
119 * @return the IpSubnet for specific ipAddress
120 */
121 Route findBorderRoute(IpAddress ipAddress);
122
123 /**
124 * Finds the network interface related to the host.
125 *
126 * @param host the host
127 * @return the interface related to the host
128 */
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +0900129 Interface findHostInterface(Host host);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900130
131 /**
132 * Sends Neighbour Query (ARP or NDP) to Find Host Location.
133 *
134 * @param ip the ip address to resolve
135 * @return true if request mac packets are emitted. otherwise false
136 */
137 boolean requestMac(IpAddress ip);
138
139 /**
140 * Sends Dump Event to all SimpleFabricListeners to Dump Info on the Subject.
141 *
142 * @param subject the subject to dump
143 * @param out the output stream to dump
144 */
145 void dumpToStream(String subject, OutputStream out);
146
147 /**
148 * Triggers to send Refresh Notification to all sub modules.
149 */
150 void triggerRefresh();
151
152 /**
153 * Triggers to send Flush Notification to all sub modules.
154 */
155 void triggerFlush();
156
157}