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-10-06 13:13:45 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a0ed763c88462978c70392429d03bfbebbb27bf3
a0ed763c
2 parents
9b4030df
9ee0d5b1
Merge remote-tracking branch 'origin/master'
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
17 deletions
core/api/src/main/java/org/onlab/onos/ApplicationId.java
core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java
core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java
core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTests.java → core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
utils/misc/src/main/java/org/onlab/util/Timer.java
core/api/src/main/java/org/onlab/onos/ApplicationId.java
View file @
a0ed763
...
...
@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public
final
class
ApplicationId
{
private
static
AtomicInteger
idDispenser
;
private
static
final
AtomicInteger
ID_DISPENCER
=
new
AtomicInteger
(
1
)
;
private
final
Integer
id
;
// Ban public construction
...
...
@@ -50,10 +50,7 @@ public final class ApplicationId {
* @return app id
*/
public
static
ApplicationId
getAppId
()
{
if
(
ApplicationId
.
idDispenser
==
null
)
{
ApplicationId
.
idDispenser
=
new
AtomicInteger
(
1
);
}
return
new
ApplicationId
(
ApplicationId
.
idDispenser
.
getAndIncrement
());
return
new
ApplicationId
(
ApplicationId
.
ID_DISPENCER
.
getAndIncrement
());
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/flow/FlowId.java
View file @
a0ed763
...
...
@@ -26,6 +26,9 @@ public final class FlowId {
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
)
{
return
false
;
}
if
(
obj
.
getClass
()
==
this
.
getClass
())
{
FlowId
that
=
(
FlowId
)
obj
;
return
Objects
.
equal
(
this
.
flowid
,
that
.
flowid
);
...
...
core/api/src/test/java/org/onlab/onos/net/device/DeviceEventTest.java
View file @
a0ed763
...
...
@@ -39,7 +39,7 @@ public class DeviceEventTest extends AbstractEventTest {
Device
device
=
createDevice
();
Port
port
=
new
DefaultPort
(
device
,
PortNumber
.
portNumber
(
123
),
true
);
long
before
=
System
.
currentTimeMillis
();
DeviceEvent
event
=
new
DeviceEvent
(
DeviceEvent
.
Type
.
DEVICE_ADDED
,
device
);
DeviceEvent
event
=
new
DeviceEvent
(
DeviceEvent
.
Type
.
DEVICE_ADDED
,
device
,
port
);
long
after
=
System
.
currentTimeMillis
();
validateEvent
(
event
,
DeviceEvent
.
Type
.
DEVICE_ADDED
,
device
,
before
,
after
);
}
...
...
core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
View file @
a0ed763
...
...
@@ -94,14 +94,14 @@ public class ProxyArpManager implements ProxyArpService {
@Override
public
boolean
known
(
IpPrefix
addr
)
{
checkNotNull
(
MAC_ADDR_NULL
,
addr
);
checkNotNull
(
addr
,
MAC_ADDR_NULL
);
Set
<
Host
>
hosts
=
hostService
.
getHostsByIp
(
addr
);
return
!
hosts
.
isEmpty
();
}
@Override
public
void
reply
(
Ethernet
eth
)
{
checkNotNull
(
REQUEST_NULL
,
eth
);
checkNotNull
(
eth
,
REQUEST_NULL
);
checkArgument
(
eth
.
getEtherType
()
==
Ethernet
.
TYPE_ARP
,
REQUEST_NOT_ARP
);
ARP
arp
=
(
ARP
)
eth
.
getPayload
();
...
...
@@ -137,7 +137,7 @@ public class ProxyArpManager implements ProxyArpService {
@Override
public
void
forward
(
Ethernet
eth
)
{
checkNotNull
(
REQUEST_NULL
,
eth
);
checkNotNull
(
eth
,
REQUEST_NULL
);
checkArgument
(
eth
.
getEtherType
()
==
Ethernet
.
TYPE_ARP
,
REQUEST_NOT_ARP
);
ARP
arp
=
(
ARP
)
eth
.
getPayload
();
...
...
@@ -206,12 +206,12 @@ public class ProxyArpManager implements ProxyArpService {
for
(
Link
l
:
links
)
{
// for each link, mark the concerned ports as internal
// and the remaining ports are therefore external.
if
(
l
.
src
().
deviceId
().
equals
(
d
)
if
(
l
.
src
().
deviceId
().
equals
(
d
.
id
()
)
&&
ports
.
contains
(
l
.
src
().
port
()))
{
ports
.
remove
(
l
.
src
().
port
());
internalPorts
.
put
(
d
,
l
.
src
().
port
());
}
if
(
l
.
dst
().
deviceId
().
equals
(
d
)
if
(
l
.
dst
().
deviceId
().
equals
(
d
.
id
()
)
&&
ports
.
contains
(
l
.
dst
().
port
()))
{
ports
.
remove
(
l
.
dst
().
port
());
internalPorts
.
put
(
d
,
l
.
dst
().
port
());
...
...
core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest
s
.java
→
core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
View file @
a0ed763
...
...
@@ -34,7 +34,8 @@ import com.google.common.collect.ImmutableMap;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.testing.EqualsTester
;
public
class
KryoSerializerTests
{
public
class
KryoSerializerTest
{
private
static
final
ProviderId
PID
=
new
ProviderId
(
"of"
,
"foo"
);
private
static
final
ProviderId
PIDA
=
new
ProviderId
(
"of"
,
"foo"
,
true
);
private
static
final
DeviceId
DID1
=
deviceId
(
"of:foo"
);
...
...
@@ -92,7 +93,7 @@ public class KryoSerializerTests {
@Test
public
final
void
test
()
{
public
final
void
test
Serialization
()
{
testSerialized
(
new
ConnectPoint
(
DID1
,
P1
));
testSerialized
(
new
DefaultLink
(
PID
,
CP1
,
CP2
,
Link
.
Type
.
DIRECT
));
testSerialized
(
new
DefaultPort
(
DEV1
,
P1
,
true
));
...
...
@@ -119,6 +120,7 @@ public class KryoSerializerTests {
}
}
@Test
public
final
void
testAnnotations
()
{
// Annotations does not have equals defined, manually test equality
final
byte
[]
a1Bytes
=
kryos
.
serialize
(
A1
);
...
...
@@ -132,9 +134,9 @@ public class KryoSerializerTests {
// code clone
public
static
void
assertAnnotationsEquals
(
Annotations
actual
,
SparseAnnotations
...
annotations
)
{
Default
Annotations
expected
=
DefaultAnnotations
.
builder
().
build
();
Sparse
Annotations
expected
=
DefaultAnnotations
.
builder
().
build
();
for
(
SparseAnnotations
a
:
annotations
)
{
expected
=
DefaultAnnotations
.
merge
(
expected
,
a
);
expected
=
DefaultAnnotations
.
union
(
expected
,
a
);
}
assertEquals
(
expected
.
keys
(),
actual
.
keys
());
for
(
String
key
:
expected
.
keys
())
{
...
...
utils/misc/src/main/java/org/onlab/util/Timer.java
View file @
a0ed763
...
...
@@ -8,7 +8,7 @@ import org.jboss.netty.util.HashedWheelTimer;
*/
public
final
class
Timer
{
private
static
HashedWheelTimer
timer
;
private
static
volatile
HashedWheelTimer
timer
;
// Ban public construction
private
Timer
()
{
...
...
@@ -21,10 +21,16 @@ public final class Timer {
*/
public
static
HashedWheelTimer
getTimer
()
{
if
(
Timer
.
timer
==
null
)
{
initTimer
();
}
return
Timer
.
timer
;
}
private
static
synchronized
void
initTimer
()
{
if
(
Timer
.
timer
==
null
)
{
Timer
.
timer
=
new
HashedWheelTimer
();
Timer
.
timer
.
start
();
}
return
Timer
.
timer
;
}
}
...
...
Please
register
or
login
to post a comment