本文整理汇总了Java中org.openflow.protocol.OFPhysicalPort.OFPortConfig类的典型用法代码示例。如果您正苦于以下问题:Java OFPortConfig类的具体用法?Java OFPortConfig怎么用?Java OFPortConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPortConfig类属于org.openflow.protocol.OFPhysicalPort包,在下文中一共展示了OFPortConfig类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isPortEnabled
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的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;
}
示例2: Builder
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的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);
}
示例3: addConfig
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的package包/类
/**
* @param config the config to set
*/
public Builder addConfig(OFPortConfig config) {
if (config == null)
throw new NullPointerException("PortConfig must not be null");
this.config.add(config);
return this;
}
示例4: fromOFPhysicalPort
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的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())
);
}
示例5: create
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的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));
}
示例6: setUpPorts
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的package包/类
@Before
public void setUpPorts() {
ImmutablePort.Builder bld = new ImmutablePort.Builder();
// p1a is disabled
p1a = bld.setName("port1")
.setPortNumber((short)1)
.setPortStateLinkDown(true)
.build();
assertFalse("Sanity check portEnabled", p1a.isEnabled());
// p1b is enabled
// p1b has different feature from p1a
p1b = bld.addCurrentFeature(OFPortFeatures.OFPPF_1GB_FD)
.setPortStateLinkDown(false)
.build();
assertTrue("Sanity check portEnabled", p1b.isEnabled());
// p2 is disabled
// p2 has mixed case
bld = new ImmutablePort.Builder();
p2a = bld.setName("Port2")
.setPortNumber((short)2)
.setPortStateLinkDown(false)
.addConfig(OFPortConfig.OFPPC_PORT_DOWN)
.build();
// p2b only differs in PortFeatures
p2b = bld.addCurrentFeature(OFPortFeatures.OFPPF_100MB_HD)
.build();
assertFalse("Sanity check portEnabled", p2a.isEnabled());
// p3 is enabled
// p3 has mixed case
bld = new ImmutablePort.Builder();
p3 = bld.setName("porT3")
.setPortNumber((short)3)
.setPortStateLinkDown(false)
.build();
assertTrue("Sanity check portEnabled", p3.isEnabled());
}
示例7: portEnabled
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的package包/类
private boolean portEnabled(OFPhysicalPort port) {
if (port == null)
return false;
if ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0)
return false;
if ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0)
return false;
// Port STP state doesn't work with multiple VLANs, so ignore it for now
// if ((port.getState() & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK.getValue())
// return false;
return true;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:13,代码来源:LinkDiscoveryManager.java
示例8: portEnabled
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的package包/类
@Override
public boolean portEnabled(OFPhysicalPort port) {
if (port == null)
return false;
if ((port.getConfig() & OFPortConfig.OFPPC_PORT_DOWN.getValue()) > 0)
return false;
if ((port.getState() & OFPortState.OFPPS_LINK_DOWN.getValue()) > 0)
return false;
// Port STP state doesn't work with multiple VLANs, so ignore it for now
//if ((port.getState() & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK.getValue())
// return false;
return true;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:14,代码来源:OFSwitchImpl.java
示例9: portEnabled
import org.openflow.protocol.OFPhysicalPort.OFPortConfig; //导入依赖的package包/类
private boolean portEnabled(OFPhysicalPort port) {
if (port == null) return false;
if ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0)
return false;
if ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0)
return false;
// Port STP state doesn't work with multiple VLANs, so ignore it for now
// if ((port.getState() & OFPortState.OFPPS_STP_MASK.getValue()) ==
// OFPortState.OFPPS_STP_BLOCK.getValue())
// return false;
return true;
}