diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-06 07:15:03 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-08 10:55:21 -0800 |
commit | 76dc892491948adae5e5e62cf94448967e8d865b (patch) | |
tree | 7a33ef05cc583946db21edad627060f280a53549 /framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java | |
parent | d333c63fdec8b064184b0a26f8d777f267577fde (diff) |
Fixes bad POM file with ONOS commit 8c68536972f63069c263635c9d9f4f31d7f3e9a2
Change-Id: I7adb5a2d3738d53dbc41db7577768b0e7ced5450
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java')
-rw-r--r-- | framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java | 39 |
1 files changed, 34 insertions, 5 deletions
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<InterfaceIpAddress> ipAddresses; private final MacAddress macAddress; @@ -43,14 +45,16 @@ 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<InterfaceIpAddress> 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; @@ -58,6 +62,29 @@ public class Interface { } /** + * 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<InterfaceIpAddress> 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. * * @return the connection point @@ -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) |