b9c82878987bce113287e8fc4f4128d2d43924f1
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / PeerExportGroup.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.bgp.rib.spi;
10
11 import java.util.Collection;
12 import java.util.Map;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
17
18 /**
19  * A collection of peers sharing the same export policy.
20  */
21 public interface PeerExportGroup {
22     final class PeerExporTuple {
23         private final YangInstanceIdentifier yii;
24         private final PeerRole role;
25
26         public PeerExporTuple(final YangInstanceIdentifier yii, final PeerRole role) {
27             this.yii = yii;
28             this.role = role;
29         }
30
31         public YangInstanceIdentifier getYii() {
32             return yii;
33         }
34
35         public PeerRole getRole() {
36             return role;
37         }
38     }
39
40     /**
41      * Transform outgoing attributes according to policy per Peer
42      *
43      * @param sourcePeerId root Peer
44      * @param attributes attributes container
45      * @return return attributes container after apply policy
46      */
47     ContainerNode effectiveAttributes(PeerId sourcePeerId, ContainerNode attributes);
48
49     /**
50      * @return map of peer
51      */
52     Collection<Map.Entry<PeerId, PeerExporTuple>> getPeers();
53 }