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
Brian O'Connor
2014-10-23 15:47:32 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
086724eb7e4758ce523e8ac475e5cc1718eadbac
086724eb
1 parent
86160f54
refactoring OpticalPathIntent
Change-Id: Ic6ab6237237b2a5019851182b2869110bc5b1b73
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
45 deletions
core/api/src/main/java/org/onlab/onos/net/intent/OpticalPathIntent.java
core/net/src/main/java/org/onlab/onos/net/intent/impl/OpticalConnectivityIntentCompiler.java
core/net/src/main/java/org/onlab/onos/net/intent/impl/OpticalPathIntentInstaller.java
core/api/src/main/java/org/onlab/onos/net/intent/OpticalPathIntent.java
View file @
086724e
...
...
@@ -6,46 +6,45 @@ import org.onlab.onos.ApplicationId;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.Path
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.onos.net.flow.TrafficTreatment
;
import
com.google.common.base.MoreObjects
;
public
class
OpticalPathIntent
extends
OpticalConnectivityIntent
{
public
class
OpticalPathIntent
extends
ConnectivityIntent
{
private
final
ConnectPoint
src
;
private
final
ConnectPoint
dst
;
private
final
Path
path
;
// private final TrafficSelector opticalMatch;
// private final TrafficTreatment opticalAction;
public
OpticalPathIntent
(
ApplicationId
appId
,
ConnectPoint
src
,
ConnectPoint
dst
,
TrafficSelector
match
,
TrafficTreatment
action
,
Path
path
)
{
super
(
appId
,
src
,
dst
);
// this.opticalMatch = match;
// this.opticalAction = action;
super
(
id
(
OpticalPathIntent
.
class
,
src
,
dst
),
appId
,
resources
(
path
.
links
()),
null
,
null
);
this
.
src
=
src
;
this
.
dst
=
dst
;
this
.
path
=
path
;
}
protected
OpticalPathIntent
()
{
// this.opticalMatch
= null;
// this.opticalAction
= null;
this
.
src
=
null
;
this
.
dst
=
null
;
this
.
path
=
null
;
}
public
Path
path
()
{
return
path
;
public
ConnectPoint
src
()
{
return
src
;
}
/*
public
TrafficSelector selector
() {
// return opticalMatch
;
public
ConnectPoint
dst
()
{
return
dst
;
}
public
TrafficTreatment treatment
() {
// return opticalAction
;
public
Path
path
()
{
return
path
;
}
*/
@Override
public
boolean
isInstallable
()
{
return
true
;
...
...
@@ -55,10 +54,8 @@ public class OpticalPathIntent extends OpticalConnectivityIntent {
public
String
toString
()
{
return
MoreObjects
.
toStringHelper
(
getClass
())
.
add
(
"id"
,
id
())
//.add("match", opticalMatch)
//.add("action", opticalAction)
.
add
(
"ingressPort"
,
this
.
getSrcConnectPoint
())
.
add
(
"egressPort"
,
this
.
getDst
())
.
add
(
"ingressPort"
,
src
)
.
add
(
"egressPort"
,
dst
)
.
add
(
"path"
,
path
)
.
toString
();
}
...
...
core/net/src/main/java/org/onlab/onos/net/intent/impl/OpticalConnectivityIntentCompiler.java
View file @
086724e
...
...
@@ -14,16 +14,11 @@ import org.apache.felix.scr.annotations.Reference;
import
org.apache.felix.scr.annotations.ReferenceCardinality
;
import
org.onlab.onos.CoreService
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.Path
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.onos.net.flow.TrafficTreatment
;
import
org.onlab.onos.net.intent.Intent
;
import
org.onlab.onos.net.intent.IntentCompiler
;
import
org.onlab.onos.net.intent.IntentExtensionService
;
import
org.onlab.onos.net.intent.OpticalConnectivityIntent
;
import
org.onlab.onos.net.intent.OpticalPathIntent
;
import
org.onlab.onos.net.provider.ProviderId
;
...
...
@@ -32,7 +27,6 @@ import org.onlab.onos.net.topology.LinkWeight;
import
org.onlab.onos.net.topology.PathService
;
import
org.onlab.onos.net.topology.Topology
;
import
org.onlab.onos.net.topology.TopologyEdge
;
import
org.onlab.onos.net.topology.TopologyService
;
import
org.slf4j.Logger
;
...
...
@@ -88,15 +82,10 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
links
.
addAll
(
path
.
links
());
//links.add(DefaultEdgeLink.createEdgeLink(intent.getDst(), false));
TrafficSelector
opticalSelector
=
null
;
TrafficTreatment
opticalTreatment
=
null
;
// create a new opticalPathIntent
Intent
newIntent
=
new
OpticalPathIntent
(
intent
.
appId
(),
path
.
src
(),
path
.
dst
(),
opticalSelector
,
opticalTreatment
,
path
);
retList
.
add
(
newIntent
);
...
...
core/net/src/main/java/org/onlab/onos/net/intent/impl/OpticalPathIntentInstaller.java
View file @
086724e
...
...
@@ -3,7 +3,6 @@ package org.onlab.onos.net.intent.impl;
import
static
org
.
onlab
.
onos
.
net
.
flow
.
DefaultTrafficTreatment
.
builder
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.List
;
import
org.apache.felix.scr.annotations.Activate
;
...
...
@@ -20,11 +19,11 @@ import org.onlab.onos.net.flow.DefaultTrafficSelector;
import
org.onlab.onos.net.flow.DefaultTrafficTreatment
;
import
org.onlab.onos.net.flow.FlowRule
;
import
org.onlab.onos.net.flow.FlowRuleBatchEntry
;
import
org.onlab.onos.net.flow.FlowRuleBatchEntry.FlowRuleOperation
;
import
org.onlab.onos.net.flow.FlowRuleBatchOperation
;
import
org.onlab.onos.net.flow.FlowRuleService
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.onos.net.flow.TrafficTreatment
;
import
org.onlab.onos.net.flow.FlowRuleBatchEntry.FlowRuleOperation
;
import
org.onlab.onos.net.intent.IntentExtensionService
;
import
org.onlab.onos.net.intent.IntentInstaller
;
import
org.onlab.onos.net.intent.OpticalPathIntent
;
...
...
@@ -86,12 +85,12 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
LinkResourceAllocations
allocations
=
assignWavelength
(
intent
);
TrafficSelector
.
Builder
selectorBuilder
=
DefaultTrafficSelector
.
builder
();
selectorBuilder
.
matchInport
(
intent
.
getSrcConnectPoint
().
port
());
selectorBuilder
.
matchInport
(
intent
.
src
().
port
());
TrafficTreatment
.
Builder
treatmentBuilder
=
DefaultTrafficTreatment
.
builder
();
List
<
FlowRuleBatchEntry
>
rules
=
Lists
.
newLinkedList
();
ConnectPoint
prev
=
intent
.
getSrcConnectPoint
();
ConnectPoint
prev
=
intent
.
src
();
//TODO throw exception if the lambda was not assigned successfully
for
(
Link
link
:
intent
.
path
().
links
())
{
...
...
@@ -127,8 +126,8 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
// build the last T port rule
TrafficTreatment
treatmentLast
=
builder
()
.
setOutput
(
intent
.
getD
st
().
port
()).
build
();
FlowRule
rule
=
new
DefaultFlowRule
(
intent
.
getD
st
().
deviceId
(),
.
setOutput
(
intent
.
d
st
().
port
()).
build
();
FlowRule
rule
=
new
DefaultFlowRule
(
intent
.
d
st
().
deviceId
(),
selectorBuilder
.
build
(),
treatmentLast
,
100
,
...
...
@@ -190,12 +189,12 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
LinkResourceAllocations
allocations
=
resourceService
.
getAllocations
(
intent
.
id
());
TrafficSelector
.
Builder
selectorBuilder
=
DefaultTrafficSelector
.
builder
();
selectorBuilder
.
matchInport
(
intent
.
getSrcConnectPoint
().
port
());
selectorBuilder
.
matchInport
(
intent
.
src
().
port
());
TrafficTreatment
.
Builder
treatmentBuilder
=
DefaultTrafficTreatment
.
builder
();
List
<
FlowRuleBatchEntry
>
rules
=
Lists
.
newLinkedList
();
ConnectPoint
prev
=
intent
.
getSrcConnectPoint
();
ConnectPoint
prev
=
intent
.
src
();
//TODO throw exception if the lambda was not retrieved successfully
for
(
Link
link
:
intent
.
path
().
links
())
{
...
...
@@ -231,8 +230,8 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
// build the last T port rule
TrafficTreatment
treatmentLast
=
builder
()
.
setOutput
(
intent
.
getD
st
().
port
()).
build
();
FlowRule
rule
=
new
DefaultFlowRule
(
intent
.
getD
st
().
deviceId
(),
.
setOutput
(
intent
.
d
st
().
port
()).
build
();
FlowRule
rule
=
new
DefaultFlowRule
(
intent
.
d
st
().
deviceId
(),
selectorBuilder
.
build
(),
treatmentLast
,
100
,
...
...
Please
register
or
login
to post a comment