use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class HandshakeManagerImpl method postHandshake.
/**
* after handshake set features, register to session.
*
* @param proposedVersion proposed openflow version
* @param xid transaction id
*/
protected void postHandshake(final Short proposedVersion, final Long xid) {
// set version
version = proposedVersion;
LOG.debug("version set: {}", proposedVersion);
// request features
GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder();
featuresBuilder.setVersion(version).setXid(xid);
LOG.debug("sending feature request for version={} and xid={}", version, xid);
Future<RpcResult<GetFeaturesOutput>> featuresFuture = connectionAdapter.getFeatures(featuresBuilder.build());
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(featuresFuture), new FutureCallback<RpcResult<GetFeaturesOutput>>() {
@Override
public void onSuccess(@Nonnull RpcResult<GetFeaturesOutput> rpcFeatures) {
LOG.trace("features are back");
if (rpcFeatures.isSuccessful()) {
GetFeaturesOutput featureOutput = rpcFeatures.getResult();
LOG.debug("obtained features: datapathId={}", featureOutput.getDatapathId());
LOG.debug("obtained features: auxiliaryId={}", featureOutput.getAuxiliaryId());
LOG.trace("handshake SETTLED: version={}, datapathId={}, auxiliaryId={}", version, featureOutput.getDatapathId(), featureOutput.getAuxiliaryId());
handshakeListener.onHandshakeSuccessful(featureOutput, proposedVersion);
} else {
// handshake failed
LOG.warn("issuing disconnect during handshake [{}]", connectionAdapter.getRemoteAddress());
for (RpcError rpcError : rpcFeatures.getErrors()) {
LOG.debug("handshake - features failure [{}]: i:{} | m:{} | s:{}", xid, rpcError.getInfo(), rpcError.getMessage(), rpcError.getSeverity(), rpcError.getCause());
}
handshakeListener.onHandshakeFailure();
}
LOG.debug("postHandshake DONE");
}
@Override
public void onFailure(Throwable throwable) {
LOG.warn("getting feature failed seriously [{}, addr:{}]: {}", xid, connectionAdapter.getRemoteAddress(), throwable.getMessage());
LOG.trace("DETAIL of sending of hello failure:", throwable);
}
}, MoreExecutors.directExecutor());
LOG.debug("future features [{}] hooked ..", xid);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class SystemNotificationsListenerImpl method executeOnSwitchIdleEvent.
@SuppressWarnings("checkstyle:IllegalCatch")
private void executeOnSwitchIdleEvent() {
boolean shouldBeDisconnected = true;
final InetSocketAddress remoteAddress = connectionContext.getConnectionAdapter().getRemoteAddress();
if (ConnectionContext.CONNECTION_STATE.WORKING.equals(connectionContext.getConnectionState())) {
FeaturesReply features = connectionContext.getFeatures();
LOG.info("Switch Idle state occurred, node={}|auxId={}", remoteAddress, features.getAuxiliaryId());
connectionContext.changeStateToTimeouting();
EchoInputBuilder builder = new EchoInputBuilder();
builder.setVersion(features.getVersion());
builder.setXid(ECHO_XID.getValue());
Future<RpcResult<EchoOutput>> echoReplyFuture = connectionContext.getConnectionAdapter().echo(builder.build());
try {
RpcResult<EchoOutput> echoReplyValue = echoReplyFuture.get(echoReplyTimeout, TimeUnit.MILLISECONDS);
if (echoReplyValue.isSuccessful() && Objects.equals(echoReplyValue.getResult().getXid(), ECHO_XID.getValue())) {
connectionContext.changeStateToWorking();
shouldBeDisconnected = false;
} else {
logErrors(remoteAddress, echoReplyValue);
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Exception while waiting for echoReply from [{}] in TIMEOUTING state: {}", remoteAddress, e.getMessage());
}
if (LOG.isTraceEnabled()) {
LOG.trace("Exception while waiting for echoReply from [{}] in TIMEOUTING state: {}", remoteAddress, e);
}
}
}
if (shouldBeDisconnected) {
if (LOG.isInfoEnabled()) {
LOG.info("ConnectionEvent:Closing connection as device is idle. Echo sent at {}. Device:{}, NodeId:{}", new Date(System.currentTimeMillis() - echoReplyTimeout), remoteAddress, connectionContext.getSafeNodeIdForLOG());
}
connectionContext.closeConnection(true);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class BuildSwitchCapabilitiesOF10 method build.
@Override
public SwitchFeatures build(GetFeaturesOutput features) {
SwitchFeaturesBuilder builderSwFeatures = new SwitchFeaturesBuilder();
builderSwFeatures.setMaxBuffers(features.getBuffers());
builderSwFeatures.setMaxTables(features.getTables());
List<Class<? extends FeatureCapability>> capabilities = new ArrayList<>();
if (features.getCapabilitiesV10().isOFPCARPMATCHIP()) {
capabilities.add(FlowFeatureCapabilityArpMatchIp.class);
}
if (features.getCapabilitiesV10().isOFPCFLOWSTATS()) {
capabilities.add(FlowFeatureCapabilityFlowStats.class);
}
if (features.getCapabilitiesV10().isOFPCIPREASM()) {
capabilities.add(FlowFeatureCapabilityIpReasm.class);
}
if (features.getCapabilitiesV10().isOFPCPORTSTATS()) {
capabilities.add(FlowFeatureCapabilityPortStats.class);
}
if (features.getCapabilitiesV10().isOFPCQUEUESTATS()) {
capabilities.add(FlowFeatureCapabilityQueueStats.class);
}
if (features.getCapabilitiesV10().isOFPCRESERVED()) {
capabilities.add(FlowFeatureCapabilityReserved.class);
}
if (features.getCapabilitiesV10().isOFPCSTP()) {
capabilities.add(FlowFeatureCapabilityStp.class);
}
if (features.getCapabilitiesV10().isOFPCTABLESTATS()) {
capabilities.add(FlowFeatureCapabilityTableStats.class);
}
builderSwFeatures.setCapabilities(capabilities);
return builderSwFeatures.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class MultipartTableFeaturesSerializerInjector method injectSerializers.
/**
* Injects multipart table features serializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
*
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends TableFeaturePropType>, Consumer<OFSerializer<TableFeaturePropType>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(Instructions.class).accept(new InstructionsTablePropertySerializer());
injector.apply(InstructionsMiss.class).accept(new InstructionsMissTablePropertySerializer());
injector.apply(NextTable.class).accept(new NextTableTablePropertySerializer());
injector.apply(NextTableMiss.class).accept(new NextTableMissTablePropertySerializer());
injector.apply(ApplyActions.class).accept(new ApplyActionsTablePropertySerializer());
injector.apply(ApplyActionsMiss.class).accept(new ApplyActionsMissTablePropertySerializer());
injector.apply(WriteActions.class).accept(new WriteActionsTablePropertySerializer());
injector.apply(WriteActionsMiss.class).accept(new WriteActionsMissTablePropertySerializer());
injector.apply(Match.class).accept(new MatchTablePropertySerializer());
injector.apply(Wildcards.class).accept(new WildcardsTablePropertySerializer());
injector.apply(WriteSetfield.class).accept(new WriteSetfieldTablePropertySerializer());
injector.apply(WriteSetfieldMiss.class).accept(new WriteSetfieldMissTablePropertySerializer());
injector.apply(ApplySetfield.class).accept(new ApplySetfieldTablePropertySerializer());
injector.apply(ApplySetfieldMiss.class).accept(new ApplySetfieldMissTablePropertySerializer());
// TODO: Add support for experimenters
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class TableFeaturesConvertor method toTableProperties.
private static List<TableFeatureProperties> toTableProperties(final org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties tableProperties) {
if (tableProperties == null) {
return Collections.emptyList();
}
List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> sortedTableProperties = TABLE_FEATURE_PROPS_ORDERING.sortedCopy(tableProperties.getTableFeatureProperties());
for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties property : sortedTableProperties) {
TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property.getTableFeaturePropType();
setTableFeatureProperty(propType);
if (propType instanceof Instructions) {
setTableFeatureProperty((Instructions) propType, propBuilder);
} else if (propType instanceof InstructionsMiss) {
setTableFeatureProperty((InstructionsMiss) propType, propBuilder);
} else if (propType instanceof NextTable) {
setTableFeatureProperty((NextTable) propType, propBuilder);
} else if (propType instanceof NextTableMiss) {
setTableFeatureProperty((NextTableMiss) propType, propBuilder);
} else if (propType instanceof WriteActions) {
setTableFeatureProperty((WriteActions) propType, propBuilder);
} else if (propType instanceof WriteActionsMiss) {
setTableFeatureProperty((WriteActionsMiss) propType, propBuilder);
} else if (propType instanceof ApplyActions) {
setTableFeatureProperty((ApplyActions) propType, propBuilder);
} else if (propType instanceof ApplyActionsMiss) {
setTableFeatureProperty((ApplyActionsMiss) propType, propBuilder);
} else if (propType instanceof Match) {
setTableFeatureProperty((Match) propType, propBuilder);
} else if (propType instanceof Wildcards) {
setTableFeatureProperty((Wildcards) propType, propBuilder);
} else if (propType instanceof WriteSetfield) {
setTableFeatureProperty((WriteSetfield) propType, propBuilder);
} else if (propType instanceof WriteSetfieldMiss) {
setTableFeatureProperty((WriteSetfieldMiss) propType, propBuilder);
} else if (propType instanceof ApplySetfield) {
setTableFeatureProperty((ApplySetfield) propType, propBuilder);
} else if (propType instanceof ApplySetfieldMiss) {
setTableFeatureProperty((ApplySetfieldMiss) propType, propBuilder);
}
// Experimenter and Experimenter miss Table features are unhandled
ofTablePropertiesList.add(propBuilder.build());
}
return ofTablePropertiesList;
}
Aggregations