Showing
22 changed files
with
212 additions
and
28 deletions
... | @@ -20,6 +20,18 @@ public final class Criteria { | ... | @@ -20,6 +20,18 @@ public final class Criteria { |
20 | return null; | 20 | return null; |
21 | } | 21 | } |
22 | 22 | ||
23 | + /** | ||
24 | + * Creates a match on ETH_DST field using the specified value. This value | ||
25 | + * may be a wildcard mask. | ||
26 | + * | ||
27 | + * @param macValue MAC address value or wildcard mask | ||
28 | + * @return match criterion | ||
29 | + */ | ||
30 | + public static Criterion matchEthDst(MACValue macValue) { | ||
31 | + return null; | ||
32 | + } | ||
33 | + | ||
34 | + | ||
23 | // Dummy to illustrate the concept for now; delete ASAP | 35 | // Dummy to illustrate the concept for now; delete ASAP |
24 | private static class MACValue { } | 36 | private static class MACValue { } |
25 | } | 37 | } | ... | ... |
... | @@ -2,14 +2,14 @@ package org.onlab.onos.net.flow; | ... | @@ -2,14 +2,14 @@ package org.onlab.onos.net.flow; |
2 | 2 | ||
3 | import org.onlab.onos.net.DeviceId; | 3 | import org.onlab.onos.net.DeviceId; |
4 | 4 | ||
5 | -import java.util.List; | ||
6 | - | ||
7 | /** | 5 | /** |
8 | * Represents a generalized match & action pair to be applied to | 6 | * Represents a generalized match & action pair to be applied to |
9 | * an infrastucture device. | 7 | * an infrastucture device. |
10 | */ | 8 | */ |
11 | public interface FlowRule { | 9 | public interface FlowRule { |
12 | 10 | ||
11 | + //TODO: build cookie value | ||
12 | + | ||
13 | /** | 13 | /** |
14 | * Returns the flow rule priority given in natural order; higher numbers | 14 | * Returns the flow rule priority given in natural order; higher numbers |
15 | * mean higher priorities. | 15 | * mean higher priorities. |
... | @@ -38,6 +38,6 @@ public interface FlowRule { | ... | @@ -38,6 +38,6 @@ public interface FlowRule { |
38 | * | 38 | * |
39 | * @return traffic treatment | 39 | * @return traffic treatment |
40 | */ | 40 | */ |
41 | - List<Treatment> treatments(); | 41 | + TrafficTreatment treatment(); |
42 | 42 | ||
43 | } | 43 | } | ... | ... |
... | @@ -22,4 +22,11 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide | ... | @@ -22,4 +22,11 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide |
22 | */ | 22 | */ |
23 | void flowMissing(FlowRule flowRule); | 23 | void flowMissing(FlowRule flowRule); |
24 | 24 | ||
25 | + /** | ||
26 | + * Signals that a flow rule was indeed added. | ||
27 | + * | ||
28 | + * @param flowRule the added flow rule | ||
29 | + */ | ||
30 | + void flowAdded(FlowRule flowRule); | ||
31 | + | ||
25 | } | 32 | } | ... | ... |
... | @@ -26,6 +26,15 @@ public interface FlowRuleService { | ... | @@ -26,6 +26,15 @@ public interface FlowRuleService { |
26 | void applyFlowRules(FlowRule... flowRules); | 26 | void applyFlowRules(FlowRule... flowRules); |
27 | 27 | ||
28 | /** | 28 | /** |
29 | + * Removes the specified flow rules from their respective devices. | ||
30 | + * | ||
31 | + * @param flowRules one or more flow rules | ||
32 | + * throws SomeKindOfException that indicates which ones were removed and | ||
33 | + * which ones failed | ||
34 | + */ | ||
35 | + void removeFlowRules(FlowRule... flowRules); | ||
36 | + | ||
37 | + /** | ||
29 | * Adds the specified flow rule listener. | 38 | * Adds the specified flow rule listener. |
30 | * | 39 | * |
31 | * @param listener flow rule listener | 40 | * @param listener flow rule listener | ... | ... |
... | @@ -24,8 +24,9 @@ public interface TrafficSelector { | ... | @@ -24,8 +24,9 @@ public interface TrafficSelector { |
24 | * already been added, it will be replaced by this one. | 24 | * already been added, it will be replaced by this one. |
25 | * | 25 | * |
26 | * @param criterion new criterion | 26 | * @param criterion new criterion |
27 | + * @return self | ||
27 | */ | 28 | */ |
28 | - void add(Criterion criterion); | 29 | + Builder add(Criterion criterion); |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * Builds an immutable traffic selector. | 32 | * Builds an immutable traffic selector. | ... | ... |
... | @@ -25,7 +25,7 @@ public interface TrafficTreatment { | ... | @@ -25,7 +25,7 @@ public interface TrafficTreatment { |
25 | * | 25 | * |
26 | * @param instruction new instruction | 26 | * @param instruction new instruction |
27 | */ | 27 | */ |
28 | - void add(Instruction instruction); | 28 | + Builder add(Instruction instruction); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Builds an immutable traffic treatment descriptor. | 31 | * Builds an immutable traffic treatment descriptor. | ... | ... |
1 | +package org.onlab.onos.net.packet; | ||
2 | + | ||
3 | + | ||
4 | +public abstract class DefaultPacketContext implements PacketContext { | ||
5 | + | ||
6 | + private final long time; | ||
7 | + private final InboundPacket inPkt; | ||
8 | + private final OutboundPacket outPkt; | ||
9 | + private boolean block = false; | ||
10 | + | ||
11 | + protected DefaultPacketContext(long time, InboundPacket inPkt, | ||
12 | + OutboundPacket outPkt, boolean block) { | ||
13 | + super(); | ||
14 | + this.time = time; | ||
15 | + this.inPkt = inPkt; | ||
16 | + this.outPkt = outPkt; | ||
17 | + this.block = block; | ||
18 | + } | ||
19 | + | ||
20 | + @Override | ||
21 | + public long time() { | ||
22 | + return time; | ||
23 | + } | ||
24 | + | ||
25 | + @Override | ||
26 | + public InboundPacket inPacket() { | ||
27 | + return inPkt; | ||
28 | + } | ||
29 | + | ||
30 | + @Override | ||
31 | + public OutboundPacket outPacket() { | ||
32 | + return outPkt; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public abstract void send(); | ||
37 | + | ||
38 | + @Override | ||
39 | + public void block() { | ||
40 | + this.block = true; | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public boolean isHandled() { | ||
45 | + return this.block; | ||
46 | + } | ||
47 | + | ||
48 | +} |
1 | package org.onlab.onos.net.packet; | 1 | package org.onlab.onos.net.packet; |
2 | 2 | ||
3 | + | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Abstraction of an inbound packet processor. | 6 | * Abstraction of an inbound packet processor. |
5 | */ | 7 | */ |
6 | public interface PacketProcessor { | 8 | public interface PacketProcessor { |
7 | 9 | ||
10 | + public static final int ADVISOR_MAX = Integer.MAX_VALUE / 3; | ||
11 | + public static final int DIRECTOR_MAX = (Integer.MAX_VALUE / 3) * 2; | ||
12 | + public static final int OBSERVER_MAX = Integer.MAX_VALUE; | ||
13 | + | ||
8 | /** | 14 | /** |
9 | * Processes the inbound packet as specified in the given context. | 15 | * Processes the inbound packet as specified in the given context. |
10 | * | 16 | * | ... | ... |
1 | package org.onlab.onos.net.packet; | 1 | package org.onlab.onos.net.packet; |
2 | 2 | ||
3 | +import org.onlab.onos.net.provider.Provider; | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Abstraction of a packet provider capable of emitting packets. | 6 | * Abstraction of a packet provider capable of emitting packets. |
5 | */ | 7 | */ |
6 | -public interface PacketProvider { | 8 | +public interface PacketProvider extends Provider { |
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Emits the specified outbound packet onto the network. | 11 | * Emits the specified outbound packet onto the network. | ... | ... |
1 | package org.onlab.onos.net.packet; | 1 | package org.onlab.onos.net.packet; |
2 | 2 | ||
3 | +import org.onlab.onos.net.provider.ProviderService; | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Entity capable of processing inbound packets. | 6 | * Entity capable of processing inbound packets. |
5 | */ | 7 | */ |
6 | -public interface PacketProviderService { | 8 | +public interface PacketProviderService extends ProviderService<PacketProvider> { |
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Submits inbound packet context for processing. This processing will be | 11 | * Submits inbound packet context for processing. This processing will be | ... | ... |
... | @@ -18,7 +18,7 @@ public interface PacketService { | ... | @@ -18,7 +18,7 @@ public interface PacketService { |
18 | * @throws java.lang.IllegalArgumentException if a processor with the | 18 | * @throws java.lang.IllegalArgumentException if a processor with the |
19 | * given priority already exists | 19 | * given priority already exists |
20 | */ | 20 | */ |
21 | - void addProcessor(PacketProcessor processor, long priority); | 21 | + void addProcessor(PacketProcessor processor, int priority); |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Removes the specified processor from the processing pipeline. | 24 | * Removes the specified processor from the processing pipeline. | ... | ... |
1 | +package org.onlab.onos.net; | ||
2 | + | ||
3 | +import static org.junit.Assert.assertEquals; | ||
4 | + | ||
5 | +import org.junit.Test; | ||
6 | + | ||
7 | +import com.google.common.testing.EqualsTester; | ||
8 | + | ||
9 | +public class DefaultHostTest extends TestDeviceParams { | ||
10 | + | ||
11 | + @Test | ||
12 | + public void testEquality() { | ||
13 | + Host h1 = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1); | ||
14 | + Host h2 = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1); | ||
15 | + Host h3 = new DefaultHost(PID, HID2, MAC2, VLAN2, LOC2, IPSET2); | ||
16 | + Host h4 = new DefaultHost(PID, HID2, MAC2, VLAN2, LOC2, IPSET2); | ||
17 | + Host h5 = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC2, IPSET1); | ||
18 | + | ||
19 | + new EqualsTester().addEqualityGroup(h1, h2) | ||
20 | + .addEqualityGroup(h3, h4) | ||
21 | + .addEqualityGroup(h5) | ||
22 | + .testEquals(); | ||
23 | + } | ||
24 | + | ||
25 | + @Test | ||
26 | + public void basics() { | ||
27 | + Host host = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1); | ||
28 | + assertEquals("incorrect provider", PID, host.providerId()); | ||
29 | + assertEquals("incorrect id", HID1, host.id()); | ||
30 | + assertEquals("incorrect type", MAC1, host.mac()); | ||
31 | + assertEquals("incorrect VLAN", VLAN1, host.vlan()); | ||
32 | + assertEquals("incorrect location", LOC1, host.location()); | ||
33 | + assertEquals("incorrect IP's", IPSET1, host.ipAddresses()); | ||
34 | + } | ||
35 | + | ||
36 | +} |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | import com.google.common.testing.EqualsTester; | 3 | import com.google.common.testing.EqualsTester; |
4 | + | ||
4 | import org.junit.Test; | 5 | import org.junit.Test; |
6 | +import org.onlab.packet.MACAddress; | ||
7 | +import org.onlab.packet.VLANID; | ||
5 | 8 | ||
6 | import static org.onlab.onos.net.HostId.hostId; | 9 | import static org.onlab.onos.net.HostId.hostId; |
7 | 10 | ||
8 | /** | 11 | /** |
9 | - * Test of the host identifier. | 12 | + * Test for the host identifier. |
10 | */ | 13 | */ |
11 | public class HostIdTest extends ElementIdTest { | 14 | public class HostIdTest extends ElementIdTest { |
12 | 15 | ||
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"); | ||
18 | + private static final VLANID VLAN1 = VLANID.vlanId((short) 11); | ||
19 | + private static final VLANID VLAN2 = VLANID.vlanId((short) 22); | ||
20 | + | ||
21 | + @Override | ||
13 | @Test | 22 | @Test |
14 | public void basics() { | 23 | public void basics() { |
15 | new EqualsTester() | 24 | new EqualsTester() |
16 | - .addEqualityGroup(hostId("nic:foo"), | 25 | + .addEqualityGroup(hostId("nic:00:11:00:00:00:01/11"), |
17 | - hostId("nic:foo")) | 26 | + hostId(MAC1, VLAN1)) |
18 | - .addEqualityGroup(hostId("nic:bar")) | 27 | + .addEqualityGroup(hostId(MAC2, VLAN2)) |
19 | .testEquals(); | 28 | .testEquals(); |
20 | } | 29 | } |
21 | 30 | ... | ... |
1 | +package org.onlab.onos.net; | ||
2 | + | ||
3 | +import static org.onlab.onos.net.DeviceId.deviceId; | ||
4 | + | ||
5 | +import java.util.Set; | ||
6 | + | ||
7 | +import org.onlab.onos.net.provider.ProviderId; | ||
8 | +import org.onlab.packet.IPAddress; | ||
9 | +import org.onlab.packet.MACAddress; | ||
10 | +import org.onlab.packet.VLANID; | ||
11 | + | ||
12 | +import com.google.common.collect.Sets; | ||
13 | + | ||
14 | +/** | ||
15 | + * Provides a set of test DefaultDevice parameters for use with Host- | ||
16 | + * related tests. | ||
17 | + */ | ||
18 | +public abstract class TestDeviceParams { | ||
19 | + | ||
20 | + protected static final ProviderId PID = new ProviderId("foo"); | ||
21 | + protected static final DeviceId DID1 = deviceId("of:foo"); | ||
22 | + protected static final DeviceId DID2 = deviceId("of:bar"); | ||
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"); | ||
25 | + protected static final VLANID VLAN1 = VLANID.vlanId((short) 11); | ||
26 | + protected static final VLANID VLAN2 = VLANID.vlanId((short) 22); | ||
27 | + protected static final IPAddress IP1 = IPAddress.valueOf("10.0.0.1"); | ||
28 | + protected static final IPAddress IP2 = IPAddress.valueOf("10.0.0.2"); | ||
29 | + protected static final IPAddress IP3 = IPAddress.valueOf("10.0.0.3"); | ||
30 | + | ||
31 | + protected static final PortNumber P1 = PortNumber.portNumber(100); | ||
32 | + protected static final PortNumber P2 = PortNumber.portNumber(200); | ||
33 | + protected static final HostId HID1 = HostId.hostId(MAC1, VLAN1); | ||
34 | + protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2); | ||
35 | + protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L); | ||
36 | + protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L); | ||
37 | + protected static final Set<IPAddress> IPSET1 = Sets.newHashSet(IP1, IP2); | ||
38 | + protected static final Set<IPAddress> IPSET2 = Sets.newHashSet(IP1, IP3); | ||
39 | + | ||
40 | +} |
... | @@ -11,7 +11,7 @@ import org.projectfloodlight.openflow.protocol.match.MatchField; | ... | @@ -11,7 +11,7 @@ import org.projectfloodlight.openflow.protocol.match.MatchField; |
11 | import org.projectfloodlight.openflow.types.OFBufferId; | 11 | import org.projectfloodlight.openflow.types.OFBufferId; |
12 | import org.projectfloodlight.openflow.types.OFPort; | 12 | import org.projectfloodlight.openflow.types.OFPort; |
13 | 13 | ||
14 | -public final class DefaultPacketContext implements PacketContext { | 14 | +public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext { |
15 | 15 | ||
16 | private boolean free = true; | 16 | private boolean free = true; |
17 | private boolean isBuilt = false; | 17 | private boolean isBuilt = false; |
... | @@ -19,7 +19,7 @@ public final class DefaultPacketContext implements PacketContext { | ... | @@ -19,7 +19,7 @@ public final class DefaultPacketContext implements PacketContext { |
19 | private final OFPacketIn pktin; | 19 | private final OFPacketIn pktin; |
20 | private OFPacketOut pktout = null; | 20 | private OFPacketOut pktout = null; |
21 | 21 | ||
22 | - private DefaultPacketContext(OpenFlowSwitch s, OFPacketIn pkt) { | 22 | + private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) { |
23 | this.sw = s; | 23 | this.sw = s; |
24 | this.pktin = pkt; | 24 | this.pktin = pkt; |
25 | } | 25 | } |
... | @@ -78,8 +78,8 @@ public final class DefaultPacketContext implements PacketContext { | ... | @@ -78,8 +78,8 @@ public final class DefaultPacketContext implements PacketContext { |
78 | return new Dpid(sw.getId()); | 78 | return new Dpid(sw.getId()); |
79 | } | 79 | } |
80 | 80 | ||
81 | - public static PacketContext packetContextFromPacketIn(OpenFlowSwitch s, OFPacketIn pkt) { | 81 | + public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s, OFPacketIn pkt) { |
82 | - return new DefaultPacketContext(s, pkt); | 82 | + return new DefaultOpenFlowPacketContext(s, pkt); |
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override | ... | ... |
... | @@ -8,7 +8,7 @@ import org.projectfloodlight.openflow.types.OFPort; | ... | @@ -8,7 +8,7 @@ import org.projectfloodlight.openflow.types.OFPort; |
8 | * to view the packet in event but may block the response to the | 8 | * to view the packet in event but may block the response to the |
9 | * event if blocked has been called. | 9 | * event if blocked has been called. |
10 | */ | 10 | */ |
11 | -public interface PacketContext { | 11 | +public interface OpenFlowPacketContext { |
12 | 12 | ||
13 | //TODO: may want to support sending packet out other switches than | 13 | //TODO: may want to support sending packet out other switches than |
14 | // the one it came in on. | 14 | // the one it came in on. | ... | ... |
... | @@ -10,5 +10,5 @@ public interface PacketListener { | ... | @@ -10,5 +10,5 @@ public interface PacketListener { |
10 | * | 10 | * |
11 | * @param pktCtx the packet context | 11 | * @param pktCtx the packet context |
12 | */ | 12 | */ |
13 | - public void handlePacket(PacketContext pktCtx); | 13 | + public void handlePacket(OpenFlowPacketContext pktCtx); |
14 | } | 14 | } | ... | ... |
... | @@ -12,7 +12,7 @@ import org.apache.felix.scr.annotations.Activate; | ... | @@ -12,7 +12,7 @@ import org.apache.felix.scr.annotations.Activate; |
12 | import org.apache.felix.scr.annotations.Component; | 12 | import org.apache.felix.scr.annotations.Component; |
13 | import org.apache.felix.scr.annotations.Deactivate; | 13 | import org.apache.felix.scr.annotations.Deactivate; |
14 | import org.apache.felix.scr.annotations.Service; | 14 | import org.apache.felix.scr.annotations.Service; |
15 | -import org.onlab.onos.of.controller.DefaultPacketContext; | 15 | +import org.onlab.onos.of.controller.DefaultOpenFlowPacketContext; |
16 | import org.onlab.onos.of.controller.Dpid; | 16 | import org.onlab.onos.of.controller.Dpid; |
17 | import org.onlab.onos.of.controller.OpenFlowController; | 17 | import org.onlab.onos.of.controller.OpenFlowController; |
18 | import org.onlab.onos.of.controller.OpenFlowSwitch; | 18 | import org.onlab.onos.of.controller.OpenFlowSwitch; |
... | @@ -124,7 +124,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -124,7 +124,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
124 | break; | 124 | break; |
125 | case PACKET_IN: | 125 | case PACKET_IN: |
126 | for (PacketListener p : ofPacketListener) { | 126 | for (PacketListener p : ofPacketListener) { |
127 | - p.handlePacket(DefaultPacketContext | 127 | + p.handlePacket(DefaultOpenFlowPacketContext |
128 | .packetContextFromPacketIn(this.getSwitch(dpid), | 128 | .packetContextFromPacketIn(this.getSwitch(dpid), |
129 | (OFPacketIn) msg)); | 129 | (OFPacketIn) msg)); |
130 | } | 130 | } | ... | ... |
... | @@ -15,7 +15,7 @@ import org.onlab.onos.of.controller.Dpid; | ... | @@ -15,7 +15,7 @@ import org.onlab.onos.of.controller.Dpid; |
15 | import org.onlab.onos.of.controller.OpenFlowController; | 15 | import org.onlab.onos.of.controller.OpenFlowController; |
16 | import org.onlab.onos.of.controller.OpenFlowSwitch; | 16 | import org.onlab.onos.of.controller.OpenFlowSwitch; |
17 | import org.onlab.onos.of.controller.OpenFlowSwitchListener; | 17 | import org.onlab.onos.of.controller.OpenFlowSwitchListener; |
18 | -import org.onlab.onos.of.controller.PacketContext; | 18 | +import org.onlab.onos.of.controller.OpenFlowPacketContext; |
19 | import org.onlab.onos.of.controller.PacketListener; | 19 | import org.onlab.onos.of.controller.PacketListener; |
20 | import org.projectfloodlight.openflow.protocol.OFPortConfig; | 20 | import org.projectfloodlight.openflow.protocol.OFPortConfig; |
21 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 21 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
... | @@ -87,7 +87,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid | ... | @@ -87,7 +87,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid |
87 | 87 | ||
88 | 88 | ||
89 | @Override | 89 | @Override |
90 | - public void handlePacket(PacketContext pktCtx) { | 90 | + public void handlePacket(OpenFlowPacketContext pktCtx) { |
91 | LinkDiscovery ld = discoverers.get(pktCtx.dpid()); | 91 | LinkDiscovery ld = discoverers.get(pktCtx.dpid()); |
92 | if (ld == null) { | 92 | if (ld == null) { |
93 | return; | 93 | return; | ... | ... |
... | @@ -57,7 +57,7 @@ public class IPAddress { | ... | @@ -57,7 +57,7 @@ public class IPAddress { |
57 | * @return an IP address | 57 | * @return an IP address |
58 | */ | 58 | */ |
59 | public static IPAddress valueOf(String address) { | 59 | public static IPAddress valueOf(String address) { |
60 | - final String [] parts = address.split("."); | 60 | + final String [] parts = address.split("\\."); |
61 | if (parts.length != INET_LEN) { | 61 | if (parts.length != INET_LEN) { |
62 | throw new IllegalArgumentException("Malformed IP address string; " | 62 | throw new IllegalArgumentException("Malformed IP address string; " |
63 | + "Addres must have four decimal values separated by dots (.)"); | 63 | + "Addres must have four decimal values separated by dots (.)"); |
... | @@ -119,7 +119,9 @@ public class IPAddress { | ... | @@ -119,7 +119,9 @@ public class IPAddress { |
119 | return true; | 119 | return true; |
120 | } | 120 | } |
121 | if (obj instanceof IPAddress) { | 121 | if (obj instanceof IPAddress) { |
122 | + | ||
122 | IPAddress other = (IPAddress) obj; | 123 | IPAddress other = (IPAddress) obj; |
124 | + | ||
123 | if (!(this.version.equals(other.version))) { | 125 | if (!(this.version.equals(other.version))) { |
124 | return false; | 126 | return false; |
125 | } | 127 | } | ... | ... |
... | @@ -37,12 +37,12 @@ public class VLANID { | ... | @@ -37,12 +37,12 @@ public class VLANID { |
37 | } | 37 | } |
38 | 38 | ||
39 | if (obj instanceof VLANID) { | 39 | if (obj instanceof VLANID) { |
40 | - return true; | ||
41 | - } | ||
42 | 40 | ||
43 | - VLANID other = (VLANID) obj; | 41 | + VLANID other = (VLANID) obj; |
44 | - if (this.value == other.value) { | 42 | + |
45 | - return true; | 43 | + if (this.value == other.value) { |
44 | + return true; | ||
45 | + } | ||
46 | } | 46 | } |
47 | 47 | ||
48 | return false; | 48 | return false; | ... | ... |
-
Please register or login to post a comment