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
Sho SHIMIZU
2015-11-20 16:31:12 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
69dc584a4ab27c0a48978b72aec5034f7d7c4f76
69dc584a
1 parent
76430855
Fix the issue of ONOS-3423
Change-Id: I60c3105149f6ef46e2effb7de6d8f40152027ec7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
core/api/src/main/java/org/onosproject/net/newresource/ResourcePath.java
core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java
core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceRegistrar.java
core/api/src/main/java/org/onosproject/net/newresource/ResourcePath.java
View file @
69dc584
...
...
@@ -121,10 +121,10 @@ public abstract class ResourcePath {
public
List
<
Object
>
components
()
{
LinkedList
<
Object
>
components
=
new
LinkedList
<>();
Optional
<
Discrete
>
parentPath
=
Optional
.
ofNullable
(
parent
)
;
while
(
parentPath
.
isPresent
())
{
components
.
addFirst
(
last
);
parentPath
=
parent
.
parent
()
;
ResourcePath
current
=
this
;
while
(
current
.
parent
()
.
isPresent
())
{
components
.
addFirst
(
current
.
last
);
current
=
current
.
parent
;
}
return
components
;
...
...
core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java
View file @
69dc584
...
...
@@ -26,6 +26,7 @@ import org.onosproject.net.PortNumber;
import
java.util.Optional
;
import
static
org
.
hamcrest
.
Matchers
.
contains
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
...
...
@@ -63,6 +64,13 @@ public class ResourcePathTest {
}
@Test
public
void
testComponents
()
{
ResourcePath
port
=
ResourcePath
.
discrete
(
D1
,
P1
);
assertThat
(
port
.
components
(),
contains
(
D1
,
P1
));
}
@Test
public
void
testThereIsParent
()
{
ResourcePath
path
=
ResourcePath
.
discrete
(
LinkKey
.
linkKey
(
CP1_1
,
CP2_1
),
VLAN1
);
ResourcePath
parent
=
ResourcePath
.
discrete
(
LinkKey
.
linkKey
(
CP1_1
,
CP2_1
));
...
...
core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceRegistrar.java
View file @
69dc584
...
...
@@ -59,17 +59,15 @@ public final class ResourceRegistrar {
@Activate
public
void
activate
()
{
// FIXME there is a loop causing high resource utilization on device registration
// deviceListener = new ResourceDeviceListener(adminService, executor);
// deviceService.addListener(deviceListener);
// linkListener = new ResourceLinkListener(adminService, driverService, executor);
// linkService.addListener(linkListener);
deviceListener
=
new
ResourceDeviceListener
(
adminService
,
executor
);
deviceService
.
addListener
(
deviceListener
);
linkListener
=
new
ResourceLinkListener
(
adminService
,
driverService
,
executor
);
linkService
.
addListener
(
linkListener
);
}
@Deactivate
public
void
deactivate
()
{
// FIXME there is a loop causing high resource utilization on device registration
// deviceService.removeListener(deviceListener);
// linkService.removeListener(linkListener);
deviceService
.
removeListener
(
deviceListener
);
linkService
.
removeListener
(
linkListener
);
}
}
...
...
Please
register
or
login
to post a comment