Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
diff --git a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
index e5eac73..08fe0f5 100644
--- a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
+++ b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
@@ -170,7 +170,9 @@
// We don't yet support bufferids in the flowservice so packet out first.
packetOut(context, portNumber);
-
+ if (true) {
+ return;
+ }
// Install the flow rule to handle this type of message from now on.
Ethernet inPkt = context.inPacket().parsed();
diff --git a/cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java b/cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java
index 2da76fd..c23d59e 100644
--- a/cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java
@@ -1,11 +1,12 @@
package org.onlab.onos.cli;
import com.google.common.collect.Lists;
+
import org.apache.karaf.shell.commands.Command;
import org.onlab.onos.cluster.ClusterService;
import org.onlab.onos.cluster.ControllerNode;
-import org.onlab.onos.cluster.MastershipService;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipService;
import java.util.Collections;
import java.util.List;
@@ -22,7 +23,7 @@
@Override
protected void execute() {
ClusterService service = get(ClusterService.class);
- MastershipService mastershipService = get(MastershipService.class);
+ DeviceMastershipService mastershipService = get(DeviceMastershipService.class);
List<ControllerNode> nodes = newArrayList(service.getNodes());
Collections.sort(nodes, Comparators.NODE_COMPARATOR);
ControllerNode self = service.getLocalNode();
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
index dfb8283..3418aa0 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
@@ -3,9 +3,9 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onlab.onos.cli.AbstractShellCommand;
-import org.onlab.onos.cluster.MastershipAdminService;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceMastershipAdminService;
import static org.onlab.onos.net.DeviceId.deviceId;
@@ -30,7 +30,7 @@
@Override
protected void execute() {
- MastershipAdminService service = get(MastershipAdminService.class);
+ DeviceMastershipAdminService service = get(DeviceMastershipAdminService.class);
MastershipRole mastershipRole = MastershipRole.valueOf(role.toUpperCase());
service.setRole(new NodeId(node), deviceId(uri), mastershipRole);
}
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
index fe18ba0..5fd29f2 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
@@ -19,17 +19,16 @@
description = "Wipes-out the entire network information base, i.e. devices, links, hosts")
public class WipeOutCommand extends ClustersListCommand {
- private static final String DISCLAIMER = "Delete everything please.";
+ private static final String PLEASE = "please";
- @Argument(index = 0, name = "disclaimer", description = "Device ID",
+ @Argument(index = 0, name = "please", description = "Confirmation phrase",
required = false, multiValued = false)
- String disclaimer = null;
+ String please = null;
@Override
protected void execute() {
- if (disclaimer == null || !disclaimer.equals(DISCLAIMER)) {
- print("I'm afraid I can't do that!\nPlease acknowledge with phrase: '%s'",
- DISCLAIMER);
+ if (please == null || !please.equals(PLEASE)) {
+ print("I'm afraid I can't do that!\nSay: %s", PLEASE);
return;
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipListener.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipListener.java
deleted file mode 100644
index 71d65be..0000000
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipListener.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.onlab.onos.cluster;
-
-import org.onlab.onos.event.EventListener;
-
-/**
- * Entity capable of receiving device mastership-related events.
- */
-public interface MastershipListener extends EventListener<MastershipEvent> {
-}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStoreDelegate.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipStoreDelegate.java
deleted file mode 100644
index b4d923c..0000000
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStoreDelegate.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.onlab.onos.cluster;
-
-import org.onlab.onos.store.StoreDelegate;
-
-/**
- * Mastership store delegate abstraction.
- */
-public interface MastershipStoreDelegate extends StoreDelegate<MastershipEvent> {
-}
diff --git a/core/api/src/main/java/org/onlab/onos/net/ElementId.java b/core/api/src/main/java/org/onlab/onos/net/ElementId.java
index d2cd398..3f9c88d 100644
--- a/core/api/src/main/java/org/onlab/onos/net/ElementId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/ElementId.java
@@ -9,10 +9,12 @@
public abstract class ElementId {
private final URI uri;
+ private final String str;
// Default constructor for serialization
protected ElementId() {
this.uri = null;
+ this.str = null;
}
/**
@@ -22,6 +24,7 @@
*/
protected ElementId(URI uri) {
this.uri = uri;
+ this.str = uri.toString();
}
/**
@@ -35,7 +38,7 @@
@Override
public int hashCode() {
- return Objects.hash(uri);
+ return Objects.hash(str);
}
@Override
@@ -46,14 +49,14 @@
if (obj instanceof ElementId) {
final ElementId that = (ElementId) obj;
return this.getClass() == that.getClass() &&
- Objects.equals(this.uri, that.uri);
+ Objects.equals(this.str, that.str);
}
return false;
}
@Override
public String toString() {
- return uri.toString();
+ return str;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipAdminService.java
similarity index 78%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipAdminService.java
index 907b3f8..78c9c39 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipAdminService.java
@@ -1,12 +1,13 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
+import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
/**
* Service for administering the inventory of device masterships.
*/
-public interface MastershipAdminService {
+public interface DeviceMastershipAdminService {
/**
* Applies the current mastership role for the specified device.
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipEvent.java
similarity index 78%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipEvent.java
index 15811fb..1232d9c 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipEvent.java
@@ -1,12 +1,13 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
+import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.event.AbstractEvent;
import org.onlab.onos.net.DeviceId;
/**
* Describes a device mastership event.
*/
-public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceId> {
+public class DeviceMastershipEvent extends AbstractEvent<DeviceMastershipEvent.Type, DeviceId> {
//do we worry about explicitly setting slaves/equals? probably not,
//to keep it simple
@@ -30,7 +31,7 @@
* @param device event device subject
* @param master master ID subject
*/
- public MastershipEvent(Type type, DeviceId device, NodeId master) {
+ public DeviceMastershipEvent(Type type, DeviceId device, NodeId master) {
super(type, device);
this.master = master;
}
@@ -44,7 +45,7 @@
* @param master master ID subject
* @param time occurrence time
*/
- public MastershipEvent(Type type, DeviceId device, NodeId master, long time) {
+ public DeviceMastershipEvent(Type type, DeviceId device, NodeId master, long time) {
super(type, device, time);
this.master = master;
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipListener.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipListener.java
new file mode 100644
index 0000000..0c7c8d9
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipListener.java
@@ -0,0 +1,9 @@
+package org.onlab.onos.net.device;
+
+import org.onlab.onos.event.EventListener;
+
+/**
+ * Entity capable of receiving device mastership-related events.
+ */
+public interface DeviceMastershipListener extends EventListener<DeviceMastershipEvent> {
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipService.java
similarity index 88%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipService.java
index 51b6f6a..a44abfd 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipService.java
@@ -1,7 +1,8 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
import java.util.Set;
+import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
@@ -11,7 +12,7 @@
* determining mastership, but is not responsible for actually applying it
* to the devices; this falls on the device service.
*/
-public interface MastershipService {
+public interface DeviceMastershipService {
/**
* Returns the role of the local node for the specified device, without
@@ -62,20 +63,20 @@
*
* @return the MastershipTermService for this mastership manager
*/
- MastershipTermService requestTermService();
+ DeviceMastershipTermService requestTermService();
/**
* Adds the specified mastership change listener.
*
* @param listener the mastership listener
*/
- void addListener(MastershipListener listener);
+ void addListener(DeviceMastershipListener listener);
/**
* Removes the specified mastership change listener.
*
* @param listener the mastership listener
*/
- void removeListener(MastershipListener listener);
+ void removeListener(DeviceMastershipListener listener);
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStore.java
similarity index 84%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStore.java
index dc5603f..ee9b253 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStore.java
@@ -1,7 +1,8 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
import java.util.Set;
+import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.store.Store;
@@ -10,7 +11,7 @@
* Manages inventory of mastership roles for devices, across controller
* instances; not intended for direct use.
*/
-public interface MastershipStore extends Store<MastershipEvent, MastershipStoreDelegate> {
+public interface DeviceMastershipStore extends Store<DeviceMastershipEvent, DeviceMastershipStoreDelegate> {
// three things to map: NodeId, DeviceId, MastershipRole
@@ -54,7 +55,7 @@
* @param deviceId device identifier
* @return a mastership event
*/
- MastershipEvent setMaster(NodeId nodeId, DeviceId deviceId);
+ DeviceMastershipEvent setMaster(NodeId nodeId, DeviceId deviceId);
/**
* Returns the current master and number of past mastership hand-offs
@@ -63,7 +64,7 @@
* @param deviceId the device identifier
* @return the current master's ID and the term value for device, or null
*/
- MastershipTerm getTermFor(DeviceId deviceId);
+ DeviceMastershipTerm getTermFor(DeviceId deviceId);
/**
* Sets a controller instance's mastership role to STANDBY for a device.
@@ -74,7 +75,7 @@
* @param deviceId device to revoke mastership role for
* @return a mastership event
*/
- MastershipEvent setStandby(NodeId nodeId, DeviceId deviceId);
+ DeviceMastershipEvent setStandby(NodeId nodeId, DeviceId deviceId);
/**
* Allows a controller instance to give up its current role for a device.
@@ -85,6 +86,6 @@
* @param deviceId device to revoke mastership role for
* @return a mastership event
*/
- MastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId);
+ DeviceMastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId);
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStoreDelegate.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStoreDelegate.java
new file mode 100644
index 0000000..f654d85
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipStoreDelegate.java
@@ -0,0 +1,9 @@
+package org.onlab.onos.net.device;
+
+import org.onlab.onos.store.StoreDelegate;
+
+/**
+ * DeviceMastership store delegate abstraction.
+ */
+public interface DeviceMastershipStoreDelegate extends StoreDelegate<DeviceMastershipEvent> {
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipTerm.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTerm.java
similarity index 64%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipTerm.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTerm.java
index 71d08f2..f05a3d2 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipTerm.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTerm.java
@@ -1,19 +1,21 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
import java.util.Objects;
-public final class MastershipTerm {
+import org.onlab.onos.cluster.NodeId;
+
+public final class DeviceMastershipTerm {
private final NodeId master;
private final int termNumber;
- private MastershipTerm(NodeId master, int term) {
+ private DeviceMastershipTerm(NodeId master, int term) {
this.master = master;
this.termNumber = term;
}
- public static MastershipTerm of(NodeId master, int term) {
- return new MastershipTerm(master, term);
+ public static DeviceMastershipTerm of(NodeId master, int term) {
+ return new DeviceMastershipTerm(master, term);
}
public NodeId master() {
@@ -34,8 +36,8 @@
if (this == other) {
return true;
}
- if (other instanceof MastershipTerm) {
- MastershipTerm that = (MastershipTerm) other;
+ if (other instanceof DeviceMastershipTerm) {
+ DeviceMastershipTerm that = (DeviceMastershipTerm) other;
if (!this.master.equals(that.master)) {
return false;
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipTermService.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTermService.java
similarity index 74%
rename from core/api/src/main/java/org/onlab/onos/cluster/MastershipTermService.java
rename to core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTermService.java
index b03ed81..7a0c063 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipTermService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceMastershipTermService.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.cluster;
+package org.onlab.onos.net.device;
import org.onlab.onos.net.DeviceId;
@@ -6,7 +6,7 @@
/**
* Service to obtain mastership term information.
*/
-public interface MastershipTermService {
+public interface DeviceMastershipTermService {
// TBD: manage/increment per device mastership change
// or increment on any change
@@ -16,5 +16,5 @@
* @param deviceId the identifier of the device
* @return current master's term.
*/
- MastershipTerm getMastershipTerm(DeviceId deviceId);
+ DeviceMastershipTerm getMastershipTerm(DeviceId deviceId);
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
index 7182916..269347a 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
@@ -1,19 +1,16 @@
package org.onlab.onos.net.flow;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.onos.net.flow.instructions.Instructions;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
-import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
/**
* Default traffic treatment implementation.
@@ -58,7 +55,7 @@
}
if (obj instanceof DefaultTrafficTreatment) {
DefaultTrafficTreatment that = (DefaultTrafficTreatment) obj;
- return Objects.equals(instructions, that.instructions);
+ return Objects.equals(instructions, that.instructions);
}
return false;
@@ -70,8 +67,6 @@
*/
public static final class Builder implements TrafficTreatment.Builder {
- private final Logger log = getLogger(getClass());
-
boolean drop = false;
List<Instruction> outputs = new LinkedList<>();
@@ -107,7 +102,8 @@
groups.add(instruction);
break;
default:
- log.warn("Unknown instruction type {}", instruction.type());
+ throw new IllegalArgumentException("Unknown instruction type: " +
+ instruction.type());
}
return this;
}
diff --git a/core/api/src/main/java/org/onlab/onos/store/ClockProviderService.java b/core/api/src/main/java/org/onlab/onos/store/ClockProviderService.java
index a5f81c7..fff6d15 100644
--- a/core/api/src/main/java/org/onlab/onos/store/ClockProviderService.java
+++ b/core/api/src/main/java/org/onlab/onos/store/ClockProviderService.java
@@ -1,7 +1,7 @@
package org.onlab.onos.store;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
//TODO: Consider renaming to DeviceClockProviderService?
/**
@@ -16,5 +16,5 @@
* @param deviceId device identifier.
* @param term mastership term.
*/
- public void setMastershipTerm(DeviceId deviceId, MastershipTerm term);
+ public void setMastershipTerm(DeviceId deviceId, DeviceMastershipTerm term);
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/Timestamped.java b/core/api/src/main/java/org/onlab/onos/store/Timestamped.java
similarity index 95%
rename from core/store/dist/src/main/java/org/onlab/onos/store/common/impl/Timestamped.java
rename to core/api/src/main/java/org/onlab/onos/store/Timestamped.java
index 77b0a87..9de7b0d 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/Timestamped.java
+++ b/core/api/src/main/java/org/onlab/onos/store/Timestamped.java
@@ -1,11 +1,9 @@
-package org.onlab.onos.store.common.impl;
+package org.onlab.onos.store;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
-import org.onlab.onos.store.Timestamp;
-
import com.google.common.base.MoreObjects;
/**
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/VersionedValue.java b/core/api/src/main/java/org/onlab/onos/store/VersionedValue.java
similarity index 95%
rename from core/store/dist/src/main/java/org/onlab/onos/store/device/impl/VersionedValue.java
rename to core/api/src/main/java/org/onlab/onos/store/VersionedValue.java
index a0f485a..70602f6 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/VersionedValue.java
+++ b/core/api/src/main/java/org/onlab/onos/store/VersionedValue.java
@@ -1,9 +1,7 @@
-package org.onlab.onos.store.device.impl;
+package org.onlab.onos.store;
import java.util.Objects;
-import org.onlab.onos.store.Timestamp;
-
/**
* Wrapper class for a entity that is versioned
* and can either be up or down.
diff --git a/core/api/src/test/java/org/onlab/onos/cluster/MastershipServiceAdapter.java b/core/api/src/test/java/org/onlab/onos/cluster/MastershipServiceAdapter.java
index 2e92f5b..53fafd3 100644
--- a/core/api/src/test/java/org/onlab/onos/cluster/MastershipServiceAdapter.java
+++ b/core/api/src/test/java/org/onlab/onos/cluster/MastershipServiceAdapter.java
@@ -2,13 +2,16 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceMastershipListener;
+import org.onlab.onos.net.device.DeviceMastershipService;
+import org.onlab.onos.net.device.DeviceMastershipTermService;
import java.util.Set;
/**
* Test adapter for mastership service.
*/
-public class MastershipServiceAdapter implements MastershipService {
+public class MastershipServiceAdapter implements DeviceMastershipService {
@Override
public MastershipRole getLocalRole(DeviceId deviceId) {
return null;
@@ -34,15 +37,15 @@
}
@Override
- public void addListener(MastershipListener listener) {
+ public void addListener(DeviceMastershipListener listener) {
}
@Override
- public void removeListener(MastershipListener listener) {
+ public void removeListener(DeviceMastershipListener listener) {
}
@Override
- public MastershipTermService requestTermService() {
+ public DeviceMastershipTermService requestTermService() {
return null;
}
}
diff --git a/core/api/src/test/java/org/onlab/onos/cluster/MastershipTermTest.java b/core/api/src/test/java/org/onlab/onos/cluster/MastershipTermTest.java
index 139c695..87faf52 100644
--- a/core/api/src/test/java/org/onlab/onos/cluster/MastershipTermTest.java
+++ b/core/api/src/test/java/org/onlab/onos/cluster/MastershipTermTest.java
@@ -3,6 +3,7 @@
import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import com.google.common.testing.EqualsTester;
@@ -11,10 +12,10 @@
private static final NodeId N1 = new NodeId("foo");
private static final NodeId N2 = new NodeId("bar");
- private static final MastershipTerm TERM1 = MastershipTerm.of(N1, 0);
- private static final MastershipTerm TERM2 = MastershipTerm.of(N2, 1);
- private static final MastershipTerm TERM3 = MastershipTerm.of(N2, 1);
- private static final MastershipTerm TERM4 = MastershipTerm.of(N1, 1);
+ private static final DeviceMastershipTerm TERM1 = DeviceMastershipTerm.of(N1, 0);
+ private static final DeviceMastershipTerm TERM2 = DeviceMastershipTerm.of(N2, 1);
+ private static final DeviceMastershipTerm TERM3 = DeviceMastershipTerm.of(N2, 1);
+ private static final DeviceMastershipTerm TERM4 = DeviceMastershipTerm.of(N1, 1);
@Test
public void basics() {
@@ -24,7 +25,7 @@
@Test
public void testEquality() {
- new EqualsTester().addEqualityGroup(MastershipTerm.of(N1, 0), TERM1)
+ new EqualsTester().addEqualityGroup(DeviceMastershipTerm.of(N1, 0), TERM1)
.addEqualityGroup(TERM2, TERM3)
.addEqualityGroup(TERM4);
}
diff --git a/core/net/src/main/java/org/onlab/onos/cluster/impl/MastershipManager.java b/core/net/src/main/java/org/onlab/onos/cluster/impl/MastershipManager.java
index 125745b..b9c6ae8 100644
--- a/core/net/src/main/java/org/onlab/onos/cluster/impl/MastershipManager.java
+++ b/core/net/src/main/java/org/onlab/onos/cluster/impl/MastershipManager.java
@@ -14,25 +14,25 @@
import org.onlab.onos.cluster.ClusterEvent;
import org.onlab.onos.cluster.ClusterEventListener;
import org.onlab.onos.cluster.ClusterService;
-import org.onlab.onos.cluster.MastershipAdminService;
-import org.onlab.onos.cluster.MastershipEvent;
-import org.onlab.onos.cluster.MastershipListener;
-import org.onlab.onos.cluster.MastershipService;
-import org.onlab.onos.cluster.MastershipStore;
-import org.onlab.onos.cluster.MastershipStoreDelegate;
-import org.onlab.onos.cluster.MastershipTerm;
-import org.onlab.onos.cluster.MastershipTermService;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.event.AbstractListenerRegistry;
import org.onlab.onos.event.EventDeliveryService;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceMastershipAdminService;
+import org.onlab.onos.net.device.DeviceMastershipEvent;
+import org.onlab.onos.net.device.DeviceMastershipListener;
+import org.onlab.onos.net.device.DeviceMastershipService;
+import org.onlab.onos.net.device.DeviceMastershipStore;
+import org.onlab.onos.net.device.DeviceMastershipStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
+import org.onlab.onos.net.device.DeviceMastershipTermService;
import org.slf4j.Logger;
@Component(immediate = true)
@Service
public class MastershipManager
-implements MastershipService, MastershipAdminService {
+implements DeviceMastershipService, DeviceMastershipAdminService {
private static final String NODE_ID_NULL = "Node ID cannot be null";
private static final String DEVICE_ID_NULL = "Device ID cannot be null";
@@ -40,13 +40,13 @@
private final Logger log = getLogger(getClass());
- protected final AbstractListenerRegistry<MastershipEvent, MastershipListener>
+ protected final AbstractListenerRegistry<DeviceMastershipEvent, DeviceMastershipListener>
listenerRegistry = new AbstractListenerRegistry<>();
- private final MastershipStoreDelegate delegate = new InternalDelegate();
+ private final DeviceMastershipStoreDelegate delegate = new InternalDelegate();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected MastershipStore store;
+ protected DeviceMastershipStore store;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected EventDeliveryService eventDispatcher;
@@ -58,7 +58,7 @@
@Activate
public void activate() {
- eventDispatcher.addSink(MastershipEvent.class, listenerRegistry);
+ eventDispatcher.addSink(DeviceMastershipEvent.class, listenerRegistry);
clusterService.addListener(clusterListener);
store.setDelegate(delegate);
log.info("Started");
@@ -66,7 +66,7 @@
@Deactivate
public void deactivate() {
- eventDispatcher.removeSink(MastershipEvent.class);
+ eventDispatcher.removeSink(DeviceMastershipEvent.class);
clusterService.removeListener(clusterListener);
store.unsetDelegate(delegate);
log.info("Stopped");
@@ -78,7 +78,7 @@
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(role, ROLE_NULL);
- MastershipEvent event = null;
+ DeviceMastershipEvent event = null;
if (role.equals(MastershipRole.MASTER)) {
event = store.setMaster(nodeId, deviceId);
} else {
@@ -98,7 +98,7 @@
@Override
public void relinquishMastership(DeviceId deviceId) {
- MastershipEvent event = null;
+ DeviceMastershipEvent event = null;
event = store.relinquishRole(
clusterService.getLocalNode().id(), deviceId);
@@ -127,18 +127,18 @@
@Override
- public MastershipTermService requestTermService() {
+ public DeviceMastershipTermService requestTermService() {
return new InternalMastershipTermService();
}
@Override
- public void addListener(MastershipListener listener) {
+ public void addListener(DeviceMastershipListener listener) {
checkNotNull(listener);
listenerRegistry.addListener(listener);
}
@Override
- public void removeListener(MastershipListener listener) {
+ public void removeListener(DeviceMastershipListener listener) {
checkNotNull(listener);
listenerRegistry.removeListener(listener);
}
@@ -146,16 +146,16 @@
// FIXME: provide wiring to allow events to be triggered by changes within the store
// Posts the specified event to the local event dispatcher.
- private void post(MastershipEvent event) {
+ private void post(DeviceMastershipEvent event) {
if (event != null && eventDispatcher != null) {
eventDispatcher.post(event);
}
}
- private class InternalMastershipTermService implements MastershipTermService {
+ private class InternalMastershipTermService implements DeviceMastershipTermService {
@Override
- public MastershipTerm getMastershipTerm(DeviceId deviceId) {
+ public DeviceMastershipTerm getMastershipTerm(DeviceId deviceId) {
return store.getTermFor(deviceId);
}
@@ -181,10 +181,10 @@
}
- public class InternalDelegate implements MastershipStoreDelegate {
+ public class InternalDelegate implements DeviceMastershipStoreDelegate {
@Override
- public void notify(MastershipEvent event) {
+ public void notify(DeviceMastershipEvent event) {
log.info("dispatching mastership event {}", event);
eventDispatcher.post(event);
}
diff --git a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
index 8cde5a3..d4b8889 100644
--- a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
@@ -13,11 +13,6 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.cluster.ClusterService;
-import org.onlab.onos.cluster.MastershipEvent;
-import org.onlab.onos.cluster.MastershipListener;
-import org.onlab.onos.cluster.MastershipService;
-import org.onlab.onos.cluster.MastershipTermService;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.event.AbstractListenerRegistry;
import org.onlab.onos.event.EventDeliveryService;
@@ -36,6 +31,11 @@
import org.onlab.onos.net.device.DeviceService;
import org.onlab.onos.net.device.DeviceStore;
import org.onlab.onos.net.device.DeviceStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipEvent;
+import org.onlab.onos.net.device.DeviceMastershipListener;
+import org.onlab.onos.net.device.DeviceMastershipService;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
+import org.onlab.onos.net.device.DeviceMastershipTermService;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
@@ -64,7 +64,7 @@
private final DeviceStoreDelegate delegate = new InternalStoreDelegate();
- private final MastershipListener mastershipListener = new InternalMastershipListener();
+ private final DeviceMastershipListener mastershipListener = new InternalMastershipListener();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceStore store;
@@ -76,9 +76,9 @@
protected ClusterService clusterService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected MastershipService mastershipService;
+ protected DeviceMastershipService mastershipService;
- protected MastershipTermService termService;
+ protected DeviceMastershipTermService termService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ClockProviderService clockProviderService;
@@ -209,7 +209,7 @@
return;
}
- MastershipTerm term = mastershipService.requestTermService()
+ DeviceMastershipTerm term = mastershipService.requestTermService()
.getMastershipTerm(deviceId);
if (!term.master().equals(clusterService.getLocalNode().id())) {
// lost mastership after requestRole told this instance was MASTER.
@@ -320,16 +320,16 @@
}
// Intercepts mastership events
- private class InternalMastershipListener implements MastershipListener {
+ private class InternalMastershipListener implements DeviceMastershipListener {
@Override
- public void event(MastershipEvent event) {
+ public void event(DeviceMastershipEvent event) {
final DeviceId did = event.subject();
if (isAvailable(did)) {
final NodeId myNodeId = clusterService.getLocalNode().id();
if (myNodeId.equals(event.master())) {
- MastershipTerm term = termService.getMastershipTerm(did);
+ DeviceMastershipTerm term = termService.getMastershipTerm(did);
if (term.master().equals(myNodeId)) {
// only set the new term if I am the master
diff --git a/core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java b/core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java
index 29b4ddf..84ca891 100644
--- a/core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java
+++ b/core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java
@@ -10,11 +10,11 @@
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.ControllerNode.State;
import org.onlab.onos.cluster.DefaultControllerNode;
-import org.onlab.onos.cluster.MastershipService;
-import org.onlab.onos.cluster.MastershipTermService;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.event.impl.TestEventDispatcher;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipService;
+import org.onlab.onos.net.device.DeviceMastershipTermService;
import org.onlab.onos.store.trivial.impl.SimpleMastershipStore;
import org.onlab.packet.IpPrefix;
@@ -34,7 +34,7 @@
private static final DeviceId DEV_OTHER = DeviceId.deviceId("of:2");
private MastershipManager mgr;
- protected MastershipService service;
+ protected DeviceMastershipService service;
@Before
public void setUp() {
@@ -120,7 +120,7 @@
@Test
public void termService() {
- MastershipTermService ts = mgr.requestTermService();
+ DeviceMastershipTermService ts = mgr.requestTermService();
//term = 0 for both
mgr.setRole(NID_LOCAL, DEV_MASTER, MASTER);
diff --git a/core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java b/core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java
index e833b4a..bc4e353 100644
--- a/core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java
+++ b/core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java
@@ -11,8 +11,6 @@
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.DefaultControllerNode;
import org.onlab.onos.cluster.MastershipServiceAdapter;
-import org.onlab.onos.cluster.MastershipTerm;
-import org.onlab.onos.cluster.MastershipTermService;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.cluster.ControllerNode.State;
import org.onlab.onos.event.Event;
@@ -32,6 +30,8 @@
import org.onlab.onos.net.device.DeviceProviderRegistry;
import org.onlab.onos.net.device.DeviceProviderService;
import org.onlab.onos.net.device.DeviceService;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
+import org.onlab.onos.net.device.DeviceMastershipTermService;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.AbstractProvider;
import org.onlab.onos.net.provider.ProviderId;
@@ -290,12 +290,12 @@
}
@Override
- public MastershipTermService requestTermService() {
- return new MastershipTermService() {
+ public DeviceMastershipTermService requestTermService() {
+ return new DeviceMastershipTermService() {
@Override
- public MastershipTerm getMastershipTerm(DeviceId deviceId) {
+ public DeviceMastershipTerm getMastershipTerm(DeviceId deviceId) {
// FIXME: just returning something not null
- return MastershipTerm.of(NID_LOCAL, 1);
+ return DeviceMastershipTerm.of(NID_LOCAL, 1);
}
};
}
@@ -339,7 +339,7 @@
ClockProviderService {
@Override
- public void setMastershipTerm(DeviceId deviceId, MastershipTerm term) {
+ public void setMastershipTerm(DeviceId deviceId, DeviceMastershipTerm term) {
// TODO Auto-generated method stub
}
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
index 1b11873..c72fae8 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
@@ -6,6 +6,7 @@
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
+
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -23,10 +24,8 @@
import org.onlab.onos.store.cluster.messaging.ClusterMessage;
import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler;
import org.onlab.onos.store.cluster.messaging.MessageSubject;
-import org.onlab.onos.store.serializers.ClusterMessageSerializer;
import org.onlab.onos.store.serializers.KryoPoolUtil;
import org.onlab.onos.store.serializers.KryoSerializer;
-import org.onlab.onos.store.serializers.MessageSubjectSerializer;
import org.onlab.util.KryoPool;
import org.onlab.netty.Endpoint;
import org.onlab.netty.Message;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/ClusterMessageSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterMessageSerializer.java
similarity index 95%
rename from core/store/dist/src/main/java/org/onlab/onos/store/serializers/ClusterMessageSerializer.java
rename to core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterMessageSerializer.java
index c0cefd6..d9a61b8 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/ClusterMessageSerializer.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterMessageSerializer.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.serializers;
+package org.onlab.onos.store.cluster.messaging.impl;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.store.cluster.messaging.ClusterMessage;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/MessageSubjectSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/MessageSubjectSerializer.java
similarity index 93%
rename from core/store/dist/src/main/java/org/onlab/onos/store/serializers/MessageSubjectSerializer.java
rename to core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/MessageSubjectSerializer.java
index bb6b292..d817ced 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/MessageSubjectSerializer.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/MessageSubjectSerializer.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.serializers;
+package org.onlab.onos.store.cluster.messaging.impl;
import org.onlab.onos.store.cluster.messaging.MessageSubject;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/AntiEntropyReply.java b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/AntiEntropyReply.java
index 033a1de..46a2333 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/AntiEntropyReply.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/AntiEntropyReply.java
@@ -4,7 +4,7 @@
import java.util.Set;
import org.onlab.onos.cluster.NodeId;
-import org.onlab.onos.store.device.impl.VersionedValue;
+import org.onlab.onos.store.VersionedValue;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestamp.java b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/DeviceMastershipBasedTimestamp.java
similarity index 80%
rename from core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestamp.java
rename to core/store/dist/src/main/java/org/onlab/onos/store/common/impl/DeviceMastershipBasedTimestamp.java
index 0f4f894..4bc41ab 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestamp.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/DeviceMastershipBasedTimestamp.java
@@ -13,7 +13,7 @@
* Default implementation of Timestamp.
* TODO: Better documentation.
*/
-public final class MastershipBasedTimestamp implements Timestamp {
+public final class DeviceMastershipBasedTimestamp implements Timestamp {
private final int termNumber;
private final int sequenceNumber;
@@ -24,16 +24,16 @@
* @param termNumber the mastership termNumber
* @param sequenceNumber the sequenceNumber number within the termNumber
*/
- public MastershipBasedTimestamp(int termNumber, int sequenceNumber) {
+ public DeviceMastershipBasedTimestamp(int termNumber, int sequenceNumber) {
this.termNumber = termNumber;
this.sequenceNumber = sequenceNumber;
}
@Override
public int compareTo(Timestamp o) {
- checkArgument(o instanceof MastershipBasedTimestamp,
+ checkArgument(o instanceof DeviceMastershipBasedTimestamp,
"Must be MastershipBasedTimestamp", o);
- MastershipBasedTimestamp that = (MastershipBasedTimestamp) o;
+ DeviceMastershipBasedTimestamp that = (DeviceMastershipBasedTimestamp) o;
return ComparisonChain.start()
.compare(this.termNumber, that.termNumber)
@@ -51,10 +51,10 @@
if (this == obj) {
return true;
}
- if (!(obj instanceof MastershipBasedTimestamp)) {
+ if (!(obj instanceof DeviceMastershipBasedTimestamp)) {
return false;
}
- MastershipBasedTimestamp that = (MastershipBasedTimestamp) obj;
+ DeviceMastershipBasedTimestamp that = (DeviceMastershipBasedTimestamp) obj;
return Objects.equals(this.termNumber, that.termNumber) &&
Objects.equals(this.sequenceNumber, that.sequenceNumber);
}
@@ -87,7 +87,7 @@
// Default constructor for serialization
@Deprecated
- protected MastershipBasedTimestamp() {
+ protected DeviceMastershipBasedTimestamp() {
this.termNumber = -1;
this.sequenceNumber = -1;
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampSerializer.java
new file mode 100644
index 0000000..99b4f95
--- /dev/null
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampSerializer.java
@@ -0,0 +1,34 @@
+package org.onlab.onos.store.common.impl;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
+// To be used if Timestamp ever needs to cross bundle boundary.
+/**
+ * Kryo Serializer for {@link DeviceMastershipBasedTimestamp}.
+ */
+public class MastershipBasedTimestampSerializer extends Serializer<DeviceMastershipBasedTimestamp> {
+
+ /**
+ * Creates a serializer for {@link DeviceMastershipBasedTimestamp}.
+ */
+ public MastershipBasedTimestampSerializer() {
+ // non-null, immutable
+ super(false, true);
+ }
+
+ @Override
+ public void write(Kryo kryo, Output output, DeviceMastershipBasedTimestamp object) {
+ output.writeInt(object.termNumber());
+ output.writeInt(object.sequenceNumber());
+ }
+
+ @Override
+ public DeviceMastershipBasedTimestamp read(Kryo kryo, Input input, Class<DeviceMastershipBasedTimestamp> type) {
+ final int term = input.readInt();
+ final int sequence = input.readInt();
+ return new DeviceMastershipBasedTimestamp(term, sequence);
+ }
+}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyAdvertisement.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyAdvertisement.java
index d05659b..c9f232a 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyAdvertisement.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyAdvertisement.java
@@ -8,6 +8,7 @@
import org.onlab.onos.net.Device;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.store.Timestamp;
+import org.onlab.onos.store.VersionedValue;
import org.onlab.onos.store.common.impl.AntiEntropyAdvertisement;
// TODO DeviceID needs to be changed to something like (ProviderID, DeviceID)
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyReply.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyReply.java
index e7a4d0a..34dc873 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyReply.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceAntiEntropyReply.java
@@ -10,6 +10,7 @@
import org.onlab.onos.net.Device;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.store.Timestamp;
+import org.onlab.onos.store.VersionedValue;
import org.onlab.onos.store.common.impl.AntiEntropyReply;
import com.google.common.collect.ImmutableMap;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceClockManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceClockManager.java
index e1e3692..6f4fb96 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceClockManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/DeviceClockManager.java
@@ -10,12 +10,12 @@
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.store.ClockProviderService;
import org.onlab.onos.store.ClockService;
import org.onlab.onos.store.Timestamp;
-import org.onlab.onos.store.common.impl.MastershipBasedTimestamp;
+import org.onlab.onos.store.common.impl.DeviceMastershipBasedTimestamp;
import org.slf4j.Logger;
/**
@@ -29,7 +29,7 @@
// TODO: Implement per device ticker that is reset to 0 at the beginning of a new term.
private final AtomicInteger ticker = new AtomicInteger(0);
- private ConcurrentMap<DeviceId, MastershipTerm> deviceMastershipTerms = new ConcurrentHashMap<>();
+ private ConcurrentMap<DeviceId, DeviceMastershipTerm> deviceMastershipTerms = new ConcurrentHashMap<>();
@Activate
public void activate() {
@@ -43,15 +43,15 @@
@Override
public Timestamp getTimestamp(DeviceId deviceId) {
- MastershipTerm term = deviceMastershipTerms.get(deviceId);
+ DeviceMastershipTerm term = deviceMastershipTerms.get(deviceId);
if (term == null) {
throw new IllegalStateException("Requesting timestamp for a deviceId without mastership");
}
- return new MastershipBasedTimestamp(term.termNumber(), ticker.incrementAndGet());
+ return new DeviceMastershipBasedTimestamp(term.termNumber(), ticker.incrementAndGet());
}
@Override
- public void setMastershipTerm(DeviceId deviceId, MastershipTerm term) {
+ public void setMastershipTerm(DeviceId deviceId, DeviceMastershipTerm term) {
deviceMastershipTerms.put(deviceId, term);
}
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
index 2221ea0..06c70a0 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
@@ -35,14 +35,14 @@
import org.onlab.onos.store.AbstractStore;
import org.onlab.onos.store.ClockService;
import org.onlab.onos.store.Timestamp;
+import org.onlab.onos.store.Timestamped;
import org.onlab.onos.store.cluster.messaging.ClusterCommunicationService;
import org.onlab.onos.store.cluster.messaging.ClusterMessage;
import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler;
-import org.onlab.onos.store.common.impl.MastershipBasedTimestamp;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.common.impl.DeviceMastershipBasedTimestamp;
+import org.onlab.onos.store.common.impl.MastershipBasedTimestampSerializer;
import org.onlab.onos.store.serializers.KryoPoolUtil;
import org.onlab.onos.store.serializers.KryoSerializer;
-import org.onlab.onos.store.serializers.MastershipBasedTimestampSerializer;
import org.onlab.util.KryoPool;
import org.onlab.util.NewConcurrentHashMap;
import org.slf4j.Logger;
@@ -125,7 +125,7 @@
.register(InternalPortStatusEvent.class, new InternalPortStatusEventSerializer())
.register(Timestamp.class)
.register(Timestamped.class)
- .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
+ .register(DeviceMastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
.build()
.populate(1);
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEvent.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEvent.java
index 4214384..1deb5d5 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEvent.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEvent.java
@@ -3,7 +3,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.DeviceDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
/**
* Information published by GossipDeviceStore to notify peers of a device
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEventSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEventSerializer.java
index 0d3d013..63ddda3 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEventSerializer.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalDeviceEventSerializer.java
@@ -3,7 +3,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.DeviceDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEvent.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEvent.java
index 64e77ca..ad4e380 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEvent.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEvent.java
@@ -5,7 +5,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
/**
* Information published by GossipDeviceStore to notify peers of a port
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEventSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEventSerializer.java
index 6fff395..ede88f1 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEventSerializer.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortEventSerializer.java
@@ -5,7 +5,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEvent.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEvent.java
index 7d3854b..00f9a9f 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEvent.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEvent.java
@@ -3,7 +3,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
/**
* Information published by GossipDeviceStore to notify peers of a port
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEventSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEventSerializer.java
index 6ec4122..82fbb89 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEventSerializer.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/InternalPortStatusEventSerializer.java
@@ -3,7 +3,7 @@
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.onos.store.common.impl.Timestamped;
+import org.onlab.onos.store.Timestamped;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/OnosDistributedLinkStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/OnosDistributedLinkStore.java
index a59b151..d00d76b 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/OnosDistributedLinkStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/OnosDistributedLinkStore.java
@@ -31,7 +31,7 @@
import org.onlab.onos.store.AbstractStore;
import org.onlab.onos.store.ClockService;
import org.onlab.onos.store.Timestamp;
-import org.onlab.onos.store.device.impl.VersionedValue;
+import org.onlab.onos.store.VersionedValue;
import org.slf4j.Logger;
import com.google.common.collect.HashMultimap;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/MastershipBasedTimestampSerializer.java b/core/store/dist/src/main/java/org/onlab/onos/store/serializers/MastershipBasedTimestampSerializer.java
deleted file mode 100644
index 516915e..0000000
--- a/core/store/dist/src/main/java/org/onlab/onos/store/serializers/MastershipBasedTimestampSerializer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.onlab.onos.store.serializers;
-
-import org.onlab.onos.store.common.impl.MastershipBasedTimestamp;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-// To be used if Timestamp ever needs to cross bundle boundary.
-/**
- * Kryo Serializer for {@link MastershipBasedTimestamp}.
- */
-public class MastershipBasedTimestampSerializer extends Serializer<MastershipBasedTimestamp> {
-
- /**
- * Creates a serializer for {@link MastershipBasedTimestamp}.
- */
- public MastershipBasedTimestampSerializer() {
- // non-null, immutable
- super(false, true);
- }
-
- @Override
- public void write(Kryo kryo, Output output, MastershipBasedTimestamp object) {
- output.writeInt(object.termNumber());
- output.writeInt(object.sequenceNumber());
- }
-
- @Override
- public MastershipBasedTimestamp read(Kryo kryo, Input input, Class<MastershipBasedTimestamp> type) {
- final int term = input.readInt();
- final int sequence = input.readInt();
- return new MastershipBasedTimestamp(term, sequence);
- }
-}
diff --git a/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampTest.java b/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampTest.java
index ea63ef8..2c8ff35 100644
--- a/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampTest.java
+++ b/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/MastershipBasedTimestampTest.java
@@ -6,26 +6,25 @@
import org.junit.Test;
import org.onlab.onos.store.Timestamp;
-import org.onlab.onos.store.serializers.MastershipBasedTimestampSerializer;
import org.onlab.util.KryoPool;
import com.google.common.testing.EqualsTester;
/**
- * Test of {@link MastershipBasedTimestamp}.
+ * Test of {@link DeviceMastershipBasedTimestamp}.
*/
public class MastershipBasedTimestampTest {
- private static final Timestamp TS_1_1 = new MastershipBasedTimestamp(1, 1);
- private static final Timestamp TS_1_2 = new MastershipBasedTimestamp(1, 2);
- private static final Timestamp TS_2_1 = new MastershipBasedTimestamp(2, 1);
- private static final Timestamp TS_2_2 = new MastershipBasedTimestamp(2, 2);
+ private static final Timestamp TS_1_1 = new DeviceMastershipBasedTimestamp(1, 1);
+ private static final Timestamp TS_1_2 = new DeviceMastershipBasedTimestamp(1, 2);
+ private static final Timestamp TS_2_1 = new DeviceMastershipBasedTimestamp(2, 1);
+ private static final Timestamp TS_2_2 = new DeviceMastershipBasedTimestamp(2, 2);
@Test
public final void testBasic() {
final int termNumber = 5;
final int sequenceNumber = 6;
- MastershipBasedTimestamp ts = new MastershipBasedTimestamp(termNumber,
+ DeviceMastershipBasedTimestamp ts = new DeviceMastershipBasedTimestamp(termNumber,
sequenceNumber);
assertEquals(termNumber, ts.termNumber());
@@ -35,7 +34,7 @@
@Test
public final void testCompareTo() {
assertTrue(TS_1_1.compareTo(TS_1_1) == 0);
- assertTrue(TS_1_1.compareTo(new MastershipBasedTimestamp(1, 1)) == 0);
+ assertTrue(TS_1_1.compareTo(new DeviceMastershipBasedTimestamp(1, 1)) == 0);
assertTrue(TS_1_1.compareTo(TS_1_2) < 0);
assertTrue(TS_1_2.compareTo(TS_1_1) > 0);
@@ -49,14 +48,14 @@
@Test
public final void testEqualsObject() {
new EqualsTester()
- .addEqualityGroup(new MastershipBasedTimestamp(1, 1),
- new MastershipBasedTimestamp(1, 1), TS_1_1)
- .addEqualityGroup(new MastershipBasedTimestamp(1, 2),
- new MastershipBasedTimestamp(1, 2), TS_1_2)
- .addEqualityGroup(new MastershipBasedTimestamp(2, 1),
- new MastershipBasedTimestamp(2, 1), TS_2_1)
- .addEqualityGroup(new MastershipBasedTimestamp(2, 2),
- new MastershipBasedTimestamp(2, 2), TS_2_2)
+ .addEqualityGroup(new DeviceMastershipBasedTimestamp(1, 1),
+ new DeviceMastershipBasedTimestamp(1, 1), TS_1_1)
+ .addEqualityGroup(new DeviceMastershipBasedTimestamp(1, 2),
+ new DeviceMastershipBasedTimestamp(1, 2), TS_1_2)
+ .addEqualityGroup(new DeviceMastershipBasedTimestamp(2, 1),
+ new DeviceMastershipBasedTimestamp(2, 1), TS_2_1)
+ .addEqualityGroup(new DeviceMastershipBasedTimestamp(2, 2),
+ new DeviceMastershipBasedTimestamp(2, 2), TS_2_2)
.testEquals();
}
@@ -64,7 +63,7 @@
public final void testKryoSerializable() {
final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
final KryoPool kryos = KryoPool.newBuilder()
- .register(MastershipBasedTimestamp.class)
+ .register(DeviceMastershipBasedTimestamp.class)
.build();
kryos.serialize(TS_2_1, buffer);
@@ -80,7 +79,7 @@
public final void testKryoSerializableWithHandcraftedSerializer() {
final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
final KryoPool kryos = KryoPool.newBuilder()
- .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
+ .register(DeviceMastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
.build();
kryos.serialize(TS_1_2, buffer);
diff --git a/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/TimestampedTest.java b/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/TimestampedTest.java
index 4b44d40..2a0faa8 100644
--- a/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/TimestampedTest.java
+++ b/core/store/dist/src/test/java/org/onlab/onos/store/common/impl/TimestampedTest.java
@@ -6,6 +6,7 @@
import org.junit.Test;
import org.onlab.onos.store.Timestamp;
+import org.onlab.onos.store.Timestamped;
import org.onlab.util.KryoPool;
import com.google.common.testing.EqualsTester;
@@ -15,9 +16,9 @@
*/
public class TimestampedTest {
- private static final Timestamp TS_1_1 = new MastershipBasedTimestamp(1, 1);
- private static final Timestamp TS_1_2 = new MastershipBasedTimestamp(1, 2);
- private static final Timestamp TS_2_1 = new MastershipBasedTimestamp(2, 1);
+ private static final Timestamp TS_1_1 = new DeviceMastershipBasedTimestamp(1, 1);
+ private static final Timestamp TS_1_2 = new DeviceMastershipBasedTimestamp(1, 2);
+ private static final Timestamp TS_2_1 = new DeviceMastershipBasedTimestamp(2, 1);
@Test
public final void testHashCode() {
@@ -79,7 +80,7 @@
final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
final KryoPool kryos = KryoPool.newBuilder()
.register(Timestamped.class,
- MastershipBasedTimestamp.class)
+ DeviceMastershipBasedTimestamp.class)
.build();
Timestamped<String> original = new Timestamped<>("foobar", TS_1_1);
diff --git a/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java b/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
index fa42a6b..d1060cc 100644
--- a/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
+++ b/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
@@ -25,7 +25,6 @@
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.ControllerNode.State;
import org.onlab.onos.cluster.DefaultControllerNode;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.Annotations;
import org.onlab.onos.net.DefaultAnnotations;
@@ -40,6 +39,7 @@
import org.onlab.onos.net.device.DeviceEvent;
import org.onlab.onos.net.device.DeviceStore;
import org.onlab.onos.net.device.DeviceStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.ProviderId;
import org.onlab.onos.store.ClockService;
@@ -113,8 +113,8 @@
deviceClockManager.activate();
clockService = deviceClockManager;
- deviceClockManager.setMastershipTerm(DID1, MastershipTerm.of(MYSELF, 1));
- deviceClockManager.setMastershipTerm(DID2, MastershipTerm.of(MYSELF, 2));
+ deviceClockManager.setMastershipTerm(DID1, DeviceMastershipTerm.of(MYSELF, 1));
+ deviceClockManager.setMastershipTerm(DID2, DeviceMastershipTerm.of(MYSELF, 2));
ClusterCommunicationService clusterCommunicator = new TestClusterCommunicationService();
ClusterService clusterService = new TestClusterService();
diff --git a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStore.java b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
similarity index 88%
rename from core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStore.java
rename to core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
index 71d42fa..cdcf84b 100644
--- a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStore.java
+++ b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
@@ -1,6 +1,6 @@
package org.onlab.onos.store.cluster.impl;
-import static org.onlab.onos.cluster.MastershipEvent.Type.MASTER_CHANGED;
+import static org.onlab.onos.net.device.DeviceMastershipEvent.Type.MASTER_CHANGED;
import java.util.Map;
import java.util.Set;
@@ -12,13 +12,13 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.cluster.ClusterService;
-import org.onlab.onos.cluster.MastershipEvent;
-import org.onlab.onos.cluster.MastershipStore;
-import org.onlab.onos.cluster.MastershipStoreDelegate;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceMastershipEvent;
+import org.onlab.onos.net.device.DeviceMastershipStore;
+import org.onlab.onos.net.device.DeviceMastershipStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.store.common.AbstractHazelcastStore;
import com.google.common.collect.ImmutableSet;
@@ -32,9 +32,9 @@
*/
@Component(immediate = true)
@Service
-public class DistributedMastershipStore
-extends AbstractHazelcastStore<MastershipEvent, MastershipStoreDelegate>
-implements MastershipStore {
+public class DistributedDeviceMastershipStore
+extends AbstractHazelcastStore<DeviceMastershipEvent, DeviceMastershipStoreDelegate>
+implements DeviceMastershipStore {
//arbitrary lock name
private static final String LOCK = "lock";
@@ -100,7 +100,7 @@
}
@Override
- public MastershipEvent setMaster(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent setMaster(NodeId nodeId, DeviceId deviceId) {
byte [] did = serialize(deviceId);
byte [] nid = serialize(nodeId);
@@ -123,12 +123,12 @@
masters.put(did, nid);
evict(nid, did);
updateTerm(did);
- return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId);
+ return new DeviceMastershipEvent(MASTER_CHANGED, deviceId, nodeId);
case NONE:
masters.put(did, nid);
evict(nid, did);
updateTerm(did);
- return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId);
+ return new DeviceMastershipEvent(MASTER_CHANGED, deviceId, nodeId);
default:
log.warn("unknown Mastership Role {}", role);
return null;
@@ -191,21 +191,21 @@
}
@Override
- public MastershipTerm getTermFor(DeviceId deviceId) {
+ public DeviceMastershipTerm getTermFor(DeviceId deviceId) {
byte[] did = serialize(deviceId);
if ((masters.get(did) == null) ||
(terms.get(did) == null)) {
return null;
}
- return MastershipTerm.of(
+ return DeviceMastershipTerm.of(
(NodeId) deserialize(masters.get(did)), terms.get(did));
}
@Override
- public MastershipEvent setStandby(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent setStandby(NodeId nodeId, DeviceId deviceId) {
byte [] did = serialize(deviceId);
byte [] nid = serialize(nodeId);
- MastershipEvent event = null;
+ DeviceMastershipEvent event = null;
ILock lock = theInstance.getLock(LOCK);
lock.lock();
@@ -231,10 +231,10 @@
}
@Override
- public MastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId) {
byte [] did = serialize(deviceId);
byte [] nid = serialize(nodeId);
- MastershipEvent event = null;
+ DeviceMastershipEvent event = null;
ILock lock = theInstance.getLock(LOCK);
lock.lock();
@@ -260,7 +260,7 @@
}
//helper to fetch a new master candidate for a given device.
- private MastershipEvent reelect(NodeId current, DeviceId deviceId) {
+ private DeviceMastershipEvent reelect(NodeId current, DeviceId deviceId) {
byte [] did = serialize(deviceId);
byte [] nid = serialize(current);
@@ -281,7 +281,7 @@
evict(backup, did);
Integer term = terms.get(did);
terms.put(did, ++term);
- return new MastershipEvent(
+ return new DeviceMastershipEvent(
MASTER_CHANGED, deviceId, (NodeId) deserialize(backup));
}
}
@@ -320,7 +320,7 @@
@Override
protected void onAdd(DeviceId deviceId, NodeId nodeId) {
- notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, nodeId));
+ notifyDelegate(new DeviceMastershipEvent(MASTER_CHANGED, deviceId, nodeId));
}
@Override
diff --git a/core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStoreTest.java b/core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStoreTest.java
similarity index 88%
rename from core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStoreTest.java
rename to core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStoreTest.java
index bf1bb38..d993250 100644
--- a/core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedMastershipStoreTest.java
+++ b/core/store/hz/cluster/src/test/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStoreTest.java
@@ -21,12 +21,12 @@
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.ControllerNode.State;
import org.onlab.onos.cluster.DefaultControllerNode;
-import org.onlab.onos.cluster.MastershipEvent;
-import org.onlab.onos.cluster.MastershipEvent.Type;
-import org.onlab.onos.cluster.MastershipStoreDelegate;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipEvent;
+import org.onlab.onos.net.device.DeviceMastershipStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
+import org.onlab.onos.net.device.DeviceMastershipEvent.Type;
import org.onlab.onos.store.common.StoreManager;
import org.onlab.onos.store.common.StoreService;
import org.onlab.onos.store.common.TestStoreManager;
@@ -40,7 +40,7 @@
/**
* Test of the Hazelcast-based distributed MastershipStore implementation.
*/
-public class DistributedMastershipStoreTest {
+public class DistributedDeviceMastershipStoreTest {
private static final DeviceId DID1 = DeviceId.deviceId("of:01");
private static final DeviceId DID2 = DeviceId.deviceId("of:02");
@@ -54,8 +54,8 @@
private static final ControllerNode CN1 = new DefaultControllerNode(N1, IP);
private static final ControllerNode CN2 = new DefaultControllerNode(N2, IP);
- private DistributedMastershipStore dms;
- private TestDistributedMastershipStore testStore;
+ private DistributedDeviceMastershipStore dms;
+ private TestDistributedDeviceMastershipStore testStore;
private KryoSerializer serializationMgr;
private StoreManager storeMgr;
@@ -77,11 +77,11 @@
serializationMgr = new KryoSerializer();
- dms = new TestDistributedMastershipStore(storeMgr, serializationMgr);
+ dms = new TestDistributedDeviceMastershipStore(storeMgr, serializationMgr);
dms.clusterService = new TestClusterService();
dms.activate();
- testStore = (TestDistributedMastershipStore) dms;
+ testStore = (TestDistributedDeviceMastershipStore) dms;
}
@After
@@ -133,7 +133,7 @@
assertEquals("wrong role for NONE:", MASTER, dms.requestRole(DID1));
assertTrue("wrong state for store:", !dms.terms.isEmpty());
assertEquals("wrong term",
- MastershipTerm.of(N1, 0), dms.getTermFor(DID1));
+ DeviceMastershipTerm.of(N1, 0), dms.getTermFor(DID1));
//CN2 now local. DID2 has N1 as MASTER so N2 is STANDBY
testStore.setCurrent(CN2);
@@ -143,7 +143,7 @@
//change term and requestRole() again; should persist
testStore.increment(DID2);
assertEquals("wrong role for STANDBY:", STANDBY, dms.requestRole(DID2));
- assertEquals("wrong term", MastershipTerm.of(N1, 1), dms.getTermFor(DID2));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N1, 1), dms.getTermFor(DID2));
}
@Test
@@ -155,15 +155,15 @@
//switch over to N2
assertEquals("wrong event:", Type.MASTER_CHANGED, dms.setMaster(N2, DID1).type());
- assertEquals("wrong term", MastershipTerm.of(N2, 1), dms.getTermFor(DID1));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N2, 1), dms.getTermFor(DID1));
//orphan switch - should be rare case
assertEquals("wrong event:", Type.MASTER_CHANGED, dms.setMaster(N2, DID2).type());
- assertEquals("wrong term", MastershipTerm.of(N2, 0), dms.getTermFor(DID2));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N2, 0), dms.getTermFor(DID2));
//disconnect and reconnect - sign of failing re-election or single-instance channel
testStore.reset(true, false, false);
dms.setMaster(N2, DID2);
- assertEquals("wrong term", MastershipTerm.of(N2, 1), dms.getTermFor(DID2));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N2, 1), dms.getTermFor(DID2));
}
@Test
@@ -211,9 +211,9 @@
//shamelessly copy other distributed store tests
final CountDownLatch addLatch = new CountDownLatch(1);
- MastershipStoreDelegate checkAdd = new MastershipStoreDelegate() {
+ DeviceMastershipStoreDelegate checkAdd = new DeviceMastershipStoreDelegate() {
@Override
- public void notify(MastershipEvent event) {
+ public void notify(DeviceMastershipEvent event) {
assertEquals("wrong event:", Type.MASTER_CHANGED, event.type());
assertEquals("wrong subject", DID1, event.subject());
assertEquals("wrong subject", N1, event.master());
@@ -227,9 +227,9 @@
assertTrue("Add event fired", addLatch.await(1, TimeUnit.SECONDS));
}
- private class TestDistributedMastershipStore extends
- DistributedMastershipStore {
- public TestDistributedMastershipStore(StoreService storeService,
+ private class TestDistributedDeviceMastershipStore extends
+ DistributedDeviceMastershipStore {
+ public TestDistributedDeviceMastershipStore(StoreService storeService,
KryoSerializer kryoSerialization) {
this.storeService = storeService;
this.serializer = kryoSerialization;
diff --git a/core/store/hz/net/src/main/java/org/onlab/onos/store/device/impl/NoOpClockProviderService.java b/core/store/hz/net/src/main/java/org/onlab/onos/store/device/impl/NoOpClockProviderService.java
index b68620a..729b01e 100644
--- a/core/store/hz/net/src/main/java/org/onlab/onos/store/device/impl/NoOpClockProviderService.java
+++ b/core/store/hz/net/src/main/java/org/onlab/onos/store/device/impl/NoOpClockProviderService.java
@@ -2,8 +2,8 @@
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.store.ClockProviderService;
// FIXME: Code clone in onos-core-trivial, onos-core-hz-net
@@ -15,6 +15,6 @@
public class NoOpClockProviderService implements ClockProviderService {
@Override
- public void setMastershipTerm(DeviceId deviceId, MastershipTerm term) {
+ public void setMastershipTerm(DeviceId deviceId, DeviceMastershipTerm term) {
}
}
diff --git a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/KryoPoolUtil.java b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/KryoPoolUtil.java
index 0c33cfe..5676cb6 100644
--- a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/KryoPoolUtil.java
+++ b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/KryoPoolUtil.java
@@ -7,7 +7,6 @@
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.DefaultControllerNode;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DefaultAnnotations;
@@ -24,6 +23,7 @@
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.device.DefaultDeviceDescription;
import org.onlab.onos.net.device.DefaultPortDescription;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.net.provider.ProviderId;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
@@ -74,7 +74,7 @@
.register(LinkKey.class, new LinkKeySerializer())
.register(ConnectPoint.class, new ConnectPointSerializer())
.register(DefaultLink.class, new DefaultLinkSerializer())
- .register(MastershipTerm.class, new MastershipTermSerializer())
+ .register(DeviceMastershipTerm.class, new MastershipTermSerializer())
.register(MastershipRole.class, new MastershipRoleSerializer())
.build();
diff --git a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/MastershipTermSerializer.java b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/MastershipTermSerializer.java
index 0ac61a8..0d0a6b0 100644
--- a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/MastershipTermSerializer.java
+++ b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/MastershipTermSerializer.java
@@ -1,19 +1,20 @@
package org.onlab.onos.store.serializers;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
+
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
/**
- * Kryo Serializer for {@link org.onlab.onos.cluster.MastershipTerm}.
+ * Kryo Serializer for {@link org.onlab.onos.net.device.DeviceMastershipTerm}.
*/
-public class MastershipTermSerializer extends Serializer<MastershipTerm> {
+public class MastershipTermSerializer extends Serializer<DeviceMastershipTerm> {
/**
- * Creates {@link MastershipTerm} serializer instance.
+ * Creates {@link DeviceMastershipTerm} serializer instance.
*/
public MastershipTermSerializer() {
// non-null, immutable
@@ -21,14 +22,14 @@
}
@Override
- public MastershipTerm read(Kryo kryo, Input input, Class<MastershipTerm> type) {
+ public DeviceMastershipTerm read(Kryo kryo, Input input, Class<DeviceMastershipTerm> type) {
final NodeId node = new NodeId(input.readString());
final int term = input.readInt();
- return MastershipTerm.of(node, term);
+ return DeviceMastershipTerm.of(node, term);
}
@Override
- public void write(Kryo kryo, Output output, MastershipTerm object) {
+ public void write(Kryo kryo, Output output, DeviceMastershipTerm object) {
output.writeString(object.master().toString());
output.writeInt(object.termNumber());
}
diff --git a/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java b/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
index d651d56..ab9e012 100644
--- a/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
+++ b/core/store/serializers/src/test/java/org/onlab/onos/store/serializers/KryoSerializerTest.java
@@ -10,7 +10,6 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.Annotations;
import org.onlab.onos.net.ConnectPoint;
@@ -25,6 +24,7 @@
import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.SparseAnnotations;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.net.provider.ProviderId;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
@@ -114,7 +114,7 @@
testSerialized(PID);
testSerialized(PIDA);
testSerialized(new NodeId("bar"));
- testSerialized(MastershipTerm.of(new NodeId("foo"), 2));
+ testSerialized(DeviceMastershipTerm.of(new NodeId("foo"), 2));
for (MastershipRole role : MastershipRole.values()) {
testSerialized(role);
}
diff --git a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/NoOpClockProviderService.java b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/NoOpClockProviderService.java
index ff4b31a..5f3c2ef 100644
--- a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/NoOpClockProviderService.java
+++ b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/NoOpClockProviderService.java
@@ -2,8 +2,8 @@
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.store.ClockProviderService;
//FIXME: Code clone in onos-core-trivial, onos-core-hz-net
@@ -15,6 +15,6 @@
public class NoOpClockProviderService implements ClockProviderService {
@Override
- public void setMastershipTerm(DeviceId deviceId, MastershipTerm term) {
+ public void setMastershipTerm(DeviceId deviceId, DeviceMastershipTerm term) {
}
}
diff --git a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
index e8096ea..7f88edb 100644
--- a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
+++ b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
@@ -15,18 +15,18 @@
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.cluster.ControllerNode;
import org.onlab.onos.cluster.DefaultControllerNode;
-import org.onlab.onos.cluster.MastershipEvent;
-import org.onlab.onos.cluster.MastershipStore;
-import org.onlab.onos.cluster.MastershipStoreDelegate;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceMastershipEvent;
+import org.onlab.onos.net.device.DeviceMastershipStore;
+import org.onlab.onos.net.device.DeviceMastershipStoreDelegate;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import org.onlab.onos.store.AbstractStore;
import org.onlab.packet.IpPrefix;
import org.slf4j.Logger;
-import static org.onlab.onos.cluster.MastershipEvent.Type.*;
+import static org.onlab.onos.net.device.DeviceMastershipEvent.Type.*;
/**
* Manages inventory of controller mastership over devices using
@@ -35,8 +35,8 @@
@Component(immediate = true)
@Service
public class SimpleMastershipStore
- extends AbstractStore<MastershipEvent, MastershipStoreDelegate>
- implements MastershipStore {
+ extends AbstractStore<DeviceMastershipEvent, DeviceMastershipStoreDelegate>
+ implements DeviceMastershipStore {
private final Logger log = getLogger(getClass());
@@ -63,7 +63,7 @@
}
@Override
- public MastershipEvent setMaster(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent setMaster(NodeId nodeId, DeviceId deviceId) {
MastershipRole role = getRole(nodeId, deviceId);
synchronized (this) {
@@ -86,7 +86,7 @@
}
}
- return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId);
+ return new DeviceMastershipEvent(MASTER_CHANGED, deviceId, nodeId);
}
@Override
@@ -164,17 +164,17 @@
}
@Override
- public MastershipTerm getTermFor(DeviceId deviceId) {
+ public DeviceMastershipTerm getTermFor(DeviceId deviceId) {
if ((masterMap.get(deviceId) == null) ||
(termMap.get(deviceId) == null)) {
return null;
}
- return MastershipTerm.of(
+ return DeviceMastershipTerm.of(
masterMap.get(deviceId), termMap.get(deviceId).get());
}
@Override
- public MastershipEvent setStandby(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent setStandby(NodeId nodeId, DeviceId deviceId) {
MastershipRole role = getRole(nodeId, deviceId);
synchronized (this) {
switch (role) {
@@ -185,7 +185,7 @@
} else {
masterMap.put(deviceId, backup);
termMap.get(deviceId).incrementAndGet();
- return new MastershipEvent(MASTER_CHANGED, deviceId, backup);
+ return new DeviceMastershipEvent(MASTER_CHANGED, deviceId, backup);
}
case STANDBY:
case NONE:
@@ -215,7 +215,7 @@
}
@Override
- public MastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId) {
+ public DeviceMastershipEvent relinquishRole(NodeId nodeId, DeviceId deviceId) {
return setStandby(nodeId, deviceId);
}
diff --git a/core/store/trivial/src/test/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStoreTest.java b/core/store/trivial/src/test/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStoreTest.java
index 1e8e5c7..d3430ca 100644
--- a/core/store/trivial/src/test/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStoreTest.java
+++ b/core/store/trivial/src/test/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStoreTest.java
@@ -6,9 +6,9 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.onos.cluster.MastershipTerm;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.device.DeviceMastershipTerm;
import com.google.common.collect.Sets;
@@ -16,7 +16,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.onlab.onos.net.MastershipRole.*;
-import static org.onlab.onos.cluster.MastershipEvent.Type.*;
+import static org.onlab.onos.net.device.DeviceMastershipEvent.Type.*;
/**
* Test for the simple MastershipStore implementation.
@@ -98,12 +98,12 @@
@Test
public void getTermFor() {
put(DID1, N1, true, true);
- assertEquals("wrong term", MastershipTerm.of(N1, 0), sms.getTermFor(DID1));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N1, 0), sms.getTermFor(DID1));
//switch to N2 and back - 2 term switches
sms.setMaster(N2, DID1);
sms.setMaster(N1, DID1);
- assertEquals("wrong term", MastershipTerm.of(N1, 2), sms.getTermFor(DID1));
+ assertEquals("wrong term", DeviceMastershipTerm.of(N1, 2), sms.getTermFor(DID1));
}
@Test
diff --git a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
index 0f69bac..e56a4f9 100644
--- a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
+++ b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
@@ -1,10 +1,5 @@
package org.onlab.onos.openflow.controller;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.onlab.packet.Ethernet;
import org.projectfloodlight.openflow.protocol.OFPacketIn;
import org.projectfloodlight.openflow.protocol.OFPacketOut;
@@ -13,12 +8,12 @@
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.types.OFBufferId;
import org.projectfloodlight.openflow.types.OFPort;
-import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext {
- private final Logger log = getLogger(getClass());
-
private final AtomicBoolean free = new AtomicBoolean(true);
private final AtomicBoolean isBuilt = new AtomicBoolean(false);
private final OpenFlowSwitch sw;
@@ -82,7 +77,7 @@
}
public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s,
- OFPacketIn pkt) {
+ OFPacketIn pkt) {
return new DefaultOpenFlowPacketContext(s, pkt);
}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
index 53ad55f..168c06d 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
@@ -157,9 +157,7 @@
}
log.debug("OpenFlow port set to {}", this.openFlowPort);
String threads = configParams.get("workerthreads");
- if (threads != null) {
- this.workerThreads = Integer.parseInt(threads);
- }
+ this.workerThreads = threads != null ? Integer.parseInt(threads) : 16;
log.debug("Number of worker threads set to {}", this.workerThreads);
}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
index 716f7ec..685ee9c 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -44,7 +44,6 @@
private final ExecutorService executor = Executors.newFixedThreadPool(16,
namedThreads("of-event-%d"));
-
protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches =
new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches =
diff --git a/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java b/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
index e7c4443..71ddb0d 100644
--- a/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
+++ b/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
@@ -1,9 +1,5 @@
package org.onlab.onos.provider.of.packet.impl;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.List;
-
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.onos.net.flow.instructions.Instruction.Type;
@@ -14,16 +10,16 @@
import org.onlab.onos.openflow.controller.OpenFlowPacketContext;
import org.onlab.packet.Ethernet;
import org.projectfloodlight.openflow.types.OFPort;
-import org.slf4j.Logger;
+
+import java.util.List;
public class OpenFlowCorePacketContext extends DefaultPacketContext {
- private final Logger log = getLogger(getClass());
-
private final OpenFlowPacketContext ofPktCtx;
protected OpenFlowCorePacketContext(long time, InboundPacket inPkt,
- OutboundPacket outPkt, boolean block, OpenFlowPacketContext ofPktCtx) {
+ OutboundPacket outPkt, boolean block,
+ OpenFlowPacketContext ofPktCtx) {
super(time, inPkt, outPkt, block);
this.ofPktCtx = ofPktCtx;
}
@@ -36,9 +32,8 @@
} else {
Ethernet eth = new Ethernet();
eth.deserialize(outPacket().data().array(), 0,
- outPacket().data().array().length);
+ outPacket().data().array().length);
sendPacket(eth);
-
}
}
@@ -61,6 +56,7 @@
}
ofPktCtx.send();
}
+
private OFPort buildPort(PortNumber port) {
return OFPort.of((int) port.toLong());
}