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 com.google.common.base.Preconditions;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
12 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
15 * Invoked on routes which we send outside of our home AS.
17 final class ToExternalExportPolicy extends AbstractExportPolicy {
18 private final Long localAs;
20 ToExternalExportPolicy(final Long localAs) {
21 this.localAs = Preconditions.checkNotNull(localAs);
25 ContainerNode effectiveAttributes(final PeerRole sourceRole, final ContainerNode attributes) {
26 final ContainerNode ret = AttributeOperations.getInstance(attributes).exportedAttributes(attributes, this.localAs);
30 // eBGP -> eBGP, propagate
33 // Non-Client iBGP -> eBGP, propagate
36 // Client iBGP -> eBGP, propagate
39 // Internal iBGP -> eBGP, propagate
42 throw new IllegalArgumentException("Unhandled source role " + sourceRole);