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
Thomas Vachuska
2014-11-05 18:27:09 -0800
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
Gerrit Code Review
2014-11-05 18:27:09 -0800
Commit
929eedb07c96893fe1218743788f1c4436ad4a36
929eedb0
2 parents
79a1e5e1
caa14d6f
Merge "Changed LOCAL port number in the CLI to "local"."
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
View file @
929eedb
...
...
@@ -25,6 +25,7 @@ import org.apache.karaf.shell.commands.Option;
import
org.onlab.onos.cli.Comparators
;
import
org.onlab.onos.net.Device
;
import
org.onlab.onos.net.Port
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.device.DeviceService
;
import
java.util.ArrayList
;
...
...
@@ -108,7 +109,7 @@ public class DevicePortsListCommand extends DevicesListCommand {
for
(
Port
port
:
service
.
getPorts
(
device
.
id
()))
{
if
(
isIncluded
(
port
))
{
ports
.
add
(
mapper
.
createObjectNode
()
.
put
(
"port"
,
port
.
number
().
toString
(
))
.
put
(
"port"
,
port
Name
(
port
.
number
()
))
.
put
(
"isEnabled"
,
port
.
isEnabled
())
.
put
(
"type"
,
port
.
type
().
toString
().
toLowerCase
())
.
put
(
"portSpeed"
,
port
.
portSpeed
())
...
...
@@ -120,6 +121,10 @@ public class DevicePortsListCommand extends DevicesListCommand {
return
result
;
}
private
String
portName
(
PortNumber
port
)
{
return
port
.
equals
(
PortNumber
.
LOCAL
)
?
"local"
:
port
.
toString
();
}
// Determines if a port should be included in output.
private
boolean
isIncluded
(
Port
port
)
{
return
enabled
&&
port
.
isEnabled
()
||
disabled
&&
!
port
.
isEnabled
()
||
...
...
@@ -133,7 +138,8 @@ public class DevicePortsListCommand extends DevicesListCommand {
Collections
.
sort
(
ports
,
Comparators
.
PORT_COMPARATOR
);
for
(
Port
port
:
ports
)
{
if
(
isIncluded
(
port
))
{
print
(
FMT
,
port
.
number
(),
port
.
isEnabled
()
?
"enabled"
:
"disabled"
,
print
(
FMT
,
portName
(
port
.
number
()),
port
.
isEnabled
()
?
"enabled"
:
"disabled"
,
port
.
type
().
toString
().
toLowerCase
(),
port
.
portSpeed
(),
annotations
(
port
.
annotations
()));
}
...
...
Please
register
or
login
to post a comment