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-11 10:52:10 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e615ee42bc12d5717a21e4c9d83fc4c0426e8400
e615ee42
1 parent
2afb119d
Re-assembled the topology subsystem.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
View file @
e615ee4
...
...
@@ -36,6 +36,7 @@ public class SimpleHostStore {
// hosts sorted based on their location
private
final
Multimap
<
ConnectPoint
,
Host
>
locations
=
HashMultimap
.
create
();
/**
* Creates a new host or updates the existing one based on the specified
* description.
...
...
@@ -56,13 +57,13 @@ public class SimpleHostStore {
// creates a new host and sends HOST_ADDED
private
HostEvent
createHost
(
ProviderId
providerId
,
HostId
hostId
,
HostDescription
descr
)
{
HostDescription
descr
)
{
DefaultHost
newhost
=
new
DefaultHost
(
providerId
,
hostId
,
descr
.
hwAddress
(),
descr
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
synchronized
(
this
)
{
descr
.
hwAddress
(),
descr
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
synchronized
(
this
)
{
hosts
.
put
(
hostId
,
newhost
);
locations
.
put
(
descr
.
location
(),
newhost
);
}
...
...
@@ -71,22 +72,22 @@ public class SimpleHostStore {
// checks for type of update to host, sends appropriate event
private
HostEvent
updateHost
(
ProviderId
providerId
,
Host
host
,
HostDescription
descr
)
{
HostDescription
descr
)
{
DefaultHost
updated
;
HostEvent
event
;
if
(
host
.
location
().
equals
(
descr
.
location
()))
{
updated
=
new
DefaultHost
(
providerId
,
host
.
id
(),
host
.
mac
(),
host
.
vlan
(),
host
.
location
(),
descr
.
ipAddresses
());
host
.
mac
(),
host
.
vlan
(),
host
.
location
(),
descr
.
ipAddresses
());
event
=
new
HostEvent
(
HOST_UPDATED
,
updated
);
}
else
{
updated
=
new
DefaultHost
(
providerId
,
host
.
id
(),
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
host
.
ipAddresses
());
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
host
.
ipAddresses
());
event
=
new
HostEvent
(
HOST_MOVED
,
updated
);
}
synchronized
(
this
)
{
...
...
@@ -104,7 +105,7 @@ public class SimpleHostStore {
* @return remove even or null if host was not found
*/
HostEvent
removeHost
(
HostId
hostId
)
{
synchronized
(
this
)
{
synchronized
(
this
)
{
Host
host
=
hosts
.
remove
(
hostId
);
if
(
host
!=
null
)
{
locations
.
remove
((
host
.
location
()),
host
);
...
...
@@ -216,4 +217,4 @@ public class SimpleHostStore {
return
hostset
;
}
}
\ No newline at end of file
}
...
...
Please
register
or
login
to post a comment