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-11 19:17:33 -0800
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
Gerrit Code Review
2014-11-11 19:17:33 -0800
Commit
dee20dd35afa28917f3214118746dfce9b28d6a4
dee20dd3
2 parents
62f92754
9909d177
Merge "Filter paths not satisfying the specified constraints"
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java
core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java
View file @
dee20dd
...
...
@@ -15,6 +15,8 @@
*/
package
org
.
onlab
.
onos
.
net
.
intent
.
impl
;
import
com.google.common.base.Predicate
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Reference
;
...
...
@@ -94,11 +96,19 @@ public abstract class ConnectivityIntentCompiler<T extends ConnectivityIntent>
protected
Path
getPath
(
ConnectivityIntent
intent
,
ElementId
one
,
ElementId
two
)
{
Set
<
Path
>
paths
=
pathService
.
getPaths
(
one
,
two
,
weight
(
intent
.
constraints
()));
if
(
paths
.
isEmpty
())
{
throw
new
PathNotFoundException
(
"No packet path from "
+
one
+
" to "
+
two
);
final
List
<
Constraint
>
constraints
=
intent
.
constraints
();
ImmutableList
<
Path
>
filtered
=
FluentIterable
.
from
(
paths
)
.
filter
(
new
Predicate
<
Path
>()
{
@Override
public
boolean
apply
(
Path
path
)
{
return
checkPath
(
path
,
constraints
);
}
}).
toList
();
if
(
filtered
.
isEmpty
())
{
throw
new
PathNotFoundException
(
"No packet path form "
+
one
+
" to "
+
two
);
}
// TODO: let's be more intelligent about this eventually
return
paths
.
iterator
().
next
();
return
filtered
.
iterator
().
next
();
}
/**
...
...
Please
register
or
login
to post a comment