Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jonathan Hart
2014-09-19 11:24:06 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b79d6416684b19004fb8d7bbbdaf87eb2b4540c9
b79d6416
1 parent
1d56fe4d
Added IP addresses to Port
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
core/api/src/main/java/org/onlab/onos/net/DefaultPort.java
core/api/src/main/java/org/onlab/onos/net/Port.java
core/api/src/main/java/org/onlab/onos/net/DefaultPort.java
View file @
b79d641
package
org
.
onlab
.
onos
.
net
;
import
static
com
.
google
.
common
.
base
.
MoreObjects
.
toStringHelper
;
import
java.util.Collections
;
import
java.util.Objects
;
import
java.util.Set
;
import
static
com
.
google
.
common
.
base
.
MoreObjects
.
toStringHelper
;
import
org.onlab.packet.IpAddress
;
/**
* Default port implementation.
...
...
@@ -13,6 +17,9 @@ public class DefaultPort implements Port {
private
final
PortNumber
number
;
private
final
boolean
isEnabled
;
// Attributes
private
final
Set
<
IpAddress
>
ipAddresses
;
/**
* Creates a network element attributed to the specified provider.
*
...
...
@@ -22,9 +29,24 @@ public class DefaultPort implements Port {
*/
public
DefaultPort
(
Element
element
,
PortNumber
number
,
boolean
isEnabled
)
{
this
(
element
,
number
,
isEnabled
,
null
);
}
/**
* Creates a network element attributed to the specified provider.
*
* @param element parent network element
* @param number port number
* @param isEnabled indicator whether the port is up and active
* @param ipAddresses set of IP addresses assigned to the port
*/
public
DefaultPort
(
Element
element
,
PortNumber
number
,
boolean
isEnabled
,
Set
<
IpAddress
>
ipAddresses
)
{
this
.
element
=
element
;
this
.
number
=
number
;
this
.
isEnabled
=
isEnabled
;
this
.
ipAddresses
=
(
ipAddresses
==
null
)
?
null
:
Collections
.
unmodifiableSet
(
ipAddresses
);
}
@Override
...
...
@@ -67,4 +89,9 @@ public class DefaultPort implements Port {
return
element
;
}
@Override
public
Set
<
IpAddress
>
ipAddresses
()
{
return
ipAddresses
;
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/Port.java
View file @
b79d641
package
org
.
onlab
.
onos
.
net
;
import
java.util.Set
;
import
org.onlab.packet.IpAddress
;
/**
* Abstraction of a network port.
*/
...
...
@@ -28,4 +32,12 @@ public interface Port {
// set of port attributes
/**
* Returns the set of IP addresses that are logically configured on this
* port.
*
* @return the set of IP addresses configured on the port. The set is empty
* if no addresses are configured.
*/
Set
<
IpAddress
>
ipAddresses
();
}
...
...
Please
register
or
login
to post a comment