use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities in project openflowplugin by opendaylight.
the class BuildSwitchCapabilitiesOF13 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.getCapabilities().isOFPCFLOWSTATS()) {
capabilities.add(FlowFeatureCapabilityFlowStats.class);
}
if (features.getCapabilities().isOFPCGROUPSTATS()) {
capabilities.add(FlowFeatureCapabilityGroupStats.class);
}
if (features.getCapabilities().isOFPCIPREASM()) {
capabilities.add(FlowFeatureCapabilityIpReasm.class);
}
if (features.getCapabilities().isOFPCPORTBLOCKED()) {
capabilities.add(FlowFeatureCapabilityPortBlocked.class);
}
if (features.getCapabilities().isOFPCPORTSTATS()) {
capabilities.add(FlowFeatureCapabilityPortStats.class);
}
if (features.getCapabilities().isOFPCQUEUESTATS()) {
capabilities.add(FlowFeatureCapabilityQueueStats.class);
}
if (features.getCapabilities().isOFPCTABLESTATS()) {
capabilities.add(FlowFeatureCapabilityTableStats.class);
}
builderSwFeatures.setCapabilities(capabilities);
return builderSwFeatures.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities in project bgpcep by opendaylight.
the class NodeAttributesParser method parseNodeAttributes.
/**
* Parse Node Attributes.
*
* @param attributes key is the tlv type and value is the value of the tlv
* @param protocolId to differentiate parsing methods
* @return {@link LinkStateAttribute}
*/
static LinkStateAttribute parseNodeAttributes(final Multimap<Integer, ByteBuf> attributes, final ProtocolId protocolId) {
final List<TopologyIdentifier> topologyMembership = new ArrayList<>();
final List<IsisAreaIdentifier> areaMembership = new ArrayList<>();
final NodeAttributesBuilder builder = new NodeAttributesBuilder();
for (final Entry<Integer, ByteBuf> entry : attributes.entries()) {
final int key = entry.getKey();
final ByteBuf value = entry.getValue();
LOG.trace("Node attribute TLV {}", key);
switch(key) {
case TlvUtil.MULTI_TOPOLOGY_ID:
parseTopologyId(topologyMembership, value);
break;
case NODE_FLAG_BITS:
parseNodeFlags(value, builder);
break;
case NODE_OPAQUE:
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring opaque value: {}.", ByteBufUtil.hexDump(value));
}
break;
case DYNAMIC_HOSTNAME:
builder.setDynamicHostname(new String(ByteArray.readAllBytes(value), StandardCharsets.US_ASCII));
LOG.debug("Parsed Node Name {}", builder.getDynamicHostname());
break;
case ISIS_AREA_IDENTIFIER:
final IsisAreaIdentifier ai = new IsisAreaIdentifier(ByteArray.readAllBytes(value));
areaMembership.add(ai);
LOG.debug("Parsed AreaIdentifier {}", ai);
break;
case TlvUtil.LOCAL_IPV4_ROUTER_ID:
final Ipv4RouterIdentifier ip4 = new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value));
builder.setIpv4RouterId(ip4);
LOG.debug("Parsed IPv4 Router Identifier {}", ip4);
break;
case TlvUtil.LOCAL_IPV6_ROUTER_ID:
final Ipv6RouterIdentifier ip6 = new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value));
builder.setIpv6RouterId(ip6);
LOG.debug("Parsed IPv6 Router Identifier {}", ip6);
break;
case SR_CAPABILITIES:
final SrCapabilities caps = SrNodeAttributesParser.parseSrCapabilities(value, protocolId);
builder.setSrCapabilities(caps);
LOG.debug("Parsed SR Capabilities {}", caps);
break;
case SR_ALGORITHMS:
final SrAlgorithm algs = SrNodeAttributesParser.parseSrAlgorithms(value);
builder.setSrAlgorithm(algs);
LOG.debug("Parsed SR Algorithms {}", algs);
break;
default:
LOG.warn("TLV {} is not a valid node attribute, ignoring it", key);
}
}
LOG.trace("Finished parsing Node Attributes.");
builder.setTopologyIdentifier(topologyMembership);
builder.setIsisAreaId(areaMembership);
return new NodeAttributesCaseBuilder().setNodeAttributes(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities in project bgpcep by opendaylight.
the class NeighborUtil method buildCapabilityState.
/**
* Builds Neighbor State containing Capabilities State, session State.
*
* @return Neighbor State
*/
public static NeighborStateAugmentation buildCapabilityState(@NonNull final BGPSessionState neighbor) {
final List<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
SessionState sessionState = null;
switch(neighbor.getSessionState()) {
case IDLE:
sessionState = SessionState.IDLE;
break;
case UP:
sessionState = SessionState.ESTABLISHED;
break;
case OPEN_CONFIRM:
sessionState = SessionState.OPENCONFIRM;
break;
default:
}
return new NeighborStateAugmentationBuilder().setSupportedCapabilities(supportedCapabilities).setSessionState(sessionState).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities in project bgpcep by opendaylight.
the class BGPSessionStateImpl method advertizeCapabilities.
@Override
public synchronized void advertizeCapabilities(final int newHoldTimerValue, final SocketAddress newRemoteAddress, final SocketAddress localAddress, final Set<BgpTableType> tableTypes, final List<BgpParameters> bgpParameters) {
if (bgpParameters != null) {
for (final BgpParameters parameters : bgpParameters) {
for (final OptionalCapabilities optionalCapabilities : parameters.nonnullOptionalCapabilities()) {
final CParameters cParam = optionalCapabilities.getCParameters();
final CParameters1 capabilities = cParam.augmentation(CParameters1.class);
if (capabilities != null) {
final MultiprotocolCapability mc = capabilities.getMultiprotocolCapability();
if (mc != null) {
this.multiProtocolCapability = true;
}
if (capabilities.getGracefulRestartCapability() != null) {
this.gracefulRestartCapability = true;
}
if (capabilities.getAddPathCapability() != null) {
this.addPathCapability = true;
}
if (capabilities.getRouteRefreshCapability() != null) {
this.routerRefreshCapability = true;
}
}
if (cParam.getAs4BytesCapability() != null) {
this.asn32Capability = true;
}
}
}
}
this.holdTimerValue = newHoldTimerValue;
this.remoteAddress = StrictBGPPeerRegistry.getIpAddress(newRemoteAddress);
this.remotePort = new PortNumber(Uint16.valueOf(((InetSocketAddress) newRemoteAddress).getPort()));
this.localPort = new PortNumber(Uint16.valueOf(((InetSocketAddress) localAddress).getPort()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities in project bgpcep by opendaylight.
the class CapabilityParameterParser method serializeOptionalCapabilities.
private ByteBuf serializeOptionalCapabilities(final List<OptionalCapabilities> capabilities) {
if (capabilities == null) {
return null;
}
final ByteBuf buffer = Unpooled.buffer();
for (final OptionalCapabilities optionalCapa : capabilities) {
LOG.trace("Started serializing BGP Capability: {}", optionalCapa);
serializeOptionalCapability(optionalCapa, buffer);
}
return buffer;
}
Aggregations