package org.opendaylight.openflowplugin.openflow.md.core.session;
+import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import java.util.concurrent.TimeUnit;
-import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
-import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
+import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
+import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
/**
* @author mirehak
private GetFeaturesOutput features;
private ConnectionConductor primaryConductor;
+ private NotificationEnqueuer notificationEnqueuer;
private ConcurrentHashMap<SwitchConnectionDistinguisher, ConnectionConductor> auxiliaryConductors;
private boolean valid;
- private SwitchConnectionDistinguisher sessionKey;
+ private SwitchSessionKeyOF sessionKey;
private IMessageDispatchService mdService;
private final AtomicLong xid;
private final Map<Long, PortGrouping> physicalPorts;
private final Map<Long, Boolean> portBandwidth;
- public static Cache<TransactionKey, Object> bulkTransactionCache = CacheBuilder.newBuilder().expireAfterWrite(10000, TimeUnit.MILLISECONDS).concurrencyLevel(1).build();
+ private CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration;
+ private int seed;
+ private ControllerRole roleOnDevice = ControllerRole.OFPCRROLEEQUAL;
/**
public Set<Entry<SwitchConnectionDistinguisher, ConnectionConductor>> getAuxiliaryConductors() {
return Collections.unmodifiableSet(auxiliaryConductors.entrySet());
}
-
- @Override
- public Cache<TransactionKey, Object> getbulkTransactionCache() {
- return bulkTransactionCache;
- }
@Override
public GetFeaturesOutput getFeatures() {
/**
* @param sessionKey the sessionKey to set
*/
- public void setSessionKey(SwitchConnectionDistinguisher sessionKey) {
+ public void setSessionKey(SwitchSessionKeyOF sessionKey) {
this.sessionKey = sessionKey;
}
+ /**
+ * @param seed the seed to set
+ */
+ public void setSeed(int seed) {
+ this.seed = seed;
+ }
+
@Override
- public SwitchConnectionDistinguisher getSessionKey() {
+ public SwitchSessionKeyOF getSessionKey() {
return sessionKey;
}
public Map<Long, PortGrouping> getPhysicalPorts() {
return this.physicalPorts;
}
-
+
@Override
public Map<Long, Boolean> getPortsBandwidth() {
return this.portBandwidth;
}
return result;
}
+
+ @Override
+ public void setProviderRegistration(
+ CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration) {
+ this.providerRegistration = providerRegistration;
+ }
+
+ @Override
+ public CompositeObjectRegistration<ModelDrivenSwitch> getProviderRegistration() {
+ return providerRegistration;
+ }
+
+ @Override
+ public int getSeed() {
+ return seed;
+ }
+
+ /**
+ * @param notificationEnqueuer the notificationEnqueuer to set
+ */
+ public void setNotificationEnqueuer(
+ NotificationEnqueuer notificationEnqueuer) {
+ this.notificationEnqueuer = notificationEnqueuer;
+ }
+
+ @Override
+ public NotificationEnqueuer getNotificationEnqueuer() {
+ return notificationEnqueuer;
+ }
+
+ /**
+ * @return the roleOnDevice
+ */
+ @Override
+ public ControllerRole getRoleOnDevice() {
+ return roleOnDevice;
+ }
+
+ /**
+ * @param roleOnDevice the roleOnDevice to set
+ */
+ @Override
+ public void setRoleOnDevice(ControllerRole roleOnDevice) {
+ Preconditions.checkNotNull("Proposed controller role can not be empty.", roleOnDevice);
+ this.roleOnDevice = roleOnDevice;
+ }
}