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


Java OFMessage.Builder方法代码示例

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


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

示例1: sendHandshakeHelloMessage

import org.projectfloodlight.openflow.protocol.OFMessage; //导入方法依赖的package包/类
/**
 * Send hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHandshakeHelloMessage() throws IOException {
    // The OF protocol requires us to start things off by sending the highest
    // version of the protocol supported.

    // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3 (ofp_version=0x04)
    // see Sec. 7.5.1 of the OF1.3.4 spec
    U32 bitmap = U32.ofRaw(0x00000012);
    OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
            .setBitmaps(Collections.singletonList(bitmap))
            .build();
    OFMessage.Builder mb = factory13.buildHello()
            .setXid(this.handshakeTransactionIds--)
            .setElements(Collections.singletonList(hem));
    log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
    channel.write(Collections.singletonList(mb.build()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OFChannelHandler.java

示例2: equalsIgnoreXid

import org.projectfloodlight.openflow.protocol.OFMessage; //导入方法依赖的package包/类
/**
 * Returns true if each object is deeply-equal in the same manner that
 * Object's equals() does with the exception of the XID field, which is
 * ignored; otherwise, returns false.
 * 
 * NOTE: This function is VERY INEFFICIENT and creates a new OFMessage
 * object in order to the the comparison minus the XID. It is advised
 * that you use it sparingly and ideally only within unit tests.
 * 
 * @param a; object A to compare
 * @param b; object B to compare
 * @return true if A and B are deeply-equal; false otherwise
 */
public static boolean equalsIgnoreXid(OFMessage a, OFMessage b) {
	OFMessage.Builder mb = b.createBuilder().setXid(a.getXid());
	return a.equals(mb.build());
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:OFMessageUtils.java


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