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