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
alshabib
2014-10-17 14:38:41 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
acd918362c5fc09c3149e1d80ba971c97bb88ff0
acd91836
1 parent
e794cbe3
link provider cleanup
Change-Id: Ifeedfbfc20e3d75b140ee73f7479cd18bcb84adf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
22 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/LinkDiscovery.java
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
View file @
acd9183
...
...
@@ -8,6 +8,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.Device
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Port
;
import
org.onlab.onos.net.device.DeviceEvent
;
import
org.onlab.onos.net.device.DeviceListener
;
import
org.onlab.onos.net.device.DeviceService
;
...
...
@@ -90,53 +91,50 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
public
void
event
(
DeviceEvent
event
)
{
LinkDiscovery
ld
=
null
;
Device
device
=
event
.
subject
();
// it's not a switch so leave.
if
(
device
.
type
()
!=
Device
.
Type
.
SWITCH
)
{
return
;
}
Port
port
=
event
.
port
();
switch
(
event
.
type
())
{
case
DEVICE_ADDED:
discoverers
.
put
(
event
.
subject
()
.
id
(),
new
LinkDiscovery
(
event
.
subject
()
,
packetSevice
,
discoverers
.
put
(
device
.
id
(),
new
LinkDiscovery
(
device
,
packetSevice
,
providerService
,
useBDDP
));
break
;
case
PORT_ADDED:
case
PORT_UPDATED:
if
(
event
.
port
().
isEnabled
())
{
ld
=
discoverers
.
get
(
event
.
subject
()
.
id
());
ld
=
discoverers
.
get
(
device
.
id
());
if
(
ld
==
null
)
{
return
;
}
ld
.
addPort
(
event
.
port
()
);
ld
.
addPort
(
port
);
}
else
{
ConnectPoint
point
=
new
ConnectPoint
(
event
.
subject
()
.
id
(),
event
.
port
()
.
number
());
ConnectPoint
point
=
new
ConnectPoint
(
device
.
id
(),
port
.
number
());
providerService
.
linksVanished
(
point
);
}
break
;
case
PORT_REMOVED:
ConnectPoint
point
=
new
ConnectPoint
(
event
.
subject
()
.
id
(),
event
.
port
()
.
number
());
ConnectPoint
point
=
new
ConnectPoint
(
device
.
id
(),
port
.
number
());
providerService
.
linksVanished
(
point
);
break
;
case
DEVICE_REMOVED:
case
DEVICE_SUSPENDED:
ld
=
discoverers
.
get
(
event
.
subject
()
.
id
());
ld
=
discoverers
.
get
(
device
.
id
());
if
(
ld
==
null
)
{
return
;
}
ld
.
stop
();
providerService
.
linksVanished
(
event
.
subject
()
.
id
());
providerService
.
linksVanished
(
device
.
id
());
break
;
case
DEVICE_AVAILABILITY_CHANGED:
ld
=
discoverers
.
get
(
event
.
subject
()
.
id
());
ld
=
discoverers
.
get
(
device
.
id
());
if
(
ld
==
null
)
{
return
;
}
if
(
deviceService
.
isAvailable
(
event
.
subject
()
.
id
()))
{
if
(
deviceService
.
isAvailable
(
device
.
id
()))
{
ld
.
start
();
}
else
{
providerService
.
linksVanished
(
event
.
subject
()
.
id
());
providerService
.
linksVanished
(
device
.
id
());
ld
.
stop
();
}
break
;
...
...
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java
View file @
acd9183
...
...
@@ -184,14 +184,13 @@ public class LinkDiscovery implements TimerTask {
this
.
slowPorts
.
remove
(
portNumber
);
this
.
fastPorts
.
add
(
portNumber
);
this
.
portProbeCount
.
put
(
portNumber
,
new
AtomicInteger
(
0
));
}
else
{
if
(
this
.
fastPorts
.
contains
(
portNumber
))
{
}
else
if
(
this
.
fastPorts
.
contains
(
portNumber
))
{
this
.
portProbeCount
.
get
(
portNumber
).
set
(
0
);
}
else
{
}
else
{
this
.
log
.
debug
(
"Got ackProbe for non-existing port: {}"
,
portNumber
);
}
}
}
}
...
...
@@ -256,7 +255,7 @@ public class LinkDiscovery implements TimerTask {
//fastIterator.remove();
//this.slowPorts.add(portNumber);
//this.portProbeCount.remove(portNumber);
this
.
portProbeCount
.
get
(
portNumber
).
set
(
0
);
ConnectPoint
cp
=
new
ConnectPoint
(
device
.
id
(),
...
...
Please
register
or
login
to post a comment