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
tom
2014-09-09 11:54:28 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0efbb1deccdeeb8906fef057d6cf0423a0592d24
0efbb1de
1 parent
484ac5cf
Sketching more topology related stuff.
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
net/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyManager.java
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
net/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java
View file @
0efbb1d
...
...
@@ -105,7 +105,7 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> {
*
* @return port subject or null if the event is not port specific.
*/
Port
port
()
{
public
Port
port
()
{
return
port
;
}
...
...
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
View file @
0efbb1d
...
...
@@ -51,7 +51,7 @@ public class SimpleDeviceManager
private
final
AbstractListenerRegistry
<
DeviceEvent
,
DeviceListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
final
SimpleDeviceStore
store
=
new
SimpleDeviceStore
();
private
final
SimpleDeviceStore
store
=
new
SimpleDeviceStore
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
EventDeliveryService
eventDispatcher
;
...
...
@@ -143,7 +143,10 @@ public class SimpleDeviceManager
public
void
removeDevice
(
DeviceId
deviceId
)
{
checkNotNull
(
deviceId
,
DEVICE_ID_NULL
);
DeviceEvent
event
=
store
.
removeDevice
(
deviceId
);
post
(
event
);
if
(
event
!=
null
)
{
log
.
info
(
"Device {} administratively removed"
,
deviceId
);
post
(
event
);
}
}
// Personalized device provider service issued to the supplied provider.
...
...
@@ -159,12 +162,12 @@ public class SimpleDeviceManager
checkNotNull
(
deviceId
,
DEVICE_ID_NULL
);
checkNotNull
(
deviceDescription
,
DEVICE_DESCRIPTION_NULL
);
checkValidity
();
log
.
info
(
"Device {} connected"
,
deviceId
);
DeviceEvent
event
=
store
.
createOrUpdateDevice
(
provider
().
id
(),
deviceId
,
deviceDescription
);
// If there was a change of any kind, trigger role selection process.
if
(
event
!=
null
)
{
log
.
info
(
"Device {} connected"
,
deviceId
);
Device
device
=
event
.
subject
();
provider
().
roleChanged
(
device
,
store
.
getRole
(
device
.
id
()));
post
(
event
);
...
...
@@ -175,9 +178,11 @@ public class SimpleDeviceManager
public
void
deviceDisconnected
(
DeviceId
deviceId
)
{
checkNotNull
(
deviceId
,
DEVICE_ID_NULL
);
checkValidity
();
log
.
info
(
"Device {} disconnected"
,
deviceId
);
DeviceEvent
event
=
store
.
markOffline
(
deviceId
);
post
(
event
);
if
(
event
!=
null
)
{
log
.
info
(
"Device {} disconnected"
,
deviceId
);
post
(
event
);
}
}
@Override
...
...
@@ -185,7 +190,6 @@ public class SimpleDeviceManager
checkNotNull
(
deviceId
,
DEVICE_ID_NULL
);
checkNotNull
(
portDescriptions
,
"Port descriptions list cannot be null"
);
checkValidity
();
log
.
info
(
"Device {} ports updated"
,
deviceId
);
List
<
DeviceEvent
>
events
=
store
.
updatePorts
(
deviceId
,
portDescriptions
);
for
(
DeviceEvent
event
:
events
)
{
post
(
event
);
...
...
@@ -199,9 +203,10 @@ public class SimpleDeviceManager
checkValidity
();
DeviceEvent
event
=
store
.
updatePortStatus
(
deviceId
,
portDescription
);
if
(
event
!=
null
)
{
log
.
info
(
"Device {} port status changed"
,
deviceId
);
log
.
info
(
"Device {} port {} status changed"
,
deviceId
,
event
.
port
().
number
());
post
(
event
);
}
post
(
event
);
}
}
...
...
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyManager.java
View file @
0efbb1d
...
...
@@ -53,6 +53,8 @@ public class SimpleTopologyManager
private
final
AbstractListenerRegistry
<
TopologyEvent
,
TopologyListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
final
SimpleTopologyStore
store
=
new
SimpleTopologyStore
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
private
EventDeliveryService
eventDispatcher
;
...
...
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
0 → 100644
View file @
0efbb1d
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
/**
* Manages inventory of topology snapshots using trivial in-memory
* implementation.
*/
public
class
SimpleTopologyStore
{
}
Please
register
or
login
to post a comment