BGPCEP-754: Start using default import policy
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / FromExternalImportPolicy.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  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;
9
10 import org.opendaylight.protocol.bgp.rib.impl.spi.AbstractImportPolicy;
11 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
12
13 /**
14  * Import policy invoked on routes which we get from outside of our home AS.
15  */
16 final class FromExternalImportPolicy extends AbstractImportPolicy {
17     @Override
18     public ContainerNode effectiveAttributes(final ContainerNode attributes) {
19         /*
20          * Filter out non-transitive attributes, so they do not cross inter-AS
21          * boundaries.
22          *
23          * FIXME: to be completely flexible, we need to allow for retaining
24          *        the MED attribute. @see https://tools.ietf.org/html/rfc4271#section-5.1.4.
25          */
26         return AttributeOperations.getInstance(attributes).transitiveAttributes(attributes);
27     }
28 }