Search in sources :

Example 1 with Config1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.Config1 in project bgpcep by opendaylight.

the class GracefulRestartUtil method getLlGracefulTimers.

static Map<TablesKey, Integer> getLlGracefulTimers(final Collection<? extends AfiSafi> afiSafis, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
    final Map<TablesKey, Integer> timers = new HashMap<>();
    afiSafis.forEach(afiSafi -> {
        final GracefulRestart gracefulRestart = afiSafi.getGracefulRestart();
        if (gracefulRestart != null) {
            final Config gracefulRestartConfig = gracefulRestart.getConfig();
            if (gracefulRestartConfig != null) {
                final LlGracefulRestart llGracefulRestart;
                final Config1 peerAug = gracefulRestartConfig.augmentation(Config1.class);
                if (peerAug != null) {
                    llGracefulRestart = peerAug.getLlGracefulRestart();
                } else {
                    final Config2 neighborAug = gracefulRestartConfig.augmentation(Config2.class);
                    if (neighborAug != null) {
                        llGracefulRestart = neighborAug.getLlGracefulRestart();
                    } else {
                        return;
                    }
                }
                if (llGracefulRestart != null) {
                    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.ll.graceful.restart.Config config = llGracefulRestart.getConfig();
                    if (config != null) {
                        final Uint24 staleTime = config.getLongLivedStaleTime();
                        if (staleTime != null && staleTime.getValue().toJava() > 0) {
                            final TablesKey key = tableTypeRegistry.getTableKey(afiSafi.getAfiSafiName());
                            if (key != null) {
                                timers.put(key, staleTime.getValue().intValue());
                            } else {
                                LOG.debug("Skipping unsupported afi-safi {}", afiSafi.getAfiSafiName());
                            }
                        }
                    }
                }
            }
        }
    });
    return timers;
}
Also used : TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey) HashMap(java.util.HashMap) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config) Config1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.Config1) LlGracefulRestart(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.LlGracefulRestart) GracefulRestart(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestart) Config2(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.Config2) Uint24(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Uint24) LlGracefulRestart(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.LlGracefulRestart)

Aggregations

HashMap (java.util.HashMap)1 GracefulRestart (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestart)1 Config (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config)1 Uint24 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Uint24)1 Config1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.Config1)1 Config2 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.Config2)1 LlGracefulRestart (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.LlGracefulRestart)1 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey)1