Search in sources :

Example 6 with Identifier

use of org.opendaylight.yangtools.yang.binding.Identifier in project bgpcep by opendaylight.

the class AddPathAbstractRouteEntry method updateBestPaths.

@Override
public void updateBestPaths(final RouteEntryDependenciesContainer entryDependencies, final Identifier routeKey, final WriteTransaction tx) {
    final RIBSupport ribSupport = entryDependencies.getRibSupport();
    final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDependencies.getLocRibTableTarget();
    if (this.bestPathRemoved != null) {
        this.bestPathRemoved.forEach(path -> {
            final Identifier newRouteKey = ribSupport.createNewRouteKey(path.getPathId(), routeKey);
            final InstanceIdentifier routeTarget = ribSupport.createRouteIdentifier(locRibTarget, newRouteKey);
            LOG.debug("Delete route from LocRib {}", routeTarget);
            tx.delete(LogicalDatastoreType.OPERATIONAL, routeTarget);
        });
        this.bestPathRemoved = null;
    }
    if (this.removedPaths != null) {
        this.removedPaths.forEach(removedPath -> {
            final Identifier routeKeyAddPath = ribSupport.createNewRouteKey(removedPath.getPathId(), routeKey);
            final Identifier routeKeyNonAddPath = ribSupport.createNewRouteKey(NON_PATH_ID_VALUE, routeKey);
            fillAdjRibsOut(true, null, null, null, routeKeyNonAddPath, routeKeyAddPath, RouterIds.createPeerId(removedPath.getRouteId()), entryDependencies.getLocalTablesKey(), entryDependencies, tx);
        });
        this.removedPaths = null;
    }
    if (this.newBestPathToBeAdvertised != null) {
        this.newBestPathToBeAdvertised.forEach(path -> addPathToDataStore(entryDependencies, path, isFirstBestPath(this.bestPath.indexOf(path)), routeKey, tx));
        this.newBestPathToBeAdvertised = null;
    }
}
Also used : TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Identifier(org.opendaylight.yangtools.yang.binding.Identifier) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier)

Example 7 with Identifier

use of org.opendaylight.yangtools.yang.binding.Identifier in project bgpcep by opendaylight.

the class AddPathAbstractRouteEntry method writeRoutePath.

@SuppressWarnings("unchecked")
private void writeRoutePath(final RouteEntryInfo entryInfo, final boolean destPeerSupAddPath, final AddPathBestPath path, final TablesKey localTK, final RouteEntryDependenciesContainer routeEntryDep, final WriteTransaction tx) {
    final Identifier routeKey = entryInfo.getRouteKey();
    final RIBSupport ribSupport = routeEntryDep.getRibSupport();
    final BGPRouteEntryExportParameters baseExp = new BGPRouteEntryExportParametersImpl(this.peerTracker.getPeer(path.getPeerId()), entryInfo.getToPeer());
    final Optional<Attributes> effAttrib = routeEntryDep.getRoutingPolicies().applyExportPolicies(baseExp, path.getAttributes());
    Identifier newRouteKey = ribSupport.createNewRouteKey(destPeerSupAddPath ? path.getPathId() : NON_PATH_ID_VALUE, routeKey);
    final Peer toPeer = entryInfo.getToPeer();
    final Route route = createRoute(ribSupport, newRouteKey, destPeerSupAddPath ? path.getPathId() : NON_PATH_ID_VALUE, path);
    InstanceIdentifier ribOutIId = ribSupport.createRouteIdentifier(toPeer.getRibOutIId(localTK), newRouteKey);
    if (effAttrib.isPresent() && route != null) {
        LOG.debug("Write route {} to peer AdjRibsOut {}", route, toPeer.getPeerId());
        tx.put(LogicalDatastoreType.OPERATIONAL, ribOutIId, route);
        tx.put(LogicalDatastoreType.OPERATIONAL, ribOutIId.child(Attributes.class), effAttrib.get());
    }
}
Also used : InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Identifier(org.opendaylight.yangtools.yang.binding.Identifier) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) Peer(org.opendaylight.protocol.bgp.rib.spi.Peer) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) BGPRouteEntryExportParametersImpl(org.opendaylight.protocol.bgp.mode.impl.BGPRouteEntryExportParametersImpl) BGPRouteEntryExportParameters(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)

Example 8 with Identifier

use of org.opendaylight.yangtools.yang.binding.Identifier in project bgpcep by opendaylight.

the class AddPathAbstractRouteEntry method addPathToDataStore.

private void addPathToDataStore(final RouteEntryDependenciesContainer entryDep, final AddPathBestPath path, final boolean isFirstBestPath, final Identifier routeKey, final WriteTransaction tx) {
    final RIBSupport ribSup = entryDep.getRibSupport();
    final Identifier routeKeyAddPath = ribSup.createNewRouteKey(path.getPathId(), routeKey);
    final Identifier routeKeyAddNonPath = ribSup.createNewRouteKey(NON_PATH_ID_VALUE, routeKey);
    final Route routeAddPath = createRoute(ribSup, routeKeyAddPath, path.getPathId(), path);
    final Route routeNonAddPath = createRoute(ribSup, routeKeyAddNonPath, NON_PATH_ID_VALUE, path);
    final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
    final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, routeKeyAddPath);
    LOG.debug("Write route to LocRib {}", routeAddPath);
    tx.put(LogicalDatastoreType.OPERATIONAL, routeTarget, routeAddPath);
    fillAdjRibsOut(isFirstBestPath, path.getAttributes(), routeNonAddPath, routeAddPath, routeKeyAddNonPath, routeKeyAddPath, path.getPeerId(), entryDep.getLocalTablesKey(), entryDep, tx);
}
Also used : InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Identifier(org.opendaylight.yangtools.yang.binding.Identifier) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)

Aggregations

Identifier (org.opendaylight.yangtools.yang.binding.Identifier)8 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)8 KeyedInstanceIdentifier (org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier)7 RIBSupport (org.opendaylight.protocol.bgp.rib.spi.RIBSupport)6 Route (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)5 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)5 Tables (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables)4 BGPRouteEntryExportParametersImpl (org.opendaylight.protocol.bgp.mode.impl.BGPRouteEntryExportParametersImpl)2 Peer (org.opendaylight.protocol.bgp.rib.spi.Peer)2 BGPRouteEntryExportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters)2 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)2 HashMap (java.util.HashMap)1 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 MergeCommand (org.opendaylight.netvirt.elan.l2gw.ha.commands.MergeCommand)1 RouteEntry (org.opendaylight.protocol.bgp.mode.api.RouteEntry)1 HwvtepGlobalAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)1 PhysicalSwitchAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation)1 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)1