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-17 11:05:47 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a56d5fe7b758281e75ad032630deb1e2ddff1cda
a56d5fe7
1 parent
0f3828a2
Added a few todos.
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
44 deletions
core/api/src/main/java/org/onlab/onos/net/HostLocation.java
core/api/src/main/java/org/onlab/onos/net/host/HostService.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java
tools/dev/bash_profile
tools/package/package
core/api/src/main/java/org/onlab/onos/net/HostLocation.java
View file @
a56d5fe
package
org
.
onlab
.
onos
.
net
;
import
java.util.Objects
;
/**
* Representation of a network edge location where an end-station host is
* connected.
*/
public
class
HostLocation
extends
ConnectPoint
{
// Note that time is explicitly excluded from the notion of equality.
private
final
long
time
;
public
HostLocation
(
DeviceId
deviceId
,
PortNumber
portNumber
,
long
time
)
{
...
...
@@ -25,18 +24,4 @@ public class HostLocation extends ConnectPoint {
return
time
;
}
@Override
public
int
hashCode
()
{
return
31
*
super
.
hashCode
()
+
Objects
.
hash
(
time
);
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
HostLocation
)
{
final
HostLocation
other
=
(
HostLocation
)
obj
;
return
super
.
equals
(
obj
)
&&
Objects
.
equals
(
this
.
time
,
other
.
time
);
}
return
false
;
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/host/HostService.java
View file @
a56d5fe
...
...
@@ -43,7 +43,6 @@ public interface HostService {
* @param vlanId vlan identifier
* @return set of hosts in the given vlan id
*/
// FIXME: change long to VLanId
Set
<
Host
>
getHostsByVlan
(
VlanId
vlanId
);
/**
...
...
@@ -62,6 +61,8 @@ public interface HostService {
*/
Set
<
Host
>
getHostsByIp
(
IpAddress
ip
);
// TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan);
/**
* Returns the set of hosts whose most recent location is the specified
* connection point.
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java
View file @
a56d5fe
...
...
@@ -48,7 +48,7 @@ public class SimpleHostStore {
* @return appropriate event or null if no change resulted
*/
HostEvent
createOrUpdateHost
(
ProviderId
providerId
,
HostId
hostId
,
HostDescription
hostDescription
)
{
HostDescription
hostDescription
)
{
Host
host
=
hosts
.
get
(
hostId
);
if
(
host
==
null
)
{
return
createHost
(
providerId
,
hostId
,
hostDescription
);
...
...
@@ -58,12 +58,12 @@ public class SimpleHostStore {
// creates a new host and sends HOST_ADDED
private
HostEvent
createHost
(
ProviderId
providerId
,
HostId
hostId
,
HostDescription
descr
)
{
HostDescription
descr
)
{
DefaultHost
newhost
=
new
DefaultHost
(
providerId
,
hostId
,
descr
.
hwAddress
(),
descr
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
descr
.
hwAddress
(),
descr
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
synchronized
(
this
)
{
hosts
.
put
(
hostId
,
newhost
);
locations
.
put
(
descr
.
location
(),
newhost
);
...
...
@@ -73,23 +73,23 @@ public class SimpleHostStore {
// checks for type of update to host, sends appropriate event
private
HostEvent
updateHost
(
ProviderId
providerId
,
Host
host
,
HostDescription
descr
)
{
HostDescription
descr
)
{
DefaultHost
updated
;
HostEvent
event
;
// Consider only actual location (not timestamp) change?
if
(!(
host
.
location
().
port
().
equals
(
descr
.
location
().
port
())))
{
if
(!
host
.
location
().
equals
(
descr
.
location
()))
{
updated
=
new
DefaultHost
(
providerId
,
host
.
id
(),
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
host
.
ipAddresses
());
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
host
.
ipAddresses
());
event
=
new
HostEvent
(
HOST_MOVED
,
updated
);
}
else
if
(!(
host
.
ipAddresses
().
equals
(
descr
.
ipAddresses
())))
{
updated
=
new
DefaultHost
(
providerId
,
host
.
id
(),
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
host
.
mac
(),
host
.
vlan
(),
descr
.
location
(),
descr
.
ipAddresses
());
event
=
new
HostEvent
(
HOST_UPDATED
,
updated
);
}
else
{
return
null
;
...
...
@@ -134,7 +134,7 @@ public class SimpleHostStore {
* @return iterable collection of all hosts
*/
Iterable
<
Host
>
getHosts
()
{
return
Collections
.
unmodifiableSet
(
new
HashSet
<
Host
>(
hosts
.
values
()));
return
Collections
.
unmodifiableSet
(
new
HashSet
<>(
hosts
.
values
()));
}
/**
...
...
@@ -154,7 +154,7 @@ public class SimpleHostStore {
* @return set of hosts in the vlan
*/
Set
<
Host
>
getHosts
(
VlanId
vlanId
)
{
Set
<
Host
>
vlanset
=
new
HashSet
<
Host
>();
Set
<
Host
>
vlanset
=
new
HashSet
<>();
for
(
Host
h
:
hosts
.
values
())
{
if
(
h
.
vlan
().
equals
(
vlanId
))
{
vlanset
.
add
(
h
);
...
...
tools/dev/bash_profile
View file @
a56d5fe
...
...
@@ -12,7 +12,7 @@ export KARAF_LOG=$KARAF/data/log/karaf.log
# Setup a path
export
PS
=
":"
export
PATH
=
"
$PATH
:
$ONOS_ROOT
/tools/dev
;
$ONOS_ROOT
/tools/package"
export
PATH
=
"
$PATH
:
$ONOS_ROOT
/tools/dev
:
$ONOS_ROOT
/tools/package"
export
PATH
=
"
$PATH
:
$MAVEN
/bin:
$KARAF
/bin"
export
PATH
=
"
$PATH
:."
...
...
tools/package/package
View file @
a56d5fe
...
...
@@ -29,18 +29,13 @@ cd $ONOS_STAGE
# Unroll the Apache Karaf bits and make the ONOS top-level directories.
unzip
$KARAF_ZIP
mkdir bin
mkdir lib
# Stage the ONOS admin scripts
cp -r
$ONOS_ROOT
/tools/package/bin .
# Stage the ONOS bundles
mkdir -p lib/org/onlab
cp -r
$M2_REPO
/org/onlab lib/org
# Patch the Apache Karaf distribution file to point to the lib as maven repo
#perl -pi.old -e "s|^org.ops4j.pax.url.mvn.repositories= |org.ops4j.pax.url.mvn.repositories= \\\n file:../../lib, |" $ONOS_STAGE/$KARAF_DIST/etc/org.ops4j.pax.url.mvn.cfg
mkdir -p system/org/onlab
cp -r
$M2_REPO
/org/onlab system/org/
# Patch the Apache Karaf distribution file to add ONOS features repository
perl -pi.old -e
"s|^(featuresRepositories=.*)|
\1
,mvn:org.onlab.onos/onos-features/
$ONOS_VERSION
/xml/features|"
\
...
...
Please
register
or
login
to post a comment