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:53 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
20d72c0ac3357b1e2c23020fea365f6d61b543cf
20d72c0a
2 parents
64369da9
086724eb
Merge branch 'optical-integration' of
ssh://gerrit.onlab.us:29418/onos-next
into optical-integration
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
155 additions
and
61 deletions
cli/src/main/java/org/onlab/onos/cli/net/AddOpticalIntentCommand.java
cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
core/api/src/main/java/org/onlab/onos/net/intent/OpticalPathIntent.java
core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.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/net/src/main/java/org/onlab/onos/net/resource/DefaultLinkResourceAllocations.java → core/net/src/main/java/org/onlab/onos/net/resource/impl/DefaultLinkResourceAllocations.java
core/net/src/main/java/org/onlab/onos/net/resource/LinkResourceManager.java → core/net/src/main/java/org/onlab/onos/net/resource/impl/LinkResourceManager.java
core/net/src/main/java/org/onlab/onos/net/resource/package-info.java → core/net/src/main/java/org/onlab/onos/net/resource/impl/package-info.java
cli/src/main/java/org/onlab/onos/cli/net/AddOpticalIntentCommand.java
0 → 100644
View file @
20d72c0
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
static
org
.
onlab
.
onos
.
net
.
DeviceId
.
deviceId
;
import
static
org
.
onlab
.
onos
.
net
.
PortNumber
.
portNumber
;
import
org.apache.karaf.shell.commands.Argument
;
import
org.apache.karaf.shell.commands.Command
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.intent.Intent
;
import
org.onlab.onos.net.intent.IntentService
;
import
org.onlab.onos.net.intent.OpticalConnectivityIntent
;
/**
* Installs optical connectivity intents.
*/
@Command
(
scope
=
"onos"
,
name
=
"add-optical-intent"
,
description
=
"Installs optical connectivity intent"
)
public
class
AddOpticalIntentCommand
extends
ConnectivityIntentCommand
{
@Argument
(
index
=
0
,
name
=
"ingressDevice"
,
description
=
"Ingress Device/Port Description"
,
required
=
true
,
multiValued
=
false
)
String
ingressDeviceString
=
null
;
@Argument
(
index
=
1
,
name
=
"egressDevice"
,
description
=
"Egress Device/Port Description"
,
required
=
true
,
multiValued
=
false
)
String
egressDeviceString
=
null
;
@Override
protected
void
execute
()
{
IntentService
service
=
get
(
IntentService
.
class
);
DeviceId
ingressDeviceId
=
deviceId
(
getDeviceId
(
ingressDeviceString
));
PortNumber
ingressPortNumber
=
portNumber
(
getPortNumber
(
ingressDeviceString
));
ConnectPoint
ingress
=
new
ConnectPoint
(
ingressDeviceId
,
ingressPortNumber
);
DeviceId
egressDeviceId
=
deviceId
(
getDeviceId
(
egressDeviceString
));
PortNumber
egressPortNumber
=
portNumber
(
getPortNumber
(
egressDeviceString
));
ConnectPoint
egress
=
new
ConnectPoint
(
egressDeviceId
,
egressPortNumber
);
Intent
intent
=
new
OpticalConnectivityIntent
(
appId
(),
ingress
,
egress
);
service
.
submit
(
intent
);
}
/**
* Extracts the port number portion of the ConnectPoint.
*
* @param deviceString string representing the device/port
* @return port number as a string, empty string if the port is not found
*/
private
String
getPortNumber
(
String
deviceString
)
{
int
slash
=
deviceString
.
indexOf
(
'/'
);
if
(
slash
<=
0
)
{
return
""
;
}
return
deviceString
.
substring
(
slash
+
1
,
deviceString
.
length
());
}
/**
* Extracts the device ID portion of the ConnectPoint.
*
* @param deviceString string representing the device/port
* @return device ID string
*/
private
String
getDeviceId
(
String
deviceString
)
{
int
slash
=
deviceString
.
indexOf
(
'/'
);
if
(
slash
<=
0
)
{
return
""
;
}
return
deviceString
.
substring
(
0
,
slash
);
}
}
cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
View file @
20d72c0
...
...
@@ -119,6 +119,14 @@
</optional-completers>
</command>
<command>
<action
class=
"org.onlab.onos.cli.net.AddOpticalIntentCommand"
/>
<completers>
<ref
component-id=
"connectPointCompleter"
/>
<ref
component-id=
"connectPointCompleter"
/>
<null/>
</completers>
</command>
<command>
<action
class=
"org.onlab.onos.cli.net.GetStatistics"
/>
<completers>
<ref
component-id=
"connectPointCompleter"
/>
...
...
core/api/src/main/java/org/onlab/onos/net/intent/OpticalPathIntent.java
View file @
20d72c0
...
...
@@ -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/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
View file @
20d72c0
...
...
@@ -36,7 +36,7 @@ public interface LinkResourceService {
* @param intentId the target Intent's id
* @return allocated resources for Intent
*/
LinkResourceAllocations
getAllocation
(
IntentId
intentId
);
LinkResourceAllocations
getAllocation
s
(
IntentId
intentId
);
/**
* Returns all allocated resources to given link.
...
...
core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.java
View file @
20d72c0
...
...
@@ -5,10 +5,4 @@ package org.onlab.onos.net.resource;
*/
public
interface
ResourceAllocation
extends
ResourceRequest
{
/**
* Returns the type of the allocated resource.
*
* @return the type of the allocated resource
*/
ResourceType
type
();
}
...
...
core/net/src/main/java/org/onlab/onos/net/intent/impl/OpticalConnectivityIntentCompiler.java
View file @
20d72c0
...
...
@@ -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 @
20d72c0
...
...
@@ -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
())
{
...
...
@@ -109,7 +108,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
}
treatmentBuilder
.
setOutput
(
link
.
src
().
port
());
//treatmentBuilder.setLambda(
la.toInt());
treatmentBuilder
.
setLambda
((
short
)
la
.
toInt
());
FlowRule
rule
=
new
DefaultFlowRule
(
prev
.
deviceId
(),
selectorBuilder
.
build
(),
...
...
@@ -122,13 +121,13 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
prev
=
link
.
dst
();
selectorBuilder
.
matchInport
(
link
.
dst
().
port
());
//selectorBuilder.setLambda(
la.toInt());
selectorBuilder
.
matchLambda
((
short
)
la
.
toInt
());
}
// 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
,
...
...
@@ -187,15 +186,15 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
@Override
public
List
<
FlowRuleBatchOperation
>
uninstall
(
OpticalPathIntent
intent
)
{
LinkResourceAllocations
allocations
=
resourceService
.
getAllocation
(
intent
.
id
());
LinkResourceAllocations
allocations
=
resourceService
.
getAllocation
s
(
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
())
{
...
...
@@ -213,7 +212,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
}
treatmentBuilder
.
setOutput
(
link
.
src
().
port
());
//treatmentBuilder.setLambda(
la.toInt());
treatmentBuilder
.
setLambda
((
short
)
la
.
toInt
());
FlowRule
rule
=
new
DefaultFlowRule
(
prev
.
deviceId
(),
selectorBuilder
.
build
(),
...
...
@@ -226,13 +225,13 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
prev
=
link
.
dst
();
selectorBuilder
.
matchInport
(
link
.
dst
().
port
());
//selectorBuilder.setLambda(
la.toInt());
selectorBuilder
.
matchLambda
((
short
)
la
.
toInt
());
}
// 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
,
...
...
core/net/src/main/java/org/onlab/onos/net/resource/DefaultLinkResourceAllocations.java
→
core/net/src/main/java/org/onlab/onos/net/resource/
impl/
DefaultLinkResourceAllocations.java
View file @
20d72c0
package
org
.
onlab
.
onos
.
net
.
resource
;
package
org
.
onlab
.
onos
.
net
.
resource
.
impl
;
import
java.util.Collection
;
import
java.util.Collections
;
...
...
@@ -7,6 +7,11 @@ import java.util.Set;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.intent.IntentId
;
import
org.onlab.onos.net.resource.LinkResourceAllocations
;
import
org.onlab.onos.net.resource.LinkResourceRequest
;
import
org.onlab.onos.net.resource.ResourceAllocation
;
import
org.onlab.onos.net.resource.ResourceRequest
;
import
org.onlab.onos.net.resource.ResourceType
;
/**
* Implementation of {@link LinkResourceAllocations}.
...
...
core/net/src/main/java/org/onlab/onos/net/resource/LinkResourceManager.java
→
core/net/src/main/java/org/onlab/onos/net/resource/
impl/
LinkResourceManager.java
View file @
20d72c0
package
org
.
onlab
.
onos
.
net
.
resource
;
package
org
.
onlab
.
onos
.
net
.
resource
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -12,6 +12,15 @@ import org.apache.felix.scr.annotations.Deactivate;
import
org.apache.felix.scr.annotations.Service
;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.intent.IntentId
;
import
org.onlab.onos.net.resource.BandwidthResourceAllocation
;
import
org.onlab.onos.net.resource.BandwidthResourceRequest
;
import
org.onlab.onos.net.resource.Lambda
;
import
org.onlab.onos.net.resource.LambdaResourceAllocation
;
import
org.onlab.onos.net.resource.LinkResourceAllocations
;
import
org.onlab.onos.net.resource.LinkResourceRequest
;
import
org.onlab.onos.net.resource.LinkResourceService
;
import
org.onlab.onos.net.resource.ResourceAllocation
;
import
org.onlab.onos.net.resource.ResourceRequest
;
import
org.slf4j.Logger
;
import
com.google.common.collect.Sets
;
...
...
@@ -76,7 +85,7 @@ public class LinkResourceManager implements LinkResourceService {
}
@Override
public
LinkResourceAllocations
getAllocation
(
IntentId
intentId
)
{
public
LinkResourceAllocations
getAllocation
s
(
IntentId
intentId
)
{
// TODO Auto-generated method stub
return
null
;
}
...
...
core/net/src/main/java/org/onlab/onos/net/resource/package-info.java
→
core/net/src/main/java/org/onlab/onos/net/resource/
impl/
package-info.java
View file @
20d72c0
/**
* Services for reserving network resources, e.g. bandwidth, lambdas.
*/
package
org
.
onlab
.
onos
.
net
.
resource
;
package
org
.
onlab
.
onos
.
net
.
resource
.
impl
;
...
...
Please
register
or
login
to post a comment