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


Java OFPortReason类代码示例

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


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

示例1: handleMessage

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
/**
 * 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,代码行数:28,代码来源:AbstractOpenFlowSwitch.java

示例2: sendPortStatus

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
private void sendPortStatus(Port port, OFPortReason ofPortReason) {
    Set<Channel> channels = controllerChannels();
    if (channels.isEmpty()) {
        log.trace("No channels present.  Port status will not be sent.");
        return;
    }
    OFPortDesc ofPortDesc = portDesc(port);
    OFPortStatus ofPortStatus = FACTORY.buildPortStatus()
            .setDesc(ofPortDesc)
            .setReason(ofPortReason)
            .build();
    log.trace("Sending port status {}", ofPortStatus);
    channels.forEach(channel -> {
        channel.writeAndFlush(Collections.singletonList(ofPortStatus));
    });
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:DefaultOFSwitch.java

示例3: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OpenFlowDeviceProvider.java

示例4: portChanged

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
@Test
public void portChanged() {
    OFPortStatus stat = SW1.factory().buildPortStatus()
            .setReason(OFPortReason.ADD)
            .setDesc(PD3)
            .build();
    controller.listener.portChanged(DPID1, stat);
    assertNotNull("never went throught the provider service", registry.descr);
    assertEquals("port status unhandled", 3, registry.ports.get(DID1).size());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:OpenFlowDeviceProviderTest.java

示例5: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OpenFlowDeviceProvider.java

示例6: portStatus

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
private OFPortStatus portStatus(boolean up, int port) {
    OFPortDesc desc = portDesc(port, up);
    OFPortStatus status = OFFactoryVer10.INSTANCE.buildPortStatus()
            .setDesc(desc)
            .setReason(up ? OFPortReason.ADD : OFPortReason.DELETE).build();
    return status;

}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:9,代码来源:OpenFlowLinkProviderTest.java

示例7: readFrom

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
public static OFPortReason readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readByte());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:8,代码来源:OFPortReasonSerializerVer12.java

示例8: ofWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OFPortReasonSerializerVer12.java

示例9: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
public static byte toWireValue(OFPortReason e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case DELETE:
            return DELETE_VAL;
        case MODIFY:
            return MODIFY_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFPortReason in version 1.2: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:OFPortReasonSerializerVer12.java

示例10: ofWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OFPortReasonSerializerVer13.java

示例11: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
public static byte toWireValue(OFPortReason e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case DELETE:
            return DELETE_VAL;
        case MODIFY:
            return MODIFY_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFPortReason in version 1.3: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:OFPortReasonSerializerVer13.java

示例12: ofWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OFPortReasonSerializerVer10.java

示例13: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
public static byte toWireValue(OFPortReason e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case DELETE:
            return DELETE_VAL;
        case MODIFY:
            return MODIFY_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFPortReason in version 1.0: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:OFPortReasonSerializerVer10.java

示例14: ofWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
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,代码行数:13,代码来源:OFPortReasonSerializerVer11.java

示例15: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortReason; //导入依赖的package包/类
public static byte toWireValue(OFPortReason e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case DELETE:
            return DELETE_VAL;
        case MODIFY:
            return MODIFY_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFPortReason in version 1.1: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:OFPortReasonSerializerVer11.java


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