diff options
author | CNlucius <lukai1@huawei.com> | 2016-09-13 11:40:12 +0800 |
---|---|---|
committer | CNlucius <lukai1@huawei.com> | 2016-09-13 11:41:53 +0800 |
commit | b731e2f1dd0972409b136aebc7b463dd72c9cfad (patch) | |
tree | 5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/core/api/src/main/java/org/onosproject/net/host | |
parent | ee93993458266114c29271a481ef9ce7ce621b2a (diff) |
ONOSFW-171
O/S-SFC-ONOS scenario documentation
Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/host')
13 files changed, 0 insertions, 987 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java deleted file mode 100644 index 307a6078..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import java.util.Collections; -import java.util.Set; - -import org.onosproject.net.AbstractDescription; -import org.onosproject.net.HostLocation; -import org.onosproject.net.SparseAnnotations; -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; - -import com.google.common.collect.ImmutableSet; - -import static com.google.common.base.MoreObjects.toStringHelper; -import com.google.common.base.Objects; - -/** - * Default implementation of an immutable host description. - */ -public class DefaultHostDescription extends AbstractDescription - implements HostDescription { - - private final MacAddress mac; - private final VlanId vlan; - private final HostLocation location; - private final Set<IpAddress> ip; - - /** - * Creates a host description using the supplied information. - * - * @param mac host MAC address - * @param vlan host VLAN identifier - * @param location host location - * @param annotations optional key/value annotations map - */ - public DefaultHostDescription(MacAddress mac, VlanId vlan, - HostLocation location, - SparseAnnotations... annotations) { - this(mac, vlan, location, Collections.<IpAddress>emptySet(), - annotations); - } - - /** - * Creates a host description using the supplied information. - * - * @param mac host MAC address - * @param vlan host VLAN identifier - * @param location host location - * @param ip host IP address - * @param annotations optional key/value annotations map - */ - public DefaultHostDescription(MacAddress mac, VlanId vlan, - HostLocation location, IpAddress ip, - SparseAnnotations... annotations) { - this(mac, vlan, location, ImmutableSet.of(ip), annotations); - } - - /** - * Creates a host description using the supplied information. - * - * @param mac host MAC address - * @param vlan host VLAN identifier - * @param location host location - * @param ip host IP addresses - * @param annotations optional key/value annotations map - */ - public DefaultHostDescription(MacAddress mac, VlanId vlan, - HostLocation location, Set<IpAddress> ip, - SparseAnnotations... annotations) { - super(annotations); - this.mac = mac; - this.vlan = vlan; - this.location = location; - this.ip = ImmutableSet.copyOf(ip); - } - - @Override - public MacAddress hwAddress() { - return mac; - } - - @Override - public VlanId vlan() { - return vlan; - } - - @Override - public HostLocation location() { - return location; - } - - @Override - public Set<IpAddress> ipAddress() { - return ip; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("mac", mac) - .add("vlan", vlan) - .add("location", location) - .add("ipAddress", ip) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hashCode(super.hashCode(), mac, vlan, location, ip); - } - - @Override - public boolean equals(Object object) { - if (object != null && getClass() == object.getClass()) { - if (!super.equals(object)) { - return false; - } - DefaultHostDescription that = (DefaultHostDescription) object; - return Objects.equal(this.mac, that.mac) - && Objects.equal(this.vlan, that.vlan) - && Objects.equal(this.location, that.location) - && Objects.equal(this.ip, that.ip); - } - return false; - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java deleted file mode 100644 index 8676e46a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onosproject.net.HostId; - -/** - * Service for administering the inventory of end-station hosts. - */ -public interface HostAdminService extends HostService { - - /** - * Removes the end-station host with the specified identifier. - * - * @param hostId host identifier - */ - void removeHost(HostId hostId); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostDescription.java deleted file mode 100644 index 14c6f7ad..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostDescription.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import java.util.Set; - -import org.onosproject.net.Description; -import org.onosproject.net.HostLocation; -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; - -/** - * Information describing host and its location. - */ -public interface HostDescription extends Description { - - /** - * Returns the MAC address associated with this host (NIC). - * - * @return the MAC address of this host - */ - MacAddress hwAddress(); - - /** - * Returns the VLAN associated with this host. - * - * @return the VLAN ID value - */ - VlanId vlan(); - - /** - * Returns the location of the host on the network edge. - * - * @return the network location - */ - HostLocation location(); - - /** - * Returns the IP address associated with this host's MAC. - * - * @return host IP address - */ - Set<IpAddress> ipAddress(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java deleted file mode 100644 index 92824cf8..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.joda.time.LocalDateTime; -import org.onosproject.event.AbstractEvent; -import org.onosproject.net.Host; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Describes end-station host event. - */ -public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { - - /** - * Type of host events. - */ - public enum Type { - /** - * Signifies that a new host has been detected. - */ - HOST_ADDED, - - /** - * Signifies that a host has been removed. - */ - HOST_REMOVED, - - /** - * Signifies that host data changed, e.g. IP address - */ - HOST_UPDATED, - - /** - * Signifies that a host location has changed. - */ - HOST_MOVED - } - - private Host prevSubject; - - /** - * Creates an event of a given type and for the specified host and the - * current time. - * - * @param type host event type - * @param host event host subject - */ - public HostEvent(Type type, Host host) { - super(type, host); - } - - /** - * Creates an event of a given type and for the specified host and time. - * - * @param type host event type - * @param host event host subject - * @param time occurrence time - */ - public HostEvent(Type type, Host host, long time) { - super(type, host, time); - } - - /** - * Creates an event with previous subject. - * - * The previous subject is ignored if the type is not moved or updated - * - * @param type host event type - * @param host event host subject - * @param prevSubject previous host subject - */ - public HostEvent(Type type, Host host, Host prevSubject) { - super(type, host); - if (type == Type.HOST_MOVED || type == Type.HOST_UPDATED) { - this.prevSubject = prevSubject; - } - } - - /** - * Gets the previous subject in this host event. - * - * @return the previous subject, or null if previous subject is not - * specified. - */ - public Host prevSubject() { - return this.prevSubject; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("time", new LocalDateTime(time())) - .add("type", type()) - .add("subject", subject()) - .add("prevSubject", prevSubject()) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostListener.java deleted file mode 100644 index 2eef7592..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving end-station host related events. - */ -public interface HostListener extends EventListener<HostEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProvider.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProvider.java deleted file mode 100644 index 0270996b..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onosproject.net.Host; -import org.onosproject.net.provider.Provider; - -/** - * Provider of information about hosts and their location on the network. - */ -public interface HostProvider extends Provider { - - /** - * Triggers an asynchronous probe of the specified host, intended to - * determine whether the host is present or not. An indirect result of this - * should be invocation of {@link org.onosproject.net.host.HostProviderService#hostDetected} - * or {@link org.onosproject.net.host.HostProviderService#hostVanished} - * at some later point in time. - * - * @param host host to probe - */ - void triggerProbe(Host host); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderRegistry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderRegistry.java deleted file mode 100644 index 8ab600c2..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of a host provider registry. - */ -public interface HostProviderRegistry - extends ProviderRegistry<HostProvider, HostProviderService> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java deleted file mode 100644 index 3403486c..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onlab.packet.IpAddress; -import org.onosproject.net.HostId; -import org.onosproject.net.provider.ProviderService; - -/** - * Means of conveying host information to the core. - */ -public interface HostProviderService extends ProviderService<HostProvider> { - - /** - * Notifies the core when a host has been detected on a network along with - * information that identifies the host location. - * - * @param hostId id of the host that been detected - * @param hostDescription description of host and its location - * @deprecated in Drake release - */ - @Deprecated - default void hostDetected(HostId hostId, HostDescription hostDescription) { - hostDetected(hostId, hostDescription, false); - } - - /** - * Notifies the core when a host has been detected on a network along with - * information that identifies the host location. - * - * @param hostId id of the host that been detected - * @param hostDescription description of host and its location - * @param replaceIps replace IP set if true, merge IP set otherwise - */ - void hostDetected(HostId hostId, HostDescription hostDescription, boolean replaceIps); - - /** - * Notifies the core when a host is no longer detected on a network. - * - * @param hostId id of the host that vanished - */ - void hostVanished(HostId hostId); - - /** - * Notifies the core when an IP is no longer associated with a host. - * - * @param hostId id of the host - * @param ipAddress ip address of host that vanished - */ - void removeIpFromHost(HostId hostId, IpAddress ipAddress); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostService.java deleted file mode 100644 index 39012159..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostService.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.event.ListenerService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Host; -import org.onosproject.net.HostId; - -import java.util.Set; - -/** - * Service for interacting with the inventory of end-station hosts. - */ -public interface HostService - extends ListenerService<HostEvent, HostListener> { - - /** - * Returns the number of end-station hosts known to the system. - * - * @return number of end-station hosts - */ - int getHostCount(); - - /** - * Returns a collection of all end-station hosts. - * - * @return collection of hosts - */ - Iterable<Host> getHosts(); - - /** - * Returns the host with the specified identifier. - * - * @param hostId host identifier - * @return host or null if one with the given identifier is not known - */ - Host getHost(HostId hostId); - - /** - * Returns the set of hosts that belong to the specified VLAN. - * - * @param vlanId vlan identifier - * @return set of hosts in the given vlan id - */ - Set<Host> getHostsByVlan(VlanId vlanId); - - /** - * Returns the set of hosts that have the specified MAC address. - * - * @param mac mac address - * @return set of hosts with the given mac - */ - Set<Host> getHostsByMac(MacAddress mac); - - /** - * Returns the set of hosts that have the specified IP address. - * - * @param ip ip address - * @return set of hosts with the given IP - */ - Set<Host> getHostsByIp(IpAddress ip); - - // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan); - - /** - * Returns the set of hosts whose most recent location is the specified - * connection point. - * - * @param connectPoint connection point - * @return set of hosts connected to the connection point - */ - Set<Host> getConnectedHosts(ConnectPoint connectPoint); - - /** - * Returns the set of hosts whose most recent location is the specified - * infrastructure device. - * - * @param deviceId device identifier - * @return set of hosts connected to the device - */ - Set<Host> getConnectedHosts(DeviceId deviceId); - - /** - * Requests the host service to monitor hosts with the given IP address and - * notify listeners of changes. - * - * @param ip IP address of the host to monitor - */ - void startMonitoringIp(IpAddress ip); - - /** - * Stops the host service from monitoring an IP address. - * - * @param ip IP address to stop monitoring - */ - // TODO clients can cancel other client's requests - void stopMonitoringIp(IpAddress ip); - - /** - * Requests the host service to resolve the MAC address for the given IP - * address. This will trigger a notification to the host listeners if the MAC - * address is found. - * - * @param ip IP address to find the MAC address for - */ - void requestMac(IpAddress ip); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java deleted file mode 100644 index 918ced45..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Host; -import org.onosproject.net.HostId; -import org.onosproject.net.provider.ProviderId; -import org.onosproject.store.Store; - -import java.util.Set; - -/** - * Manages inventory of end-station hosts; not intended for direct use. - */ -public interface HostStore extends Store<HostEvent, HostStoreDelegate> { - - /** - * Creates a new host or updates the existing one based on the specified - * description. - * - * @param providerId provider identification - * @param hostId host identification - * @param hostDescription host description data - * @param replaceIps replace IP set if true, merge IP set otherwise - * @return appropriate event or null if no change resulted - */ - HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, - HostDescription hostDescription, - boolean replaceIps); - - /** - * Removes the specified host from the inventory. - * - * @param hostId host identification - * @return remove event or null if host was not found - */ - HostEvent removeHost(HostId hostId); - - /** - * Removes the specified ip from the host entry. - * - * @param hostId host identification - * @param ipAddress ipAddress to be removed - * @return remove event or null if host was not found - */ - HostEvent removeIp(HostId hostId, IpAddress ipAddress); - - /** - * Returns the number of hosts in the store. - * - * @return host count - */ - int getHostCount(); - - /** - * Returns a collection of all hosts in the store. - * - * @return iterable collection of all hosts - */ - Iterable<Host> getHosts(); - - /** - * Returns the host with the specified identifer. - * - * @param hostId host identification - * @return host or null if not found - */ - Host getHost(HostId hostId); - - /** - * Returns the set of all hosts within the specified VLAN. - * - * @param vlanId vlan id - * @return set of hosts in the vlan - */ - Set<Host> getHosts(VlanId vlanId); - - /** - * Returns the set of hosts with the specified MAC address. - * - * @param mac mac address - * @return set of hosts with the given mac - */ - Set<Host> getHosts(MacAddress mac); - - /** - * Returns the set of hosts with the specified IP address. - * - * @param ip ip address - * @return set of hosts with the given IP - */ - Set<Host> getHosts(IpAddress ip); - - /** - * Returns the set of hosts whose location falls on the given connection point. - * - * @param connectPoint connection point - * @return set of hosts - */ - Set<Host> getConnectedHosts(ConnectPoint connectPoint); - - /** - * Returns the set of hosts whose location falls on the given device. - * - * @param deviceId infrastructure device identifier - * @return set of hosts - */ - Set<Host> getConnectedHosts(DeviceId deviceId); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStoreDelegate.java deleted file mode 100644 index efc84232..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStoreDelegate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onosproject.store.StoreDelegate; - -/** - * Infrastructure link store delegate abstraction. - */ -public interface HostStoreDelegate extends StoreDelegate<HostEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/InterfaceIpAddress.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/InterfaceIpAddress.java deleted file mode 100644 index 2f53df50..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/InterfaceIpAddress.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.host; - -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpPrefix; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Represents a single IP address information on an interface. - * - * TODO: - * - Add computation for the default broadcast address if it is not - * specified - * - Add explicit checks that each IP address or prefix belong to the - * same IP version: IPv4/IPv6. - * - Inside the copy constructor we should use copy constructors for each - * field - */ -public class InterfaceIpAddress { - private final IpAddress ipAddress; - private final IpPrefix subnetAddress; - private final IpAddress broadcastAddress; - private final IpAddress peerAddress; - - /** - * Copy constructor. - * - * @param other the object to copy from - */ - public InterfaceIpAddress(InterfaceIpAddress other) { - // TODO: we should use copy constructors for each field - this.ipAddress = other.ipAddress; - this.subnetAddress = other.subnetAddress; - this.broadcastAddress = other.broadcastAddress; - this.peerAddress = other.peerAddress; - } - - /** - * Constructor for a given IP address and a subnet address. - * - * @param ipAddress the IP address - * @param subnetAddress the IP subnet address - */ - public InterfaceIpAddress(IpAddress ipAddress, IpPrefix subnetAddress) { - this.ipAddress = checkNotNull(ipAddress); - this.subnetAddress = checkNotNull(subnetAddress); - // TODO: Recompute the default broadcast address from the subnet - // address - this.broadcastAddress = null; - this.peerAddress = null; - } - - /** - * Constructor for a given IP address and a subnet address. - * - * @param ipAddress the IP address - * @param subnetAddress the IP subnet address - * @param broadcastAddress the IP broadcast address. It can be used - * to specify non-default broadcast address - */ - public InterfaceIpAddress(IpAddress ipAddress, IpPrefix subnetAddress, - IpAddress broadcastAddress) { - this.ipAddress = checkNotNull(ipAddress); - this.subnetAddress = checkNotNull(subnetAddress); - this.broadcastAddress = broadcastAddress; - this.peerAddress = null; - } - - /** - * Constructor for a given IP address and a subnet address. - * - * @param ipAddress the IP address - * @param subnetAddress the IP subnet address - * @param broadcastAddress the IP broadcast address. It can be used - * to specify non-default broadcast address. It should be null for - * point-to-point interfaces with a peer address - * @param peerAddress the peer IP address for point-to-point interfaces - */ - public InterfaceIpAddress(IpAddress ipAddress, IpPrefix subnetAddress, - IpAddress broadcastAddress, - IpAddress peerAddress) { - this.ipAddress = checkNotNull(ipAddress); - this.subnetAddress = checkNotNull(subnetAddress); - this.broadcastAddress = broadcastAddress; - this.peerAddress = peerAddress; - } - - /** - * Gets the IP address. - * - * @return the IP address - */ - public IpAddress ipAddress() { - return ipAddress; - } - - /** - * Gets the IP subnet address. - * - * @return the IP subnet address - */ - public IpPrefix subnetAddress() { - return subnetAddress; - } - - /** - * Gets the subnet IP broadcast address. - * - * @return the subnet IP broadcast address - */ - public IpAddress broadcastAddress() { - return broadcastAddress; - } - - /** - * Gets the IP point-to-point interface peer address. - * - * @return the IP point-to-point interface peer address - */ - public IpAddress peerAddress() { - return peerAddress; - } - - /** - * Converts a CIDR string literal to an interface IP address. - * E.g. 10.0.0.1/24 - * - * @param value an IP address value in string form - * @return an interface IP address - * @throws IllegalArgumentException if the argument is invalid - */ - public static InterfaceIpAddress valueOf(String value) { - String[] splits = value.split("/"); - checkArgument(splits.length == 2, "Invalid IP address and prefix length format"); - - // NOTE: IpPrefix will mask-out the bits after the prefix length. - IpPrefix subnet = IpPrefix.valueOf(value); - IpAddress addr = IpAddress.valueOf(splits[0]); - return new InterfaceIpAddress(addr, subnet); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if (!(other instanceof InterfaceIpAddress)) { - return false; - } - InterfaceIpAddress otherAddr = (InterfaceIpAddress) other; - - return Objects.equals(this.ipAddress, otherAddr.ipAddress) - && Objects.equals(this.subnetAddress, otherAddr.subnetAddress) - && Objects.equals(this.broadcastAddress, - otherAddr.broadcastAddress) - && Objects.equals(this.peerAddress, otherAddr.peerAddress); - } - - @Override - public int hashCode() { - return Objects.hash(ipAddress, subnetAddress, broadcastAddress, - peerAddress); - } - - @Override - public String toString() { - /*return toStringHelper(this).add("ipAddress", ipAddress) - .add("subnetAddress", subnetAddress) - .add("broadcastAddress", broadcastAddress) - .add("peerAddress", peerAddress) - .omitNullValues().toString();*/ - return ipAddress.toString() + "/" + subnetAddress.prefixLength(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/package-info.java deleted file mode 100644 index 4f2bc7c4..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * End-station host model & related services API definitions. - */ -package org.onosproject.net.host; |