protected OFFeaturesReply getSwitchFeaturesReply(DatapathId switchId) { IOFSwitchService switchService = (IOFSwitchService) getContext().getAttributes(). get(IOFSwitchService.class.getCanonicalName()); IOFSwitch sw = switchService.getSwitch(switchId); Future<OFFeaturesReply> future; OFFeaturesReply featuresReply = null; OFFeaturesRequest featuresRequest = sw.getOFFactory().buildFeaturesRequest().build(); if (sw != null) { try { future = sw.writeRequest(featuresRequest); featuresReply = future.get(10, TimeUnit.SECONDS); } catch (Exception e) { log.error("Failure getting features reply from switch" + sw, e); } } return featuresReply; }
/** * Send a features request message to the switch using the handshake * transactions ids. * @throws IOException */ private void sendFeaturesRequest() throws IOException { // Send initial Features Request OFFeaturesRequest m = factory.buildFeaturesRequest() .setXid(handshakeTransactionIds--) .build(); write(m); }
/** * Send a features request message to the switch using the handshake * transactions ids. * @throws IOException */ private void sendFeaturesRequest() throws IOException { // Send initial Features Request OFFeaturesRequest m = factory.buildFeaturesRequest() .setXid(handshakeTransactionIds--) .build(); channel.write(Collections.singletonList(m)); }
@Override public void processUnhandledShimMessage(Message message, String originId) { if (bypassUnsupportedMessages) { boolean warn = true; if (message instanceof OpenFlowMessage) { OFMessage openFlowMessage = ((OpenFlowMessage) message).getOfMessage(); if (openFlowMessage instanceof OFEchoRequest || openFlowMessage instanceof OFEchoReply) { warn = false; } else if (openFlowMessage instanceof OFFeaturesReply || openFlowMessage instanceof OFFeaturesRequest) { warn = false; } } if (warn && message instanceof OpenFlowMessage) { logger.warn("Received unsupported OpenFlow message (dpid={}) {} for composition from {}, attempting to relay instead.", message.getHeader().getDatapathId(), ((OpenFlowMessage) message).getOfMessage(), originId); } else if (warn) { logger.warn("Received unsupported message {} for composition from {}, attempting to relay instead.", message, originId); } try { if (message.getHeader().getModuleId() == 0) { logger.info("Message ID is 0 relaying to ALL backends"); backendManager.sendMessageToAllModules(message); } else { backendManager.sendMessage(message); } } catch (Throwable ex) { logger.error("Could not relay unsupported message.", ex); } } else { logger.error("Received unsupported message {} from {} for composition, bypass is not activated.", message, originId); } }