Remove useless UnsupportedOperationExceptions
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / config / RoutingPolicyUtil.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.rib.impl.config;
9
10 import static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.DefaultPolicyType.ACCEPTROUTE;
11
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;
16
17 public final class RoutingPolicyUtil {
18     private static final Config DEFAULT_POLICY = new ConfigBuilder().setDefaultImportPolicy(ACCEPTROUTE)
19             .setDefaultExportPolicy(ACCEPTROUTE).setImportPolicy(Collections.emptyList())
20             .setExportPolicy(Collections.emptyList()).build();
21
22     private RoutingPolicyUtil() {
23         // Hidden on purpose
24     }
25
26     public static Config getApplyPolicy(final ApplyPolicy applyPolicy) {
27         if (applyPolicy == null) {
28             return DEFAULT_POLICY;
29         }
30         return applyPolicy.getConfig();
31     }
32 }