2 * Copyright (c) 2015 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.protocol.bgp.rib.impl;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.Preconditions;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
14 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
17 * Invoked on routes which we send outside of our home AS.
19 final class ToExternalExportPolicy extends AbstractExportPolicy {
20 private final Long localAs;
22 ToExternalExportPolicy(final Long localAs) {
23 this.localAs = requireNonNull(localAs);
27 ContainerNode effectiveAttributes(final PeerRole sourceRole, final ContainerNode attributes) {
28 final ContainerNode ret = AttributeOperations.getInstance(attributes).exportedAttributes(attributes, this.localAs);
32 // eBGP -> eBGP, propagate
35 // Non-Client iBGP -> eBGP, propagate
38 // Client iBGP -> eBGP, propagate
41 // Internal iBGP -> eBGP, propagate
44 throw new IllegalArgumentException("Unhandled source role " + sourceRole);