本文整理汇总了Java中org.openflow.protocol.OFPhysicalPort类的典型用法代码示例。如果您正苦于以下问题:Java OFPhysicalPort类的具体用法?Java OFPhysicalPort怎么用?Java OFPhysicalPort使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPhysicalPort类属于org.openflow.protocol包,在下文中一共展示了OFPhysicalPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort; //导入依赖的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; //导入依赖的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: setUpFeaturesReply
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
@Before
public void setUpFeaturesReply() {
featuresReply = (OFFeaturesReply)BasicFactory.getInstance()
.getMessage(OFType.FEATURES_REPLY);
featuresReply.setDatapathId(0x42L);
featuresReply.setBuffers(1);
featuresReply.setTables((byte)1);
featuresReply.setCapabilities(3);
featuresReply.setActions(4);
List<OFPhysicalPort> ports = new ArrayList<OFPhysicalPort>();
// A dummy port.
OFPhysicalPort p = new OFPhysicalPort();
p.setName("Eth1");
p.setPortNumber((short)1);
ports.add(p);
featuresReply.setPorts(ports);
}
示例4: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort; //导入依赖的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: OFSwitchImpl
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
public OFSwitchImpl() {
this.stringId = null;
this.attributes = new ConcurrentHashMap<Object, Object>();
this.connectedSince = new Date();
this.transactionIdSource = new AtomicInteger();
this.portLock = new Object();
this.portsByNumber = new ConcurrentHashMap<Short, OFPhysicalPort>();
this.portsByName = new ConcurrentHashMap<String, OFPhysicalPort>();
this.connected = true;
this.statsFutureMap = new ConcurrentHashMap<Integer,OFStatisticsFuture>();
this.featuresFutureMap = new ConcurrentHashMap<Integer,OFFeaturesReplyFuture>();
this.iofMsgListenersMap = new ConcurrentHashMap<Integer,IOFMessageListener>();
this.role = null;
this.timedCache = new TimedCache<Long>(100, 5*1000 ); // 5 seconds interval
this.listenerLock = new ReentrantReadWriteLock();
this.portBroadcastCacheHitMap = new ConcurrentHashMap<Short, Long>();
this.pendingRoleRequests = new LinkedList<OFSwitchImpl.PendingRoleRequestEntry>();
// Defaults properties for an ideal switch
this.setAttribute(PROP_FASTWILDCARDS, OFMatch.OFPFW_ALL);
this.setAttribute(PROP_SUPPORTS_OFPP_FLOOD, new Boolean(true));
this.setAttribute(PROP_SUPPORTS_OFPP_TABLE, new Boolean(true));
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:24,代码来源:OFSwitchImpl.java
示例6: setFeaturesReply
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
@Override
@JsonIgnore
public void setFeaturesReply(OFFeaturesReply featuresReply) {
synchronized(portLock) {
if (stringId == null) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
for (OFPhysicalPort port : featuresReply.getPorts()) {
setPort(port);
}
}
this.datapathId = featuresReply.getDatapathId();
this.capabilities = featuresReply.getCapabilities();
this.buffers = featuresReply.getBuffers();
this.actions = featuresReply.getActions();
this.tables = featuresReply.getTables();
this.stringId = HexString.toHexString(this.datapathId);
}
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:21,代码来源:OFSwitchImpl.java
示例7: setupSwitchForAddSwitch
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
protected void setupSwitchForAddSwitch(IOFSwitch sw, long dpid) {
String dpidString = HexString.toHexString(dpid);
expect(sw.getId()).andReturn(dpid).anyTimes();
expect(sw.getStringId()).andReturn(dpidString).anyTimes();
expect(sw.getConnectedSince()).andReturn(new Date());
Channel channel = createMock(Channel.class);
expect(sw.getChannel()).andReturn(channel);
expect(channel.getRemoteAddress()).andReturn(null);
expect(sw.getCapabilities()).andReturn(0).anyTimes();
expect(sw.getBuffers()).andReturn(0).anyTimes();
expect(sw.getTables()).andReturn((byte)0).anyTimes();
expect(sw.getActions()).andReturn(0).anyTimes();
expect(sw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>()).anyTimes();
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:17,代码来源:ControllerTest.java
示例8: testAddSwitchNoClearFM
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
@Test
public void testAddSwitchNoClearFM() throws Exception {
controller.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
OFSwitchImpl oldsw = new OFSwitchImpl();
OFFeaturesReply featuresReply = new OFFeaturesReply();
featuresReply.setDatapathId(0L);
featuresReply.setPorts(new ArrayList<OFPhysicalPort>());
oldsw.setFeaturesReply(featuresReply);
Channel channel = createMock(Channel.class);
oldsw.setChannel(channel);
expect(channel.getRemoteAddress()).andReturn(null);
expect(channel.close()).andReturn(null);
IOFSwitch newsw = createMock(IOFSwitch.class);
expect(newsw.getId()).andReturn(0L).anyTimes();
expect(newsw.getStringId()).andReturn("00:00:00:00:00:00:00").anyTimes();
controller.activeSwitches.put(0L, oldsw);
replay(newsw, channel);
controller.addSwitch(newsw, false);
verify(newsw, channel);
}
示例9: updateBroadcastSwitchPorts
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
/**
* Updates the broadcast switch ports whenever a switch joins, leaves, or the
* config for broadcast interfaces is changed.
*/
protected void updateBroadcastSwitchPorts() {
List<SwitchPort> lspt = new ArrayList<SwitchPort>();
for(SwitchInterface si : confBroadcastIfaces) {
Long dpid = HexString.toLong(si.dpid);
IOFSwitch sw = controllerProvider.getSwitches().get(dpid);
if (sw != null) {
OFPhysicalPort p = sw.getPort(si.getIfaceName());
if (p!=null && sw.portEnabled(p))
lspt.add(new SwitchPort(dpid, p.getPortNumber()));
}
}
broadcastSwitchPorts = lspt;
}
示例10: createPhysicalPort
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
private void createPhysicalPort(String rawMessage) {
ofPort = new OFPhysicalPort();
ofPort.setPortNumber(this.portNo);
ofPort.setName(String.valueOf(this.portNo));
int totalFeatures = 0;
for (String feature: this.portFeatures) {
if (!feature.equals(""))
totalFeatures += OFPhysicalPort.OFPortFeatures.valueOf(feature).getValue();
}
ofPort.setCurrentFeatures(totalFeatures);
ofPort.setSupportedFeatures(0);
ofPort.setAdvertisedFeatures(0);
ofPort.setConfig( (this.conf_up ? 1 : 0));
ofPort.setState( (this.stat_up ? 1 : 0));
byte[] hardwareAddress = new String("00000" + portNo).getBytes();
if (portNo > 9)
hardwareAddress = new String("0000" + portNo).getBytes();
ofPort.setHardwareAddress(hardwareAddress);
}
示例11: handlePortStatusMessage
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
protected void handlePortStatusMessage(IOFSwitch sw, OFPortStatus m) {
short portNumber = m.getDesc().getPortNumber();
OFPhysicalPort port = m.getDesc();
if (m.getReason() == (byte)OFPortReason.OFPPR_MODIFY.ordinal()) {
sw.setPort(port);
log.debug("Port #{} modified for {}", portNumber, sw);
} else if (m.getReason() == (byte)OFPortReason.OFPPR_ADD.ordinal()) {
sw.setPort(port);
log.debug("Port #{} added for {}", portNumber, sw);
} else if (m.getReason() ==
(byte)OFPortReason.OFPPR_DELETE.ordinal()) {
sw.deletePort(portNumber);
log.debug("Port #{} deleted for {}", portNumber, sw);
}
SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.PORTCHANGED);
try {
this.updates.put(update);
} catch (InterruptedException e) {
log.error("Failure adding update to queue", e);
}
}
示例12: OFSwitchBase
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
public OFSwitchBase() {
this.stringId = null;
this.attributes = new ConcurrentHashMap<Object, Object>();
this.connectedSince = new Date();
this.transactionIdSource = new AtomicInteger();
this.portLock = new Object();
this.portsByNumber = new ConcurrentHashMap<Short, OFPhysicalPort>();
this.portsByName = new ConcurrentHashMap<String, OFPhysicalPort>();
this.connected = true;
this.statsFutureMap = new ConcurrentHashMap<Integer,OFStatisticsFuture>();
this.featuresFutureMap = new ConcurrentHashMap<Integer,OFFeaturesReplyFuture>();
this.iofMsgListenersMap = new ConcurrentHashMap<Integer,IOFMessageListener>();
this.role = null;
this.timedCache = new TimedCache<Long>(100, 5*1000 ); // 5 seconds interval
this.listenerLock = new ReentrantReadWriteLock();
this.portBroadcastCacheHitMap = new ConcurrentHashMap<Short, AtomicLong>();
// Defaults properties for an ideal switch
this.setAttribute(PROP_FASTWILDCARDS, OFMatch.OFPFW_ALL);
this.setAttribute(PROP_SUPPORTS_OFPP_FLOOD, new Boolean(true));
this.setAttribute(PROP_SUPPORTS_OFPP_TABLE, new Boolean(true));
}
示例13: applyPortStatus
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
/**
* Changes the attribute of this port according to a MODIFY PortStatus.
*
* @param portstat
* the port status
*/
public void applyPortStatus(OVXPortStatus portstat) {
if (!portstat.isReason(OFPortReason.OFPPR_MODIFY)) {
return;
}
OFPhysicalPort psport = portstat.getDesc();
this.portNumber = psport.getPortNumber();
this.hardwareAddress = psport.getHardwareAddress();
this.name = psport.getName();
this.config = psport.getConfig();
this.state = psport.getState();
this.currentFeatures = psport.getCurrentFeatures();
this.advertisedFeatures = psport.getAdvertisedFeatures();
this.supportedFeatures = psport.getSupportedFeatures();
this.peerFeatures = psport.getPeerFeatures();
}
示例14: Port
import org.openflow.protocol.OFPhysicalPort; //导入依赖的package包/类
/**
* Instantiates a new port.
*/
protected Port(final OFPhysicalPort ofPort) {
super();
this.portNumber = ofPort.getPortNumber();
this.hardwareAddress = ofPort.getHardwareAddress();
this.name = ofPort.getName();
this.config = ofPort.getConfig();
this.state = ofPort.getState();
this.currentFeatures = ofPort.getCurrentFeatures();
this.advertisedFeatures = ofPort.getAdvertisedFeatures();
this.supportedFeatures = ofPort.getSupportedFeatures();
this.peerFeatures = ofPort.getPeerFeatures();
if (this.hardwareAddress == null) {
this.hardwareAddress = new byte[] {(byte) 0xDE, (byte) 0xAD,
(byte) 0xBE, (byte) 0xEF, (byte) 0xCA, (byte) 0xFE};
}
this.mac = new MACAddress(this.hardwareAddress);
this.isEdge = false;
this.parentSwitch = null;
this.portLink = null;
}
示例15: generateSwitchPortStatusUpdate
import org.openflow.protocol.OFPhysicalPort; //导入依赖的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));
}