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
Toshio Koide
2014-10-23 18:43:30 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9be539e079437071a866e09ac57d96b0e3b18c31
9be539e0
1 parent
e550584a
Preparing implementation of link resource data store.
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
25 deletions
core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
core/net/src/main/java/org/onlab/onos/net/resource/impl/DefaultLinkResourceAllocations.java
core/net/src/main/java/org/onlab/onos/net/resource/impl/LinkResourceManager.java
core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
View file @
9be539e
...
...
@@ -41,14 +41,6 @@ public interface LinkResourceService {
Iterable
<
LinkResourceAllocations
>
getAllocations
();
/**
* Returns the resources allocated for an Intent.
*
* @param intentId the target Intent's id
* @return allocated resources for Intent
*/
LinkResourceAllocations
getAllocations
(
IntentId
intentId
);
/**
* Returns all allocated resources to given link.
*
* @param link a target link
...
...
@@ -57,12 +49,12 @@ public interface LinkResourceService {
Iterable
<
LinkResourceAllocations
>
getAllocations
(
Link
link
);
/**
* Returns
all IDs of intents using the given link
.
* Returns
the resources allocated for an Intent
.
*
* @param
link a target link
* @return
IDs of intents using the link
* @param
intentId the target Intent's id
* @return
allocated resources for Intent
*/
Iterable
<
IntentId
>
getIntents
(
Link
link
);
LinkResourceAllocations
getAllocations
(
IntentId
intentId
);
/**
* Returns available resources for given link.
...
...
@@ -70,7 +62,7 @@ public interface LinkResourceService {
* @param link a target link
* @return available resources for the target link
*/
ResourceRequest
getAvailableResources
(
Link
link
);
Iterable
<
ResourceRequest
>
getAvailableResources
(
Link
link
);
/**
* Returns available resources for given link.
...
...
core/net/src/main/java/org/onlab/onos/net/resource/impl/DefaultLinkResourceAllocations.java
View file @
9be539e
...
...
@@ -26,7 +26,7 @@ public class DefaultLinkResourceAllocations implements LinkResourceAllocations {
* @param request requested resources
* @param allocations allocated resources
*/
protected
DefaultLinkResourceAllocations
(
LinkResourceRequest
request
,
DefaultLinkResourceAllocations
(
LinkResourceRequest
request
,
Map
<
Link
,
Set
<
ResourceAllocation
>>
allocations
)
{
this
.
request
=
request
;
this
.
allocations
=
allocations
;
...
...
core/net/src/main/java/org/onlab/onos/net/resource/impl/LinkResourceManager.java
View file @
9be539e
...
...
@@ -3,6 +3,7 @@ package org.onlab.onos.net.resource.impl;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -44,12 +45,16 @@ public class LinkResourceManager implements LinkResourceService {
log
.
info
(
"Stopped"
);
}
private
Iterable
<
Lambda
>
getAvailableLambdas
(
Iterable
<
Link
>
links
)
{
return
Sets
.
newHashSet
(
Lambda
.
valueOf
(
7
));
}
@Override
public
LinkResourceAllocations
requestResources
(
LinkResourceRequest
req
)
{
// TODO implement it using a resource data store.
ResourceAllocation
alloc
=
null
;
for
(
ResourceRequest
r:
req
.
resources
())
{
for
(
ResourceRequest
r
:
req
.
resources
())
{
switch
(
r
.
type
())
{
case
BANDWIDTH:
log
.
info
(
"requestResources() always returns requested bandwidth"
);
...
...
@@ -58,7 +63,10 @@ public class LinkResourceManager implements LinkResourceService {
break
;
case
LAMBDA:
log
.
info
(
"requestResources() always returns lambda 7"
);
alloc
=
new
LambdaResourceAllocation
(
Lambda
.
valueOf
(
7
));
Iterator
<
Lambda
>
lambdaIterator
=
getAvailableLambdas
(
req
.
links
()).
iterator
();
if
(
lambdaIterator
.
hasNext
())
{
alloc
=
new
LambdaResourceAllocation
(
lambdaIterator
.
next
());
}
break
;
default
:
break
;
...
...
@@ -66,7 +74,7 @@ public class LinkResourceManager implements LinkResourceService {
}
Map
<
Link
,
Set
<
ResourceAllocation
>>
allocations
=
new
HashMap
<>();
for
(
Link
link:
req
.
links
())
{
for
(
Link
link
:
req
.
links
())
{
allocations
.
put
(
link
,
Sets
.
newHashSet
(
alloc
));
}
return
new
DefaultLinkResourceAllocations
(
req
,
allocations
);
...
...
@@ -91,25 +99,19 @@ public class LinkResourceManager implements LinkResourceService {
}
@Override
public
LinkResourceAllocations
getAllocations
(
IntentId
intentId
)
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
Iterable
<
LinkResourceAllocations
>
getAllocations
(
Link
link
)
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
Iterable
<
IntentId
>
getIntents
(
Link
link
)
{
public
LinkResourceAllocations
getAllocations
(
IntentId
intentId
)
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
ResourceRequest
getAvailableResources
(
Link
link
)
{
public
Iterable
<
ResourceRequest
>
getAvailableResources
(
Link
link
)
{
// TODO Auto-generated method stub
return
null
;
}
...
...
Please
register
or
login
to post a comment