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
tom
2014-09-04 16:41:10 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d40fc7a38c2e73d0fc5adc7a54b49787c43995b4
d40fc7a3
1 parent
249829af
Simplified port state.
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
39 deletions
net/api/src/main/java/org/onlab/onos/net/Port.java
net/api/src/main/java/org/onlab/onos/net/device/DefaultPortDescription.java
net/api/src/main/java/org/onlab/onos/net/device/PortDescription.java
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
net/api/src/main/java/org/onlab/onos/net/Port.java
View file @
d40fc7a
package
org
.
onlab
.
onos
.
net
;
import
java.util.Set
;
/**
* Abstraction of a network port.
*/
public
interface
Port
{
/**
* Port state.
*/
enum
State
{
UP
,
DOWN
,
BLOCKED
,
UNKNOWN
}
/**
* Returns the port number.
*
* @return port number
...
...
@@ -22,13 +13,6 @@ public interface Port {
PortNumber
number
();
/**
* Returns the port state(s).
*
* @return port state set
*/
Set
<
State
>
state
();
/**
* Indicates whether or not the port is currently up and active.
*
* @return true if the port is operational
...
...
@@ -36,13 +20,6 @@ public interface Port {
boolean
isEnabled
();
/**
* Indicates whether or not the port is administratively blocked.
*
* @return true if the port is blocked
*/
boolean
isBlocked
();
/**
* Returns the identifier of the network element to which this port belongs.
*
* @return parent network element
...
...
net/api/src/main/java/org/onlab/onos/net/device/DefaultPortDescription.java
View file @
d40fc7a
package
org
.
onlab
.
onos
.
net
.
device
;
import
com.google.common.collect.ImmutableSet
;
import
org.onlab.onos.net.Port
;
import
org.onlab.onos.net.PortNumber
;
import
java.util.Set
;
/**
* Default implementation of immutable port description.
*/
public
class
DefaultPortDescription
implements
PortDescription
{
private
final
PortNumber
number
;
private
final
Set
<
Port
.
State
>
state
;
private
final
boolean
isEnabled
;
public
DefaultPortDescription
(
PortNumber
number
,
Set
<
Port
.
State
>
state
)
{
public
DefaultPortDescription
(
PortNumber
number
,
boolean
isEnabled
)
{
this
.
number
=
number
;
this
.
state
=
ImmutableSet
.
copyOf
(
state
)
;
this
.
isEnabled
=
isEnabled
;
}
@Override
...
...
@@ -25,8 +21,8 @@ public class DefaultPortDescription implements PortDescription {
}
@Override
public
Set
<
Port
.
State
>
portState
()
{
return
state
;
public
boolean
isEnabled
()
{
return
isEnabled
;
}
}
...
...
net/api/src/main/java/org/onlab/onos/net/device/PortDescription.java
View file @
d40fc7a
package
org
.
onlab
.
onos
.
net
.
device
;
import
org.onlab.onos.net.Port
;
import
org.onlab.onos.net.PortNumber
;
import
java.util.Set
;
/**
* Information about a port.
*/
...
...
@@ -20,10 +17,10 @@ public interface PortDescription {
PortNumber
portNumber
();
/**
*
Returns the port state set
.
*
Indicates whether or not the port is up and active
.
*
* @return
set of port states
* @return
true if the port is active and has carrier signal
*/
Set
<
Port
.
State
>
portState
();
boolean
isEnabled
();
}
...
...
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
View file @
d40fc7a
...
...
@@ -44,6 +44,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
private
DeviceProviderService
providerService
;
private
OpenFlowSwitchListener
listener
=
new
InternalDeviceProvider
();
/**
* Creates an OpenFlow device provider.
*/
...
...
@@ -54,13 +56,14 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
@Activate
public
void
activate
()
{
providerService
=
providerRegistry
.
register
(
this
);
controller
.
addListener
(
new
InternalDeviceProvider
()
);
controller
.
addListener
(
listener
);
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
providerRegistry
.
unregister
(
this
);
controller
.
removeListener
(
listener
);
providerService
=
null
;
log
.
info
(
"Stopped"
);
}
...
...
Please
register
or
login
to post a comment