Projects >> floodlight >>bd3d1bf0b5e4d252b708ed4668114efdc153e59f

Chunk
Conflicting content
            linkChanged = false;

            if (oldInfo == null) {
<<<<<<< HEAD
                addLink(lt, newInfo);
=======
                // index it by switch source
                if (!switchLinks.containsKey(lt.getSrc()))
                    switchLinks.put(lt.getSrc(), new HashSet());
                switchLinks.get(lt.getSrc()).add(lt);

                // index it by switch dest
                if (!switchLinks.containsKey(lt.getDst()))
                    switchLinks.put(lt.getDst(), new HashSet());
                switchLinks.get(lt.getDst()).add(lt);

                // index both ends by switch:port
                if (!portLinks.containsKey(srcNpt))
                    portLinks.put(srcNpt, new HashSet());
                portLinks.get(srcNpt).add(lt);

                if (!portLinks.containsKey(dstNpt))
                    portLinks.put(dstNpt, new HashSet());
                portLinks.get(dstNpt).add(lt);

                writeLinkToStorage(lt, newInfo);
>>>>>>> 88831be8b521bc12b0a5547a913e1dc8e864a5b2
                updateOperation = UpdateOperation.LINK_UPDATED;
                linkChanged = true;
Solution content
            linkChanged = false;

            if (oldInfo == null) {
                addLink(lt, newInfo);
                updateOperation = UpdateOperation.LINK_UPDATED;
                linkChanged = true;
File
LinkDiscoveryManager.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Chunk
Conflicting content
                               linkType,
                               EvAction.LINK_ADDED, "LLDP Recvd");
            } else {
<<<<<<< HEAD
                linkChanged = updateLink(lt, oldInfo, newInfo);
=======
                // Since the link info is already there, we need to
                // update the right fields.
                if (newInfo.getUnicastValidTime() == null) {
                    // This is due to a multicast LLDP, so copy the old unicast
                    // value.
                    if (oldInfo.getUnicastValidTime() != null) {
                        newInfo.setUnicastValidTime(oldInfo.getUnicastValidTime());
                    }
                } else if (newInfo.getMulticastValidTime() == null) {
                    // This is due to a unicast LLDP, so copy the old multicast
                    // value.
                    if (oldInfo.getMulticastValidTime() != null) {
                        newInfo.setMulticastValidTime(oldInfo.getMulticastValidTime());
                    }
                }

                Long oldTime = oldInfo.getUnicastValidTime();
                Long newTime = newInfo.getUnicastValidTime();
                // the link has changed its state between openflow and
                // non-openflow
                // if the unicastValidTimes are null or not null
                if (oldTime != null & newTime == null) {
                    // openflow -> non-openflow transition
                    // we need to add the link tuple to the portNOFLinks
                    linkChanged = true;
                } else if (oldTime == null & newTime != null) {
                    // non-openflow -> openflow transition
                    // we need to remove the link from the portNOFLinks
                    linkChanged = true;
                }

                // Only update the port states if they've changed
                if (newInfo.getSrcPortState().intValue() != oldInfo.getSrcPortState()
                                                                   .intValue()
                    || newInfo.getDstPortState().intValue() != oldInfo.getDstPortState()
                                                                      .intValue())
                                                                                  linkChanged = true;

                // Write changes to storage. This will always write the updated
                // valid time, plus the port states if they've changed (i.e. if
                // they weren't set to null in the previous block of code.
                writeLinkToStorage(lt, newInfo);
>>>>>>> 88831be8b521bc12b0a5547a913e1dc8e864a5b2

                if (linkChanged) {
                    updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
Solution content
                               linkType,
                               EvAction.LINK_ADDED, "LLDP Recvd");
            } else {
                linkChanged = updateLink(lt, oldInfo, newInfo);
                if (linkChanged) {
                    updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
File
LinkDiscoveryManager.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
    // IHAListener
    //***************

<<<<<<< HEAD
    private class HAListenerDelegate implements IHAListener {
        @Override
        public void  transitionToMaster() {
            if (log.isTraceEnabled()) {
                log.trace("Sending LLDPs "
                        + "to HA change from SLAVE->MASTER");
            }
            LinkDiscoveryManager.this.role = Role.MASTER;
            clearAllLinks();
            readTopologyConfigFromStorage();
            log.debug("Role Change to Master: Rescheduling discovery task.");
            discoveryTask.reschedule(1, TimeUnit.MICROSECONDS);
=======
    @Override
    public void roleChanged(Role oldRole, Role newRole) {
        switch (newRole) {
            case MASTER:
                if (oldRole == Role.SLAVE) {
                    if (log.isTraceEnabled()) {
                        log.trace("Sending LLDPs "
                                  + "to HA change from SLAVE->MASTER");
                    }
                    clearAllLinks();
                    readTopologyConfigFromStorage();
                    log.debug("Role Change to Master: Rescheduling discovery task.");
                    discoveryTask.reschedule(1, TimeUnit.MICROSECONDS);
                }
                break;
            case SLAVE:
                if (log.isTraceEnabled()) {
                    log.trace("Clearing links due to "
                              + "HA change to SLAVE");
                }
                switchLinks.clear();
                links.clear();
                portLinks.clear();
                discoverOnAllPorts();
                break;
            default:
                break;
>>>>>>> 88831be8b521bc12b0a5547a913e1dc8e864a5b2
        }
        @Override
Solution content
    // IHAListener
    //***************

    private class HAListenerDelegate implements IHAListener {
        @Override
        public void  transitionToMaster() {
            if (log.isTraceEnabled()) {
                log.trace("Sending LLDPs "
                        + "to HA change from SLAVE->MASTER");
            }
            LinkDiscoveryManager.this.role = Role.MASTER;
            clearAllLinks();
            readTopologyConfigFromStorage();
            log.debug("Role Change to Master: Rescheduling discovery task.");
            discoveryTask.reschedule(1, TimeUnit.MICROSECONDS);
        }

        @Override
File
LinkDiscoveryManager.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Break statement
Case statement
Class signature
If statement
Method invocation
Method signature
Switch statement