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
alshabib
2014-10-23 09:05:31 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
46122d85509e56e3b75569ff06564cd91055c659
46122d85
1 parent
558e8937
finished stats service
Change-Id: Ic1edef3e9cabefb2cbfdd8eecc465b3fa7f96bd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
core/net/src/main/java/org/onlab/onos/net/statistic/impl/StatisticManager.java
core/net/src/main/java/org/onlab/onos/net/statistic/impl/StatisticManager.java
View file @
46122d8
...
...
@@ -20,7 +20,6 @@ import org.onlab.onos.net.statistic.Load;
import
org.onlab.onos.net.statistic.StatisticService
;
import
org.onlab.onos.net.statistic.StatisticStore
;
import
org.slf4j.Logger
;
import
java.util.Set
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -68,17 +67,52 @@ public class StatisticManager implements StatisticService {
@Override
public
Link
max
(
Path
path
)
{
return
null
;
if
(
path
.
links
().
isEmpty
())
{
return
null
;
}
Load
maxLoad
=
new
DefaultLoad
();
Link
maxLink
=
null
;
for
(
Link
link
:
path
.
links
())
{
Load
load
=
loadInternal
(
link
.
src
());
if
(
load
.
rate
()
>
maxLoad
.
rate
())
{
maxLoad
=
load
;
maxLink
=
link
;
}
}
return
maxLink
;
}
@Override
public
Link
min
(
Path
path
)
{
return
null
;
if
(
path
.
links
().
isEmpty
())
{
return
null
;
}
Load
minLoad
=
new
DefaultLoad
();
Link
minLink
=
null
;
for
(
Link
link
:
path
.
links
())
{
Load
load
=
loadInternal
(
link
.
src
());
if
(
load
.
rate
()
<
minLoad
.
rate
())
{
minLoad
=
load
;
minLink
=
link
;
}
}
return
minLink
;
}
@Override
public
FlowRule
highestHitter
(
ConnectPoint
connectPoint
)
{
return
null
;
Set
<
FlowEntry
>
hitters
=
statisticStore
.
getCurrentStatistic
(
connectPoint
);
if
(
hitters
.
isEmpty
())
{
return
null
;
}
FlowEntry
max
=
hitters
.
iterator
().
next
();
for
(
FlowEntry
entry
:
hitters
)
{
if
(
entry
.
bytes
()
>
max
.
bytes
())
{
max
=
entry
;
}
}
return
max
;
}
private
Load
loadInternal
(
ConnectPoint
connectPoint
)
{
...
...
Please
register
or
login
to post a comment