From 76dc892491948adae5e5e62cf94448967e8d865b Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Sun, 6 Dec 2015 07:15:03 -0800 Subject: Fixes bad POM file with ONOS commit 8c68536972f63069c263635c9d9f4f31d7f3e9a2 Change-Id: I7adb5a2d3738d53dbc41db7577768b0e7ced5450 Signed-off-by: Ashlee Young --- .../onosproject/incubator/net/intf/Interface.java | 39 +++++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java') diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java index b9d3eadf..e2109689 100644 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java +++ b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java @@ -30,11 +30,13 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * An Interface maps network configuration information (such as addresses and - * vlans) to a port in the network. This is considered a L2/L3 network - * interface. + * vlans) to a port in the network. */ @Beta public class Interface { + public static final String NO_INTERFACE_NAME = ""; + + private final String name; private final ConnectPoint connectPoint; private final Set ipAddresses; private final MacAddress macAddress; @@ -43,20 +45,45 @@ public class Interface { /** * Creates new Interface with the provided configuration. * + * @param name name of the interface * @param connectPoint the connect point this interface maps to * @param ipAddresses Set of IP addresses * @param macAddress MAC address * @param vlan VLAN ID */ - public Interface(ConnectPoint connectPoint, + public Interface(String name, ConnectPoint connectPoint, Set ipAddresses, MacAddress macAddress, VlanId vlan) { + this.name = name == null ? NO_INTERFACE_NAME : name; this.connectPoint = checkNotNull(connectPoint); this.ipAddresses = ipAddresses == null ? Sets.newHashSet() : ipAddresses; this.macAddress = macAddress == null ? MacAddress.NONE : macAddress; this.vlan = vlan == null ? VlanId.NONE : vlan; } + /** + * Creates new Interface with the provided configuration. + * + * @param connectPoint the connect point this interface maps to + * @param ipAddresses Set of IP addresses + * @param macAddress MAC address + * @param vlan VLAN ID + */ + public Interface(ConnectPoint connectPoint, + Set ipAddresses, + MacAddress macAddress, VlanId vlan) { + this(NO_INTERFACE_NAME, connectPoint, ipAddresses, macAddress, vlan); + } + + /** + * Retrieves the name of the interface. + * + * @return name + */ + public String name() { + return name; + } + /** * Retrieves the connection point that this interface maps to. * @@ -101,7 +128,8 @@ public class Interface { Interface otherInterface = (Interface) other; - return Objects.equals(connectPoint, otherInterface.connectPoint) && + return Objects.equals(name, otherInterface.name) && + Objects.equals(connectPoint, otherInterface.connectPoint) && Objects.equals(ipAddresses, otherInterface.ipAddresses) && Objects.equals(macAddress, otherInterface.macAddress) && Objects.equals(vlan, otherInterface.vlan); @@ -109,12 +137,13 @@ public class Interface { @Override public int hashCode() { - return Objects.hash(connectPoint, ipAddresses, macAddress, vlan); + return Objects.hash(connectPoint, name, ipAddresses, macAddress, vlan); } @Override public String toString() { return MoreObjects.toStringHelper(getClass()) + .add("name", name) .add("connectPoint", connectPoint) .add("ipAddresses", ipAddresses) .add("macAddress", macAddress) -- cgit 1.2.3-korg