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-10-07 11:40:00 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1dd08e4949c698916da41dffe1be60209cfbc838
1dd08e49
1 parent
ad25fbff
Enhanced flow list command to be more parsable and to use sorted devices list.
Fixed NPE.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
View file @
1dd08e4
...
...
@@ -47,7 +47,7 @@ public class FlowsListCommand extends AbstractShellCommand {
DeviceService
deviceService
=
get
(
DeviceService
.
class
);
FlowRuleService
service
=
get
(
FlowRuleService
.
class
);
Map
<
Device
,
List
<
FlowEntry
>>
flows
=
getSortedFlows
(
deviceService
,
service
);
for
(
Device
d
:
flows
.
keySet
(
))
{
for
(
Device
d
:
getSortedDevices
(
deviceService
))
{
printFlows
(
d
,
flows
.
get
(
d
));
}
}
...
...
@@ -58,14 +58,15 @@ public class FlowsListCommand extends AbstractShellCommand {
* @param service device service
* @return sorted device list
*/
protected
Map
<
Device
,
List
<
FlowEntry
>>
getSortedFlows
(
DeviceService
deviceService
,
FlowRuleService
service
)
{
protected
Map
<
Device
,
List
<
FlowEntry
>>
getSortedFlows
(
DeviceService
deviceService
,
FlowRuleService
service
)
{
Map
<
Device
,
List
<
FlowEntry
>>
flows
=
Maps
.
newHashMap
();
List
<
FlowEntry
>
rules
;
FlowEntryState
s
=
null
;
if
(
state
!=
null
&&
!
state
.
equals
(
"any"
))
{
s
=
FlowEntryState
.
valueOf
(
state
.
toUpperCase
());
}
Iterable
<
Device
>
devices
=
uri
==
null
?
getSortedDevices
(
deviceService
)
:
Iterable
<
Device
>
devices
=
uri
==
null
?
deviceService
.
getDevices
(
)
:
Collections
.
singletonList
(
deviceService
.
getDevice
(
DeviceId
.
deviceId
(
uri
)));
for
(
Device
d
:
devices
)
{
if
(
s
==
null
)
{
...
...
@@ -90,18 +91,16 @@ public class FlowsListCommand extends AbstractShellCommand {
* @param flows the set of flows for that device.
*/
protected
void
printFlows
(
Device
d
,
List
<
FlowEntry
>
flows
)
{
print
(
"Device: "
+
d
.
id
());
if
(
flows
==
null
|
flows
.
isEmpty
())
{
print
(
" %s"
,
"No flows."
);
return
;
}
for
(
FlowEntry
f
:
flows
)
{
print
(
FMT
,
Long
.
toHexString
(
f
.
id
().
value
()),
f
.
state
(),
f
.
bytes
(),
f
.
packets
(),
f
.
life
(),
f
.
priority
());
print
(
SFMT
,
f
.
selector
().
criteria
());
print
(
TFMT
,
f
.
treatment
().
instructions
());
boolean
empty
=
flows
==
null
||
flows
.
isEmpty
();
print
(
"deviceId=%s, flowRuleCount=%d"
,
d
.
id
(),
empty
?
0
:
flows
.
size
());
if
(!
empty
)
{
for
(
FlowEntry
f
:
flows
)
{
print
(
FMT
,
Long
.
toHexString
(
f
.
id
().
value
()),
f
.
state
(),
f
.
bytes
(),
f
.
packets
(),
f
.
life
(),
f
.
priority
());
print
(
SFMT
,
f
.
selector
().
criteria
());
print
(
TFMT
,
f
.
treatment
().
instructions
());
}
}
}
}
...
...
core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java
View file @
1dd08e4
...
...
@@ -113,7 +113,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService {
@Override
public
void
run
()
{
if
(
event
.
reasons
()
==
null
)
{
delegate
.
triggerCompile
(
n
ull
,
true
);
delegate
.
triggerCompile
(
n
ew
HashSet
<
IntentId
>()
,
true
);
}
else
{
Set
<
IntentId
>
toBeRecompiled
=
new
HashSet
<>();
...
...
Please
register
or
login
to post a comment