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 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
13 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
16 * Invoked on routes which we send outside of our home AS.
18 final class ToExternalExportPolicy extends AbstractExportPolicy {
19 private final Long localAs;
21 ToExternalExportPolicy(final Long localAs) {
22 this.localAs = requireNonNull(localAs);
26 ContainerNode effectiveAttributes(final PeerRole sourceRole, final ContainerNode attributes) {
27 final ContainerNode ret = AttributeOperations.getInstance(attributes).exportedAttributes(attributes, this.localAs);
31 // eBGP -> eBGP, propagate
34 // Non-Client iBGP -> eBGP, propagate
37 // Client iBGP -> eBGP, propagate
40 // Internal iBGP -> eBGP, propagate
43 throw new IllegalArgumentException("Unhandled source role " + sourceRole);