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
Thomas Vachuska
2014-10-21 20:26:57 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
0bbcb00cbaa44f2fcec6615a9ac9a3456075b1dc
0bbcb00c
2 parents
5c4324ec
574afdab
Merge remote-tracking branch 'origin/master'
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
26 deletions
core/api/src/main/java/org/onlab/onos/net/link/DefaultLinkDescription.java
core/net/src/main/java/org/onlab/onos/net/link/impl/LinkManager.java
core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/AbstractOpenFlowSwitch.java
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/test/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProviderTest.java
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/OpenFlowRuleProvider.java
core/api/src/main/java/org/onlab/onos/net/link/DefaultLinkDescription.java
View file @
0bbcb00
package
org
.
onlab
.
onos
.
net
.
link
;
import
com.google.common.base.MoreObjects
;
import
org.onlab.onos.net.AbstractDescription
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.Link
;
...
...
@@ -46,4 +47,11 @@ public class DefaultLinkDescription extends AbstractDescription
return
type
;
}
@Override
public
String
toString
()
{
return
MoreObjects
.
toStringHelper
(
"Link"
).
add
(
"src"
,
src
())
.
add
(
"dst"
,
dst
())
.
add
(
"type"
,
type
()).
toString
();
}
}
...
...
core/net/src/main/java/org/onlab/onos/net/link/impl/LinkManager.java
View file @
0bbcb00
...
...
@@ -201,10 +201,10 @@ public class LinkManager
ConnectPoint
dst
=
linkDescription
.
dst
();
// if we aren't master for the device associated with the ConnectPoint
// we probably shouldn't be doing this.
if
((
deviceService
.
getRole
(
src
.
deviceId
())
!=
MastershipRole
.
MASTER
)
||
(
deviceService
.
getRole
(
dst
.
deviceId
())
!=
MastershipRole
.
MASTER
)
)
{
return
;
}
// if (deviceService.getRole(dst.deviceId()) != MastershipRole.MASTER
) {
//
return;
//
}
LinkEvent
event
=
store
.
createOrUpdateLink
(
provider
().
id
(),
linkDescription
);
if
(
event
!=
null
)
{
...
...
@@ -220,14 +220,8 @@ public class LinkManager
ConnectPoint
src
=
linkDescription
.
src
();
ConnectPoint
dst
=
linkDescription
.
dst
();
// if we aren't master for the device associated with the ConnectPoint
// we probably shouldn't be doing this.
if
((
deviceService
.
getRole
(
src
.
deviceId
())
!=
MastershipRole
.
MASTER
)
||
(
deviceService
.
getRole
(
dst
.
deviceId
())
!=
MastershipRole
.
MASTER
))
{
return
;
}
LinkEvent
event
=
store
.
removeLink
(
linkDescription
.
src
(),
linkDescription
.
dst
());
LinkEvent
event
=
store
.
removeLink
(
src
,
dst
);
if
(
event
!=
null
)
{
log
.
info
(
"Link {} vanished"
,
linkDescription
);
post
(
event
);
...
...
core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
View file @
0bbcb00
...
...
@@ -239,11 +239,14 @@ public class GossipLinkStore
LinkKey
key
=
linkKey
(
linkDescription
.
src
(),
linkDescription
.
dst
());
final
LinkEvent
event
;
final
Timestamped
<
LinkDescription
>
mergedDesc
;
synchronized
(
getOrCreateLinkDescriptions
(
key
))
{
Map
<
ProviderId
,
Timestamped
<
LinkDescription
>>
map
=
getOrCreateLinkDescriptions
(
key
);
synchronized
(
map
)
{
event
=
createOrUpdateLinkInternal
(
providerId
,
deltaDesc
);
mergedDesc
=
getOrCreateLinkDescriptions
(
key
)
.
get
(
providerId
);
mergedDesc
=
map
.
get
(
providerId
);
}
if
(
event
!=
null
)
{
log
.
info
(
"Notifying peers of a link update topology event from providerId: "
+
"{} between src: {} and dst: {}"
,
...
...
openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/AbstractOpenFlowSwitch.java
View file @
0bbcb00
...
...
@@ -288,6 +288,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
// The message wasn't really a Nicira role reply. We just
// dispatch it to the OFMessage listeners in this case.
this
.
handleMessage
(
m
);
return
;
}
RoleRecvStatus
rrs
=
this
.
roleMan
.
deliverRoleReply
(
...
...
@@ -301,8 +302,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
this
.
transitionToEqualSwitch
();
}
}
else
{
return
;
//TODO: tell people that we failed.
this
.
disconnectSwitch
();
}
}
...
...
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
View file @
0bbcb00
...
...
@@ -71,6 +71,15 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
providerService
=
providerRegistry
.
register
(
this
);
deviceService
.
addListener
(
listener
);
packetSevice
.
addProcessor
(
listener
,
0
);
LinkDiscovery
ld
;
for
(
Device
device
:
deviceService
.
getDevices
())
{
ld
=
new
LinkDiscovery
(
device
,
packetSevice
,
masterService
,
providerService
,
useBDDP
);
discoverers
.
put
(
device
.
id
(),
ld
);
for
(
Port
p
:
deviceService
.
getPorts
(
device
.
id
()))
{
ld
.
addPort
(
p
);
}
}
log
.
info
(
"Started"
);
}
...
...
@@ -96,6 +105,10 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
LinkDiscovery
ld
=
null
;
Device
device
=
event
.
subject
();
Port
port
=
event
.
port
();
if
(
device
==
null
)
{
log
.
error
(
"Device is null."
);
return
;
}
switch
(
event
.
type
())
{
case
DEVICE_ADDED:
discoverers
.
put
(
device
.
id
(),
...
...
@@ -144,6 +157,11 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
break
;
case
DEVICE_UPDATED:
case
DEVICE_MASTERSHIP_CHANGED:
if
(!
discoverers
.
containsKey
(
device
.
id
()))
{
discoverers
.
put
(
device
.
id
(),
new
LinkDiscovery
(
device
,
packetSevice
,
masterService
,
providerService
,
useBDDP
));
}
break
;
default
:
log
.
debug
(
"Unknown event {}"
,
event
);
...
...
providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java
View file @
0bbcb00
...
...
@@ -257,10 +257,10 @@ public class LinkDiscovery implements TimerTask {
sendProbes
(
portNumber
);
}
else
{
// Update fast and slow ports
//
fastIterator.remove();
//
this.slowPorts.add(portNumber);
//
this.portProbeCount.remove(portNumber);
this
.
portProbeCount
.
get
(
portNumber
).
set
(
0
);
fastIterator
.
remove
();
this
.
slowPorts
.
add
(
portNumber
);
this
.
portProbeCount
.
remove
(
portNumber
);
ConnectPoint
cp
=
new
ConnectPoint
(
device
.
id
(),
...
...
providers/lldp/src/test/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProviderTest.java
View file @
0bbcb00
...
...
@@ -134,7 +134,7 @@ public class LLDPLinkProviderTest {
deviceListener
.
event
(
portEvent
(
DeviceEvent
.
Type
.
PORT_ADDED
,
DID2
,
port
(
DID2
,
1
,
false
)));
assertNull
(
"D
PID
exists"
,
assertNull
(
"D
eviceId
exists"
,
provider
.
discoverers
.
get
(
DID2
));
}
...
...
@@ -394,7 +394,7 @@ public class LLDPLinkProviderTest {
@Override
public
Iterable
<
Device
>
getDevices
()
{
return
devices
.
values
()
;
return
Collections
.
EMPTY_LIST
;
}
@Override
...
...
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/OpenFlowRuleProvider.java
View file @
0bbcb00
...
...
@@ -205,7 +205,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
pendingFMs
.
put
(
xid
,
installation
);
}
pendingFutures
.
put
(
U32
.
f
(
batch
.
hashCode
()),
installation
);
installation
.
verify
(
batch
.
hashCode
(
));
installation
.
verify
(
U32
.
f
(
batch
.
hashCode
()
));
return
installation
;
}
...
...
@@ -226,7 +226,10 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
@Override
public
void
switchRemoved
(
Dpid
dpid
)
{
collectors
.
remove
(
dpid
).
stop
();
FlowStatsCollector
collector
=
collectors
.
remove
(
dpid
);
if
(
collector
!=
null
)
{
collector
.
stop
();
}
}
@Override
...
...
@@ -321,7 +324,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
private
final
List
<
FlowEntry
>
offendingFlowMods
=
Lists
.
newLinkedList
();
private
final
CountDownLatch
countDownLatch
;
private
Integer
pendingXid
;
private
Long
pendingXid
;
private
BatchState
state
;
public
InstallationFuture
(
Set
<
Dpid
>
sws
,
Map
<
Long
,
FlowRuleBatchEntry
>
fmXids
)
{
...
...
@@ -391,7 +394,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
}
public
void
verify
(
Integer
id
)
{
public
void
verify
(
Long
id
)
{
pendingXid
=
id
;
for
(
Dpid
dpid
:
sws
)
{
OpenFlowSwitch
sw
=
controller
.
getSwitch
(
dpid
);
...
...
@@ -449,7 +452,9 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
private
void
cleanUp
()
{
if
(
isDone
()
||
isCancelled
())
{
if
(
pendingXid
!=
null
)
{
pendingFutures
.
remove
(
pendingXid
);
}
for
(
Long
xid
:
fms
.
keySet
())
{
pendingFMs
.
remove
(
xid
);
}
...
...
Please
register
or
login
to post a comment