Showing
5 changed files
with
25 additions
and
44 deletions
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | -import java.util.Objects; | ||
4 | - | ||
5 | /** | 3 | /** |
6 | * Representation of a network edge location where an end-station host is | 4 | * Representation of a network edge location where an end-station host is |
7 | * connected. | 5 | * connected. |
8 | */ | 6 | */ |
9 | public class HostLocation extends ConnectPoint { | 7 | public class HostLocation extends ConnectPoint { |
10 | 8 | ||
9 | + // Note that time is explicitly excluded from the notion of equality. | ||
11 | private final long time; | 10 | private final long time; |
12 | 11 | ||
13 | public HostLocation(DeviceId deviceId, PortNumber portNumber, long time) { | 12 | public HostLocation(DeviceId deviceId, PortNumber portNumber, long time) { |
... | @@ -25,18 +24,4 @@ public class HostLocation extends ConnectPoint { | ... | @@ -25,18 +24,4 @@ public class HostLocation extends ConnectPoint { |
25 | return time; | 24 | return time; |
26 | } | 25 | } |
27 | 26 | ||
28 | - @Override | ||
29 | - public int hashCode() { | ||
30 | - return 31 * super.hashCode() + Objects.hash(time); | ||
31 | - } | ||
32 | - | ||
33 | - @Override | ||
34 | - public boolean equals(Object obj) { | ||
35 | - if (obj instanceof HostLocation) { | ||
36 | - final HostLocation other = (HostLocation) obj; | ||
37 | - return super.equals(obj) && Objects.equals(this.time, other.time); | ||
38 | - } | ||
39 | - return false; | ||
40 | - } | ||
41 | - | ||
42 | } | 27 | } | ... | ... |
... | @@ -43,7 +43,6 @@ public interface HostService { | ... | @@ -43,7 +43,6 @@ public interface HostService { |
43 | * @param vlanId vlan identifier | 43 | * @param vlanId vlan identifier |
44 | * @return set of hosts in the given vlan id | 44 | * @return set of hosts in the given vlan id |
45 | */ | 45 | */ |
46 | - // FIXME: change long to VLanId | ||
47 | Set<Host> getHostsByVlan(VlanId vlanId); | 46 | Set<Host> getHostsByVlan(VlanId vlanId); |
48 | 47 | ||
49 | /** | 48 | /** |
... | @@ -62,6 +61,8 @@ public interface HostService { | ... | @@ -62,6 +61,8 @@ public interface HostService { |
62 | */ | 61 | */ |
63 | Set<Host> getHostsByIp(IpAddress ip); | 62 | Set<Host> getHostsByIp(IpAddress ip); |
64 | 63 | ||
64 | + // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan); | ||
65 | + | ||
65 | /** | 66 | /** |
66 | * Returns the set of hosts whose most recent location is the specified | 67 | * Returns the set of hosts whose most recent location is the specified |
67 | * connection point. | 68 | * connection point. | ... | ... |
... | @@ -48,7 +48,7 @@ public class SimpleHostStore { | ... | @@ -48,7 +48,7 @@ public class SimpleHostStore { |
48 | * @return appropriate event or null if no change resulted | 48 | * @return appropriate event or null if no change resulted |
49 | */ | 49 | */ |
50 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, | 50 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
51 | - HostDescription hostDescription) { | 51 | + HostDescription hostDescription) { |
52 | Host host = hosts.get(hostId); | 52 | Host host = hosts.get(hostId); |
53 | if (host == null) { | 53 | if (host == null) { |
54 | return createHost(providerId, hostId, hostDescription); | 54 | return createHost(providerId, hostId, hostDescription); |
... | @@ -58,12 +58,12 @@ public class SimpleHostStore { | ... | @@ -58,12 +58,12 @@ public class SimpleHostStore { |
58 | 58 | ||
59 | // creates a new host and sends HOST_ADDED | 59 | // creates a new host and sends HOST_ADDED |
60 | private HostEvent createHost(ProviderId providerId, HostId hostId, | 60 | private HostEvent createHost(ProviderId providerId, HostId hostId, |
61 | - HostDescription descr) { | 61 | + HostDescription descr) { |
62 | DefaultHost newhost = new DefaultHost(providerId, hostId, | 62 | DefaultHost newhost = new DefaultHost(providerId, hostId, |
63 | - descr.hwAddress(), | 63 | + descr.hwAddress(), |
64 | - descr.vlan(), | 64 | + descr.vlan(), |
65 | - descr.location(), | 65 | + descr.location(), |
66 | - descr.ipAddresses()); | 66 | + descr.ipAddresses()); |
67 | synchronized (this) { | 67 | synchronized (this) { |
68 | hosts.put(hostId, newhost); | 68 | hosts.put(hostId, newhost); |
69 | locations.put(descr.location(), newhost); | 69 | locations.put(descr.location(), newhost); |
... | @@ -73,23 +73,23 @@ public class SimpleHostStore { | ... | @@ -73,23 +73,23 @@ public class SimpleHostStore { |
73 | 73 | ||
74 | // checks for type of update to host, sends appropriate event | 74 | // checks for type of update to host, sends appropriate event |
75 | private HostEvent updateHost(ProviderId providerId, Host host, | 75 | private HostEvent updateHost(ProviderId providerId, Host host, |
76 | - HostDescription descr) { | 76 | + HostDescription descr) { |
77 | DefaultHost updated; | 77 | DefaultHost updated; |
78 | HostEvent event; | 78 | HostEvent event; |
79 | - // Consider only actual location (not timestamp) change? | 79 | + if (!host.location().equals(descr.location())) { |
80 | - if (!(host.location().port().equals(descr.location().port()))) { | ||
81 | updated = new DefaultHost(providerId, host.id(), | 80 | updated = new DefaultHost(providerId, host.id(), |
82 | - host.mac(), | 81 | + host.mac(), |
83 | - host.vlan(), | 82 | + host.vlan(), |
84 | - descr.location(), | 83 | + descr.location(), |
85 | - host.ipAddresses()); | 84 | + host.ipAddresses()); |
86 | event = new HostEvent(HOST_MOVED, updated); | 85 | event = new HostEvent(HOST_MOVED, updated); |
86 | + | ||
87 | } else if (!(host.ipAddresses().equals(descr.ipAddresses()))) { | 87 | } else if (!(host.ipAddresses().equals(descr.ipAddresses()))) { |
88 | updated = new DefaultHost(providerId, host.id(), | 88 | updated = new DefaultHost(providerId, host.id(), |
89 | - host.mac(), | 89 | + host.mac(), |
90 | - host.vlan(), | 90 | + host.vlan(), |
91 | - descr.location(), | 91 | + descr.location(), |
92 | - descr.ipAddresses()); | 92 | + descr.ipAddresses()); |
93 | event = new HostEvent(HOST_UPDATED, updated); | 93 | event = new HostEvent(HOST_UPDATED, updated); |
94 | } else { | 94 | } else { |
95 | return null; | 95 | return null; |
... | @@ -134,7 +134,7 @@ public class SimpleHostStore { | ... | @@ -134,7 +134,7 @@ public class SimpleHostStore { |
134 | * @return iterable collection of all hosts | 134 | * @return iterable collection of all hosts |
135 | */ | 135 | */ |
136 | Iterable<Host> getHosts() { | 136 | Iterable<Host> getHosts() { |
137 | - return Collections.unmodifiableSet(new HashSet<Host>(hosts.values())); | 137 | + return Collections.unmodifiableSet(new HashSet<>(hosts.values())); |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
... | @@ -154,7 +154,7 @@ public class SimpleHostStore { | ... | @@ -154,7 +154,7 @@ public class SimpleHostStore { |
154 | * @return set of hosts in the vlan | 154 | * @return set of hosts in the vlan |
155 | */ | 155 | */ |
156 | Set<Host> getHosts(VlanId vlanId) { | 156 | Set<Host> getHosts(VlanId vlanId) { |
157 | - Set<Host> vlanset = new HashSet<Host>(); | 157 | + Set<Host> vlanset = new HashSet<>(); |
158 | for (Host h : hosts.values()) { | 158 | for (Host h : hosts.values()) { |
159 | if (h.vlan().equals(vlanId)) { | 159 | if (h.vlan().equals(vlanId)) { |
160 | vlanset.add(h); | 160 | vlanset.add(h); | ... | ... |
... | @@ -12,7 +12,7 @@ export KARAF_LOG=$KARAF/data/log/karaf.log | ... | @@ -12,7 +12,7 @@ export KARAF_LOG=$KARAF/data/log/karaf.log |
12 | 12 | ||
13 | # Setup a path | 13 | # Setup a path |
14 | export PS=":" | 14 | export PS=":" |
15 | -export PATH="$PATH:$ONOS_ROOT/tools/dev;$ONOS_ROOT/tools/package" | 15 | +export PATH="$PATH:$ONOS_ROOT/tools/dev:$ONOS_ROOT/tools/package" |
16 | export PATH="$PATH:$MAVEN/bin:$KARAF/bin" | 16 | export PATH="$PATH:$MAVEN/bin:$KARAF/bin" |
17 | export PATH="$PATH:." | 17 | export PATH="$PATH:." |
18 | 18 | ... | ... |
... | @@ -29,18 +29,13 @@ cd $ONOS_STAGE | ... | @@ -29,18 +29,13 @@ cd $ONOS_STAGE |
29 | # Unroll the Apache Karaf bits and make the ONOS top-level directories. | 29 | # Unroll the Apache Karaf bits and make the ONOS top-level directories. |
30 | unzip $KARAF_ZIP | 30 | unzip $KARAF_ZIP |
31 | mkdir bin | 31 | mkdir bin |
32 | -mkdir lib | ||
33 | 32 | ||
34 | # Stage the ONOS admin scripts | 33 | # Stage the ONOS admin scripts |
35 | cp -r $ONOS_ROOT/tools/package/bin . | 34 | cp -r $ONOS_ROOT/tools/package/bin . |
36 | 35 | ||
37 | # Stage the ONOS bundles | 36 | # Stage the ONOS bundles |
38 | -mkdir -p lib/org/onlab | 37 | +mkdir -p system/org/onlab |
39 | -cp -r $M2_REPO/org/onlab lib/org | 38 | +cp -r $M2_REPO/org/onlab system/org/ |
40 | - | ||
41 | - | ||
42 | -# Patch the Apache Karaf distribution file to point to the lib as maven repo | ||
43 | -#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 | ||
44 | 39 | ||
45 | # Patch the Apache Karaf distribution file to add ONOS features repository | 40 | # Patch the Apache Karaf distribution file to add ONOS features repository |
46 | perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ | 41 | 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