blob: 6cacec481732415e121130083dde3c164cbb72bd [file] [log] [blame]
Satish Kf6d87cb2015-11-30 19:59:22 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Satish Kf6d87cb2015-11-30 19:59:22 +05303 *
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.iptopology.api.device;
17
18import org.onlab.packet.Ip4Address;
19import org.onlab.packet.Ip6Address;
20import org.onosproject.iptopology.api.DevicePrefix;
21import org.onosproject.iptopology.api.InterfaceIdentifier;
22import org.onosproject.iptopology.api.IpDevice;
23import org.onosproject.iptopology.api.DeviceIntf;
24import org.onosproject.net.DeviceId;
25import org.onosproject.net.provider.ProviderId;
26import org.onosproject.store.Store;
27
28import java.util.List;
29
30/**
31 * Manages inventory of ip devices; not intended for direct use.
32 */
33public interface IpDeviceStore extends Store<IpDeviceEvent, IpDeviceStoreDelegate> {
34
35 /**
36 * Returns the number of ip devices known to the system.
37 *
38 * @return number of ip devices
39 */
40 int getIpDeviceCount();
41
42 /**
43 * Returns an iterable collection of all ip devices known to the system.
44 *
45 * @return ip device collection
46 */
47 Iterable<IpDevice> getIpDevices();
48
49
50 /**
51 * Returns an ip device with the specified identifier.
52 *
53 * @param deviceId device identifier
54 * @return ip device
55 */
56 IpDevice getIpDevice(DeviceId deviceId);
57
58 /**
59 * Creates a new infrastructure ip device, or updates an existing one using
60 * the supplied device description.
61 *
62 * @param providerId provider identifier
63 * @param deviceId device identifier
64 * @param deviceDescription device description
65 * @return ready to send event describing what occurred; null if no change
66 */
67 IpDeviceEvent createOrUpdateIpDevice(ProviderId providerId, DeviceId deviceId,
68 IpDeviceDescription deviceDescription);
69
70 /**
71 * Administratively removes the specified ip device from the store.
72 *
73 * @param deviceId device to be removed
74 * @return null if no such ip device
75 */
76 IpDeviceEvent removeIpDevice(DeviceId deviceId);
77
78 /**
79 * Updates the interface of the specified ip device using the given
80 * list of interface descriptions. The list is assumed to be comprehensive.
81 *
82 * @param providerId provider identifier
83 * @param deviceId ip device identifier
84 * @param interfaceDescriptions list of interface descriptions
85 * @return ready to send events describing what occurred; empty list if no change
86 */
87 List<IpDeviceEvent> updateInterfaces(ProviderId providerId, DeviceId deviceId,
88 List<InterfaceDescription> interfaceDescriptions);
89
90 /**
91 * Administratively removes the specified interface from the store.
92 *
93 * @param deviceId device of the interfaces to be removed
94 * @param interfaceDescriptions list of interface descriptions
95 * @return ready to send events describing what occurred.
96 */
97 List<IpDeviceEvent> removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
98
99 /**
100 * Returns the list of interfaces that belong to the specified device.
101 *
102 * @param deviceId device identifier
103 * @return list of device interfaces
104 */
105 List<DeviceIntf> getInterfaces(DeviceId deviceId);
106
107 /**
108 * Returns the specified device interface.
109 *
110 * @param deviceId device identifier
111 * @param ipv4Address ipv4 address of the interface
112 * @return device interface
113 */
114 DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address);
115
116 /**
117 * Returns the specified device interface.
118 *
119 * @param deviceId device identifier
120 * @param ipv6Address ipv6 address of the interface
121 * @return device interface
122 */
123 DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address);
124
125 /**
126 * Returns the specified device interface.
127 *
128 * @param deviceId device identifier
129 * @param intfId interface identifier of the interface
130 * @return device interface
131 */
132 DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId);
133
134 /**
135 * Updates the prefix information of the specified ip device using the given
136 * list of prefix descriptions. The list is assumed to be comprehensive.
137 *
138 * @param providerId provider identifier
139 * @param deviceId ip device identifier
140 * @param prefixDescriptions list of prefix descriptions
141 * @return ready to send events describing what occurred; empty list if no change
142 */
143 List<IpDeviceEvent> updatePrefixes(ProviderId providerId, DeviceId deviceId,
144 List<PrefixDescription> prefixDescriptions);
145
146 /**
147 * Administratively removes the specified prefix from the store.
148 *
149 * @param deviceId device of the prefix to be removed
150 * @param prefixDescriptions list of prefix descriptions
151 * @return ready to send events describing what occurred.
152 */
153 List<IpDeviceEvent> removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
154
155 /**
156 * Returns the list of prefixes that belong to the specified device.
157 *
158 * @param deviceId device identifier
159 * @return list of device prefixes
160 */
161 List<DevicePrefix> getPrefixes(DeviceId deviceId);
162
163}
164