renamed VLAN, IP, and MACAddress classes
Change-Id: Ib4df413db1f3d9ee96213fc487519536d7993c5b
Showing
27 changed files
with
233 additions
and
233 deletions
... | @@ -16,7 +16,7 @@ import org.onlab.onos.net.topology.Topology; | ... | @@ -16,7 +16,7 @@ import org.onlab.onos.net.topology.Topology; |
16 | import org.onlab.onos.net.topology.TopologyGraph; | 16 | import org.onlab.onos.net.topology.TopologyGraph; |
17 | import org.onlab.onos.net.topology.TopologyService; | 17 | import org.onlab.onos.net.topology.TopologyService; |
18 | import org.onlab.onos.net.topology.TopologyVertex; | 18 | import org.onlab.onos.net.topology.TopologyVertex; |
19 | -import org.onlab.packet.IPAddress; | 19 | +import org.onlab.packet.IpAddress; |
20 | import org.onlab.rest.BaseResource; | 20 | import org.onlab.rest.BaseResource; |
21 | 21 | ||
22 | import javax.ws.rs.GET; | 22 | import javax.ws.rs.GET; |
... | @@ -74,8 +74,8 @@ public class TopologyResource extends BaseResource { | ... | @@ -74,8 +74,8 @@ public class TopologyResource extends BaseResource { |
74 | // Merge the exterior and interior vertexes and inject host links as | 74 | // Merge the exterior and interior vertexes and inject host links as |
75 | // the exterior edges. | 75 | // the exterior edges. |
76 | for (Host host : hostService.getHosts()) { | 76 | for (Host host : hostService.getHosts()) { |
77 | - Set<IPAddress> ipAddresses = host.ipAddresses(); | 77 | + Set<IpAddress> ipAddresses = host.ipAddresses(); |
78 | - IPAddress ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next(); | 78 | + IpAddress ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next(); |
79 | String label = ipAddress != null ? ipAddress.toString() : host.mac().toString(); | 79 | String label = ipAddress != null ? ipAddress.toString() : host.mac().toString(); |
80 | vertexesNode.add(json(mapper, host.id(), 3, label, true)); | 80 | vertexesNode.add(json(mapper, host.id(), 3, label, true)); |
81 | edgesNode.add(json(mapper, 1, host.location(), new ConnectPoint(host.id(), portNumber(-1)))); | 81 | edgesNode.add(json(mapper, 1, host.location(), new ConnectPoint(host.id(), portNumber(-1)))); | ... | ... |
... | @@ -8,27 +8,27 @@ import java.util.Objects; | ... | @@ -8,27 +8,27 @@ import java.util.Objects; |
8 | import java.util.Set; | 8 | import java.util.Set; |
9 | 9 | ||
10 | import org.onlab.onos.net.provider.ProviderId; | 10 | import org.onlab.onos.net.provider.ProviderId; |
11 | -import org.onlab.packet.IPAddress; | 11 | +import org.onlab.packet.IpAddress; |
12 | -import org.onlab.packet.MACAddress; | 12 | +import org.onlab.packet.MacAddress; |
13 | -import org.onlab.packet.VLANID; | 13 | +import org.onlab.packet.VlanId; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A basic implementation of a Host. | 16 | * A basic implementation of a Host. |
17 | */ | 17 | */ |
18 | public class DefaultHost extends AbstractElement implements Host { | 18 | public class DefaultHost extends AbstractElement implements Host { |
19 | 19 | ||
20 | - private final MACAddress mac; | 20 | + private final MacAddress mac; |
21 | - private final VLANID vlan; | 21 | + private final VlanId vlan; |
22 | private final HostLocation location; | 22 | private final HostLocation location; |
23 | - private final Set<IPAddress> ips; | 23 | + private final Set<IpAddress> ips; |
24 | 24 | ||
25 | - public DefaultHost(ProviderId providerId, HostId id, MACAddress mac, | 25 | + public DefaultHost(ProviderId providerId, HostId id, MacAddress mac, |
26 | - VLANID vlan, HostLocation loc, Set<IPAddress> ips) { | 26 | + VlanId vlan, HostLocation loc, Set<IpAddress> ips) { |
27 | super(providerId, id); | 27 | super(providerId, id); |
28 | this.mac = mac; | 28 | this.mac = mac; |
29 | this.vlan = vlan; | 29 | this.vlan = vlan; |
30 | this.location = loc; | 30 | this.location = loc; |
31 | - this.ips = new HashSet<IPAddress>(ips); | 31 | + this.ips = new HashSet<IpAddress>(ips); |
32 | } | 32 | } |
33 | 33 | ||
34 | @Override | 34 | @Override |
... | @@ -37,12 +37,12 @@ public class DefaultHost extends AbstractElement implements Host { | ... | @@ -37,12 +37,12 @@ public class DefaultHost extends AbstractElement implements Host { |
37 | } | 37 | } |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | - public MACAddress mac() { | 40 | + public MacAddress mac() { |
41 | return mac; | 41 | return mac; |
42 | } | 42 | } |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | - public Set<IPAddress> ipAddresses() { | 45 | + public Set<IpAddress> ipAddresses() { |
46 | return Collections.unmodifiableSet(ips); | 46 | return Collections.unmodifiableSet(ips); |
47 | } | 47 | } |
48 | 48 | ||
... | @@ -52,7 +52,7 @@ public class DefaultHost extends AbstractElement implements Host { | ... | @@ -52,7 +52,7 @@ public class DefaultHost extends AbstractElement implements Host { |
52 | } | 52 | } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | - public VLANID vlan() { | 55 | + public VlanId vlan() { |
56 | return vlan; | 56 | return vlan; |
57 | } | 57 | } |
58 | 58 | ... | ... |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | -import org.onlab.packet.IPAddress; | 3 | +import org.onlab.packet.IpAddress; |
4 | -import org.onlab.packet.MACAddress; | 4 | +import org.onlab.packet.MacAddress; |
5 | -import org.onlab.packet.VLANID; | 5 | +import org.onlab.packet.VlanId; |
6 | 6 | ||
7 | import java.util.Set; | 7 | import java.util.Set; |
8 | 8 | ||
... | @@ -24,21 +24,21 @@ public interface Host extends Element { | ... | @@ -24,21 +24,21 @@ public interface Host extends Element { |
24 | * | 24 | * |
25 | * @return mac address | 25 | * @return mac address |
26 | */ | 26 | */ |
27 | - MACAddress mac(); | 27 | + MacAddress mac(); |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Returns the VLAN ID tied to this host. | 30 | * Returns the VLAN ID tied to this host. |
31 | * | 31 | * |
32 | * @return VLAN ID value | 32 | * @return VLAN ID value |
33 | */ | 33 | */ |
34 | - VLANID vlan(); | 34 | + VlanId vlan(); |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Returns set of IP addresses currently bound to the host MAC address. | 37 | * Returns set of IP addresses currently bound to the host MAC address. |
38 | * | 38 | * |
39 | * @return set of IP addresses; empty if no IP address is bound | 39 | * @return set of IP addresses; empty if no IP address is bound |
40 | */ | 40 | */ |
41 | - Set<IPAddress> ipAddresses(); | 41 | + Set<IpAddress> ipAddresses(); |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Returns the most recent host location where the host attaches to the | 44 | * Returns the most recent host location where the host attaches to the | ... | ... |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | -import org.onlab.packet.MACAddress; | 3 | +import org.onlab.packet.MacAddress; |
4 | -import org.onlab.packet.VLANID; | 4 | +import org.onlab.packet.VlanId; |
5 | 5 | ||
6 | import java.net.URI; | 6 | import java.net.URI; |
7 | 7 | ||
... | @@ -42,7 +42,7 @@ public final class HostId extends ElementId { | ... | @@ -42,7 +42,7 @@ public final class HostId extends ElementId { |
42 | * @param vlanId vlan identifier | 42 | * @param vlanId vlan identifier |
43 | * @return host identifier | 43 | * @return host identifier |
44 | */ | 44 | */ |
45 | - public static HostId hostId(MACAddress mac, VLANID vlanId) { | 45 | + public static HostId hostId(MacAddress mac, VlanId vlanId) { |
46 | // FIXME: use more efficient means of encoding | 46 | // FIXME: use more efficient means of encoding |
47 | return hostId("nic" + ":" + mac + "-" + vlanId); | 47 | return hostId("nic" + ":" + mac + "-" + vlanId); |
48 | } | 48 | } |
... | @@ -53,8 +53,8 @@ public final class HostId extends ElementId { | ... | @@ -53,8 +53,8 @@ public final class HostId extends ElementId { |
53 | * @param mac mac address | 53 | * @param mac mac address |
54 | * @return host identifier | 54 | * @return host identifier |
55 | */ | 55 | */ |
56 | - public static HostId hostId(MACAddress mac) { | 56 | + public static HostId hostId(MacAddress mac) { |
57 | - return hostId(mac, VLANID.vlanId(VLANID.UNTAGGED)); | 57 | + return hostId(mac, VlanId.vlanId(VlanId.UNTAGGED)); |
58 | } | 58 | } |
59 | 59 | ||
60 | } | 60 | } | ... | ... |
... | @@ -2,9 +2,9 @@ package org.onlab.onos.net.flow.criteria; | ... | @@ -2,9 +2,9 @@ package org.onlab.onos.net.flow.criteria; |
2 | 2 | ||
3 | import org.onlab.onos.net.PortNumber; | 3 | import org.onlab.onos.net.PortNumber; |
4 | import org.onlab.onos.net.flow.criteria.Criterion.Type; | 4 | import org.onlab.onos.net.flow.criteria.Criterion.Type; |
5 | -import org.onlab.packet.IPAddress; | 5 | +import org.onlab.packet.IpAddress; |
6 | -import org.onlab.packet.MACAddress; | 6 | +import org.onlab.packet.MacAddress; |
7 | -import org.onlab.packet.VLANID; | 7 | +import org.onlab.packet.VlanId; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Factory class to create various traffic selection criteria. | 10 | * Factory class to create various traffic selection criteria. |
... | @@ -34,7 +34,7 @@ public final class Criteria { | ... | @@ -34,7 +34,7 @@ public final class Criteria { |
34 | * @param macValue MAC address value or wildcard mask | 34 | * @param macValue MAC address value or wildcard mask |
35 | * @return match criterion | 35 | * @return match criterion |
36 | */ | 36 | */ |
37 | - public static Criterion matchEthSrc(MACAddress mac) { | 37 | + public static Criterion matchEthSrc(MacAddress mac) { |
38 | return new EthCriterion(mac, Type.ETH_SRC); | 38 | return new EthCriterion(mac, Type.ETH_SRC); |
39 | } | 39 | } |
40 | 40 | ||
... | @@ -45,7 +45,7 @@ public final class Criteria { | ... | @@ -45,7 +45,7 @@ public final class Criteria { |
45 | * @param macValue MAC address value or wildcard mask | 45 | * @param macValue MAC address value or wildcard mask |
46 | * @return match criterion | 46 | * @return match criterion |
47 | */ | 47 | */ |
48 | - public static Criterion matchEthDst(MACAddress mac) { | 48 | + public static Criterion matchEthDst(MacAddress mac) { |
49 | return new EthCriterion(mac, Type.ETH_DST); | 49 | return new EthCriterion(mac, Type.ETH_DST); |
50 | } | 50 | } |
51 | 51 | ||
... | @@ -65,7 +65,7 @@ public final class Criteria { | ... | @@ -65,7 +65,7 @@ public final class Criteria { |
65 | * @param vlanId vlan id value | 65 | * @param vlanId vlan id value |
66 | * @return match criterion | 66 | * @return match criterion |
67 | */ | 67 | */ |
68 | - public static Criterion matchVlanId(VLANID vlanId) { | 68 | + public static Criterion matchVlanId(VlanId vlanId) { |
69 | return new VlanIdCriterion(vlanId); | 69 | return new VlanIdCriterion(vlanId); |
70 | } | 70 | } |
71 | 71 | ||
... | @@ -95,7 +95,7 @@ public final class Criteria { | ... | @@ -95,7 +95,7 @@ public final class Criteria { |
95 | * @param ip ip src value | 95 | * @param ip ip src value |
96 | * @return match criterion | 96 | * @return match criterion |
97 | */ | 97 | */ |
98 | - public static Criterion matchIPSrc(IPAddress ip) { | 98 | + public static Criterion matchIPSrc(IpAddress ip) { |
99 | return new IPCriterion(ip, Type.IPV4_SRC); | 99 | return new IPCriterion(ip, Type.IPV4_SRC); |
100 | } | 100 | } |
101 | 101 | ||
... | @@ -105,7 +105,7 @@ public final class Criteria { | ... | @@ -105,7 +105,7 @@ public final class Criteria { |
105 | * @param ip ip src value | 105 | * @param ip ip src value |
106 | * @return match criterion | 106 | * @return match criterion |
107 | */ | 107 | */ |
108 | - public static Criterion matchIPDst(IPAddress ip) { | 108 | + public static Criterion matchIPDst(IpAddress ip) { |
109 | return new IPCriterion(ip, Type.IPV4_DST); | 109 | return new IPCriterion(ip, Type.IPV4_DST); |
110 | } | 110 | } |
111 | 111 | ||
... | @@ -133,10 +133,10 @@ public final class Criteria { | ... | @@ -133,10 +133,10 @@ public final class Criteria { |
133 | 133 | ||
134 | 134 | ||
135 | public static final class EthCriterion implements Criterion { | 135 | public static final class EthCriterion implements Criterion { |
136 | - private final MACAddress mac; | 136 | + private final MacAddress mac; |
137 | private final Type type; | 137 | private final Type type; |
138 | 138 | ||
139 | - public EthCriterion(MACAddress mac, Type type) { | 139 | + public EthCriterion(MacAddress mac, Type type) { |
140 | this.mac = mac; | 140 | this.mac = mac; |
141 | this.type = type; | 141 | this.type = type; |
142 | } | 142 | } |
... | @@ -146,7 +146,7 @@ public final class Criteria { | ... | @@ -146,7 +146,7 @@ public final class Criteria { |
146 | return this.type; | 146 | return this.type; |
147 | } | 147 | } |
148 | 148 | ||
149 | - public MACAddress mac() { | 149 | + public MacAddress mac() { |
150 | return this.mac; | 150 | return this.mac; |
151 | } | 151 | } |
152 | } | 152 | } |
... | @@ -173,10 +173,10 @@ public final class Criteria { | ... | @@ -173,10 +173,10 @@ public final class Criteria { |
173 | 173 | ||
174 | public static final class IPCriterion implements Criterion { | 174 | public static final class IPCriterion implements Criterion { |
175 | 175 | ||
176 | - private final IPAddress ip; | 176 | + private final IpAddress ip; |
177 | private final Type type; | 177 | private final Type type; |
178 | 178 | ||
179 | - public IPCriterion(IPAddress ip, Type type) { | 179 | + public IPCriterion(IpAddress ip, Type type) { |
180 | this.ip = ip; | 180 | this.ip = ip; |
181 | this.type = type; | 181 | this.type = type; |
182 | } | 182 | } |
... | @@ -186,7 +186,7 @@ public final class Criteria { | ... | @@ -186,7 +186,7 @@ public final class Criteria { |
186 | return this.type; | 186 | return this.type; |
187 | } | 187 | } |
188 | 188 | ||
189 | - public IPAddress ip() { | 189 | + public IpAddress ip() { |
190 | return this.ip; | 190 | return this.ip; |
191 | } | 191 | } |
192 | 192 | ||
... | @@ -237,9 +237,9 @@ public final class Criteria { | ... | @@ -237,9 +237,9 @@ public final class Criteria { |
237 | public static final class VlanIdCriterion implements Criterion { | 237 | public static final class VlanIdCriterion implements Criterion { |
238 | 238 | ||
239 | 239 | ||
240 | - private final VLANID vlanId; | 240 | + private final VlanId vlanId; |
241 | 241 | ||
242 | - public VlanIdCriterion(VLANID vlanId) { | 242 | + public VlanIdCriterion(VlanId vlanId) { |
243 | this.vlanId = vlanId; | 243 | this.vlanId = vlanId; |
244 | } | 244 | } |
245 | 245 | ||
... | @@ -248,7 +248,7 @@ public final class Criteria { | ... | @@ -248,7 +248,7 @@ public final class Criteria { |
248 | return Type.VLAN_VID; | 248 | return Type.VLAN_VID; |
249 | } | 249 | } |
250 | 250 | ||
251 | - public VLANID vlanId() { | 251 | + public VlanId vlanId() { |
252 | return vlanId; | 252 | return vlanId; |
253 | } | 253 | } |
254 | 254 | ... | ... |
... | @@ -8,9 +8,9 @@ import org.onlab.onos.net.flow.instructions.L2ModificationInstruction.ModEtherIn | ... | @@ -8,9 +8,9 @@ import org.onlab.onos.net.flow.instructions.L2ModificationInstruction.ModEtherIn |
8 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.L3SubType; | 8 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.L3SubType; |
9 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; | 9 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; |
10 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.ModIPProtoInstruction; | 10 | import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.ModIPProtoInstruction; |
11 | -import org.onlab.packet.IPAddress; | 11 | +import org.onlab.packet.IpAddress; |
12 | -import org.onlab.packet.MACAddress; | 12 | +import org.onlab.packet.MacAddress; |
13 | -import org.onlab.packet.VLANID; | 13 | +import org.onlab.packet.VlanId; |
14 | /** | 14 | /** |
15 | * Factory class for creating various traffic treatment instructions. | 15 | * Factory class for creating various traffic treatment instructions. |
16 | */ | 16 | */ |
... | @@ -45,7 +45,7 @@ public final class Instructions { | ... | @@ -45,7 +45,7 @@ public final class Instructions { |
45 | * @param addr the mac address to modify to. | 45 | * @param addr the mac address to modify to. |
46 | * @return a l2 modification | 46 | * @return a l2 modification |
47 | */ | 47 | */ |
48 | - public static L2ModificationInstruction modL2Src(MACAddress addr) { | 48 | + public static L2ModificationInstruction modL2Src(MacAddress addr) { |
49 | checkNotNull(addr, "Src l2 address cannot be null"); | 49 | checkNotNull(addr, "Src l2 address cannot be null"); |
50 | return new ModEtherInstruction(L2SubType.L2_SRC, addr); | 50 | return new ModEtherInstruction(L2SubType.L2_SRC, addr); |
51 | } | 51 | } |
... | @@ -55,7 +55,7 @@ public final class Instructions { | ... | @@ -55,7 +55,7 @@ public final class Instructions { |
55 | * @param addr the mac address to modify to. | 55 | * @param addr the mac address to modify to. |
56 | * @return a L2 modification | 56 | * @return a L2 modification |
57 | */ | 57 | */ |
58 | - public static L2ModificationInstruction modL2Dst(MACAddress addr) { | 58 | + public static L2ModificationInstruction modL2Dst(MacAddress addr) { |
59 | checkNotNull(addr, "Dst l2 address cannot be null"); | 59 | checkNotNull(addr, "Dst l2 address cannot be null"); |
60 | return new L2ModificationInstruction.ModEtherInstruction(L2SubType.L2_DST, addr); | 60 | return new L2ModificationInstruction.ModEtherInstruction(L2SubType.L2_DST, addr); |
61 | } | 61 | } |
... | @@ -75,7 +75,7 @@ public final class Instructions { | ... | @@ -75,7 +75,7 @@ public final class Instructions { |
75 | * @param vlanId the vlan id to modify to. | 75 | * @param vlanId the vlan id to modify to. |
76 | * @return a L2 modification | 76 | * @return a L2 modification |
77 | */ | 77 | */ |
78 | - public static L2ModificationInstruction modVlanId(VLANID vlanId) { | 78 | + public static L2ModificationInstruction modVlanId(VlanId vlanId) { |
79 | checkNotNull(vlanId, "VLAN id cannot be null"); | 79 | checkNotNull(vlanId, "VLAN id cannot be null"); |
80 | return new L2ModificationInstruction.ModVlanIdInstruction(vlanId); | 80 | return new L2ModificationInstruction.ModVlanIdInstruction(vlanId); |
81 | } | 81 | } |
... | @@ -95,7 +95,7 @@ public final class Instructions { | ... | @@ -95,7 +95,7 @@ public final class Instructions { |
95 | * @param addr the ip address to modify to. | 95 | * @param addr the ip address to modify to. |
96 | * @return a L3 modification | 96 | * @return a L3 modification |
97 | */ | 97 | */ |
98 | - public static L3ModificationInstruction modL3Src(IPAddress addr) { | 98 | + public static L3ModificationInstruction modL3Src(IpAddress addr) { |
99 | checkNotNull(addr, "Src l3 address cannot be null"); | 99 | checkNotNull(addr, "Src l3 address cannot be null"); |
100 | return new ModIPInstruction(L3SubType.L3_SRC, addr); | 100 | return new ModIPInstruction(L3SubType.L3_SRC, addr); |
101 | } | 101 | } |
... | @@ -105,7 +105,7 @@ public final class Instructions { | ... | @@ -105,7 +105,7 @@ public final class Instructions { |
105 | * @param addr the ip address to modify to. | 105 | * @param addr the ip address to modify to. |
106 | * @return a L3 modification | 106 | * @return a L3 modification |
107 | */ | 107 | */ |
108 | - public static L3ModificationInstruction modL3Dst(IPAddress addr) { | 108 | + public static L3ModificationInstruction modL3Dst(IpAddress addr) { |
109 | checkNotNull(addr, "Dst l3 address cannot be null"); | 109 | checkNotNull(addr, "Dst l3 address cannot be null"); |
110 | return new ModIPInstruction(L3SubType.L3_DST, addr); | 110 | return new ModIPInstruction(L3SubType.L3_DST, addr); |
111 | } | 111 | } | ... | ... |
1 | package org.onlab.onos.net.flow.instructions; | 1 | package org.onlab.onos.net.flow.instructions; |
2 | 2 | ||
3 | -import org.onlab.packet.MACAddress; | 3 | +import org.onlab.packet.MacAddress; |
4 | -import org.onlab.packet.VLANID; | 4 | +import org.onlab.packet.VlanId; |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * Abstraction of a single traffic treatment step. | 7 | * Abstraction of a single traffic treatment step. |
... | @@ -56,9 +56,9 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -56,9 +56,9 @@ public abstract class L2ModificationInstruction implements Instruction { |
56 | public static final class ModEtherInstruction extends L2ModificationInstruction { | 56 | public static final class ModEtherInstruction extends L2ModificationInstruction { |
57 | 57 | ||
58 | private final SubType subtype; | 58 | private final SubType subtype; |
59 | - private final MACAddress mac; | 59 | + private final MacAddress mac; |
60 | 60 | ||
61 | - public ModEtherInstruction(SubType subType, MACAddress addr) { | 61 | + public ModEtherInstruction(SubType subType, MacAddress addr) { |
62 | this.subtype = subType; | 62 | this.subtype = subType; |
63 | this.mac = addr; | 63 | this.mac = addr; |
64 | } | 64 | } |
... | @@ -68,7 +68,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -68,7 +68,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
68 | return this.subtype; | 68 | return this.subtype; |
69 | } | 69 | } |
70 | 70 | ||
71 | - public MACAddress mac() { | 71 | + public MacAddress mac() { |
72 | return this.mac; | 72 | return this.mac; |
73 | } | 73 | } |
74 | 74 | ||
... | @@ -101,9 +101,9 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -101,9 +101,9 @@ public abstract class L2ModificationInstruction implements Instruction { |
101 | */ | 101 | */ |
102 | public static final class ModVlanIdInstruction extends L2ModificationInstruction { | 102 | public static final class ModVlanIdInstruction extends L2ModificationInstruction { |
103 | 103 | ||
104 | - public final VLANID vlanId; | 104 | + public final VlanId vlanId; |
105 | 105 | ||
106 | - public ModVlanIdInstruction(VLANID vlanId) { | 106 | + public ModVlanIdInstruction(VlanId vlanId) { |
107 | this.vlanId = vlanId; | 107 | this.vlanId = vlanId; |
108 | } | 108 | } |
109 | 109 | ||
... | @@ -112,7 +112,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -112,7 +112,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
112 | return L2SubType.VLAN_ID; | 112 | return L2SubType.VLAN_ID; |
113 | } | 113 | } |
114 | 114 | ||
115 | - public VLANID vlanId() { | 115 | + public VlanId vlanId() { |
116 | return this.vlanId; | 116 | return this.vlanId; |
117 | } | 117 | } |
118 | 118 | ... | ... |
1 | package org.onlab.onos.net.flow.instructions; | 1 | package org.onlab.onos.net.flow.instructions; |
2 | 2 | ||
3 | -import org.onlab.packet.IPAddress; | 3 | +import org.onlab.packet.IpAddress; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Abstraction of a single traffic treatment step. | 6 | * Abstraction of a single traffic treatment step. |
... | @@ -47,9 +47,9 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -47,9 +47,9 @@ public abstract class L3ModificationInstruction implements Instruction { |
47 | public static final class ModIPInstruction extends L3ModificationInstruction { | 47 | public static final class ModIPInstruction extends L3ModificationInstruction { |
48 | 48 | ||
49 | private final SubType subtype; | 49 | private final SubType subtype; |
50 | - private final IPAddress ip; | 50 | + private final IpAddress ip; |
51 | 51 | ||
52 | - public ModIPInstruction(SubType subType, IPAddress addr) { | 52 | + public ModIPInstruction(SubType subType, IpAddress addr) { |
53 | this.subtype = subType; | 53 | this.subtype = subType; |
54 | this.ip = addr; | 54 | this.ip = addr; |
55 | } | 55 | } |
... | @@ -59,7 +59,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -59,7 +59,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
59 | return this.subtype; | 59 | return this.subtype; |
60 | } | 60 | } |
61 | 61 | ||
62 | - public IPAddress ip() { | 62 | + public IpAddress ip() { |
63 | return this.ip; | 63 | return this.ip; |
64 | } | 64 | } |
65 | 65 | ... | ... |
... | @@ -6,42 +6,42 @@ import java.util.HashSet; | ... | @@ -6,42 +6,42 @@ import java.util.HashSet; |
6 | import java.util.Set; | 6 | import java.util.Set; |
7 | 7 | ||
8 | import org.onlab.onos.net.HostLocation; | 8 | import org.onlab.onos.net.HostLocation; |
9 | -import org.onlab.packet.IPAddress; | 9 | +import org.onlab.packet.IpAddress; |
10 | -import org.onlab.packet.MACAddress; | 10 | +import org.onlab.packet.MacAddress; |
11 | -import org.onlab.packet.VLANID; | 11 | +import org.onlab.packet.VlanId; |
12 | 12 | ||
13 | import com.google.common.collect.ImmutableSet; | 13 | import com.google.common.collect.ImmutableSet; |
14 | 14 | ||
15 | public class DefaultHostDescription implements HostDescription { | 15 | public class DefaultHostDescription implements HostDescription { |
16 | 16 | ||
17 | - private final MACAddress mac; | 17 | + private final MacAddress mac; |
18 | - private final VLANID vlan; | 18 | + private final VlanId vlan; |
19 | private final HostLocation location; | 19 | private final HostLocation location; |
20 | - private final Set<IPAddress> ips; | 20 | + private final Set<IpAddress> ips; |
21 | 21 | ||
22 | - public DefaultHostDescription(MACAddress mac, VLANID vlan, | 22 | + public DefaultHostDescription(MacAddress mac, VlanId vlan, |
23 | HostLocation loc) { | 23 | HostLocation loc) { |
24 | this.mac = mac; | 24 | this.mac = mac; |
25 | this.vlan = vlan; | 25 | this.vlan = vlan; |
26 | this.location = loc; | 26 | this.location = loc; |
27 | - this.ips = new HashSet<IPAddress>(); | 27 | + this.ips = new HashSet<IpAddress>(); |
28 | } | 28 | } |
29 | 29 | ||
30 | - public DefaultHostDescription(MACAddress mac, VLANID vlan, | 30 | + public DefaultHostDescription(MacAddress mac, VlanId vlan, |
31 | - HostLocation loc, Set<IPAddress> ips) { | 31 | + HostLocation loc, Set<IpAddress> ips) { |
32 | this.mac = mac; | 32 | this.mac = mac; |
33 | this.vlan = vlan; | 33 | this.vlan = vlan; |
34 | this.location = loc; | 34 | this.location = loc; |
35 | - this.ips = new HashSet<IPAddress>(ips); | 35 | + this.ips = new HashSet<IpAddress>(ips); |
36 | } | 36 | } |
37 | 37 | ||
38 | @Override | 38 | @Override |
39 | - public MACAddress hwAddress() { | 39 | + public MacAddress hwAddress() { |
40 | return mac; | 40 | return mac; |
41 | } | 41 | } |
42 | 42 | ||
43 | @Override | 43 | @Override |
44 | - public VLANID vlan() { | 44 | + public VlanId vlan() { |
45 | return vlan; | 45 | return vlan; |
46 | } | 46 | } |
47 | 47 | ||
... | @@ -51,7 +51,7 @@ public class DefaultHostDescription implements HostDescription { | ... | @@ -51,7 +51,7 @@ public class DefaultHostDescription implements HostDescription { |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | - public Set<IPAddress> ipAddresses() { | 54 | + public Set<IpAddress> ipAddresses() { |
55 | return ImmutableSet.copyOf(ips); | 55 | return ImmutableSet.copyOf(ips); |
56 | } | 56 | } |
57 | 57 | ... | ... |
... | @@ -4,9 +4,9 @@ import java.util.Set; | ... | @@ -4,9 +4,9 @@ import java.util.Set; |
4 | 4 | ||
5 | import org.onlab.onos.net.Description; | 5 | import org.onlab.onos.net.Description; |
6 | import org.onlab.onos.net.HostLocation; | 6 | import org.onlab.onos.net.HostLocation; |
7 | -import org.onlab.packet.IPAddress; | 7 | +import org.onlab.packet.IpAddress; |
8 | -import org.onlab.packet.MACAddress; | 8 | +import org.onlab.packet.MacAddress; |
9 | -import org.onlab.packet.VLANID; | 9 | +import org.onlab.packet.VlanId; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Information describing host and its location. | 12 | * Information describing host and its location. |
... | @@ -18,14 +18,14 @@ public interface HostDescription extends Description { | ... | @@ -18,14 +18,14 @@ public interface HostDescription extends Description { |
18 | * | 18 | * |
19 | * @return the MAC address of this host | 19 | * @return the MAC address of this host |
20 | */ | 20 | */ |
21 | - MACAddress hwAddress(); | 21 | + MacAddress hwAddress(); |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Returns the VLAN associated with this host. | 24 | * Returns the VLAN associated with this host. |
25 | * | 25 | * |
26 | * @return the VLAN ID value | 26 | * @return the VLAN ID value |
27 | */ | 27 | */ |
28 | - VLANID vlan(); | 28 | + VlanId vlan(); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Returns the location of the host on the network edge. | 31 | * Returns the location of the host on the network edge. |
... | @@ -39,6 +39,6 @@ public interface HostDescription extends Description { | ... | @@ -39,6 +39,6 @@ public interface HostDescription extends Description { |
39 | * | 39 | * |
40 | * @return a set of IP addresses. | 40 | * @return a set of IP addresses. |
41 | */ | 41 | */ |
42 | - Set<IPAddress> ipAddresses(); | 42 | + Set<IpAddress> ipAddresses(); |
43 | 43 | ||
44 | } | 44 | } | ... | ... |
... | @@ -4,9 +4,9 @@ import org.onlab.onos.net.ConnectPoint; | ... | @@ -4,9 +4,9 @@ import org.onlab.onos.net.ConnectPoint; |
4 | import org.onlab.onos.net.DeviceId; | 4 | import org.onlab.onos.net.DeviceId; |
5 | import org.onlab.onos.net.Host; | 5 | import org.onlab.onos.net.Host; |
6 | import org.onlab.onos.net.HostId; | 6 | import org.onlab.onos.net.HostId; |
7 | -import org.onlab.packet.IPAddress; | 7 | +import org.onlab.packet.IpAddress; |
8 | -import org.onlab.packet.MACAddress; | 8 | +import org.onlab.packet.MacAddress; |
9 | -import org.onlab.packet.VLANID; | 9 | +import org.onlab.packet.VlanId; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
... | @@ -44,7 +44,7 @@ public interface HostService { | ... | @@ -44,7 +44,7 @@ public interface HostService { |
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 | 46 | // FIXME: change long to VLanId |
47 | - Set<Host> getHostsByVlan(VLANID vlanId); | 47 | + Set<Host> getHostsByVlan(VlanId vlanId); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Returns the set of hosts that have the specified MAC address. | 50 | * Returns the set of hosts that have the specified MAC address. |
... | @@ -52,7 +52,7 @@ public interface HostService { | ... | @@ -52,7 +52,7 @@ public interface HostService { |
52 | * @param mac mac address | 52 | * @param mac mac address |
53 | * @return set of hosts with the given mac | 53 | * @return set of hosts with the given mac |
54 | */ | 54 | */ |
55 | - Set<Host> getHostsByMac(MACAddress mac); | 55 | + Set<Host> getHostsByMac(MacAddress mac); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Returns the set of hosts that have the specified IP address. | 58 | * Returns the set of hosts that have the specified IP address. |
... | @@ -60,7 +60,7 @@ public interface HostService { | ... | @@ -60,7 +60,7 @@ public interface HostService { |
60 | * @param ip ip address | 60 | * @param ip ip address |
61 | * @return set of hosts with the given IP | 61 | * @return set of hosts with the given IP |
62 | */ | 62 | */ |
63 | - Set<Host> getHostsByIp(IPAddress ip); | 63 | + Set<Host> getHostsByIp(IpAddress ip); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Returns the set of hosts whose most recent location is the specified | 66 | * Returns the set of hosts whose most recent location is the specified | ... | ... |
... | @@ -3,8 +3,8 @@ package org.onlab.onos.net; | ... | @@ -3,8 +3,8 @@ package org.onlab.onos.net; |
3 | import com.google.common.testing.EqualsTester; | 3 | import com.google.common.testing.EqualsTester; |
4 | 4 | ||
5 | import org.junit.Test; | 5 | import org.junit.Test; |
6 | -import org.onlab.packet.MACAddress; | 6 | +import org.onlab.packet.MacAddress; |
7 | -import org.onlab.packet.VLANID; | 7 | +import org.onlab.packet.VlanId; |
8 | 8 | ||
9 | import static org.onlab.onos.net.HostId.hostId; | 9 | import static org.onlab.onos.net.HostId.hostId; |
10 | 10 | ||
... | @@ -13,10 +13,10 @@ import static org.onlab.onos.net.HostId.hostId; | ... | @@ -13,10 +13,10 @@ import static org.onlab.onos.net.HostId.hostId; |
13 | */ | 13 | */ |
14 | public class HostIdTest extends ElementIdTest { | 14 | public class HostIdTest extends ElementIdTest { |
15 | 15 | ||
16 | - private static final MACAddress MAC1 = MACAddress.valueOf("00:11:00:00:00:01"); | 16 | + private static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); |
17 | - private static final MACAddress MAC2 = MACAddress.valueOf("00:22:00:00:00:02"); | 17 | + private static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02"); |
18 | - private static final VLANID VLAN1 = VLANID.vlanId((short) 11); | 18 | + private static final VlanId VLAN1 = VlanId.vlanId((short) 11); |
19 | - private static final VLANID VLAN2 = VLANID.vlanId((short) 22); | 19 | + private static final VlanId VLAN2 = VlanId.vlanId((short) 22); |
20 | 20 | ||
21 | @Override | 21 | @Override |
22 | @Test | 22 | @Test | ... | ... |
... | @@ -5,9 +5,9 @@ import static org.onlab.onos.net.DeviceId.deviceId; | ... | @@ -5,9 +5,9 @@ import static org.onlab.onos.net.DeviceId.deviceId; |
5 | import java.util.Set; | 5 | import java.util.Set; |
6 | 6 | ||
7 | import org.onlab.onos.net.provider.ProviderId; | 7 | import org.onlab.onos.net.provider.ProviderId; |
8 | -import org.onlab.packet.IPAddress; | 8 | +import org.onlab.packet.IpAddress; |
9 | -import org.onlab.packet.MACAddress; | 9 | +import org.onlab.packet.MacAddress; |
10 | -import org.onlab.packet.VLANID; | 10 | +import org.onlab.packet.VlanId; |
11 | 11 | ||
12 | import com.google.common.collect.Sets; | 12 | import com.google.common.collect.Sets; |
13 | 13 | ||
... | @@ -20,13 +20,13 @@ public abstract class TestDeviceParams { | ... | @@ -20,13 +20,13 @@ public abstract class TestDeviceParams { |
20 | protected static final ProviderId PID = new ProviderId("foo"); | 20 | protected static final ProviderId PID = new ProviderId("foo"); |
21 | protected static final DeviceId DID1 = deviceId("of:foo"); | 21 | protected static final DeviceId DID1 = deviceId("of:foo"); |
22 | protected static final DeviceId DID2 = deviceId("of:bar"); | 22 | protected static final DeviceId DID2 = deviceId("of:bar"); |
23 | - protected static final MACAddress MAC1 = MACAddress.valueOf("00:11:00:00:00:01"); | 23 | + protected static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); |
24 | - protected static final MACAddress MAC2 = MACAddress.valueOf("00:22:00:00:00:02"); | 24 | + protected static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02"); |
25 | - protected static final VLANID VLAN1 = VLANID.vlanId((short) 11); | 25 | + protected static final VlanId VLAN1 = VlanId.vlanId((short) 11); |
26 | - protected static final VLANID VLAN2 = VLANID.vlanId((short) 22); | 26 | + protected static final VlanId VLAN2 = VlanId.vlanId((short) 22); |
27 | - protected static final IPAddress IP1 = IPAddress.valueOf("10.0.0.1"); | 27 | + protected static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1"); |
28 | - protected static final IPAddress IP2 = IPAddress.valueOf("10.0.0.2"); | 28 | + protected static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2"); |
29 | - protected static final IPAddress IP3 = IPAddress.valueOf("10.0.0.3"); | 29 | + protected static final IpAddress IP3 = IpAddress.valueOf("10.0.0.3"); |
30 | 30 | ||
31 | protected static final PortNumber P1 = PortNumber.portNumber(100); | 31 | protected static final PortNumber P1 = PortNumber.portNumber(100); |
32 | protected static final PortNumber P2 = PortNumber.portNumber(200); | 32 | protected static final PortNumber P2 = PortNumber.portNumber(200); |
... | @@ -34,7 +34,7 @@ public abstract class TestDeviceParams { | ... | @@ -34,7 +34,7 @@ public abstract class TestDeviceParams { |
34 | protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2); | 34 | protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2); |
35 | protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L); | 35 | protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L); |
36 | protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L); | 36 | protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L); |
37 | - protected static final Set<IPAddress> IPSET1 = Sets.newHashSet(IP1, IP2); | 37 | + protected static final Set<IpAddress> IPSET1 = Sets.newHashSet(IP1, IP2); |
38 | - protected static final Set<IPAddress> IPSET2 = Sets.newHashSet(IP1, IP3); | 38 | + protected static final Set<IpAddress> IPSET2 = Sets.newHashSet(IP1, IP3); |
39 | 39 | ||
40 | } | 40 | } | ... | ... |
... | @@ -9,9 +9,9 @@ import org.junit.Test; | ... | @@ -9,9 +9,9 @@ import org.junit.Test; |
9 | import org.onlab.onos.net.DeviceId; | 9 | import org.onlab.onos.net.DeviceId; |
10 | import org.onlab.onos.net.HostLocation; | 10 | import org.onlab.onos.net.HostLocation; |
11 | import org.onlab.onos.net.PortNumber; | 11 | import org.onlab.onos.net.PortNumber; |
12 | -import org.onlab.packet.IPAddress; | 12 | +import org.onlab.packet.IpAddress; |
13 | -import org.onlab.packet.MACAddress; | 13 | +import org.onlab.packet.MacAddress; |
14 | -import org.onlab.packet.VLANID; | 14 | +import org.onlab.packet.VlanId; |
15 | 15 | ||
16 | import com.google.common.collect.Sets; | 16 | import com.google.common.collect.Sets; |
17 | 17 | ||
... | @@ -20,16 +20,16 @@ import com.google.common.collect.Sets; | ... | @@ -20,16 +20,16 @@ import com.google.common.collect.Sets; |
20 | */ | 20 | */ |
21 | public class DefualtHostDecriptionTest { | 21 | public class DefualtHostDecriptionTest { |
22 | 22 | ||
23 | - private static final MACAddress MAC = MACAddress.valueOf("00:00:11:00:00:01"); | 23 | + private static final MacAddress MAC = MacAddress.valueOf("00:00:11:00:00:01"); |
24 | - private static final VLANID VLAN = VLANID.vlanId((short) 10); | 24 | + private static final VlanId VLAN = VlanId.vlanId((short) 10); |
25 | private static final HostLocation LOC = new HostLocation( | 25 | private static final HostLocation LOC = new HostLocation( |
26 | DeviceId.deviceId("of:foo"), | 26 | DeviceId.deviceId("of:foo"), |
27 | PortNumber.portNumber(100), | 27 | PortNumber.portNumber(100), |
28 | 123L | 28 | 123L |
29 | ); | 29 | ); |
30 | - private static final Set<IPAddress> IPS = Sets.newHashSet( | 30 | + private static final Set<IpAddress> IPS = Sets.newHashSet( |
31 | - IPAddress.valueOf("10.0.0.1"), | 31 | + IpAddress.valueOf("10.0.0.1"), |
32 | - IPAddress.valueOf("10.0.0.2") | 32 | + IpAddress.valueOf("10.0.0.2") |
33 | ); | 33 | ); |
34 | 34 | ||
35 | @Test | 35 | @Test | ... | ... |
... | @@ -11,25 +11,25 @@ import org.onlab.onos.net.HostId; | ... | @@ -11,25 +11,25 @@ import org.onlab.onos.net.HostId; |
11 | import org.onlab.onos.net.HostLocation; | 11 | import org.onlab.onos.net.HostLocation; |
12 | import org.onlab.onos.net.PortNumber; | 12 | import org.onlab.onos.net.PortNumber; |
13 | import org.onlab.onos.net.provider.ProviderId; | 13 | import org.onlab.onos.net.provider.ProviderId; |
14 | -import org.onlab.packet.IPAddress; | 14 | +import org.onlab.packet.IpAddress; |
15 | -import org.onlab.packet.MACAddress; | 15 | +import org.onlab.packet.MacAddress; |
16 | -import org.onlab.packet.VLANID; | 16 | +import org.onlab.packet.VlanId; |
17 | 17 | ||
18 | import com.google.common.collect.Sets; | 18 | import com.google.common.collect.Sets; |
19 | 19 | ||
20 | public class HostEventTest extends AbstractEventTest { | 20 | public class HostEventTest extends AbstractEventTest { |
21 | 21 | ||
22 | private Host createHost() { | 22 | private Host createHost() { |
23 | - MACAddress mac = MACAddress.valueOf("00:00:11:00:00:01"); | 23 | + MacAddress mac = MacAddress.valueOf("00:00:11:00:00:01"); |
24 | - VLANID vlan = VLANID.vlanId((short) 10); | 24 | + VlanId vlan = VlanId.vlanId((short) 10); |
25 | HostLocation loc = new HostLocation( | 25 | HostLocation loc = new HostLocation( |
26 | DeviceId.deviceId("of:foo"), | 26 | DeviceId.deviceId("of:foo"), |
27 | PortNumber.portNumber(100), | 27 | PortNumber.portNumber(100), |
28 | 123L | 28 | 123L |
29 | ); | 29 | ); |
30 | - Set<IPAddress> ipset = Sets.newHashSet( | 30 | + Set<IpAddress> ipset = Sets.newHashSet( |
31 | - IPAddress.valueOf("10.0.0.1"), | 31 | + IpAddress.valueOf("10.0.0.1"), |
32 | - IPAddress.valueOf("10.0.0.2") | 32 | + IpAddress.valueOf("10.0.0.2") |
33 | ); | 33 | ); |
34 | HostId hid = HostId.hostId(mac, vlan); | 34 | HostId hid = HostId.hostId(mac, vlan); |
35 | 35 | ... | ... |
... | @@ -4,9 +4,9 @@ import org.onlab.onos.net.ConnectPoint; | ... | @@ -4,9 +4,9 @@ import org.onlab.onos.net.ConnectPoint; |
4 | import org.onlab.onos.net.DeviceId; | 4 | import org.onlab.onos.net.DeviceId; |
5 | import org.onlab.onos.net.Host; | 5 | import org.onlab.onos.net.Host; |
6 | import org.onlab.onos.net.HostId; | 6 | import org.onlab.onos.net.HostId; |
7 | -import org.onlab.packet.IPAddress; | 7 | +import org.onlab.packet.IpAddress; |
8 | -import org.onlab.packet.MACAddress; | 8 | +import org.onlab.packet.MacAddress; |
9 | -import org.onlab.packet.VLANID; | 9 | +import org.onlab.packet.VlanId; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
... | @@ -30,17 +30,17 @@ public class HostServiceAdapter implements HostService { | ... | @@ -30,17 +30,17 @@ public class HostServiceAdapter implements HostService { |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | - public Set<Host> getHostsByVlan(VLANID vlanId) { | 33 | + public Set<Host> getHostsByVlan(VlanId vlanId) { |
34 | return null; | 34 | return null; |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | - public Set<Host> getHostsByMac(MACAddress mac) { | 38 | + public Set<Host> getHostsByMac(MacAddress mac) { |
39 | return null; | 39 | return null; |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | - public Set<Host> getHostsByIp(IPAddress ip) { | 43 | + public Set<Host> getHostsByIp(IpAddress ip) { |
44 | return null; | 44 | return null; |
45 | } | 45 | } |
46 | 46 | ... | ... |
... | @@ -22,9 +22,9 @@ import org.onlab.onos.net.host.HostProviderService; | ... | @@ -22,9 +22,9 @@ import org.onlab.onos.net.host.HostProviderService; |
22 | import org.onlab.onos.net.host.HostService; | 22 | import org.onlab.onos.net.host.HostService; |
23 | import org.onlab.onos.net.provider.AbstractProviderRegistry; | 23 | import org.onlab.onos.net.provider.AbstractProviderRegistry; |
24 | import org.onlab.onos.net.provider.AbstractProviderService; | 24 | import org.onlab.onos.net.provider.AbstractProviderService; |
25 | -import org.onlab.packet.IPAddress; | 25 | +import org.onlab.packet.IpAddress; |
26 | -import org.onlab.packet.MACAddress; | 26 | +import org.onlab.packet.MacAddress; |
27 | -import org.onlab.packet.VLANID; | 27 | +import org.onlab.packet.VlanId; |
28 | import org.slf4j.Logger; | 28 | import org.slf4j.Logger; |
29 | 29 | ||
30 | import java.util.Set; | 30 | import java.util.Set; |
... | @@ -87,18 +87,18 @@ public class SimpleHostManager | ... | @@ -87,18 +87,18 @@ public class SimpleHostManager |
87 | } | 87 | } |
88 | 88 | ||
89 | @Override | 89 | @Override |
90 | - public Set<Host> getHostsByVlan(VLANID vlanId) { | 90 | + public Set<Host> getHostsByVlan(VlanId vlanId) { |
91 | return store.getHosts(vlanId); | 91 | return store.getHosts(vlanId); |
92 | } | 92 | } |
93 | 93 | ||
94 | @Override | 94 | @Override |
95 | - public Set<Host> getHostsByMac(MACAddress mac) { | 95 | + public Set<Host> getHostsByMac(MacAddress mac) { |
96 | checkNotNull(mac, "MAC address cannot be null"); | 96 | checkNotNull(mac, "MAC address cannot be null"); |
97 | return store.getHosts(mac); | 97 | return store.getHosts(mac); |
98 | } | 98 | } |
99 | 99 | ||
100 | @Override | 100 | @Override |
101 | - public Set<Host> getHostsByIp(IPAddress ip) { | 101 | + public Set<Host> getHostsByIp(IpAddress ip) { |
102 | checkNotNull(ip, "IP address cannot be null"); | 102 | checkNotNull(ip, "IP address cannot be null"); |
103 | return store.getHosts(ip); | 103 | return store.getHosts(ip); |
104 | } | 104 | } | ... | ... |
... | @@ -19,9 +19,9 @@ import org.onlab.onos.net.HostId; | ... | @@ -19,9 +19,9 @@ import org.onlab.onos.net.HostId; |
19 | import org.onlab.onos.net.host.HostDescription; | 19 | import org.onlab.onos.net.host.HostDescription; |
20 | import org.onlab.onos.net.host.HostEvent; | 20 | import org.onlab.onos.net.host.HostEvent; |
21 | import org.onlab.onos.net.provider.ProviderId; | 21 | import org.onlab.onos.net.provider.ProviderId; |
22 | -import org.onlab.packet.IPAddress; | 22 | +import org.onlab.packet.IpAddress; |
23 | -import org.onlab.packet.MACAddress; | 23 | +import org.onlab.packet.MacAddress; |
24 | -import org.onlab.packet.VLANID; | 24 | +import org.onlab.packet.VlanId; |
25 | 25 | ||
26 | import com.google.common.collect.HashMultimap; | 26 | import com.google.common.collect.HashMultimap; |
27 | import com.google.common.collect.ImmutableSet; | 27 | import com.google.common.collect.ImmutableSet; |
... | @@ -153,7 +153,7 @@ public class SimpleHostStore { | ... | @@ -153,7 +153,7 @@ public class SimpleHostStore { |
153 | * @param vlanId vlan id | 153 | * @param vlanId vlan id |
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<Host>(); |
158 | for (Host h : hosts.values()) { | 158 | for (Host h : hosts.values()) { |
159 | if (h.vlan().equals(vlanId)) { | 159 | if (h.vlan().equals(vlanId)) { |
... | @@ -169,7 +169,7 @@ public class SimpleHostStore { | ... | @@ -169,7 +169,7 @@ public class SimpleHostStore { |
169 | * @param mac mac address | 169 | * @param mac mac address |
170 | * @return set of hosts with the given mac | 170 | * @return set of hosts with the given mac |
171 | */ | 171 | */ |
172 | - Set<Host> getHosts(MACAddress mac) { | 172 | + Set<Host> getHosts(MacAddress mac) { |
173 | Set<Host> macset = new HashSet<>(); | 173 | Set<Host> macset = new HashSet<>(); |
174 | for (Host h : hosts.values()) { | 174 | for (Host h : hosts.values()) { |
175 | if (h.mac().equals(mac)) { | 175 | if (h.mac().equals(mac)) { |
... | @@ -185,7 +185,7 @@ public class SimpleHostStore { | ... | @@ -185,7 +185,7 @@ public class SimpleHostStore { |
185 | * @param ip ip address | 185 | * @param ip ip address |
186 | * @return set of hosts with the given IP | 186 | * @return set of hosts with the given IP |
187 | */ | 187 | */ |
188 | - Set<Host> getHosts(IPAddress ip) { | 188 | + Set<Host> getHosts(IpAddress ip) { |
189 | Set<Host> ipset = new HashSet<>(); | 189 | Set<Host> ipset = new HashSet<>(); |
190 | for (Host h : hosts.values()) { | 190 | for (Host h : hosts.values()) { |
191 | if (h.ipAddresses().contains(ip)) { | 191 | if (h.ipAddresses().contains(ip)) { | ... | ... |
... | @@ -28,9 +28,9 @@ import org.onlab.onos.net.host.HostProviderRegistry; | ... | @@ -28,9 +28,9 @@ import org.onlab.onos.net.host.HostProviderRegistry; |
28 | import org.onlab.onos.net.host.HostProviderService; | 28 | import org.onlab.onos.net.host.HostProviderService; |
29 | import org.onlab.onos.net.provider.AbstractProvider; | 29 | import org.onlab.onos.net.provider.AbstractProvider; |
30 | import org.onlab.onos.net.provider.ProviderId; | 30 | import org.onlab.onos.net.provider.ProviderId; |
31 | -import org.onlab.packet.IPAddress; | 31 | +import org.onlab.packet.IpAddress; |
32 | -import org.onlab.packet.MACAddress; | 32 | +import org.onlab.packet.MacAddress; |
33 | -import org.onlab.packet.VLANID; | 33 | +import org.onlab.packet.VlanId; |
34 | 34 | ||
35 | import com.google.common.collect.Lists; | 35 | import com.google.common.collect.Lists; |
36 | import com.google.common.collect.Sets; | 36 | import com.google.common.collect.Sets; |
... | @@ -44,17 +44,17 @@ public class SimpleHostManagerTest { | ... | @@ -44,17 +44,17 @@ public class SimpleHostManagerTest { |
44 | 44 | ||
45 | private static final ProviderId PID = new ProviderId("foo"); | 45 | private static final ProviderId PID = new ProviderId("foo"); |
46 | 46 | ||
47 | - private static final VLANID VLAN1 = VLANID.vlanId((short) 1); | 47 | + private static final VlanId VLAN1 = VlanId.vlanId((short) 1); |
48 | - private static final VLANID VLAN2 = VLANID.vlanId((short) 2); | 48 | + private static final VlanId VLAN2 = VlanId.vlanId((short) 2); |
49 | - private static final MACAddress MAC1 = MACAddress.valueOf("00:00:11:00:00:01"); | 49 | + private static final MacAddress MAC1 = MacAddress.valueOf("00:00:11:00:00:01"); |
50 | - private static final MACAddress MAC2 = MACAddress.valueOf("00:00:22:00:00:02"); | 50 | + private static final MacAddress MAC2 = MacAddress.valueOf("00:00:22:00:00:02"); |
51 | private static final HostId HID1 = HostId.hostId(MAC1, VLAN1); | 51 | private static final HostId HID1 = HostId.hostId(MAC1, VLAN1); |
52 | private static final HostId HID2 = HostId.hostId(MAC2, VLAN1); | 52 | private static final HostId HID2 = HostId.hostId(MAC2, VLAN1); |
53 | 53 | ||
54 | - private static final IPAddress IP1 = IPAddress.valueOf("10.0.0.1"); | 54 | + private static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1"); |
55 | - private static final IPAddress IP2 = IPAddress.valueOf("10.0.0.2"); | 55 | + private static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2"); |
56 | - private static final Set<IPAddress> IPSET1 = Sets.newHashSet(IP1); | 56 | + private static final Set<IpAddress> IPSET1 = Sets.newHashSet(IP1); |
57 | - private static final Set<IPAddress> IPSET2 = Sets.newHashSet(IP2); | 57 | + private static final Set<IpAddress> IPSET2 = Sets.newHashSet(IP2); |
58 | 58 | ||
59 | private static final DeviceId DID1 = DeviceId.deviceId("of:001"); | 59 | private static final DeviceId DID1 = DeviceId.deviceId("of:001"); |
60 | private static final DeviceId DID2 = DeviceId.deviceId("of:002"); | 60 | private static final DeviceId DID2 = DeviceId.deviceId("of:002"); |
... | @@ -96,8 +96,8 @@ public class SimpleHostManagerTest { | ... | @@ -96,8 +96,8 @@ public class SimpleHostManagerTest { |
96 | mgr.eventDispatcher = null; | 96 | mgr.eventDispatcher = null; |
97 | } | 97 | } |
98 | 98 | ||
99 | - private void detect(HostId hid, MACAddress mac, VLANID vlan, | 99 | + private void detect(HostId hid, MacAddress mac, VlanId vlan, |
100 | - HostLocation loc, Set<IPAddress> ips) { | 100 | + HostLocation loc, Set<IpAddress> ips) { |
101 | HostDescription descr = new DefaultHostDescription(mac, vlan, loc, ips); | 101 | HostDescription descr = new DefaultHostDescription(mac, vlan, loc, ips); |
102 | providerService.hostDetected(hid, descr); | 102 | providerService.hostDetected(hid, descr); |
103 | assertNotNull("host should be found", mgr.getHost(hid)); | 103 | assertNotNull("host should be found", mgr.getHost(hid)); | ... | ... |
... | @@ -31,8 +31,8 @@ import org.onlab.onos.of.controller.OpenFlowPacketContext; | ... | @@ -31,8 +31,8 @@ import org.onlab.onos.of.controller.OpenFlowPacketContext; |
31 | import org.onlab.onos.of.controller.PacketListener; | 31 | import org.onlab.onos.of.controller.PacketListener; |
32 | import org.onlab.packet.ARP; | 32 | import org.onlab.packet.ARP; |
33 | import org.onlab.packet.Ethernet; | 33 | import org.onlab.packet.Ethernet; |
34 | -import org.onlab.packet.IPAddress; | 34 | +import org.onlab.packet.IpAddress; |
35 | -import org.onlab.packet.VLANID; | 35 | +import org.onlab.packet.VlanId; |
36 | import org.slf4j.Logger; | 36 | import org.slf4j.Logger; |
37 | 37 | ||
38 | /** | 38 | /** |
... | @@ -94,7 +94,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid | ... | @@ -94,7 +94,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid |
94 | 94 | ||
95 | // Potentially a new or moved host | 95 | // Potentially a new or moved host |
96 | if (eth.getEtherType() == Ethernet.TYPE_ARP) { | 96 | if (eth.getEtherType() == Ethernet.TYPE_ARP) { |
97 | - VLANID vlan = VLANID.vlanId(eth.getVlanID()); | 97 | + VlanId vlan = VlanId.vlanId(eth.getVlanID()); |
98 | ConnectPoint heardOn = new ConnectPoint(deviceId(Dpid.uri(pktCtx.dpid())), | 98 | ConnectPoint heardOn = new ConnectPoint(deviceId(Dpid.uri(pktCtx.dpid())), |
99 | portNumber(pktCtx.inPort())); | 99 | portNumber(pktCtx.inPort())); |
100 | 100 | ||
... | @@ -110,7 +110,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid | ... | @@ -110,7 +110,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid |
110 | 110 | ||
111 | HostId hid = HostId.hostId(eth.getSourceMAC(), vlan); | 111 | HostId hid = HostId.hostId(eth.getSourceMAC(), vlan); |
112 | ARP arp = (ARP) eth.getPayload(); | 112 | ARP arp = (ARP) eth.getPayload(); |
113 | - Set<IPAddress> ips = newHashSet(IPAddress.valueOf(arp.getSenderProtocolAddress())); | 113 | + Set<IpAddress> ips = newHashSet(IpAddress.valueOf(arp.getSenderProtocolAddress())); |
114 | HostDescription hdescr = | 114 | HostDescription hdescr = |
115 | new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ips); | 115 | new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ips); |
116 | providerService.hostDetected(hid, hdescr); | 116 | providerService.hostDetected(hid, hdescr); | ... | ... |
... | @@ -19,8 +19,8 @@ import org.onlab.onos.of.controller.OpenflowControllerAdapter; | ... | @@ -19,8 +19,8 @@ import org.onlab.onos.of.controller.OpenflowControllerAdapter; |
19 | import org.onlab.onos.of.controller.PacketListener; | 19 | import org.onlab.onos.of.controller.PacketListener; |
20 | import org.onlab.packet.ARP; | 20 | import org.onlab.packet.ARP; |
21 | import org.onlab.packet.Ethernet; | 21 | import org.onlab.packet.Ethernet; |
22 | -import org.onlab.packet.MACAddress; | 22 | +import org.onlab.packet.MacAddress; |
23 | -import org.onlab.packet.VLANID; | 23 | +import org.onlab.packet.VlanId; |
24 | import org.projectfloodlight.openflow.protocol.OFMessage; | 24 | import org.projectfloodlight.openflow.protocol.OFMessage; |
25 | import org.projectfloodlight.openflow.types.OFPort; | 25 | import org.projectfloodlight.openflow.types.OFPort; |
26 | 26 | ||
... | @@ -35,9 +35,9 @@ public class OpenFlowHostProviderTest { | ... | @@ -35,9 +35,9 @@ public class OpenFlowHostProviderTest { |
35 | private static final Dpid DPID2 = new Dpid(200); | 35 | private static final Dpid DPID2 = new Dpid(200); |
36 | private static final Dpid DPID3 = new Dpid(300); | 36 | private static final Dpid DPID3 = new Dpid(300); |
37 | 37 | ||
38 | - private static final VLANID VLAN = VLANID.vlanId(); | 38 | + private static final VlanId VLAN = VlanId.vlanId(); |
39 | - private static final MACAddress MAC = MACAddress.valueOf("00:00:11:00:00:01"); | 39 | + private static final MacAddress MAC = MacAddress.valueOf("00:00:11:00:00:01"); |
40 | - private static final MACAddress BCMAC = MACAddress.valueOf("ff:ff:ff:ff:ff:ff"); | 40 | + private static final MacAddress BCMAC = MacAddress.valueOf("ff:ff:ff:ff:ff:ff"); |
41 | private static final byte[] IP = new byte[]{10, 0, 0, 1}; | 41 | private static final byte[] IP = new byte[]{10, 0, 0, 1}; |
42 | 42 | ||
43 | private OpenFlowHostProvider provider = new OpenFlowHostProvider(); | 43 | private OpenFlowHostProvider provider = new OpenFlowHostProvider(); | ... | ... |
... | @@ -60,8 +60,8 @@ public class Ethernet extends BasePacket { | ... | @@ -60,8 +60,8 @@ public class Ethernet extends BasePacket { |
60 | Ethernet.etherTypeClassMap.put(Ethernet.TYPE_LLDP, LLDP.class); | 60 | Ethernet.etherTypeClassMap.put(Ethernet.TYPE_LLDP, LLDP.class); |
61 | } | 61 | } |
62 | 62 | ||
63 | - protected MACAddress destinationMACAddress; | 63 | + protected MacAddress destinationMACAddress; |
64 | - protected MACAddress sourceMACAddress; | 64 | + protected MacAddress sourceMACAddress; |
65 | protected byte priorityCode; | 65 | protected byte priorityCode; |
66 | protected short vlanID; | 66 | protected short vlanID; |
67 | protected short etherType; | 67 | protected short etherType; |
... | @@ -89,7 +89,7 @@ public class Ethernet extends BasePacket { | ... | @@ -89,7 +89,7 @@ public class Ethernet extends BasePacket { |
89 | * | 89 | * |
90 | * @return the destination MAC | 90 | * @return the destination MAC |
91 | */ | 91 | */ |
92 | - public MACAddress getDestinationMAC() { | 92 | + public MacAddress getDestinationMAC() { |
93 | return this.destinationMACAddress; | 93 | return this.destinationMACAddress; |
94 | } | 94 | } |
95 | 95 | ||
... | @@ -100,7 +100,7 @@ public class Ethernet extends BasePacket { | ... | @@ -100,7 +100,7 @@ public class Ethernet extends BasePacket { |
100 | * @return the Ethernet frame | 100 | * @return the Ethernet frame |
101 | */ | 101 | */ |
102 | public Ethernet setDestinationMACAddress(final byte[] destMac) { | 102 | public Ethernet setDestinationMACAddress(final byte[] destMac) { |
103 | - this.destinationMACAddress = MACAddress.valueOf(destMac); | 103 | + this.destinationMACAddress = MacAddress.valueOf(destMac); |
104 | return this; | 104 | return this; |
105 | } | 105 | } |
106 | 106 | ||
... | @@ -111,7 +111,7 @@ public class Ethernet extends BasePacket { | ... | @@ -111,7 +111,7 @@ public class Ethernet extends BasePacket { |
111 | * @return the Ethernet frame | 111 | * @return the Ethernet frame |
112 | */ | 112 | */ |
113 | public Ethernet setDestinationMACAddress(final String destMac) { | 113 | public Ethernet setDestinationMACAddress(final String destMac) { |
114 | - this.destinationMACAddress = MACAddress.valueOf(destMac); | 114 | + this.destinationMACAddress = MacAddress.valueOf(destMac); |
115 | return this; | 115 | return this; |
116 | } | 116 | } |
117 | 117 | ||
... | @@ -129,7 +129,7 @@ public class Ethernet extends BasePacket { | ... | @@ -129,7 +129,7 @@ public class Ethernet extends BasePacket { |
129 | * | 129 | * |
130 | * @return the source MACAddress | 130 | * @return the source MACAddress |
131 | */ | 131 | */ |
132 | - public MACAddress getSourceMAC() { | 132 | + public MacAddress getSourceMAC() { |
133 | return this.sourceMACAddress; | 133 | return this.sourceMACAddress; |
134 | } | 134 | } |
135 | 135 | ||
... | @@ -140,7 +140,7 @@ public class Ethernet extends BasePacket { | ... | @@ -140,7 +140,7 @@ public class Ethernet extends BasePacket { |
140 | * @return the Ethernet frame | 140 | * @return the Ethernet frame |
141 | */ | 141 | */ |
142 | public Ethernet setSourceMACAddress(final byte[] sourceMac) { | 142 | public Ethernet setSourceMACAddress(final byte[] sourceMac) { |
143 | - this.sourceMACAddress = MACAddress.valueOf(sourceMac); | 143 | + this.sourceMACAddress = MacAddress.valueOf(sourceMac); |
144 | return this; | 144 | return this; |
145 | } | 145 | } |
146 | 146 | ||
... | @@ -151,7 +151,7 @@ public class Ethernet extends BasePacket { | ... | @@ -151,7 +151,7 @@ public class Ethernet extends BasePacket { |
151 | * @return the Ethernet frame | 151 | * @return the Ethernet frame |
152 | */ | 152 | */ |
153 | public Ethernet setSourceMACAddress(final String sourceMac) { | 153 | public Ethernet setSourceMACAddress(final String sourceMac) { |
154 | - this.sourceMACAddress = MACAddress.valueOf(sourceMac); | 154 | + this.sourceMACAddress = MacAddress.valueOf(sourceMac); |
155 | return this; | 155 | return this; |
156 | } | 156 | } |
157 | 157 | ||
... | @@ -288,18 +288,18 @@ public class Ethernet extends BasePacket { | ... | @@ -288,18 +288,18 @@ public class Ethernet extends BasePacket { |
288 | } | 288 | } |
289 | final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); | 289 | final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); |
290 | if (this.destinationMACAddress == null) { | 290 | if (this.destinationMACAddress == null) { |
291 | - this.destinationMACAddress = MACAddress.valueOf(new byte[6]); | 291 | + this.destinationMACAddress = MacAddress.valueOf(new byte[6]); |
292 | } | 292 | } |
293 | - final byte[] dstAddr = new byte[MACAddress.MAC_ADDRESS_LENGTH]; | 293 | + final byte[] dstAddr = new byte[MacAddress.MAC_ADDRESS_LENGTH]; |
294 | bb.get(dstAddr); | 294 | bb.get(dstAddr); |
295 | - this.destinationMACAddress = MACAddress.valueOf(dstAddr); | 295 | + this.destinationMACAddress = MacAddress.valueOf(dstAddr); |
296 | 296 | ||
297 | if (this.sourceMACAddress == null) { | 297 | if (this.sourceMACAddress == null) { |
298 | - this.sourceMACAddress = MACAddress.valueOf(new byte[6]); | 298 | + this.sourceMACAddress = MacAddress.valueOf(new byte[6]); |
299 | } | 299 | } |
300 | - final byte[] srcAddr = new byte[MACAddress.MAC_ADDRESS_LENGTH]; | 300 | + final byte[] srcAddr = new byte[MacAddress.MAC_ADDRESS_LENGTH]; |
301 | bb.get(srcAddr); | 301 | bb.get(srcAddr); |
302 | - this.sourceMACAddress = MACAddress.valueOf(srcAddr); | 302 | + this.sourceMACAddress = MacAddress.valueOf(srcAddr); |
303 | 303 | ||
304 | short ethType = bb.getShort(); | 304 | short ethType = bb.getShort(); |
305 | if (ethType == (short) 0x8100) { | 305 | if (ethType == (short) 0x8100) { |
... | @@ -361,7 +361,7 @@ public class Ethernet extends BasePacket { | ... | @@ -361,7 +361,7 @@ public class Ethernet extends BasePacket { |
361 | * @return The macAddress as a byte array | 361 | * @return The macAddress as a byte array |
362 | */ | 362 | */ |
363 | public static byte[] toMACAddress(final String macAddress) { | 363 | public static byte[] toMACAddress(final String macAddress) { |
364 | - return MACAddress.valueOf(macAddress).toBytes(); | 364 | + return MacAddress.valueOf(macAddress).toBytes(); |
365 | } | 365 | } |
366 | 366 | ||
367 | /** | 367 | /** |
... | @@ -372,7 +372,7 @@ public class Ethernet extends BasePacket { | ... | @@ -372,7 +372,7 @@ public class Ethernet extends BasePacket { |
372 | * @return a long containing the mac address bytes | 372 | * @return a long containing the mac address bytes |
373 | */ | 373 | */ |
374 | public static long toLong(final byte[] macAddress) { | 374 | public static long toLong(final byte[] macAddress) { |
375 | - return MACAddress.valueOf(macAddress).toLong(); | 375 | + return MacAddress.valueOf(macAddress).toLong(); |
376 | } | 376 | } |
377 | 377 | ||
378 | /** | 378 | /** |
... | @@ -382,7 +382,7 @@ public class Ethernet extends BasePacket { | ... | @@ -382,7 +382,7 @@ public class Ethernet extends BasePacket { |
382 | * @return the bytes of the mac address | 382 | * @return the bytes of the mac address |
383 | */ | 383 | */ |
384 | public static byte[] toByteArray(final long macAddress) { | 384 | public static byte[] toByteArray(final long macAddress) { |
385 | - return MACAddress.valueOf(macAddress).toBytes(); | 385 | + return MacAddress.valueOf(macAddress).toBytes(); |
386 | } | 386 | } |
387 | 387 | ||
388 | /* | 388 | /* | ... | ... |
... | @@ -5,7 +5,7 @@ import java.util.Arrays; | ... | @@ -5,7 +5,7 @@ import java.util.Arrays; |
5 | /** | 5 | /** |
6 | * A class representing an IPv4 address. | 6 | * A class representing an IPv4 address. |
7 | */ | 7 | */ |
8 | -public class IPAddress { | 8 | +public class IpAddress { |
9 | 9 | ||
10 | //IP Versions | 10 | //IP Versions |
11 | public enum Version { INET, INET6 }; | 11 | public enum Version { INET, INET6 }; |
... | @@ -18,7 +18,7 @@ public class IPAddress { | ... | @@ -18,7 +18,7 @@ public class IPAddress { |
18 | //does it make more sense to have a integral address? | 18 | //does it make more sense to have a integral address? |
19 | protected byte[] octets; | 19 | protected byte[] octets; |
20 | 20 | ||
21 | - protected IPAddress(Version ver, byte[] octets) { | 21 | + protected IpAddress(Version ver, byte[] octets) { |
22 | this.version = ver; | 22 | this.version = ver; |
23 | this.octets = Arrays.copyOf(octets, INET_LEN); | 23 | this.octets = Arrays.copyOf(octets, INET_LEN); |
24 | } | 24 | } |
... | @@ -29,8 +29,8 @@ public class IPAddress { | ... | @@ -29,8 +29,8 @@ public class IPAddress { |
29 | * @param address a byte array | 29 | * @param address a byte array |
30 | * @return an IP address | 30 | * @return an IP address |
31 | */ | 31 | */ |
32 | - public static IPAddress valueOf(byte [] address) { | 32 | + public static IpAddress valueOf(byte [] address) { |
33 | - return new IPAddress(Version.INET, address); | 33 | + return new IpAddress(Version.INET, address); |
34 | } | 34 | } |
35 | 35 | ||
36 | /** | 36 | /** |
... | @@ -39,13 +39,13 @@ public class IPAddress { | ... | @@ -39,13 +39,13 @@ public class IPAddress { |
39 | * @param address an integer representing an IP value | 39 | * @param address an integer representing an IP value |
40 | * @return an IP address | 40 | * @return an IP address |
41 | */ | 41 | */ |
42 | - public static IPAddress valueOf(int address) { | 42 | + public static IpAddress valueOf(int address) { |
43 | byte [] bytes = new byte [INET_LEN]; | 43 | byte [] bytes = new byte [INET_LEN]; |
44 | for (int i = 0; i < INET_LEN; i++) { | 44 | for (int i = 0; i < INET_LEN; i++) { |
45 | bytes[i] = (byte) ((address >> (INET_LEN - (i + 1)) * 8) & 0xff); | 45 | bytes[i] = (byte) ((address >> (INET_LEN - (i + 1)) * 8) & 0xff); |
46 | } | 46 | } |
47 | 47 | ||
48 | - return new IPAddress(Version.INET, bytes); | 48 | + return new IpAddress(Version.INET, bytes); |
49 | } | 49 | } |
50 | 50 | ||
51 | /** | 51 | /** |
... | @@ -55,7 +55,7 @@ public class IPAddress { | ... | @@ -55,7 +55,7 @@ public class IPAddress { |
55 | * @param address a string representing an IP address, e.g. "10.0.0.1" | 55 | * @param address a string representing an IP address, e.g. "10.0.0.1" |
56 | * @return an IP address | 56 | * @return an IP address |
57 | */ | 57 | */ |
58 | - public static IPAddress valueOf(String address) { | 58 | + public static IpAddress valueOf(String address) { |
59 | final String [] parts = address.split("\\."); | 59 | final String [] parts = address.split("\\."); |
60 | if (parts.length != INET_LEN) { | 60 | if (parts.length != INET_LEN) { |
61 | throw new IllegalArgumentException("Malformed IP address string; " | 61 | throw new IllegalArgumentException("Malformed IP address string; " |
... | @@ -65,7 +65,7 @@ public class IPAddress { | ... | @@ -65,7 +65,7 @@ public class IPAddress { |
65 | for (int i = 0; i < INET_LEN; i++) { | 65 | for (int i = 0; i < INET_LEN; i++) { |
66 | bytes[i] = Byte.parseByte(parts[i], 10); | 66 | bytes[i] = Byte.parseByte(parts[i], 10); |
67 | } | 67 | } |
68 | - return new IPAddress(Version.INET, bytes); | 68 | + return new IpAddress(Version.INET, bytes); |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
... | @@ -119,8 +119,8 @@ public class IPAddress { | ... | @@ -119,8 +119,8 @@ public class IPAddress { |
119 | @Override | 119 | @Override |
120 | public boolean equals(Object obj) { | 120 | public boolean equals(Object obj) { |
121 | 121 | ||
122 | - if (obj instanceof IPAddress) { | 122 | + if (obj instanceof IpAddress) { |
123 | - IPAddress other = (IPAddress) obj; | 123 | + IpAddress other = (IpAddress) obj; |
124 | 124 | ||
125 | if (this.version.equals(other.version) | 125 | if (this.version.equals(other.version) |
126 | && (Arrays.equals(this.octets, other.octets))) { | 126 | && (Arrays.equals(this.octets, other.octets))) { | ... | ... |
... | @@ -21,12 +21,12 @@ import java.util.Arrays; | ... | @@ -21,12 +21,12 @@ import java.util.Arrays; |
21 | * The class representing MAC address. | 21 | * The class representing MAC address. |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | -public class MACAddress { | 24 | +public class MacAddress { |
25 | public static final int MAC_ADDRESS_LENGTH = 6; | 25 | public static final int MAC_ADDRESS_LENGTH = 6; |
26 | - private byte[] address = new byte[MACAddress.MAC_ADDRESS_LENGTH]; | 26 | + private byte[] address = new byte[MacAddress.MAC_ADDRESS_LENGTH]; |
27 | 27 | ||
28 | - public MACAddress(final byte[] address) { | 28 | + public MacAddress(final byte[] address) { |
29 | - this.address = Arrays.copyOf(address, MACAddress.MAC_ADDRESS_LENGTH); | 29 | + this.address = Arrays.copyOf(address, MacAddress.MAC_ADDRESS_LENGTH); |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
... | @@ -40,21 +40,21 @@ public class MACAddress { | ... | @@ -40,21 +40,21 @@ public class MACAddress { |
40 | * @throws IllegalArgumentException | 40 | * @throws IllegalArgumentException |
41 | * if the string cannot be parsed as a MAC address. | 41 | * if the string cannot be parsed as a MAC address. |
42 | */ | 42 | */ |
43 | - public static MACAddress valueOf(final String address) { | 43 | + public static MacAddress valueOf(final String address) { |
44 | final String[] elements = address.split(":"); | 44 | final String[] elements = address.split(":"); |
45 | - if (elements.length != MACAddress.MAC_ADDRESS_LENGTH) { | 45 | + if (elements.length != MacAddress.MAC_ADDRESS_LENGTH) { |
46 | throw new IllegalArgumentException( | 46 | throw new IllegalArgumentException( |
47 | "Specified MAC Address must contain 12 hex digits" | 47 | "Specified MAC Address must contain 12 hex digits" |
48 | + " separated pairwise by :'s."); | 48 | + " separated pairwise by :'s."); |
49 | } | 49 | } |
50 | 50 | ||
51 | - final byte[] addressInBytes = new byte[MACAddress.MAC_ADDRESS_LENGTH]; | 51 | + final byte[] addressInBytes = new byte[MacAddress.MAC_ADDRESS_LENGTH]; |
52 | - for (int i = 0; i < MACAddress.MAC_ADDRESS_LENGTH; i++) { | 52 | + for (int i = 0; i < MacAddress.MAC_ADDRESS_LENGTH; i++) { |
53 | final String element = elements[i]; | 53 | final String element = elements[i]; |
54 | addressInBytes[i] = (byte) Integer.parseInt(element, 16); | 54 | addressInBytes[i] = (byte) Integer.parseInt(element, 16); |
55 | } | 55 | } |
56 | 56 | ||
57 | - return new MACAddress(addressInBytes); | 57 | + return new MacAddress(addressInBytes); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
... | @@ -68,13 +68,13 @@ public class MACAddress { | ... | @@ -68,13 +68,13 @@ public class MACAddress { |
68 | * @throws IllegalArgumentException | 68 | * @throws IllegalArgumentException |
69 | * if the byte array cannot be parsed as a MAC address. | 69 | * if the byte array cannot be parsed as a MAC address. |
70 | */ | 70 | */ |
71 | - public static MACAddress valueOf(final byte[] address) { | 71 | + public static MacAddress valueOf(final byte[] address) { |
72 | - if (address.length != MACAddress.MAC_ADDRESS_LENGTH) { | 72 | + if (address.length != MacAddress.MAC_ADDRESS_LENGTH) { |
73 | throw new IllegalArgumentException("the length is not " | 73 | throw new IllegalArgumentException("the length is not " |
74 | - + MACAddress.MAC_ADDRESS_LENGTH); | 74 | + + MacAddress.MAC_ADDRESS_LENGTH); |
75 | } | 75 | } |
76 | 76 | ||
77 | - return new MACAddress(address); | 77 | + return new MacAddress(address); |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
... | @@ -90,13 +90,13 @@ public class MACAddress { | ... | @@ -90,13 +90,13 @@ public class MACAddress { |
90 | * @throws IllegalArgumentException | 90 | * @throws IllegalArgumentException |
91 | * if the long value cannot be parsed as a MAC address. | 91 | * if the long value cannot be parsed as a MAC address. |
92 | */ | 92 | */ |
93 | - public static MACAddress valueOf(final long address) { | 93 | + public static MacAddress valueOf(final long address) { |
94 | final byte[] addressInBytes = new byte[] { | 94 | final byte[] addressInBytes = new byte[] { |
95 | (byte) (address >> 40 & 0xff), (byte) (address >> 32 & 0xff), | 95 | (byte) (address >> 40 & 0xff), (byte) (address >> 32 & 0xff), |
96 | (byte) (address >> 24 & 0xff), (byte) (address >> 16 & 0xff), | 96 | (byte) (address >> 24 & 0xff), (byte) (address >> 16 & 0xff), |
97 | (byte) (address >> 8 & 0xff), (byte) (address >> 0 & 0xff) }; | 97 | (byte) (address >> 8 & 0xff), (byte) (address >> 0 & 0xff) }; |
98 | 98 | ||
99 | - return new MACAddress(addressInBytes); | 99 | + return new MacAddress(addressInBytes); |
100 | } | 100 | } |
101 | 101 | ||
102 | /** | 102 | /** |
... | @@ -165,11 +165,11 @@ public class MACAddress { | ... | @@ -165,11 +165,11 @@ public class MACAddress { |
165 | return true; | 165 | return true; |
166 | } | 166 | } |
167 | 167 | ||
168 | - if (!(o instanceof MACAddress)) { | 168 | + if (!(o instanceof MacAddress)) { |
169 | return false; | 169 | return false; |
170 | } | 170 | } |
171 | 171 | ||
172 | - final MACAddress other = (MACAddress) o; | 172 | + final MacAddress other = (MacAddress) o; |
173 | return Arrays.equals(this.address, other.address); | 173 | return Arrays.equals(this.address, other.address); |
174 | } | 174 | } |
175 | 175 | ... | ... |
... | @@ -4,7 +4,7 @@ package org.onlab.packet; | ... | @@ -4,7 +4,7 @@ package org.onlab.packet; |
4 | * Representation of a VLAN ID. | 4 | * Representation of a VLAN ID. |
5 | */ | 5 | */ |
6 | // FIXME: This will end-up looking like a constant; we should name it 'VlanId', 'IpAddress', 'MacAddress'. | 6 | // FIXME: This will end-up looking like a constant; we should name it 'VlanId', 'IpAddress', 'MacAddress'. |
7 | -public class VLANID { | 7 | +public class VlanId { |
8 | 8 | ||
9 | private final short value; | 9 | private final short value; |
10 | // Based on convention used elsewhere? Check and change if needed | 10 | // Based on convention used elsewhere? Check and change if needed |
... | @@ -12,28 +12,28 @@ public class VLANID { | ... | @@ -12,28 +12,28 @@ public class VLANID { |
12 | // A VLAN ID is actually 12 bits of a VLAN tag. | 12 | // A VLAN ID is actually 12 bits of a VLAN tag. |
13 | public static final short MAX_VLAN = 4095; | 13 | public static final short MAX_VLAN = 4095; |
14 | 14 | ||
15 | - protected VLANID() { | 15 | + protected VlanId() { |
16 | this.value = UNTAGGED; | 16 | this.value = UNTAGGED; |
17 | } | 17 | } |
18 | 18 | ||
19 | - protected VLANID(short value) { | 19 | + protected VlanId(short value) { |
20 | this.value = value; | 20 | this.value = value; |
21 | } | 21 | } |
22 | 22 | ||
23 | - public static VLANID vlanId() { | 23 | + public static VlanId vlanId() { |
24 | - return new VLANID(UNTAGGED); | 24 | + return new VlanId(UNTAGGED); |
25 | } | 25 | } |
26 | 26 | ||
27 | - public static VLANID vlanId(short value) { | 27 | + public static VlanId vlanId(short value) { |
28 | if (value == UNTAGGED) { | 28 | if (value == UNTAGGED) { |
29 | - return new VLANID(); | 29 | + return new VlanId(); |
30 | } | 30 | } |
31 | 31 | ||
32 | if (value > MAX_VLAN) { | 32 | if (value > MAX_VLAN) { |
33 | throw new IllegalArgumentException( | 33 | throw new IllegalArgumentException( |
34 | "value exceeds allowed maximum VLAN ID value (4095)"); | 34 | "value exceeds allowed maximum VLAN ID value (4095)"); |
35 | } | 35 | } |
36 | - return new VLANID(value); | 36 | + return new VlanId(value); |
37 | } | 37 | } |
38 | 38 | ||
39 | public short toShort() { | 39 | public short toShort() { |
... | @@ -46,9 +46,9 @@ public class VLANID { | ... | @@ -46,9 +46,9 @@ public class VLANID { |
46 | return true; | 46 | return true; |
47 | } | 47 | } |
48 | 48 | ||
49 | - if (obj instanceof VLANID) { | 49 | + if (obj instanceof VlanId) { |
50 | 50 | ||
51 | - VLANID other = (VLANID) obj; | 51 | + VlanId other = (VlanId) obj; |
52 | 52 | ||
53 | if (this.value == other.value) { | 53 | if (this.value == other.value) { |
54 | return true; | 54 | return true; | ... | ... |
... | @@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | ... | @@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; |
5 | import java.util.Arrays; | 5 | import java.util.Arrays; |
6 | 6 | ||
7 | import org.junit.Test; | 7 | import org.junit.Test; |
8 | -import org.onlab.packet.IPAddress.Version; | 8 | +import org.onlab.packet.IpAddress.Version; |
9 | 9 | ||
10 | import com.google.common.testing.EqualsTester; | 10 | import com.google.common.testing.EqualsTester; |
11 | 11 | ||
... | @@ -19,11 +19,11 @@ public class IPAddressTest { | ... | @@ -19,11 +19,11 @@ public class IPAddressTest { |
19 | 19 | ||
20 | @Test | 20 | @Test |
21 | public void testEquality() { | 21 | public void testEquality() { |
22 | - IPAddress ip1 = IPAddress.valueOf(BYTES1); | 22 | + IpAddress ip1 = IpAddress.valueOf(BYTES1); |
23 | - IPAddress ip2 = IPAddress.valueOf(BYTES2); | 23 | + IpAddress ip2 = IpAddress.valueOf(BYTES2); |
24 | - IPAddress ip3 = IPAddress.valueOf(INTVAL1); | 24 | + IpAddress ip3 = IpAddress.valueOf(INTVAL1); |
25 | - IPAddress ip4 = IPAddress.valueOf(INTVAL2); | 25 | + IpAddress ip4 = IpAddress.valueOf(INTVAL2); |
26 | - IPAddress ip5 = IPAddress.valueOf(STRVAL); | 26 | + IpAddress ip5 = IpAddress.valueOf(STRVAL); |
27 | 27 | ||
28 | new EqualsTester().addEqualityGroup(ip1, ip3) | 28 | new EqualsTester().addEqualityGroup(ip1, ip3) |
29 | .addEqualityGroup(ip2, ip5) | 29 | .addEqualityGroup(ip2, ip5) |
... | @@ -33,7 +33,7 @@ public class IPAddressTest { | ... | @@ -33,7 +33,7 @@ public class IPAddressTest { |
33 | 33 | ||
34 | @Test | 34 | @Test |
35 | public void basics() { | 35 | public void basics() { |
36 | - IPAddress ip4 = IPAddress.valueOf(BYTES1); | 36 | + IpAddress ip4 = IpAddress.valueOf(BYTES1); |
37 | assertEquals("incorrect IP Version", Version.INET, ip4.version()); | 37 | assertEquals("incorrect IP Version", Version.INET, ip4.version()); |
38 | assertEquals("faulty toOctets()", Arrays.equals( | 38 | assertEquals("faulty toOctets()", Arrays.equals( |
39 | new byte [] {0x0, 0x0, 0x0, 0xa}, ip4.toOctets()), true); | 39 | new byte [] {0x0, 0x0, 0x0, 0xa}, ip4.toOctets()), true); | ... | ... |
... | @@ -11,28 +11,28 @@ public class VLANIDTest { | ... | @@ -11,28 +11,28 @@ public class VLANIDTest { |
11 | @Test | 11 | @Test |
12 | public void testEquality() { | 12 | public void testEquality() { |
13 | 13 | ||
14 | - VLANID vlan1 = VLANID.vlanId((short) -1); | 14 | + VlanId vlan1 = VlanId.vlanId((short) -1); |
15 | - VLANID vlan2 = VLANID.vlanId((short) 100); | 15 | + VlanId vlan2 = VlanId.vlanId((short) 100); |
16 | - VLANID vlan3 = VLANID.vlanId((short) 100); | 16 | + VlanId vlan3 = VlanId.vlanId((short) 100); |
17 | 17 | ||
18 | - new EqualsTester().addEqualityGroup(VLANID.vlanId(), vlan1) | 18 | + new EqualsTester().addEqualityGroup(VlanId.vlanId(), vlan1) |
19 | .addEqualityGroup(vlan2, vlan3) | 19 | .addEqualityGroup(vlan2, vlan3) |
20 | - .addEqualityGroup(VLANID.vlanId((short) 10)); | 20 | + .addEqualityGroup(VlanId.vlanId((short) 10)); |
21 | 21 | ||
22 | } | 22 | } |
23 | 23 | ||
24 | @Test | 24 | @Test |
25 | public void basics() { | 25 | public void basics() { |
26 | // purposefully create UNTAGGED VLAN | 26 | // purposefully create UNTAGGED VLAN |
27 | - VLANID vlan1 = VLANID.vlanId((short) 10); | 27 | + VlanId vlan1 = VlanId.vlanId((short) 10); |
28 | - VLANID vlan2 = VLANID.vlanId((short) -1); | 28 | + VlanId vlan2 = VlanId.vlanId((short) -1); |
29 | 29 | ||
30 | assertEquals("incorrect VLAN value", 10, vlan1.toShort()); | 30 | assertEquals("incorrect VLAN value", 10, vlan1.toShort()); |
31 | - assertEquals("invalid untagged value", VLANID.UNTAGGED, vlan2.toShort()); | 31 | + assertEquals("invalid untagged value", VlanId.UNTAGGED, vlan2.toShort()); |
32 | } | 32 | } |
33 | 33 | ||
34 | @Test(expected = IllegalArgumentException.class) | 34 | @Test(expected = IllegalArgumentException.class) |
35 | public void testIllicitVLAN() { | 35 | public void testIllicitVLAN() { |
36 | - VLANID.vlanId((short) 5000); | 36 | + VlanId.vlanId((short) 5000); |
37 | } | 37 | } |
38 | } | 38 | } | ... | ... |
-
Please register or login to post a comment