Package net.floodlightcontroller.devicemanager

Examples of net.floodlightcontroller.devicemanager.IEntityClass


     */
    protected Device findDeviceByEntity(Entity entity) {
        // Look up the fully-qualified entity to see if it already
        // exists in the primary entity index.
        Long deviceKey = primaryIndex.findByEntity(entity);
        IEntityClass entityClass = null;

        if (deviceKey == null) {
            // If the entity does not exist in the primary entity index,
            // use the entity classifier for find the classes for the
            // entity. Look up the entity in the returned class'
View Full Code Here


            deviceUpdates = null;

            // Look up the fully-qualified entity to see if it already
            // exists in the primary entity index.
            Long deviceKey = primaryIndex.findByEntity(entity);
            IEntityClass entityClass = null;

            if (deviceKey == null) {
                // If the entity does not exist in the primary entity index,
                // use the entity classifier for find the classes for the
                // entity. Look up the entity in the returned class'
                // class entity index.
                entityClass = entityClassifier.classifyEntity(entity);
                if (entityClass == null) {
                    // could not classify entity. No device
                    device = null;
                    break;
                }
                ClassState classState = getClassState(entityClass);

                if (classState.classIndex != null) {
                    deviceKey =
                            classState.classIndex.findByEntity(entity);
                }
            }
            if (deviceKey != null) {
                // If the primary or secondary index contains the entity
                // use resulting device key to look up the device in the
                // device map, and use the referenced Device below.
                device = deviceMap.get(deviceKey);
                if (device == null) {
                    // This can happen due to concurrent modification
                    if (logger.isDebugEnabled()) {
                        logger.debug("No device for deviceKey {} while "
                                     + "while processing entity {}",
                                     deviceKey, entity);
                    }
                    // if so, then try again till we don't even get the device key
                    // and so we recreate the device
                    continue;
                }
            } else {
                // If the secondary index does not contain the entity,
                // create a new Device object containing the entity, and
                // generate a new device ID if the the entity is on an
                // attachment point port. Otherwise ignore.
                if (entity.hasSwitchPort() &&
                        !topology.isAttachmentPointPort(entity.getSwitchDPID(),
                                                 entity.getSwitchPort().shortValue())) {
                    cntDeviceOnInternalPortNotLearned.updateCounterNoFlush();
                    if (logger.isDebugEnabled()) {
                        logger.debug("Not learning new device on internal"
                                     + " link: {}", entity);
                    }
                    device = null;
                    break;
                }
                // Before we create the new device also check if
                // the entity is allowed (e.g., for spoofing protection)
                if (!isEntityAllowed(entity, entityClass)) {
                    cntPacketNotAllowed.updateCounterNoFlush();
                    if (logger.isDebugEnabled()) {
                        logger.debug("PacketIn is not allowed {} {}",
                                    entityClass.getName(), entity);
                    }
                    device = null;
                    break;
                }
                deviceKey = deviceKeyCounter.getAndIncrement();
View Full Code Here

     */
    private boolean updateIndices(Device device, Long deviceKey) {
        if (!primaryIndex.updateIndex(device, deviceKey)) {
            return false;
        }
        IEntityClass entityClass = device.getEntityClass();
        ClassState classState = getClassState(entityClass);

        if (classState.classIndex != null) {
            if (!classState.classIndex.updateIndex(device,
                                                   deviceKey))
View Full Code Here

            logger.debug("In reclassify for null device");
            return false;
        }
        boolean needToReclassify = false;
        for (Entity entity : device.entities) {
            IEntityClass entityClass =
                    this.entityClassifier.classifyEntity(entity);
            if (entityClass == null || device.getEntityClass() == null) {
                needToReclassify = true;
                break;
            }
            if (!entityClass.getName().
                    equals(device.getEntityClass().getName())) {
                needToReclassify = true;
                break;
            }
        }
View Full Code Here

    @Override
    protected boolean matches(Device value) {
        boolean match;
        if (entityClasses != null) {
            IEntityClass clazz = value.getEntityClass();
            if (clazz == null) return false;

            match = false;
            for (IEntityClass entityClass : entityClasses) {
                if (clazz.equals(entityClass)) {
                    match = true;
                    break;
                }
            }
            if (!match) return false;               
View Full Code Here

    }


    private void doTestEntityOrdering(boolean computeInsertionPoint) throws Exception {
        Entity e = new Entity(10L, null, null, null, null, null);
        IEntityClass ec = createNiceMock(IEntityClass.class);
        Device d = new Device(deviceManager, 1L, e, ec);

        int expectedLength = 1;
        Long[] macs = new Long[] {  5L// new first element
                                   15L// new last element
View Full Code Here

        d2b = deviceManager.getDeviceIteratorForQuery(entity2b.getMacAddress(),
                entity2b.getVlan(), entity2b.getIpv4Address(),
                entity2b.getSwitchDPID(), entity2b.getSwitchPort()).next();
        assertEquals(d2, d2b);

        IEntityClass eC1 = flexClassifier.createTestEntityClass("C1");
        IEntityClass eC2 = flexClassifier.createTestEntityClass("C2");

        flexClassifier.addVlanEntities((short)1, eC1);
        flexClassifier.addVlanEntities((short)2, eC1);

        deviceManager.reclassifyDevice(d1);
View Full Code Here

TOP

Related Classes of net.floodlightcontroller.devicemanager.IEntityClass

Copyright © 2018 www.massapicom. 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.