本文整理汇总了Java中org.openflow.protocol.OFPhysicalPort.OFPortState类的典型用法代码示例。如果您正苦于以下问题:Java OFPortState类的具体用法?Java OFPortState怎么用?Java OFPortState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPortState类属于org.openflow.protocol.OFPhysicalPort包,在下文中一共展示了OFPortState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = floodlightProvider.getSwitch(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port).toOFPhysicalPort();
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp)
operation = UpdateOperation.PORT_UP;
else
operation = UpdateOperation.PORT_DOWN;
updates.add(new LDUpdate(sw, port, operation));
}
示例2: toOFPhysicalPort
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
public OFPhysicalPort toOFPhysicalPort() {
OFPhysicalPort ofpp = new OFPhysicalPort();
ofpp.setPortNumber(this.getPortNumber());
ofpp.setHardwareAddress(this.getHardwareAddress());
ofpp.setName(this.getName());
ofpp.setConfig(EnumBitmaps.toBitmap(this.getConfig()));
int state = this.getStpState().getValue();
if (this.isLinkDown())
state |= OFPortState.OFPPS_LINK_DOWN.getValue();
ofpp.setState(state);
ofpp.setCurrentFeatures(EnumBitmaps.toBitmap(this.getCurrentFeatures()));
ofpp.setAdvertisedFeatures(
EnumBitmaps.toBitmap(this.getAdvertisedFeatures()));
ofpp.setSupportedFeatures(
EnumBitmaps.toBitmap(this.getSupportedFeatures()));
ofpp.setPeerFeatures(EnumBitmaps.toBitmap(this.getPeerFeatures()));
return ofpp;
}
示例3: fromImmutablePort
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
public static SyncedPort fromImmutablePort(ImmutablePort p) {
SyncedPort rv = new SyncedPort();
rv.portNumber = p.getPortNumber();
if (p.getHardwareAddress() == null) {
rv.hardwareAddress = 0;
} else {
rv.hardwareAddress =
MACAddress.valueOf(p.getHardwareAddress()).toLong();
}
rv.name = p.getName();
rv.config = EnumBitmaps.toBitmap(p.getConfig());
rv.state = p.getStpState().getValue();
if (p.isLinkDown())
rv.state |= OFPortState.OFPPS_LINK_DOWN.getValue();
rv.currentFeatures = EnumBitmaps.toBitmap(p.getCurrentFeatures());
rv.advertisedFeatures =
EnumBitmaps.toBitmap(p.getAdvertisedFeatures());
rv.supportedFeatures =
EnumBitmaps.toBitmap(p.getSupportedFeatures());
rv.peerFeatures = EnumBitmaps.toBitmap(p.getPeerFeatures());
return rv;
}
示例4: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port);
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState &
OFPortState.OFPPS_STP_MASK.getValue()) !=
OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp) operation = UpdateOperation.PORT_UP;
else operation = UpdateOperation.PORT_DOWN;
updates.add(new LDUpdate(sw, port, operation));
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:20,代码来源:LinkDiscoveryManager.java
示例5: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = floodlightProvider.getSwitch(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port).toOFPhysicalPort();
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp)
operation = UpdateOperation.PORT_UP;
else
operation = UpdateOperation.PORT_DOWN;
log.info("generateSwitchPortStatusUpdate");
updates.add(new LDUpdate(sw, port, operation));
}
示例6: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = controllerProvider.getSwitches().get(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port);
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp)
operation = UpdateOperation.PORT_UP;
else
operation = UpdateOperation.PORT_DOWN;
updates.add(new LDUpdate(sw, port, operation));
}
示例7: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port);
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp)
operation = UpdateOperation.PORT_UP;
else
operation = UpdateOperation.PORT_DOWN;
updates.add(new LDUpdate(sw, port, operation));
}
示例8: isPortEnabled
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
@Override
public boolean isPortEnabled(OFPhysicalPort port) {
if (port == null) {
return false;
}
int portConfig = port.getConfig();
int portState = port.getState();
if ((portConfig & OFPortConfig.OFPPC_PORT_DOWN.getValue()) > 0) {
return false;
}
if ((portState & OFPortState.OFPPS_LINK_DOWN.getValue()) > 0) {
return false;
}
if ((portState & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK
.getValue()) {
return false;
}
return true;
}
示例9: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(long sw, short port) {
UpdateOperation operation;
IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
if (iofSwitch == null) return;
OFPhysicalPort ofp = iofSwitch.getPort(port);
if (ofp == null) return;
int srcPortState = ofp.getState();
boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue()) != OFPortState.OFPPS_STP_BLOCK.getValue());
if (portUp)
operation = UpdateOperation.PORT_UP;
else
operation = UpdateOperation.PORT_DOWN;
updates.add(new LDUpdate(sw, port, operation));
}
示例10: getUpdateOperation
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
protected UpdateOperation getUpdateOperation(int srcPortState,
int dstPortState) {
boolean added = (((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue()) &&
((dstPortState & OFPortState.OFPPS_STP_MASK.getValue())
!= OFPortState.OFPPS_STP_BLOCK.getValue()));
if (added) return UpdateOperation.LINK_UPDATED;
return UpdateOperation.LINK_REMOVED;
}
示例11: Builder
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
public Builder() {
this.portNumber = (short)1;
this.hardwareAddress = new byte[] { 0, 0, 0, 0, 0, 0 };
this.name = "";
this.config = EnumSet.noneOf(OFPortConfig.class);
this.portStateLinkDown = false;
this.stpState = OFPortState.OFPPS_STP_LISTEN;
this.currentFeatures = EnumSet.noneOf(OFPortFeatures.class);
this.advertisedFeatures = EnumSet.noneOf(OFPortFeatures.class);
this.supportedFeatures = EnumSet.noneOf(OFPortFeatures.class);
this.peerFeatures = EnumSet.noneOf(OFPortFeatures.class);
}
示例12: setStpState
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
/**
* @param stpState the stpState to set
*/
public Builder setStpState(OFPortState stpState) {
if (stpState == null)
throw new NullPointerException("stpState must not be null");
if (!stpState.isStpState()) {
String msg = String.format("OFPortState enum constant %s " +
"is not an STP state", stpState);
throw new IllegalArgumentException(msg);
}
this.stpState = stpState;
return this;
}
示例13: fromOFPhysicalPort
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
public static ImmutablePort fromOFPhysicalPort(OFPhysicalPort p) {
if (p == null) {
throw new NullPointerException("OFPhysicalPort must not be null");
}
if (p.getHardwareAddress() == null) {
throw new NullPointerException("Hardware address must not be null");
}
if (p.getName() == null) {
throw new NullPointerException("Port name must not be null");
}
return new ImmutablePort(
p.getPortNumber(),
Arrays.copyOf(p.getHardwareAddress(), 6),
p.getName(),
EnumBitmaps.toEnumSet(OFPortConfig.class, p.getConfig()),
OFPortState.isPortDown(p.getState()),
OFPortState.getStpState(p.getState()),
EnumBitmaps.toEnumSet(OFPortFeatures.class,
p.getCurrentFeatures()),
EnumBitmaps.toEnumSet(OFPortFeatures.class,
p.getAdvertisedFeatures()),
EnumBitmaps.toEnumSet(OFPortFeatures.class,
p.getSupportedFeatures()),
EnumBitmaps.toEnumSet(OFPortFeatures.class,
p.getPeerFeatures())
);
}
示例14: create
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
public static ImmutablePort create(String name, Short portNumber) {
return new ImmutablePort(portNumber,
new byte[] { 0, 0, 0, 0, 0, 0 },
name,
EnumSet.noneOf(OFPortConfig.class),
false,
OFPortState.OFPPS_STP_LISTEN,
EnumSet.noneOf(OFPortFeatures.class),
EnumSet.noneOf(OFPortFeatures.class),
EnumSet.noneOf(OFPortFeatures.class),
EnumSet.noneOf(OFPortFeatures.class));
}
示例15: getUpdateOperation
import org.openflow.protocol.OFPhysicalPort.OFPortState; //导入依赖的package包/类
protected UpdateOperation getUpdateOperation(int srcPortState,
int dstPortState) {
boolean added =
(((srcPortState &
OFPortState.OFPPS_STP_MASK.getValue()) !=
OFPortState.OFPPS_STP_BLOCK.getValue()) &&
((dstPortState &
OFPortState.OFPPS_STP_MASK.getValue()) !=
OFPortState.OFPPS_STP_BLOCK.getValue()));
if (added) return UpdateOperation.LINK_UPDATED;
return UpdateOperation.LINK_REMOVED;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:14,代码来源:LinkDiscoveryManager.java