本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortStatus类的典型用法代码示例。如果您正苦于以下问题:Java OFPortStatus类的具体用法?Java OFPortStatus怎么用?Java OFPortStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPortStatus类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFPortStatus类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的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) {
this.agent.processMessage(dpid, m);
} else {
log.trace("Dropping received message {}, was not MASTER", m);
}
}
示例2: OFChannelHandler
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
/**
* Create a new unconnected OFChannelHandler.
* @param controller parent controller
*/
OFChannelHandler(Controller controller) {
this.controller = controller;
this.state = ChannelState.INIT;
this.pendingPortStatusMsg = new CopyOnWriteArrayList<OFPortStatus>();
this.portDescReplies = new ArrayList<OFPortDescStatsReply>();
factory13 = controller.getOFMessageFactory13();
factory10 = controller.getOFMessageFactory10();
duplicateDpidFound = Boolean.FALSE;
}
示例3: handlePendingPortStatusMessages
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
private void handlePendingPortStatusMessages(OFChannelHandler h, int index)
throws SwitchStateException {
if (h.sw == null) {
String msg = "State machine error: switch is null. Should never " +
"happen";
throw new SwitchStateException(msg);
}
log.info("Processing {} pending port status messages for {}",
h.pendingPortStatusMsg.size(), h.sw.getStringId());
ArrayList<OFPortStatus> temp = new ArrayList<OFPortStatus>();
for (OFPortStatus ps: h.pendingPortStatusMsg) {
temp.add(ps);
handlePortStatusMessage(h, ps, false);
}
// expensive but ok - we don't expect too many port-status messages
// note that we cannot use clear(), because of the reasons below
h.pendingPortStatusMsg.removeAll(temp);
temp.clear();
// the iterator above takes a snapshot of the list - so while we were
// dealing with the pending port-status messages, we could have received
// newer ones. Handle them recursively, but break the recursion after
// five steps to avoid an attack.
if (!h.pendingPortStatusMsg.isEmpty() && ++index < 5) {
handlePendingPortStatusMessages(h, index);
}
}
示例4: buildPortDescription
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的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);
}
}
示例5: portChanged
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的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());
}
示例6: processOFMessage
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
/**
* Process an OF message received on the channel and
* update state accordingly.
*
* The main "event" of the state machine. Process the received message,
* send follow up message if required and update state if required.
*
* Switches on the message type and calls more specific event handlers
* for each individual OF message type. If we receive a message that
* is supposed to be sent from a controller to a switch we throw
* a SwitchStateExeption.
*
* The more specific handlers can also throw SwitchStateExceptions
*
* @param h The OFChannelHandler that received the message
* @param m The message we received.
* @throws SwitchStateException
* @throws IOException
*/
void processOFMessage(OFMessage m) {
roleChanger.checkTimeout();
switch(m.getType()) {
case BARRIER_REPLY:
processOFBarrierReply((OFBarrierReply) m);
break;
case ERROR:
processOFError((OFErrorMsg) m);
break;
case FLOW_REMOVED:
processOFFlowRemoved((OFFlowRemoved) m);
break;
case GET_CONFIG_REPLY:
processOFGetConfigReply((OFGetConfigReply) m);
break;
case PACKET_IN:
processOFPacketIn((OFPacketIn) m);
break;
case PORT_STATUS:
processOFPortStatus((OFPortStatus) m);
break;
case QUEUE_GET_CONFIG_REPLY:
processOFQueueGetConfigReply((OFQueueGetConfigReply) m);
break;
case STATS_REPLY:
processOFStatsReply((OFStatsReply) m);
break;
case ROLE_REPLY:
processOFRoleReply((OFRoleReply) m);
break;
case EXPERIMENTER:
processOFExperimenter((OFExperimenter) m);
break;
default:
illegalMessageReceived(m);
break;
}
}
示例7: handlePendingPortStatusMessages
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
void handlePendingPortStatusMessages(SwitchDescription description){
for (OFPortStatus ps: pendingPortStatusMsg) {
handlePortStatusMessage(ps, false);
}
pendingPortStatusMsg.clear();
log.info("Switch {} bound to class {}, description {}", new Object[] { sw, sw.getClass(), description });
}
示例8: OFSwitchHandshakeHandler
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
/**
* Create a new unconnected OFChannelHandler.
* @param controller
* @param broker
* @throws SwitchHandshakeHandlerException
*/
OFSwitchHandshakeHandler(@Nonnull IOFConnectionBackend connection,
@Nonnull OFFeaturesReply featuresReply,
@Nonnull IOFSwitchManager switchManager,
@Nonnull RoleManager roleManager,
@Nonnull Timer timer) {
Preconditions.checkNotNull(connection, "connection");
Preconditions.checkNotNull(featuresReply, "featuresReply");
Preconditions.checkNotNull(switchManager, "switchManager");
Preconditions.checkNotNull(roleManager, "roleManager");
Preconditions.checkNotNull(timer, "timer");
Preconditions.checkArgument(connection.getAuxId().equals(OFAuxId.MAIN),
"connection must be MAIN connection but is %s", connection);
this.switchManager = switchManager;
this.roleManager = roleManager;
this.mainConnection = connection;
this.auxConnections = new ConcurrentHashMap<OFAuxId, IOFConnectionBackend>();
this.featuresReply = featuresReply;
this.timer = timer;
this.switchManagerCounters = switchManager.getCounters();
this.factory = OFFactories.getFactory(featuresReply.getVersion());
this.roleChanger = new RoleChanger(DEFAULT_ROLE_TIMEOUT_NS);
setState(new InitState());
this.pendingPortStatusMsg = new ArrayList<OFPortStatus>();
connection.setListener(this);
}
示例9: processOFMessage
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
@Override
void processOFMessage(OFMessage m) {
if(m.getType() == OFType.PORT_STATUS){
OFPortStatus status = (OFPortStatus) m;
handlePortStatusMessage(status, false);
}
else if(plugin != null){
this.plugin.processOFMessage(m);
}
else{
super.processOFMessage(m);
}
}
示例10: processOFPortStatus
import org.projectfloodlight.openflow.protocol.OFPortStatus; //导入依赖的package包/类
@Override
void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
throws IOException {
unhandledMessageReceived(h, m);
}