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-23 11:26:27 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
50d401fe1be63bde7f13ca8d3d2dd1a77f7c5b5a
50d401fe
2 parents
f9cd5cb5
32129f2d
Merge remote-tracking branch 'origin/master'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
61 deletions
core/api/src/main/java/org/onlab/onos/net/DefaultPort.java
core/api/src/main/java/org/onlab/onos/net/Port.java
core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
core/store/src/main/java/org/onlab/onos/store/serializers/DefaultPortSerializer.java
core/api/src/main/java/org/onlab/onos/net/DefaultPort.java
View file @
50d401f
...
...
@@ -2,13 +2,7 @@ package org.onlab.onos.net;
import
static
com
.
google
.
common
.
base
.
MoreObjects
.
toStringHelper
;
import
java.util.Collections
;
import
java.util.Objects
;
import
java.util.Set
;
import
org.onlab.packet.IpPrefix
;
import
com.google.common.collect.ImmutableSet
;
/**
* Default port implementation.
...
...
@@ -19,36 +13,18 @@ public class DefaultPort implements Port {
private
final
PortNumber
number
;
private
final
boolean
isEnabled
;
// Attributes
private
final
Set
<
IpPrefix
>
ipAddresses
;
/**
* Creates a network element attributed to the specified provider.
*
* @param element parent network element
* @param number port number
* @param isEnabled indicator whether the port is up and active
*/
public
DefaultPort
(
Element
element
,
PortNumber
number
,
boolean
isEnabled
)
{
this
(
element
,
number
,
isEnabled
,
null
);
}
/**
* Creates a network element attributed to the specified provider.
*
* @param element parent network element
* @param number port number
* @param isEnabled indicator whether the port is up and active
* @param ipAddresses set of IP addresses assigned to the port
*/
public
DefaultPort
(
Element
element
,
PortNumber
number
,
boolean
isEnabled
,
Set
<
IpPrefix
>
ipAddresses
)
{
boolean
isEnabled
)
{
this
.
element
=
element
;
this
.
number
=
number
;
this
.
isEnabled
=
isEnabled
;
this
.
ipAddresses
=
(
ipAddresses
==
null
)
?
Collections
.<
IpPrefix
>
emptySet
()
:
ImmutableSet
.
copyOf
(
ipAddresses
);
}
@Override
...
...
@@ -94,9 +70,4 @@ public class DefaultPort implements Port {
return
element
;
}
@Override
public
Set
<
IpPrefix
>
ipAddresses
()
{
return
ipAddresses
;
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/Port.java
View file @
50d401f
package
org
.
onlab
.
onos
.
net
;
import
java.util.Set
;
import
org.onlab.packet.IpPrefix
;
/**
* Abstraction of a network port.
...
...
@@ -32,12 +29,4 @@ public interface Port {
// set of port attributes
/**
* Returns the set of IP addresses that are logically configured on this
* port.
*
* @return the set of IP addresses configured on the port. The set is empty
* if no addresses are configured.
*/
Set
<
IpPrefix
>
ipAddresses
();
}
...
...
core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
View file @
50d401f
...
...
@@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit;
import
org.jboss.netty.util.Timeout
;
import
org.jboss.netty.util.TimerTask
;
import
org.onlab.onos.net.Device
;
import
org.onlab.onos.net.Host
;
import
org.onlab.onos.net.Port
;
import
org.onlab.onos.net.device.DeviceService
;
...
...
@@ -89,7 +88,7 @@ public class HostMonitor implements TimerTask {
// else (ip isn't in any configured subnet)
// send out all non-external edge ports
for
(
Device
device
:
deviceService
.
getDevices
())
{
/*
for (Device device : deviceService.getDevices()) {
for (Port port : deviceService.getPorts(device.id())) {
for (IpPrefix ip : port.ipAddresses()) {
if (ip.contains(targetIp)) {
...
...
@@ -98,7 +97,7 @@ public class HostMonitor implements TimerTask {
}
}
}
}
}
*/
}
...
...
core/store/src/main/java/org/onlab/onos/store/serializers/DefaultPortSerializer.java
View file @
50d401f
package
org
.
onlab
.
onos
.
store
.
serializers
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
org.onlab.onos.net.DefaultPort
;
import
org.onlab.onos.net.Element
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.packet.IpPrefix
;
import
com.esotericsoftware.kryo.Kryo
;
import
com.esotericsoftware.kryo.Serializer
;
import
com.esotericsoftware.kryo.io.Input
;
import
com.esotericsoftware.kryo.io.Output
;
import
com.esotericsoftware.kryo.serializers.CollectionSerializer
;
import
com.google.common.collect.ImmutableSet
;
// TODO move to util, etc.
/**
...
...
@@ -22,10 +16,6 @@ import com.google.common.collect.ImmutableSet;
public
final
class
DefaultPortSerializer
extends
Serializer
<
DefaultPort
>
{
private
final
CollectionSerializer
ipAddrSerializer
=
new
CollectionSerializer
(
IpPrefix
.
class
,
new
IpPrefixSerializer
(),
false
);
/**
* Default constructor.
*/
...
...
@@ -39,8 +29,6 @@ public final class DefaultPortSerializer extends
kryo
.
writeClassAndObject
(
output
,
object
.
element
());
kryo
.
writeObject
(
output
,
object
.
number
());
output
.
writeBoolean
(
object
.
isEnabled
());
kryo
.
writeObject
(
output
,
object
.
ipAddresses
(),
ipAddrSerializer
);
}
@Override
...
...
@@ -49,11 +37,7 @@ public final class DefaultPortSerializer extends
Element
element
=
(
Element
)
kryo
.
readClassAndObject
(
input
);
PortNumber
number
=
kryo
.
readObject
(
input
,
PortNumber
.
class
);
boolean
isEnabled
=
input
.
readBoolean
();
@SuppressWarnings
(
"unchecked"
)
Collection
<
IpPrefix
>
ipAddresses
=
kryo
.
readObject
(
input
,
ArrayList
.
class
,
ipAddrSerializer
);
return
new
DefaultPort
(
element
,
number
,
isEnabled
,
ImmutableSet
.
copyOf
(
ipAddresses
));
return
new
DefaultPort
(
element
,
number
,
isEnabled
);
}
}
...
...
Please
register
or
login
to post a comment