当前位置: 首页>>代码示例>>Java>>正文


Java OFPortReason.DELETE属性代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortReason.DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java OFPortReason.DELETE属性的具体用法?Java OFPortReason.DELETE怎么用?Java OFPortReason.DELETE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.projectfloodlight.openflow.protocol.OFPortReason的用法示例。


在下文中一共展示了OFPortReason.DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMessage

/**
 * Handle the message coming from the dataplane.
 *
 * @param m the actual message
 */
@Override
public final void handleMessage(OFMessage m) {
    if (this.role == RoleState.MASTER || m instanceof OFPortStatus) {
        try {
            // TODO revisit states other than ports should
            // also ignore role state.
            if (m.getType() == OFType.PORT_STATUS) {
                OFPortStatus portStatus = (OFPortStatus) m;
                if (portStatus.getReason() == OFPortReason.DELETE) {
                    portDescs.remove(portStatus.getDesc().getPortNo());
                } else {
                    portDescs.put(portStatus.getDesc().getPortNo(), portStatus.getDesc());
                }
            }
            this.agent.processMessage(dpid, m);
        } catch (Exception e) {
            log.warn("Unhandled exception processing {}@{}", m, dpid, e);
        }
    } else {
        log.trace("Dropping received message {}, was not MASTER", m);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:AbstractOpenFlowSwitch.java

示例2: buildPortDescription

private PortDescription buildPortDescription(OFPortStatus status) {
    OFPortDesc port = status.getDesc();
    if (status.getReason() != OFPortReason.DELETE) {
        return buildPortDescription(port);
    } else {
        PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
        Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
        SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
        return new DefaultPortDescription(portNo, false, type,
                portSpeed(port), annotations);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:OpenFlowDeviceProvider.java

示例3: buildPortDescription

private PortDescription buildPortDescription(OFPortStatus status) {
    OFPortDesc port = status.getDesc();
    if (status.getReason() != OFPortReason.DELETE) {
        return buildPortDescription(port);
    } else {
        PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
        Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
        SparseAnnotations annotations = makePortNameAnnotation(port);
        return new DefaultPortDescription(portNo, false, type,
                                          portSpeed(port), annotations);
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:12,代码来源:OpenFlowDeviceProvider.java

示例4: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.2: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFPortReasonSerializerVer12.java

示例5: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.3: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFPortReasonSerializerVer13.java

示例6: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.0: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFPortReasonSerializerVer10.java

示例7: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.1: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFPortReasonSerializerVer11.java

示例8: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.4: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFPortReasonSerializerVer14.java

示例9: buildPortDescription

private PortDescription buildPortDescription(OFPortStatus status) {
    OFPortDesc port = status.getDesc();
    if (status.getReason() != OFPortReason.DELETE) {
        return buildPortDescription(port);
    } else {
        PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
        Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
        SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
        return new DefaultPortDescription(portNo, false, type,
                                          portSpeed(port), annotations);
    }
}
 
开发者ID:fp7-netide,项目名称:Engine,代码行数:12,代码来源:NetIDEDeviceProvider.java

示例10: portChanged

@Override
public void portChanged(Dpid dpid, OFPortStatus status) {
    LOG.debug("portChanged({},{})", dpid, status);
    PortDescription portDescription = buildPortDescription(status);
    if (status.getReason() != OFPortReason.DELETE) {
        providerService.portStatusChanged(deviceId(uri(dpid)), portDescription);
    } else {
        providerService.deletePort(deviceId(uri(dpid)), portDescription);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:10,代码来源:OpenFlowDeviceProvider.java

示例11: buildPortDescription

private PortDescription buildPortDescription(OFPortStatus status) {
    OFPortDesc port = status.getDesc();
    if (status.getReason() != OFPortReason.DELETE) {
        return buildPortDescription(port);
    } else {
        PortDescription desc = buildPortDescription(port);
        if (desc.isEnabled()) {
            return DefaultPortDescription.builder(desc)
                    .isEnabled(false)
                    .build();
        }
        return desc;
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:14,代码来源:OpenFlowDeviceProvider.java

示例12: ofWireValue

public static OFPortReason ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFPortReason.ADD;
        case DELETE_VAL:
            return OFPortReason.DELETE;
        case MODIFY_VAL:
            return OFPortReason.MODIFY;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFPortReason in version 1.5: " + val);
    }
}
 
开发者ID:floodlight,项目名称:loxigen-artifacts,代码行数:12,代码来源:OFPortReasonSerializerVer15.java

示例13: handlePortStatusMessage

/**
 * Handle a OFPortStatus message, update the internal data structures
 * that store ports and return the list of OFChangeEvents.
 *
 * This method will increment error/warn counters and log
 *
 * @param ps
 * @return
 */
@SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public OrderedCollection<PortChangeEvent> handlePortStatusMessage(OFPortStatus ps) {
	if (ps == null) {
		throw new NullPointerException("OFPortStatus message must " +
				"not be null");
	}
	lock.writeLock().lock();
	try {
		OFPortDesc port = ps.getDesc();
		OFPortReason reason = ps.getReason();
		if (reason == null) {
			throw new IllegalArgumentException("Unknown PortStatus " +
					"reason code " + ps.getReason());
		}

		if (log.isDebugEnabled()) {
			log.debug("Handling OFPortStatus: {} for {}",
					reason, String.format("%s (%d)", port.getName(), port.getPortNo().getPortNumber()));
		}

		if (reason == OFPortReason.DELETE)
			return handlePortStatusDelete(port);

		// We handle ADD and MODIFY the same way. Since OpenFlow
		// doesn't specify what uniquely identifies a port the
		// notion of ADD vs. MODIFY can also be hazy. So we just
		// compare the new port to the existing ones.
		Map<OFPort,OFPortDesc> newPortByNumber =
				new HashMap<OFPort, OFPortDesc>(portsByNumber);
		OrderedCollection<PortChangeEvent> events = getSinglePortChanges(port);
		for (PortChangeEvent e: events) {
			switch(e.type) {
			case DELETE:
				newPortByNumber.remove(e.port.getPortNo());
				break;
			case ADD:
				if (reason != OFPortReason.ADD) {
					// weird case
				}
				// fall through
			case DOWN:
			case OTHER_UPDATE:
			case UP:
				// update or add the port in the map
				newPortByNumber.put(e.port.getPortNo(), e.port);
				break;
			}
		}
		updatePortsWithNewPortsByNumber(newPortByNumber);
		return events;
	} finally {
		lock.writeLock().unlock();
	}

}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:64,代码来源:OFSwitch.java

示例14: handlePortStatusMessage

/**
 * Handle a OFPortStatus message, update the internal data structures
 * that store ports and return the list of OFChangeEvents.
 *
 * This method will increment error/warn counters and log
 *
 * @param ps
 * @return
 */
@SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public OrderedCollection<PortChangeEvent> handlePortStatusMessage(OFPortStatus ps) {
    if (ps == null) {
        throw new NullPointerException("OFPortStatus message must " +
                                       "not be null");
    }
    lock.writeLock().lock();
    try {
        OFPortDesc port = ps.getDesc();
        OFPortReason reason = ps.getReason();
        if (reason == null) {
            throw new IllegalArgumentException("Unknown PortStatus " +
                    "reason code " + ps.getReason());
        }

        if (log.isDebugEnabled()) {
            log.debug("Handling OFPortStatus: {} for {}",
                      reason, String.format("%s (%d)", port.getName(), port.getPortNo().getPortNumber()));
        }

        if (reason == OFPortReason.DELETE)
            return handlePortStatusDelete(port);

        // We handle ADD and MODIFY the same way. Since OpenFlow
        // doesn't specify what uniquely identifies a port the
        // notion of ADD vs. MODIFY can also be hazy. So we just
        // compare the new port to the existing ones.
        Map<OFPort,OFPortDesc> newPortByNumber =
            new HashMap<OFPort, OFPortDesc>(portsByNumber);
        OrderedCollection<PortChangeEvent> events = getSinglePortChanges(port);
        for (PortChangeEvent e: events) {
            switch(e.type) {
                case DELETE:
                    newPortByNumber.remove(e.port.getPortNo());
                    break;
                case ADD:
                    if (reason != OFPortReason.ADD) {
                        // weird case
                    }
                    // fall through
                case DOWN:
                case OTHER_UPDATE:
                case UP:
                    // update or add the port in the map
                    newPortByNumber.put(e.port.getPortNo(), e.port);
                    break;
            }
        }
        updatePortsWithNewPortsByNumber(newPortByNumber);
        return events;
    } finally {
        lock.writeLock().unlock();
    }

}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:64,代码来源:OFSwitch.java

示例15: handlePortStatusMessage

/**
 * Handle a OFPortStatus message, update the internal data structures
 * that store ports and return the list of OFChangeEvents.
 *
 * This method will increment error/warn counters and log
 *
 * @param ps
 * @return
 */
public OrderedCollection<PortChangeEvent> handlePortStatusMessage(OFPortStatus ps) {
    if (ps == null) {
        throw new NullPointerException("OFPortStatus message must " +
                "not be null");
    }
    lock.writeLock().lock();
    try {
        OFPortReason reason = ps.getReason();
        if (reason == null) {
            throw new IllegalArgumentException("Unknown PortStatus " +
                    "reason code " + ps.getReason());
        }

        if (log.isDebugEnabled()) {
            log.debug("Handling OFPortStatus: {} for {} in sw {}",
                    reason, ps, getStringId());
        }

        if (reason == OFPortReason.DELETE)
            return handlePortStatusDelete(ps.getDesc());

        // We handle ADD and MODIFY the same way. Since OpenFlow
        // doesn't specify what uniquely identifies a port the
        // notion of ADD vs. MODIFY can also be hazy. So we just
        // compare the new port to the existing ones.
        Map<Integer, OFPortDesc> newPortByNumber =
                new HashMap<Integer, OFPortDesc>(portsByNumber);
        OrderedCollection<PortChangeEvent> events =
                getSinglePortChanges(ps.getDesc());
        for (PortChangeEvent e : events) {
            switch (e.type) {
            case DELETE:
                newPortByNumber.remove(e.port.getPortNo().getPortNumber());
                break;
            case ADD:
                if (reason != OFPortReason.ADD) {
                    // weird case
                }
                newPortByNumber.put(e.port.getPortNo().getPortNumber(),
                        e.port);
                break;
            case DOWN:
                newPortByNumber.put(e.port.getPortNo().getPortNumber(),
                        e.port);
                break;
            case OTHER_UPDATE:
                newPortByNumber.put(e.port.getPortNo().getPortNumber(),
                        e.port);
                break;
            case UP:
                newPortByNumber.put(e.port.getPortNo().getPortNumber(),
                        e.port);
                break;
            }
        }
        updatePortsWithNewPortsByNumber(newPortByNumber);
        return events;
    } finally {
        lock.writeLock().unlock();
    }

}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:71,代码来源:OFSwitchImplBase.java


注:本文中的org.projectfloodlight.openflow.protocol.OFPortReason.DELETE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。