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 javax.annotation.Nonnull;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
18 * An intermediate abstract class shared by both Client and Non-Client
21 abstract class AbstractReflectingExportPolicy extends AbstractExportPolicy {
22 private final ClusterIdentifier clusterId;
23 private final Ipv4Address originatorId;
25 protected AbstractReflectingExportPolicy(final Ipv4Address originatorId, final ClusterIdentifier clusterId) {
26 this.originatorId = requireNonNull(originatorId);
27 this.clusterId = requireNonNull(clusterId);
31 * Modify attributes so they are updated as per RFC4456 route reflection.
33 * @param attributes Input attributes, may not be null.
34 * @return Modified (reflected) attributes.
36 @Nonnull protected final ContainerNode reflectedAttributes(@Nonnull final ContainerNode attributes) {
37 return AttributeOperations.getInstance(attributes).reflectedAttributes(attributes, this.originatorId, this.clusterId);
41 * Modify attributes so they are updated as per RFC4456 route reflection, but without add ORIGINATOR_ID
42 * and CLUSTER_ID inside CLUSTER_LIST as required https://tools.ietf.org/html/rfc4456#section-8, BUG 4070.
44 * @param attributes Input attributes, may not be null.
45 * @return Modified (reflected) attributes.
47 @Nonnull protected static ContainerNode reflectedFromInternalAttributes(@Nonnull final ContainerNode attributes) {
48 return AttributeOperations.getInstance(attributes).reflectedAttributes(attributes);