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 java.util.Collection;
13 import java.util.Map.Entry;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
20 * A collection of peers sharing the same export policy.
22 final class PeerExportGroup {
23 private final Collection<Entry<PeerId, YangInstanceIdentifier>> peers;
24 private final Map<PeerId, PeerRole> peerRoles;
25 private final AbstractExportPolicy policy;
27 PeerExportGroup(final Collection<Entry<PeerId, YangInstanceIdentifier>> peers, final Map<PeerId, PeerRole> peerRoles, final AbstractExportPolicy policy) {
28 this.peers = Preconditions.checkNotNull(peers);
29 this.peerRoles = Preconditions.checkNotNull(peerRoles);
30 this.policy = Preconditions.checkNotNull(policy);
33 ContainerNode effectiveAttributes(final PeerId sourcePeerId, final ContainerNode attributes) {
34 return policy.effectiveAttributes(peerRoles.get(sourcePeerId), attributes);
37 Collection<Entry<PeerId, YangInstanceIdentifier>> getPeers() {