From 9f8ac36d0dfc1b49cd311af96323443f03d43c0e Mon Sep 17 00:00:00 2001 From: Alissa Bonas Date: Tue, 1 Oct 2013 13:57:18 +0300 Subject: [PATCH] Remove commented out code to fix sonar warnings Change-Id: I541069ede01e456824e8e10eb196a34e477bdbd8 Signed-off-by: Alissa Bonas --- .../containermanager/ContainerConfig.java | 41 -- .../internal/StaticRoutingImplementation.java | 1 - .../hosttracker/internal/HostTracker.java | 1 - .../hosttracker/IDeviceService.java | 25 - .../hosttracker/internal/Activator.java | 4 - .../hosttracker/internal/Device.java | 19 - .../internal/DeviceManagerImpl.java | 528 +----------------- .../api/AbstractBindingAwareConsumer.java | 1 - .../controller/sal/action/Action.java | 5 - .../controller/sal/packet/UDP.java | 3 - .../controller/devices/web/Devices.java | 1 - 11 files changed, 1 insertion(+), 628 deletions(-) diff --git a/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerConfig.java b/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerConfig.java index 89bf424e67..caf8a13e63 100644 --- a/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerConfig.java +++ b/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerConfig.java @@ -311,17 +311,6 @@ public class ContainerConfig implements Serializable { return status; } - /* Allow adding ports which are already present - if (!ports.isEmpty()) { - List intersection = new ArrayList(ports); - intersection.retainAll(ncList); - if (!intersection.isEmpty()) { - return new Status(StatusCode.CONFLICT, "The following node connectors are already part of this container: " - + intersection); - } - } - */ - // Add ports ports.addAll(ncList); return new Status(StatusCode.SUCCESS); @@ -415,36 +404,6 @@ public class ContainerConfig implements Serializable { } } - /* - * Revisit the following flow-spec confict validation later based on more testing. - * (*) - if (!delete) { - // Check for overlapping container flows in the request - int size = cFlowConfigs.size(); - for (int i = 0; i < size; i++) { - ContainerFlowConfig first = cFlowConfigs.get(i); - for (int j = i + 1; j < size; j++) { - ContainerFlowConfig second = cFlowConfigs.get(j); - if (first.overlap(second)) { - return new Status(StatusCode.BADREQUEST, String.format( - "Invalid Request: the proposed flow specs overlap: %s <-> %s", first.getName(), - second.getName())); - } - } - } - // Check if any of the proposed container flows overlap with the - // existing ones - for (ContainerFlowConfig current : cFlowConfigs) { - for (ContainerFlowConfig existing : this.containerFlows) { - if (current.overlap(existing)) { - return new Status(StatusCode.BADREQUEST, String.format( - "Invalid Request: the proposed flow specs overlap: %s <-> %s", current.getName(), - existing.getName())); - } - } - } - } - */ return new Status(StatusCode.SUCCESS); } diff --git a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java index 1027f8d170..315543514e 100644 --- a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java +++ b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java @@ -438,7 +438,6 @@ public class StaticRoutingImplementation implements IfNewHostNotify, log.debug("forwarding.staticrouting starting on container {}", containerName); - //staticRoutes = new ConcurrentHashMap(); allocateCaches(); retrieveCaches(); this.executor = Executors.newFixedThreadPool(1); diff --git a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java index e98b7fc90d..3f3f76e094 100644 --- a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java +++ b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java @@ -773,7 +773,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw */ @SuppressWarnings("unchecked") private void updateCurrentHierarchy(Node node, ArrayList currHierarchy, List> fullHierarchy) { - // currHierarchy.add(String.format("%x", currSw.getId())); currHierarchy.add(dpidToHostNameHack((Long) node.getID())); // Shallow copy as required ArrayList currHierarchyClone = (ArrayList) currHierarchy.clone(); diff --git a/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/IDeviceService.java b/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/IDeviceService.java index 9199f5a54e..a4791561e3 100755 --- a/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/IDeviceService.java +++ b/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/IDeviceService.java @@ -57,31 +57,6 @@ public interface IDeviceService { MAC, IPV4, VLAN, SWITCHPORT } - /** - * The source device for the current packet-in, if applicable. - */ - // public static final String CONTEXT_SRC_DEVICE = - // "net.floodlightcontroller.devicemanager.srcDevice"; - - /** - * The destination device for the current packet-in, if applicable. - */ - // public static final String CONTEXT_DST_DEVICE = - // / "net.floodlightcontroller.devicemanager.dstDevice"; - - /** - * The original destination device for the current packet-in - */ - // public static final String CONTEXT_ORIG_DST_DEVICE = - // "net.floodlightcontroller.devicemanager.origDstDevice"; - - /** - * A FloodlightContextStore object that can be used to interact with the - * FloodlightContext information created by BVS manager. - */ - // public static final FloodlightContextStore fcStore = - // new FloodlightContextStore(); - /** * Get the device with the given device key. * diff --git a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Activator.java b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Activator.java index 99be54e77e..ad3f7eef1a 100644 --- a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Activator.java +++ b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Activator.java @@ -88,10 +88,6 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setNewHostNotify", "unsetNewHostNotify").setRequired(false)); - // c.add(createContainerServiceDependency(containerName).setService( - // IClusterContainerServices.class).setCallbacks( - // "setClusterContainerService", - // "unsetClusterContainerService").setRequired(true)); c.add(createContainerServiceDependency(containerName) .setService(ITopologyManager.class) .setCallbacks("setTopologyManager", "unsetTopologyManager") diff --git a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java index b2180297da..8fcb988b6c 100755 --- a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java +++ b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java @@ -341,7 +341,6 @@ public class Device implements IDevice { */ List getDuplicateAttachmentPoints( List oldAPList, Map apMap) { - // ITopologyService topology = deviceManager.topology; List dupAPs = new ArrayList(); long timeThreshold = System.currentTimeMillis() - AttachmentPoint.INACTIVITY_INTERVAL; @@ -350,17 +349,11 @@ public class Device implements IDevice { return dupAPs; for (AttachmentPoint ap : oldAPList) { - // XXX - Missing functionality - // long id = topology.getL2DomainId(ap.getSw()); long id = 0; AttachmentPoint trueAP = apMap.get(id); if (trueAP == null) continue; - // XXX - Missing functionality - // boolean c = (topology.isConsistent(trueAP.getSw(), - // trueAP.getPort(), - // ap.getSw(), ap.getPort())); boolean c = true; boolean active = (ap.getActiveSince() > trueAP.getActiveSince()); boolean last = ap.getLastSeen() > timeThreshold; @@ -462,7 +455,6 @@ public class Device implements IDevice { } // XXX - Missing functionality - // long id = topology.getL2DomainId(sw); long id = 0; AttachmentPoint oldAP = apMap.get(id); @@ -499,11 +491,6 @@ public class Device implements IDevice { oldAPList.addAll(oldAPs); oldAPList.add(oldAP); this.oldAPs = oldAPList; - // XXX - Missing functionality - // if (!topology.isInSameBroadcastDomain(oldAP.getSw(), - // oldAP.getPort(), - // newAP.getSw(), newAP.getPort())) - // return true; // attachment point changed. return true; } else if (oldAPFlag) { // retain oldAP as is. Put the newAP in oldAPs for flagging @@ -514,11 +501,6 @@ public class Device implements IDevice { // Add to oldAPList only if it was picked up from the oldAPList oldAPList.add(newAP); this.oldAPs = oldAPList; - // XXX - Missing functionality - // if (!topology.isInSameBroadcastDomain(oldAP.getSw(), - // oldAP.getPort(), - // newAP.getSw(), newAP.getPort())) - // return true; // attachment point changed. return true; } return false; @@ -836,7 +818,6 @@ public class Device implements IDevice { if (!isFirst) builder.append(", "); isFirst = false; - // builder.append(IPv4.fromIPv4Address(ip)); builder.append(ip); } builder.append("], APs="); diff --git a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java index 1308d86eec..ee75ac06e3 100755 --- a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java +++ b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java @@ -121,17 +121,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, public static final String MODULE_NAME = "devicemanager"; - // protected ITopologyService topology; - // protected IStorageSourceService storageSource; - // protected IRestApiService restApi; - // protected IThreadPoolService threadPool; - // protected IFlowReconcileService flowReconcileMgr; - // protected IFlowReconcileEngineService flowReconcileEngine; - // protected IDebugCounterService debugCounters; - // private ISyncService syncService; - // private IStoreClient storeClient; - // private DeviceSyncManager deviceSyncManager; - private ITopologyManager topology; private ISwitchManager switchManager = null; private IDataPacketService dataPacketService = null; @@ -186,30 +175,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, static final String DEVICE_SYNC_STORE_NAME = DeviceManagerImpl.class .getCanonicalName() + ".stateStore"; - /** - * Time interval between writes of entries for the same device to the sync - * store. - */ - // static final int DEFAULT_SYNC_STORE_WRITE_INTERVAL_MS = - // 5*60*1000; // 5 min - // private int syncStoreWriteIntervalMs = - // DEFAULT_SYNC_STORE_WRITE_INTERVAL_MS; - - /** - * Time after SLAVE->MASTER until we run the consolidate store code. - */ - // static final int DEFAULT_INITIAL_SYNC_STORE_CONSOLIDATE_MS = - // 15*1000; // 15 sec - // private int initialSyncStoreConsolidateMs = - // DEFAULT_INITIAL_SYNC_STORE_CONSOLIDATE_MS; - - /** - * Time interval between consolidate store runs. - */ - // static final int DEFAULT_SYNC_STORE_CONSOLIDATE_INTERVAL_MS = - // 75*60*1000; // 75 min - // private final int syncStoreConsolidateIntervalMs = - // DEFAULT_SYNC_STORE_CONSOLIDATE_INTERVAL_MS; /** * Time in milliseconds before entities will expire @@ -409,8 +374,7 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, return -compare(newAP, oldAP); long activeOffset = 0; - // XXX - missing functionality -- need topology - // if (!topology.isConsistent(oldSw, oldPort, newSw, newPort)) { + if (!newBD && oldBD) { return -1; } @@ -420,10 +384,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, activeOffset = AttachmentPoint.OPENFLOW_TO_EXTERNAL_TIMEOUT; } - // } else { - // // The attachment point is consistent. - // activeOffset = AttachmentPoint.CONSISTENT_TIMEOUT; - // } if ((newAP.getActiveSince() > oldAP.getLastSeen() + activeOffset) || (newAP.getLastSeen() > oldAP.getLastSeen() @@ -510,13 +470,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, addIndex(true, EnumSet.of(DeviceField.IPV4)); - // floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this); - // floodlightProvider.addHAListener(this.haListenerDelegate); - // if (topology != null) - // topology.addListener(this); - // flowReconcileMgr.addFlowReconcileListener(this); - // entityClassifier.addListener(this); - stopped = false; // XXX - Should use a common threadpool but this doesn't currently exist ses = Executors.newScheduledThreadPool(1); @@ -532,33 +485,7 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, entityCleanupTask = new SingletonTask(ses, ecr); entityCleanupTask.reschedule(ENTITY_CLEANUP_INTERVAL, TimeUnit.SECONDS); - /* - * XXX Missing functionality if (restApi != null) { - * restApi.addRestletRoutable(new DeviceRoutable()); } else { - * logger.debug("Could not instantiate REST API"); } - */ - registerDeviceManagerDebugCounters(); - - /* - * XXX Missing functionality try { - * this.syncService.registerStore(DEVICE_SYNC_STORE_NAME, Scope.LOCAL); - * this.storeClient = this.syncService - * .getStoreClient(DEVICE_SYNC_STORE_NAME, String.class, - * DeviceSyncRepresentation.class); } catch (SyncException e) { throw - * new FloodlightModuleException("Error while setting up sync service", - * e); } - * - * Runnable consolidateStoreRunner = new Runnable() { - * - * @Override public void run() { deviceSyncManager.consolidateStore(); - * storeConsolidateTask.reschedule(syncStoreConsolidateIntervalMs, - * TimeUnit.MILLISECONDS); debugCounters.flushCounters(); } }; - * storeConsolidateTask = new SingletonTask(ses, - * consolidateStoreRunner); if (isMaster) - * storeConsolidateTask.reschedule(syncStoreConsolidateIntervalMs, - * TimeUnit.MILLISECONDS); - */ } /** @@ -759,49 +686,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, } } - // *************** - // IFlowReconcileListener - // *************** - /* - * XXX - Missing functionality - * - * @Override public Command reconcileFlows(ArrayList - * ofmRcList) { ListIterator iter = - * ofmRcList.listIterator(); while (iter.hasNext()) { OFMatchReconcile ofm = - * iter.next(); - * - * // Remove the STOPPed flow. if (Command.STOP == reconcileFlow(ofm)) { - * iter.remove(); } } - * - * if (ofmRcList.size() > 0) { return Command.CONTINUE; } else { return - * Command.STOP; } } - * - * protected Command reconcileFlow(OFMatchReconcile ofm) { - * debugCounters.updateCounter(CNT_RECONCILE_REQUEST); // Extract source - * entity information Entity srcEntity = - * getEntityFromFlowMod(ofm.ofmWithSwDpid, true); if (srcEntity == null) { - * debugCounters.updateCounter(CNT_RECONCILE_NO_SOURCE); return - * Command.STOP; } - * - * // Find the device by source entity Device srcDevice = - * findDeviceByEntity(srcEntity); if (srcDevice == null) { - * debugCounters.updateCounter(CNT_RECONCILE_NO_SOURCE); return - * Command.STOP; } // Store the source device in the context - * fcStore.put(ofm.cntx, CONTEXT_SRC_DEVICE, srcDevice); - * - * // Find the device matching the destination from the entity // classes of - * the source. Entity dstEntity = getEntityFromFlowMod(ofm.ofmWithSwDpid, - * false); Device dstDevice = null; if (dstEntity != null) { dstDevice = - * findDestByEntity(srcDevice.getEntityClass(), dstEntity); if (dstDevice != - * null) fcStore.put(ofm.cntx, CONTEXT_DST_DEVICE, dstDevice); else - * debugCounters.updateCounter(CNT_RECONCILE_NO_DEST); } else { - * debugCounters.updateCounter(CNT_RECONCILE_NO_DEST); } if - * (logger.isTraceEnabled()) { - * logger.trace("Reconciling flow: match={}, srcEntity={}, srcDev={}, " + - * "dstEntity={}, dstDev={}", new Object[] {ofm.ofmWithSwDpid.getOfMatch(), - * srcEntity, srcDevice, dstEntity, dstDevice } ); } return - * Command.CONTINUE; } - */ // ***************** // IListenDataPacket @@ -813,11 +697,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, if (inPkt == null) { return PacketResult.IGNORED; } - // try { - // throw new Exception("Sample"); - // } catch (Exception e) { - // logger.error("Sample stack trace", e); - // } Packet formattedPak = this.dataPacketService.decodeDataPacket(inPkt); Ethernet eth; @@ -831,7 +710,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, NodeConnector inPort = inPkt.getIncomingNodeConnector(); Entity srcEntity = getSourceEntityFromPacket(eth, inPort); if (srcEntity == null) { - // debugCounters.updateCounter(CNT_BROADCAST_SOURCE); return PacketResult.CONSUME; } @@ -846,38 +724,10 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, // Learn/lookup device information Device srcDevice = learnDeviceByEntity(srcEntity); if (srcDevice == null) { - // debugCounters.updateCounter(CNT_NO_SOURCE); return PacketResult.CONSUME; } logger.trace("Saw packet from device {}", srcDevice); - // // Store the source device in the context - // fcStore.put(cntx, CONTEXT_SRC_DEVICE, srcDevice); - // - // // Find the device matching the destination from the entity - // // classes of the source. - // Entity dstEntity = getDestEntityFromPacket(eth); - // Device dstDevice = null; - // if (dstEntity != null) { - // dstDevice = - // findDestByEntity(srcDevice.getEntityClass(), dstEntity); - // if (dstDevice != null) - // fcStore.put(cntx, CONTEXT_DST_DEVICE, dstDevice); - // //else - // //debugCounters.updateCounter(CNT_NO_DEST); - // } else { - // //debugCounters.updateCounter(CNT_NO_DEST); - // } - // - // if (logger.isTraceEnabled()) { - // logger.trace("Received PI: {} on switch {}, port {} *** eth={}" + - // " *** srcDev={} *** dstDev={} *** ", - // new Object[] { pi, sw.getStringId(), pi.getInPort(), eth, - // srcDevice, dstDevice }); - // } - // - // snoopDHCPClientName(eth, srcDevice); - return PacketResult.KEEP_PROCESSING; } @@ -885,32 +735,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, // Internal methods // **************** - /** - * Snoop and record client-provided host name from DHCP requests - * - * @param eth - * @param srcDevice - */ - // private void snoopDHCPClientName(Ethernet eth, Device srcDevice) { - // if (! (eth.getPayload() instanceof IPv4) ) - // return; - // IPv4 ipv4 = (IPv4) eth.getPayload(); - // if (! (ipv4.getPayload() instanceof UDP) ) - // return; - // UDP udp = (UDP) ipv4.getPayload(); - // if (!(udp.getPayload() instanceof DHCP)) - // return; - // DHCP dhcp = (DHCP) udp.getPayload(); - // byte opcode = dhcp.getOpCode(); - // if (opcode == DHCP.OPCODE_REQUEST) { - // DHCPOption dhcpOption = dhcp.getOption( - // DHCPOptionCode.OptionCode_Hostname); - // if (dhcpOption != null) { - // debugCounters.updateCounter(CNT_DHCP_CLIENT_NAME_SNOOPED); - // srcDevice.dhcpClientName = new String(dhcpOption.getData()); - // } - // } - // } /** * Check whether the given attachment point is valid given the current @@ -1013,90 +837,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, learnDeviceByEntity(e); } - /** - * Get a (partial) entity for the destination from the packet. - * - * @param eth - * @return - */ - // protected Entity getDestEntityFromPacket(Ethernet eth) { - // byte[] dlAddrArr = eth.getDestinationMACAddress(); - // long dlAddr = Ethernet.toLong(dlAddrArr); - // short vlan = eth.getVlanID(); - // int nwDst = 0; - // - // // Ignore broadcast/multicast destination - // if ((dlAddrArr[0] & 0x1) != 0) - // return null; - // - // if (eth.getPayload() instanceof IPv4) { - // IPv4 ipv4 = (IPv4) eth.getPayload(); - // nwDst = ipv4.getDestinationAddress(); - // } - // - // return new Entity(dlAddr, - // ((vlan >= 0) ? vlan : null), - // ((nwDst != 0) ? nwDst : null), - // null, - // null, - // null); - // } - - /** - * Parse an entity from an OFMatchWithSwDpid. - * - * @param ofmWithSwDpid - * @return the entity from the packet - */ - // private Entity getEntityFromFlowMod(OFMatchWithSwDpid ofmWithSwDpid, - // boolean isSource) { - // byte[] dlAddrArr = ofmWithSwDpid.getOfMatch().getDataLayerSource(); - // int nwSrc = ofmWithSwDpid.getOfMatch().getNetworkSource(); - // if (!isSource) { - // dlAddrArr = ofmWithSwDpid.getOfMatch().getDataLayerDestination(); - // nwSrc = ofmWithSwDpid.getOfMatch().getNetworkDestination(); - // } - // - // long dlAddr = Ethernet.toLong(dlAddrArr); - // - // // Ignore broadcast/multicast source - // if ((dlAddrArr[0] & 0x1) != 0) - // return null; - // - // Long swDpid = null; - // Short inPort = null; - // - // if (isSource) { - // swDpid = ofmWithSwDpid.getSwitchDataPathId(); - // inPort = ofmWithSwDpid.getOfMatch().getInputPort(); - // } - // - // /**for the new flow cache design, the flow mods retrived are not always - // from the source, learn AP should be disabled --meiyang*/ - // boolean learnap = false; - // /** - // * if (swDpid == null || - // inPort == null || - // !isValidAttachmentPoint(swDpid, inPort)) { - // // If this is an internal port or we otherwise don't want - // // to learn on these ports. In the future, we should - // // handle this case by labeling flows with something that - // // will give us the entity class. For now, we'll do our - // // best assuming attachment point information isn't used - // // as a key field. - // learnap = false; - // } - // */ - // - // short vlan = ofmWithSwDpid.getOfMatch().getDataLayerVirtualLan(); - // return new Entity(dlAddr, - // ((vlan >= 0) ? vlan : null), - // ((nwSrc != 0) ? nwSrc : null), - // (learnap ? swDpid : null), - // (learnap ? (int)inPort : null), - // new Date()); - // } - /** * Look up a {@link Device} based on the provided {@link Entity}. We first * check the primary index. If we do not find an entry there we classify the @@ -2026,25 +1766,6 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, return true; } - /** - * For testing: sets the interval between writes of the same device to the - * device store. - * - * @param intervalMs - */ - // void setSyncStoreWriteInterval(int intervalMs) { - // this.syncStoreWriteIntervalMs = intervalMs; - // } - - /** - * For testing: sets the time between transition to MASTER and consolidate - * store - * - * @param intervalMs - */ - // void setInitialSyncStoreConsolidateMs(int intervalMs) { - // this.initialSyncStoreConsolidateMs = intervalMs; - // } private long toLong(byte[] address) { long mac = 0; @@ -2390,251 +2111,4 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, } } - - /** - * For testing: consolidate the store NOW - */ - // void scheduleConsolidateStoreNow() { - // this.storeConsolidateTask.reschedule(0, TimeUnit.MILLISECONDS); - // } - - // private class DeviceSyncManager { - // // maps (opaque) deviceKey to the time in System.nanoTime() when we - // // last wrote the device to the sync store - // private ConcurrentMap lastWriteTimes = - // new ConcurrentHashMap(); - // - // /** - // * Write the given device to storage if we are MASTER. - // * Use this method if the device has significantly changed (e.g., - // * new AP, new IP, entities removed). - // * @param d the device to store - // */ - // public void storeDevice(Device d) { - // if (!isMaster) - // return; - // if (d == null) - // return; - // long now = System.nanoTime(); - // writeUpdatedDeviceToStorage(d); - // lastWriteTimes.put(d.getDeviceKey(), now); - // } - // - // /** - // * Write the given device to storage if we are MASTER and if the - // * last write for the device was more than this.syncStoreIntervalNs - // * time ago. - // * Use this method to updated last active times in the store. - // * @param d the device to store - // */ - // public void storeDeviceThrottled(Device d) { - // long intervalNs = syncStoreWriteIntervalMs*1000L*1000L; - // if (!isMaster) - // return; - // if (d == null) - // return; - // long now = System.nanoTime(); - // Long last = lastWriteTimes.get(d.getDeviceKey()); - // if (last == null || - // now - last > intervalNs) { - // writeUpdatedDeviceToStorage(d); - // lastWriteTimes.put(d.getDeviceKey(), now); - // } else { - // debugCounters.updateCounter(CNT_DEVICE_STORE_THROTTLED); - // } - // } - // - // /** - // * Remove the given device from the store. If only some entities have - // * been removed the updated device should be written using - // * {@link #storeDevice(Device)} - // * @param d - // */ - // public void removeDevice(Device d) { - // if (!isMaster) - // return; - // // FIXME: could we have a problem with concurrent put to the - // // hashMap? I.e., we write a stale entry to the map after the - // // delete and now are left with an entry we'll never clean up - // lastWriteTimes.remove(d.getDeviceKey()); - // try { - // // TODO: should probably do versioned delete. OTOH, even - // // if we accidentally delete, we'll write it again after - // // the next entity .... - // debugCounters.updateCounter(CNT_DEVICE_REMOVED_FROM_STORE); - // storeClient.delete(DeviceSyncRepresentation.computeKey(d)); - // } catch(ObsoleteVersionException e) { - // // FIXME - // } catch (SyncException e) { - // debugCounters.updateCounter(CNT_SYNC_EXCEPTION); - // logger.error("Could not remove device " + d + " from store", e); - // } - // } - // - // /** - // * Remove the given Versioned device from the store. If the device - // * was locally modified ignore the delete request. - // * @param syncedDeviceKey - // */ - // private void removeDevice(Versioned dev) { - // try { - // debugCounters.updateCounter(CNT_DEVICE_REMOVED_FROM_STORE); - // storeClient.delete(dev.getValue().getKey(), - // dev.getVersion()); - // } catch(ObsoleteVersionException e) { - // // Key was locally modified by another thread. - // // Do not delete and ignore. - // } catch(SyncException e) { - // debugCounters.updateCounter(CNT_SYNC_EXCEPTION); - // logger.error("Failed to remove device entry for " + - // dev.toString() + " from store.", e); - // } - // } - // - // /** - // * Synchronously transition from SLAVE to MASTER. By iterating through - // * the store and learning all devices from the store - // */ - // private void goToMaster() { - // if (logger.isDebugEnabled()) { - // logger.debug("Transitioning to MASTER role"); - // } - // debugCounters.updateCounter(CNT_TRANSITION_TO_MASTER); - // IClosableIterator>> - // iter = null; - // try { - // iter = storeClient.entries(); - // } catch (SyncException e) { - // debugCounters.updateCounter(CNT_SYNC_EXCEPTION); - // logger.error("Failed to read devices from sync store", e); - // return; - // } - // try { - // while(iter.hasNext()) { - // Versioned versionedDevice = - // iter.next().getValue(); - // DeviceSyncRepresentation storedDevice = - // versionedDevice.getValue(); - // if (storedDevice == null) - // continue; - // debugCounters.updateCounter(CNT_DEVICES_FROM_STORE); - // for(SyncEntity se: storedDevice.getEntities()) { - // learnDeviceByEntity(se.asEntity()); - // } - // } - // } finally { - // if (iter != null) - // iter.close(); - // } - // storeConsolidateTask.reschedule(initialSyncStoreConsolidateMs, - // TimeUnit.MILLISECONDS); - // } - // - // /** - // * Actually perform the write of the device to the store - // * FIXME: concurrent modification behavior - // * @param device The device to write - // */ - // private void writeUpdatedDeviceToStorage(Device device) { - // try { - // debugCounters.updateCounter(CNT_DEVICE_STORED); - // // FIXME: use a versioned put - // DeviceSyncRepresentation storeDevice = - // new DeviceSyncRepresentation(device); - // storeClient.put(storeDevice.getKey(), storeDevice); - // } catch (ObsoleteVersionException e) { - // // FIXME: what's the right behavior here. Can the store client - // // even throw this error? - // } catch (SyncException e) { - // debugCounters.updateCounter(CNT_SYNC_EXCEPTION); - // logger.error("Could not write device " + device + - // " to sync store:", e); - // } - // } - // - // /** - // * Iterate through all entries in the sync store. For each device - // * in the store check if any stored entity matches a live device. If - // * no entities match a live device we remove the entry from the store. - // * - // * Note: we do not check if all devices known to device manager are - // * in the store. We rely on regular packetIns for that. - // * Note: it's possible that multiple entries in the store map to the - // * same device. We don't check or handle this case. - // * - // * We need to perform this check after a SLAVE->MASTER transition to - // * get rid of all entries the old master might have written to the - // * store after we took over. We also run it regularly in MASTER - // * state to ensure we don't have stale entries in the store - // */ - // private void consolidateStore() { - // if (!isMaster) - // return; - // debugCounters.updateCounter(CNT_CONSOLIDATE_STORE_RUNS); - // if (logger.isDebugEnabled()) { - // logger.debug("Running consolidateStore."); - // } - // IClosableIterator>> - // iter = null; - // try { - // iter = storeClient.entries(); - // } catch (SyncException e) { - // debugCounters.updateCounter(CNT_SYNC_EXCEPTION); - // logger.error("Failed to read devices from sync store", e); - // return; - // } - // try { - // while(iter.hasNext()) { - // boolean found = false; - // Versioned versionedDevice = - // iter.next().getValue(); - // DeviceSyncRepresentation storedDevice = - // versionedDevice.getValue(); - // if (storedDevice == null) - // continue; - // for(SyncEntity se: storedDevice.getEntities()) { - // try { - // // Do we have a device for this entity?? - // IDevice d = findDevice(se.macAddress, se.vlan, - // se.ipv4Address, - // se.switchDPID, - // se.switchPort); - // if (d != null) { - // found = true; - // break; - // } - // } catch (IllegalArgumentException e) { - // // not all key fields provided. Skip entity - // } - // } - // if (!found) { - // // We currently DO NOT have a live device that - // // matches the current device from the store. - // // Delete device from store. - // if (logger.isDebugEnabled()) { - // logger.debug("Removing device {} from store. No " - // + "corresponding live device", - // storedDevice.getKey()); - // } - // debugCounters.updateCounter(CNT_CONSOLIDATE_STORE_DEVICES_REMOVED); - // removeDevice(versionedDevice); - // } - // } - // } finally { - // if (iter != null) - // iter.close(); - // } - // } - // } - // - // - // /** - // * For testing. Sets the syncService. Only call after init but before - // * startUp. Used by MockDeviceManager - // * @param syncService - // */ - // protected void setSyncServiceIfNotSet(ISyncService syncService) { - // if (this.syncService == null) - // this.syncService = syncService; - // } } diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java index ffb39d5e92..3c95ed8e1c 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java @@ -12,7 +12,6 @@ public abstract class AbstractBindingAwareConsumer implements BindingAwareConsum BindingAwareBroker broker = context.getService(brokerRef); broker.registerConsumer(this, context); startImpl(context); - //context.ungetService(brokerRef); } @Deprecated diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java index c1c38aa76c..cd3e45492d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java @@ -37,11 +37,6 @@ public abstract class Action implements Serializable { public Action() { } - /* - * public Action (ActionType type, Object value) { this.type = type; - * this.value = value; this.isValid = true; } - */ - /** * Checks if the passed value is in the valid range for this action * diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java index b9bed9a67d..f82ed8fcae 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java @@ -109,9 +109,6 @@ public class UDP extends Packet { * Store the value read from data stream in hdrFieldMap */ public void setHeaderField(String headerField, byte[] readValue) { - /*if (headerField.equals("Protocol")) { - payloadClass = decodeMap.get(readValue); - }*/ hdrFieldsMap.put(headerField, readValue); } diff --git a/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java b/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java index 6987ea9827..6bde9d7c93 100644 --- a/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java +++ b/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java @@ -752,7 +752,6 @@ public class Devices implements IDaylightWeb { @RequestMapping(value = "login") public String login(final HttpServletRequest request, final HttpServletResponse response) { - // response.setHeader("X-Page-Location", "/login"); /* * IUserManager userManager = (IUserManager) ServiceHelper * .getGlobalInstance(IUserManager.class, this); if (userManager == -- 2.36.6