use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class MPUnreachAttributeParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
if (pathAttributes2 == null) {
return;
}
final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
final ByteBuf unreachBuffer = Unpooled.buffer();
this.reg.serializeMpUnReach(mpUnreachNlri, unreachBuffer);
for (final NlriSerializer nlriSerializer : this.reg.getSerializers()) {
nlriSerializer.serializeAttribute(attribute, unreachBuffer);
}
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, unreachBuffer, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class LinkstateAttributeParser method parseAttribute.
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPParsingException {
final CLinkstateDestination lsDestination = getNlriType(builder);
if (lsDestination == null) {
LOG.warn("No Linkstate NLRI found, not parsing Linkstate attribute");
return;
}
final ObjectType nlriType = lsDestination.getObjectType();
final ProtocolId protocolId = lsDestination.getProtocolId();
final Attributes1 a = new Attributes1Builder().setLinkStateAttribute(parseLinkState(nlriType, protocolId, buffer)).build();
builder.addAugmentation(Attributes1.class, a);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class LinkstateNlriParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
if (pathAttributes1 != null) {
serializeAdvertisedRoutes(pathAttributes1.getMpReachNlri().getAdvertizedRoutes(), byteAggregator);
} else if (pathAttributes2 != null) {
serializeWithDrawnRoutes(pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes(), byteAggregator);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class LUNlriParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = (pathAttributes1.getMpReachNlri()).getAdvertizedRoutes();
if (routes != null) {
final DestinationType destinationType = routes.getDestinationType();
if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase) routes.getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
} else if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) routes.getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
}
}
} else if (pathAttributes2 != null) {
final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
if (mpUnreachNlri.getWithdrawnRoutes() != null) {
final DestinationType destinationType = mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
if (destinationType instanceof DestinationLabeledUnicastCase) {
final DestinationLabeledUnicastCase labeledUnicastCase = (DestinationLabeledUnicastCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(), true, byteAggregator);
} else if (destinationType instanceof DestinationIpv6LabeledUnicastCase) {
final DestinationIpv6LabeledUnicastCase labeledUnicastCase = (DestinationIpv6LabeledUnicastCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(), true, byteAggregator);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project netvirt by opendaylight.
the class HwvtepHAUtil method deletePSNodesOfNode.
/**
* Delete PS data of HA node of Config Data tree.
*
* @param key Node object
* @param haNode Ha Node from which to be deleted
* @param tx Transaction
* @throws ReadFailedException Exception thrown if read fails
*/
public static void deletePSNodesOfNode(InstanceIdentifier<Node> key, Node haNode, ReadWriteTransaction tx) throws ReadFailedException {
// read from switches attribute and clean up them
HwvtepGlobalAugmentation globalAugmentation = haNode.getAugmentation(HwvtepGlobalAugmentation.class);
if (globalAugmentation == null) {
return;
}
HashMap<InstanceIdentifier<Node>, Boolean> deleted = new HashMap<>();
List<Switches> switches = globalAugmentation.getSwitches();
if (switches != null) {
for (Switches switche : switches) {
InstanceIdentifier<Node> psId = (InstanceIdentifier<Node>) switche.getSwitchRef().getValue();
deleteNodeIfPresent(tx, CONFIGURATION, psId);
deleted.put(psId, Boolean.TRUE);
}
}
// also read from managed by attribute of switches and cleanup them as a back up if the above cleanup fails
Optional<Topology> topologyOptional = tx.read(CONFIGURATION, key.firstIdentifierOf(Topology.class)).checkedGet();
String deletedNodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
if (topologyOptional.isPresent()) {
Topology topology = topologyOptional.get();
if (topology.getNode() != null) {
for (Node psNode : topology.getNode()) {
PhysicalSwitchAugmentation ps = psNode.getAugmentation(PhysicalSwitchAugmentation.class);
if (ps != null) {
InstanceIdentifier<Node> iid = (InstanceIdentifier<Node>) ps.getManagedBy().getValue();
String nodeIdVal = iid.firstKeyOf(Node.class).getNodeId().getValue();
if (deletedNodeId.equals(nodeIdVal)) {
InstanceIdentifier<Node> psNodeId = convertToInstanceIdentifier(psNode.getNodeId().getValue());
if (deleted.containsKey(psNodeId)) {
deleteNodeIfPresent(tx, CONFIGURATION, psNodeId);
}
}
}
}
}
}
}
Aggregations