Examples of SwitchSyncRepresentation


Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

                // returns a non-null or throws an exception
                if (versionedSwitch.getValue() == null) {
                    switchRemovedFromStore(key);
                    continue;
                }
                SwitchSyncRepresentation storedSwitch =
                        versionedSwitch.getValue();
                IOFSwitch sw = getOFSwitchInstance(storedSwitch.getDescription());
                sw.setFeaturesReply(storedSwitch.getFeaturesReply());
                if (!key.equals(storedSwitch.getFeaturesReply().getDatapathId())) {
                    counters.storeSyncError.updateCounterWithFlush();
                    log.error("Inconsistent DPIDs from switch sync store: " +
                              "key is {} but sw.getId() says {}. Ignoring",
                              HexString.toHexString(key), sw.getStringId());
                    continue;
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

        private synchronized void addSwitchToStore(IOFSwitch sw) {
            // Add to store
            // FIXME: do we need to use a put that takes a versioned here?
            // need to verify
            try {
                storeClient.put(sw.getId(), new SwitchSyncRepresentation(sw));
            } catch (ObsoleteVersionException e) {
                // FIXME: what's the right behavior here. Can the store client
                // even throw this error? Should not since all local store
                // access is synchronized
            } catch (SyncException e) {
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

            try {
                Versioned<SwitchSyncRepresentation> versionedSSr =
                        storeClient.get(sw.getId());
                if (versionedSSr.getValue() == null) {
                    // switch is absent
                    versionedSSr.setValue(new SwitchSyncRepresentation(sw));
                    storeClient.put(sw.getId(), versionedSSr);
                    return true;
                } else {
                    return false;
                }
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

        verify(sw);
        assertEquals(sw, controller.getSwitch(dpid));
        // drain updates and ignore
        controller.processUpdateQueueForTesting();

        SwitchSyncRepresentation storedSwitch = storeClient.getValue(dpid);
        assertEquals(featuresReply, storedSwitch.getFeaturesReply());
        assertEquals(desc, storedSwitch.getDescription());
        reset(sw);
        return sw;
    }
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

        }
        if (desc == null) {
            desc = createOFDescriptionStatistics();
        }

        SwitchSyncRepresentation ssr =
                new SwitchSyncRepresentation(featuresReply, desc);
        storeClient.put(dpid, ssr);

        Iterator<Long> keysToNotify = Collections.singletonList(dpid).iterator();
        controller.getStoreListener().keysModified(keysToNotify,
                                                   UpdateType.REMOTE);
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation


        OFFeaturesReply featuresReply = createOFFeaturesReply();
        featuresReply.setDatapathId(42L);
        OFDescriptionStatistics desc = createOFDescriptionStatistics();
        SwitchSyncRepresentation ssr =
                new SwitchSyncRepresentation(featuresReply, desc);
        storeClient.put(1L, ssr);

        Iterator<Long> keysToNotify = Collections.singletonList(1L).iterator();
        controller.getStoreListener().keysModified(keysToNotify,
                                                   UpdateType.REMOTE);
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

       // activate switch
       IOFSwitch sw = doActivateNewSwitch(dpid, desc, fr1);

       // check the store
       SwitchSyncRepresentation ssr = storeClient.getValue(dpid);
       assertNotNull(ssr);
       assertEquals(dpid, ssr.getDpid());
       assertEquals(1, ssr.getPorts().size());
       assertEquals(p1, ssr.getPorts().get(0).toOFPhysicalPort());

       IOFSwitchListener listener = createMock(IOFSwitchListener.class);
       controller.addOFSwitchListener(listener);
       // setup switch with the new, second features reply (and thus ports)
       setupSwitchForAddSwitch(sw, dpid, desc, fr2);
       listener.switchPortChanged(dpid, ImmutablePort.fromOFPhysicalPort(p2),
                                  PortChangeType.OTHER_UPDATE);
       expectLastCall().once();
       replay(listener);
       replay(sw);
       controller.notifyPortChanged(sw, ImmutablePort.fromOFPhysicalPort(p2),
                                    PortChangeType.OTHER_UPDATE);
       controller.processUpdateQueueForTesting();
       verify(listener);
       verify(sw);

       // check the store
       ssr = storeClient.getValue(dpid);
       assertNotNull(ssr);
       assertEquals(dpid, ssr.getDpid());
       assertEquals(1, ssr.getPorts().size());
       assertEquals(p2, ssr.getPorts().get(0).toOFPhysicalPort());
   }
View Full Code Here

Examples of net.floodlightcontroller.core.SwitchSyncRepresentation

        verify(sw);
        assertEquals(sw, controller.getSwitch(0L));
        controller.processUpdateQueueForTesting();
        verify(listener);

        SwitchSyncRepresentation storedSwitch = storeClient.getValue(0L);
        assertEquals(createOFFeaturesReply(), storedSwitch.getFeaturesReply());
        assertEquals(createOFDescriptionStatistics(),
                     storedSwitch.getDescription());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.