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
Praseed Balakrishnan
2014-10-23 15:55:20 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
64369da98ab2a99e4ef6b84aa7335c9dc3be3bca
64369da9
1 parent
37f328a1
sigtype selector and treatment and fix not finding the switch id in test app.
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
5 deletions
apps/optical/src/main/java/org/onlab/onos/optical/testapp/LambdaForwarding.java
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java
core/api/src/main/java/org/onlab/onos/net/flow/TrafficSelector.java
core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java
apps/optical/src/main/java/org/onlab/onos/optical/testapp/LambdaForwarding.java
View file @
64369da
...
...
@@ -83,8 +83,12 @@ public class LambdaForwarding {
int
inport
;
int
outport
;
short
lambda
=
10
;
byte
sigType
=
1
;
Integer
switchNumber
=
uglyMap
.
get
(
device
.
id
());
if
(
switchNumber
==
null
)
{
return
;
}
int
switchNumber
=
uglyMap
.
get
(
device
.
id
());
switch
(
switchNumber
)
{
case
1
:
inport
=
10
;
...
...
@@ -95,13 +99,15 @@ public class LambdaForwarding {
case
2
:
inport
=
21
;
outport
=
11
;
sbuilder
.
matchLambda
(
lambda
).
matchInport
(
PortNumber
.
portNumber
(
inport
));
// match sigtype
sbuilder
.
matchLambda
(
lambda
).
matchInport
(
PortNumber
.
portNumber
(
inport
));
// match sigtype
tbuilder
.
setOutput
(
PortNumber
.
portNumber
(
outport
));
break
;
case
3
:
inport
=
30
;
outport
=
31
;
sbuilder
.
matchLambda
(
lambda
).
matchInport
(
PortNumber
.
portNumber
(
inport
));
sbuilder
.
matchLambda
(
lambda
).
matchInport
(
PortNumber
.
portNumber
(
inport
));
tbuilder
.
setOutput
(
PortNumber
.
portNumber
(
outport
)).
setLambda
(
lambda
);
break
;
default
:
...
...
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java
View file @
64369da
...
...
@@ -176,11 +176,17 @@ public final class DefaultTrafficSelector implements TrafficSelector {
}
@Override
public
Builder
matchLambda
(
s
hort
lambda
)
{
public
Builder
matchLambda
(
S
hort
lambda
)
{
return
add
(
Criteria
.
matchLambda
(
lambda
));
}
@Override
public
Builder
matchOpticalSignalType
(
Byte
signalType
)
{
return
add
(
Criteria
.
matchOpticalSignalType
(
signalType
));
}
@Override
public
TrafficSelector
build
()
{
return
new
DefaultTrafficSelector
(
ImmutableSet
.
copyOf
(
selector
.
values
()));
}
...
...
core/api/src/main/java/org/onlab/onos/net/flow/TrafficSelector.java
View file @
64369da
...
...
@@ -134,7 +134,14 @@ public interface TrafficSelector {
* @param lambda
* @return a selection builder
*/
public
Builder
matchLambda
(
short
lambda
);
public
Builder
matchLambda
(
Short
lambda
);
/**
* Matches an optical Signal Type.
* @param signalType
* @return a selection builder
*/
public
Builder
matchOpticalSignalType
(
Byte
signalType
);
/**
* Builds an immutable traffic selector.
...
...
core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java
View file @
64369da
...
...
@@ -162,6 +162,17 @@ public final class Criteria {
}
/**
* Creates a match on lambda field using the specified value.
*
* @param lambda
* @return match criterion
*/
public
static
Criterion
matchOpticalSignalType
(
Byte
lambda
)
{
return
new
OpticalSignalTypeCriterion
(
lambda
,
Type
.
OCH_SIGTYPE
);
}
/**
* Implementations of criteria.
*/
public
static
final
class
PortCriterion
implements
Criterion
{
...
...
@@ -577,4 +588,48 @@ public final class Criteria {
}
}
public
static
final
class
OpticalSignalTypeCriterion
implements
Criterion
{
private
final
byte
signalType
;
private
final
Type
type
;
public
OpticalSignalTypeCriterion
(
byte
signalType
,
Type
type
)
{
this
.
signalType
=
signalType
;
this
.
type
=
type
;
}
@Override
public
Type
type
()
{
return
this
.
type
;
}
public
Byte
signalType
()
{
return
this
.
signalType
;
}
@Override
public
String
toString
()
{
return
toStringHelper
(
type
().
toString
())
.
add
(
"signalType"
,
signalType
).
toString
();
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
signalType
,
type
);
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
instanceof
OpticalSignalTypeCriterion
)
{
OpticalSignalTypeCriterion
that
=
(
OpticalSignalTypeCriterion
)
obj
;
return
Objects
.
equals
(
signalType
,
that
.
signalType
)
&&
Objects
.
equals
(
type
,
that
.
type
);
}
return
false
;
}
}
}
...
...
Please
register
or
login
to post a comment