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 static java.util.Objects.requireNonNull;
12 import org.opendaylight.controller.config.api.DependencyResolver;
13 import org.opendaylight.controller.config.api.ModuleIdentifier;
14 import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
15 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
19 import org.opendaylight.yangtools.yang.binding.DataContainer;
21 public final class BGPPSMImplModule extends AbstractBGPPSMImplModule {
22 public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
23 super(identifier, dependencyResolver);
26 public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, BGPPSMImplModule oldModule, AutoCloseable oldInstance) {
27 super(identifier, dependencyResolver, oldModule, oldInstance);
30 private static final class AutoCloseableBestPathSelectionStrategy implements BGPBestPathSelection {
32 private final BgpTableType pathFamilyDependency;
33 private final PathSelectionMode strategyFactory;
35 AutoCloseableBestPathSelectionStrategy(final BgpTableType pathFamilyDependency, final PathSelectionMode strategyFactory) {
36 this.pathFamilyDependency = requireNonNull(pathFamilyDependency);
37 this.strategyFactory = requireNonNull(strategyFactory);
41 public void close() throws Exception {
42 this.strategyFactory.close();
46 public Class<? extends AddressFamily> getAfi() {
47 return this.pathFamilyDependency.getAfi();
51 public Class<? extends SubsequentAddressFamily> getSafi() {
52 return this.pathFamilyDependency.getSafi();
56 public Class<? extends DataContainer> getImplementedInterface() {
57 return BGPBestPathSelection.class;
61 public PathSelectionMode getStrategy() {
62 return this.strategyFactory;
67 public void customValidation() {
71 public java.lang.AutoCloseable createInstance() {
72 return new AutoCloseableBestPathSelectionStrategy(getPathAddressFamilyDependency(), getPathSelectionModeDependency());