2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yang.bgp.rib.impl;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.config.api.DependencyResolver;
12 import org.opendaylight.controller.config.api.ModuleIdentifier;
13 import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
18 import org.opendaylight.yangtools.yang.binding.DataContainer;
20 public final class BGPPSMImplModule extends AbstractBGPPSMImplModule {
21 public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
22 super(identifier, dependencyResolver);
25 public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, BGPPSMImplModule oldModule, AutoCloseable oldInstance) {
26 super(identifier, dependencyResolver, oldModule, oldInstance);
29 private static final class AutoCloseableBestPathSelectionStrategy implements BGPBestPathSelection {
31 private final BgpTableType pathFamilyDependency;
32 private final PathSelectionMode strategyFactory;
34 AutoCloseableBestPathSelectionStrategy(final BgpTableType pathFamilyDependency, final PathSelectionMode strategyFactory) {
35 this.pathFamilyDependency = Preconditions.checkNotNull(pathFamilyDependency);
36 this.strategyFactory = Preconditions.checkNotNull(strategyFactory);
40 public void close() throws Exception {
41 this.strategyFactory.close();
45 public Class<? extends AddressFamily> getAfi() {
46 return this.pathFamilyDependency.getAfi();
50 public Class<? extends SubsequentAddressFamily> getSafi() {
51 return this.pathFamilyDependency.getSafi();
55 public Class<? extends DataContainer> getImplementedInterface() {
56 return BGPBestPathSelection.class;
60 public PathSelectionMode getStrategy() {
61 return this.strategyFactory;
66 public void customValidation() {
70 public java.lang.AutoCloseable createInstance() {
71 return new AutoCloseableBestPathSelectionStrategy(getPathAddressFamilyDependency(), getPathSelectionModeDependency());