2 * Copyright (c) 2018 AT&T Intellectual Property. 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.protocol.bgp.rib.impl.config;
10 import static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.DefaultPolicyType.ACCEPTROUTE;
12 import java.util.Collections;
13 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.ApplyPolicy;
14 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.apply.policy.Config;
15 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.apply.policy.ConfigBuilder;
17 public final class RoutingPolicyUtil {
19 private static final Config DEFAULT_POLICY = new ConfigBuilder().setDefaultImportPolicy(ACCEPTROUTE)
20 .setDefaultExportPolicy(ACCEPTROUTE).setImportPolicy(Collections.emptyList())
21 .setExportPolicy(Collections.emptyList()).build();
23 private RoutingPolicyUtil() {
24 throw new UnsupportedOperationException();
27 public static Config getApplyPolicy(final ApplyPolicy applyPolicy) {
28 if (applyPolicy == null) {
29 return DEFAULT_POLICY;
31 return applyPolicy.getConfig();