Projects >> floodlight >>3ed7806202376de32ad6155785fbc960907db0ff

Chunk
Conflicting content
    }
    
    /**
<<<<<<< HEAD
     * Check whether the given attachment point is valid given the current
     * topology
     * @param switchDPID the DPID
     * @param switchPort the port
     * @return true if it's a valid attachment point
=======
     * @param linkDiscovery the link discovery service to set
>>>>>>> 755b9cc2deced03fe491fc7cc6700ef5a8418df1
     */
    protected boolean isValidAttachmentPoint(long switchDPID,
                                             int switchPort) {
Solution content
    }
    
    /**
     * Check whether the given attachment point is valid given the current
     * topology
     * @param switchDPID the DPID
     * @param switchPort the port
     * @return true if it's a valid attachment point
     */
    protected boolean isValidAttachmentPoint(long switchDPID,
                                             int switchPort) {
File
DeviceManagerImpl.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
                // update indices
                if (!updateIndices(device, deviceKey)) {
                    continue;
<<<<<<< HEAD
=======

                DeviceAttachmentPoint existingDap = tempAPMap.get(clusterId);
                if (existingDap != null) {
                    // We compare to see which one is newer, move attachment 
                    // point to "old" list.
                    // They are removed after deleting from storage.
                    if (isNewer(dap, existingDap)) {
                        tempAPMap.put(clusterId, dap);
                        tempOldAPMap.put(clusterId, existingDap);
                    } else {
                        tempOldAPMap.put(clusterId, dap);
                    }
                } else {
                    tempAPMap.put(clusterId, dap);
>>>>>>> e2c095ca47fbba2ca8981bb7cf625af100d7ff39
                }
                updateSecondaryIndices(entity, 
                                       device.getEntityClasses(), 
Solution content
                // update indices
                if (!updateIndices(device, deviceKey)) {
                    continue;
                }
                updateSecondaryIndices(entity, 
                                       device.getEntityClasses(), 
File
DeviceManagerImpl.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
        }
    }

                break;
            }
        }
<<<<<<< HEAD
           
        if (deleteQueue != null) {
            for (Long l : deleteQueue) {
                deviceMap.remove(l);
            }
=======

        synchronized (d) {
            /**
             * Since the update below is happening on a copy of the device it
             * should not impact packetIn processing time due to lock contention
             *
             * Also make sure the attachmentPoints are in non-blocked state
             */
            for (DeviceAttachmentPoint dap: tempAPMap.values()) {
                if (log.isDebugEnabled()) {
                    log.debug("Reset AP {} for device {}", dap, d);
                }
            	//dap.setBlocked(false);
                dap.resetConflictState();
            }
            d.setAttachmentPoints(tempAPMap.values());
            for (DeviceAttachmentPoint dap : tempOldAPMap.values()) {
                if (log.isDebugEnabled()) {
                    log.debug("Reset Old AP {} for device {}", dap, d);
                }
            	//dap.setBlocked(false);
                dap.resetConflictState();
                d.addOldAttachmentPoint(dap);
            }

            if (log.isDebugEnabled()) {
    public void clearAllDeviceStateFromMemory() {
                log.debug("After cleanup, device {}", d);
            }
        devMgrMaps.clearMaps();
    }

    private Date ageBoundaryDifference(Date currentDate, long expire) {
        if (expire == 0) {
            return new Date(0);
        }
        return new Date(currentDate.getTime() - 1000*expire);
    }

    // *********************
    // Storage Write Methods
    // *********************

    protected void writeDeviceToStorage(Device device, Date currentDate) {
        Map rowValues = new HashMap();
        String macString = device.getDlAddrString();
        rowValues.put(MAC_COLUMN_NAME, macString);
        if (device.getVlanId() != null)
            rowValues.put(VLAN_COLUMN_NAME, device.getVlanId());
        rowValues.put(LAST_SEEN_COLUMN_NAME, currentDate);
        storageSource.updateRowAsync(DEVICE_TABLE_NAME, rowValues);
        device.lastSeenWrittenToStorage(currentDate);

        for (DeviceAttachmentPoint attachmentPoint: 
                                            device.getAttachmentPoints()) {
            writeAttachmentPointToStorage(device, attachmentPoint, currentDate);
        }
        for (DeviceNetworkAddress networkAddress: 
                                            device.getNetworkAddresses()) {
            writeNetworkAddressToStorage(device, networkAddress, currentDate);
        }
    }

    protected void writeAttachmentPointToStorage(Device device,
            DeviceAttachmentPoint attachmentPoint, Date currentDate) {
        assert(device != null);
        assert(attachmentPoint != null);
        String deviceId = device.getDlAddrString();
        SwitchPortTuple switchPort = attachmentPoint.getSwitchPort();
        assert(switchPort != null);
        String switchId = switchPort.getSw().getStringId();
        Short port = switchPort.getPort();
        String attachmentPointId = 
                            deviceId + "|" + switchId + "|" + port.toString();

        Map rowValues = new HashMap();
        rowValues.put(ID_COLUMN_NAME, attachmentPointId);
        rowValues.put(DEVICE_COLUMN_NAME, deviceId);
        rowValues.put(SWITCH_COLUMN_NAME, switchId);
        rowValues.put(PORT_COLUMN_NAME, port);
        rowValues.put(LAST_SEEN_COLUMN_NAME, attachmentPoint.getLastSeen());
        String status = null;
        if (attachmentPoint.isBlocked())
            status = "blocked: duplicate mac";
        rowValues.put(AP_STATUS_COLUMN_NAME, status);

        storageSource.updateRowAsync(DEVICE_ATTACHMENT_POINT_TABLE_NAME, 
                                                                    rowValues);
        attachmentPoint.lastSeenWrittenToStorage(currentDate);
    }

    // **********************
    // Storage Remove Methods
    // **********************

    protected void removeAttachmentPointFromStorage(String deviceId,
                                    String switchId, String port) {
        String attachmentPointId =
                        deviceId + "|" + switchId + "|" + port;
        try {
            storageSource.deleteRowAsync(
                        DEVICE_ATTACHMENT_POINT_TABLE_NAME, attachmentPointId);
        } catch (NullPointerException e) {
            log.warn("Null ptr exception for device {} on sw {} port {}",
                    new Object[] {deviceId, switchId, port});
        }
    }

    protected void writeNetworkAddressToStorage(Device device,
            DeviceNetworkAddress networkAddress, Date currentDate) {
        assert(device != null);
        assert(networkAddress != null);
        String deviceId = device.getDlAddrString();
        String networkAddressString = IPv4.fromIPv4Address(
                                            networkAddress.getNetworkAddress());
        String networkAddressId = deviceId + "|" + networkAddressString;

        if (networkAddress.getNetworkAddress() == 0) {
            log.error("Zero network address for device {}\n {}",
                device, Thread.currentThread().getStackTrace());
            return;
>>>>>>> e2c095ca47fbba2ca8981bb7cf625af100d7ff39
        }
        
        processUpdates(deviceUpdates);
Solution content
                break;
            }
        }
           
        if (deleteQueue != null) {
            for (Long l : deleteQueue) {
                deviceMap.remove(l);
            }
        }
        
        processUpdates(deviceUpdates);
File
DeviceManagerImpl.java
Developer's decision
Version 1
Kind of conflict
Assert statement
Comment
For statement
If statement
Method declaration
Method invocation
Method signature
Return statement
Synchronized statement
Variable