本文整理汇总了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);
}
}
示例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));
});
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}