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
Yuta HIGUCHI
2014-10-31 15:23:25 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d19f6706a602c9ac8f68e12193c0eb4834f8db74
d19f6706
1 parent
20c0e97b
extract DeviceId
Change-Id: I1379ca26846e75b1c60fc523cae87539b3fa22db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
View file @
d19f670
...
...
@@ -127,18 +127,19 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
return
;
}
log
.
trace
(
"{} {} {}"
,
event
.
type
(),
event
.
subject
(),
event
);
final
DeviceId
deviceId
=
device
.
id
();
switch
(
event
.
type
())
{
case
DEVICE_ADDED:
case
DEVICE_UPDATED:
ld
=
discoverers
.
get
(
device
.
id
()
);
ld
=
discoverers
.
get
(
device
Id
);
if
(
ld
==
null
)
{
log
.
debug
(
"Device added ({}) {}"
,
event
.
type
(),
device
.
id
()
);
discoverers
.
put
(
device
.
id
()
,
log
.
debug
(
"Device added ({}) {}"
,
event
.
type
(),
device
Id
);
discoverers
.
put
(
device
Id
,
new
LinkDiscovery
(
device
,
packetSevice
,
masterService
,
providerService
,
useBDDP
));
}
else
{
if
(
ld
.
isStopped
())
{
log
.
debug
(
"Device restarted ({}) {}"
,
event
.
type
(),
device
.
id
()
);
log
.
debug
(
"Device restarted ({}) {}"
,
event
.
type
(),
device
Id
);
ld
.
start
();
}
}
...
...
@@ -146,7 +147,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
case
PORT_ADDED:
case
PORT_UPDATED:
if
(
port
.
isEnabled
())
{
ld
=
discoverers
.
get
(
device
.
id
()
);
ld
=
discoverers
.
get
(
device
Id
);
if
(
ld
==
null
)
{
return
;
}
...
...
@@ -156,47 +157,47 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
}
}
else
{
log
.
debug
(
"Port down {}"
,
port
);
ConnectPoint
point
=
new
ConnectPoint
(
device
.
id
()
,
ConnectPoint
point
=
new
ConnectPoint
(
device
Id
,
port
.
number
());
providerService
.
linksVanished
(
point
);
}
break
;
case
PORT_REMOVED:
log
.
debug
(
"Port removed {}"
,
port
);
ConnectPoint
point
=
new
ConnectPoint
(
device
.
id
()
,
ConnectPoint
point
=
new
ConnectPoint
(
device
Id
,
port
.
number
());
providerService
.
linksVanished
(
point
);
// TODO: Don't we need to removePort from ld?
break
;
case
DEVICE_REMOVED:
case
DEVICE_SUSPENDED:
log
.
debug
(
"Device removed {}"
,
device
.
id
()
);
ld
=
discoverers
.
get
(
device
.
id
()
);
log
.
debug
(
"Device removed {}"
,
device
Id
);
ld
=
discoverers
.
get
(
device
Id
);
if
(
ld
==
null
)
{
return
;
}
ld
.
stop
();
providerService
.
linksVanished
(
device
.
id
()
);
providerService
.
linksVanished
(
device
Id
);
break
;
case
DEVICE_AVAILABILITY_CHANGED:
ld
=
discoverers
.
get
(
device
.
id
()
);
ld
=
discoverers
.
get
(
device
Id
);
if
(
ld
==
null
)
{
return
;
}
if
(
deviceService
.
isAvailable
(
device
.
id
()
))
{
log
.
debug
(
"Device up {}"
,
device
.
id
()
);
if
(
deviceService
.
isAvailable
(
device
Id
))
{
log
.
debug
(
"Device up {}"
,
device
Id
);
ld
.
start
();
}
else
{
providerService
.
linksVanished
(
device
.
id
()
);
log
.
debug
(
"Device down {}"
,
device
.
id
()
);
providerService
.
linksVanished
(
device
Id
);
log
.
debug
(
"Device down {}"
,
device
Id
);
ld
.
stop
();
}
break
;
case
DEVICE_MASTERSHIP_CHANGED:
if
(!
discoverers
.
containsKey
(
device
.
id
()
))
{
if
(!
discoverers
.
containsKey
(
device
Id
))
{
// TODO: ideally, should never reach here
log
.
debug
(
"Device mastership changed ({}) {}"
,
event
.
type
(),
device
.
id
()
);
discoverers
.
put
(
device
.
id
()
,
log
.
debug
(
"Device mastership changed ({}) {}"
,
event
.
type
(),
device
Id
);
discoverers
.
put
(
device
Id
,
new
LinkDiscovery
(
device
,
packetSevice
,
masterService
,
providerService
,
useBDDP
));
}
...
...
Please
register
or
login
to post a comment