import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeNode;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
import org.opendaylight.protocol.bmp.impl.spi.BmpRouterPeer;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev150512.peers.peer.PrePolicyRib;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev150512.peers.peer.Stats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev150512.routers.Router;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTree;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTreeNode;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.common.QName;
if (this.up) {
final AdjRibInType ribType = routeMonitoring.getPeerHeader().getAdjRibInType();
switch (ribType) {
- case PrePolicy:
- this.prePolicyWriter.onMessage(routeMonitoring.getUpdate());
- break;
- case PostPolicy:
- this.postPolicyWriter.onMessage(routeMonitoring.getUpdate());
- break;
- default:
- break;
+ case PrePolicy:
+ this.prePolicyWriter.onMessage(routeMonitoring.getUpdate());
+ break;
+ case PostPolicy:
+ this.postPolicyWriter.onMessage(routeMonitoring.getUpdate());
+ break;
+ default:
+ break;
}
}
}
close();
}
- @Override
- public PeerId getPeerId() {
- return this.peerId;
- }
-
@Override
public void close() {
Preconditions.checkState(this.up, "Already closed.");
.withChild(
ImmutableNodes.leafNode(PEER_LOCAL_ADDRESS_QNAME,
getStringIpAddress(peerUp.getLocalAddress())))
- .withChild(
- ImmutableNodes.leafNode(PEER_LOCAL_PORT_QNAME, peerUp
- .getLocalPort().getValue()))
- .withChild(
- ImmutableNodes.leafNode(PEER_REMOTE_PORT_QNAME, peerUp
- .getRemotePort().getValue()))
- .withChild(ImmutableNodes.leafNode(PEER_STATUS_QNAME, "up"))
- .withChild(
- ImmutableNodes.leafNode(PEER_UP_TIMESTAMP_QNAME,
- timestamp.getValue()));
+ .withChild(
+ ImmutableNodes.leafNode(PEER_LOCAL_PORT_QNAME, peerUp
+ .getLocalPort().getValue()))
+ .withChild(
+ ImmutableNodes.leafNode(PEER_REMOTE_PORT_QNAME, peerUp
+ .getRemotePort().getValue()))
+ .withChild(ImmutableNodes.leafNode(PEER_STATUS_QNAME, "up"))
+ .withChild(
+ ImmutableNodes.leafNode(PEER_UP_TIMESTAMP_QNAME,
+ timestamp.getValue()));
if (this.receivedOpenCodec != null) {
builder.withChild((ContainerNode) this.receivedOpenCodec.serialize(peerUp.getReceivedOpen()));
}
.withChild(
Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(PrePolicyRib.QNAME))
.withChild(ImmutableNodes.mapNodeBuilder(BMP_TABLES_QNAME).build()).build())
- .withChild(
- Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(PostPolicyRib.QNAME))
- .withChild(ImmutableNodes.mapNodeBuilder(BMP_TABLES_QNAME).build()).build());
+ .withChild(
+ Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(PostPolicyRib.QNAME))
+ .withChild(ImmutableNodes.mapNodeBuilder(BMP_TABLES_QNAME).build()).build());
if (peerHeader.getDistinguisher() != null) {
mapEntryBuilder.withChild(ImmutableNodes.leafNode(PEER_DISTINGUISHER_QNAME, peerHeader.getDistinguisher().getDistinguisher()));
}
}
if (tlvs.getPerAfiSafiAdjRibInTlv() != null) {
builder.withChild(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(STAT9_QNAME))
- .withChild(ImmutableNodes.mapNodeBuilder(AF_QNAME)
- .withChild(Builders.mapEntryBuilder()
- .withChild(ImmutableNodes.leafNode(COUNT_QNAME, tlvs.getPerAfiSafiAdjRibInTlv().getCount().getValue()))
- .withNodeIdentifier(TablesUtil.toYangTablesKey(AF_QNAME, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))
- .build()).build()).build());
+ .withChild(ImmutableNodes.mapNodeBuilder(AF_QNAME)
+ .withChild(Builders.mapEntryBuilder()
+ .withChild(ImmutableNodes.leafNode(COUNT_QNAME, tlvs.getPerAfiSafiAdjRibInTlv().getCount().getValue()))
+ .withNodeIdentifier(TablesUtil.toYangTablesKey(AF_QNAME, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))
+ .build()).build()).build());
}
if (tlvs.getPerAfiSafiLocRibTlv() != null) {
builder.withChild(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(STAT10_QNAME))
- .withChild(ImmutableNodes.mapNodeBuilder(AF_QNAME)
- .withChild(Builders.mapEntryBuilder()
- .withChild(ImmutableNodes.leafNode(COUNT_QNAME, tlvs.getPerAfiSafiLocRibTlv().getCount().getValue()))
- .withNodeIdentifier(TablesUtil.toYangTablesKey(AF_QNAME, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))
- .build()).build()).build());
+ .withChild(ImmutableNodes.mapNodeBuilder(AF_QNAME)
+ .withChild(Builders.mapEntryBuilder()
+ .withChild(ImmutableNodes.leafNode(COUNT_QNAME, tlvs.getPerAfiSafiLocRibTlv().getCount().getValue()))
+ .withNodeIdentifier(TablesUtil.toYangTablesKey(AF_QNAME, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))
+ .build()).build()).build());
}
if (tlvs.getUpdatesTreatedAsWithdrawTlv() != null) {
builder.withChild(ImmutableNodes.leafNode(STAT11_QNAME, tlvs.getUpdatesTreatedAsWithdrawTlv().getCount().getValue()));
private ContainerNode createMirrors(final Mirror mirror, final Timestamp timestamp) {
final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder =
Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(Mirrors.QNAME));
- builder.withChild(ImmutableNodes.leafNode(PEER_MIRROR_INFORMATION_QNAME, MirrorInformationCode.forValue(mirror.getTlvs().getMirrorInformationTlv().getCode().getIntValue())));
+ builder.withChild(ImmutableNodes.leafNode(PEER_MIRROR_INFORMATION_QNAME, toDom(MirrorInformationCode.forValue(
+ mirror.getTlvs().getMirrorInformationTlv().getCode().getIntValue()))));
builder.withChild(ImmutableNodes.leafNode(PEER_MIRROR_TIMESTAMP_QNAME, timestamp.getValue()));
return builder.build();
}
+ private static String toDom(final MirrorInformationCode informationCode) {
+ switch (informationCode) {
+ case ErroredPdu:
+ return "errored-pdu";
+ case MessageLost:
+ return "message-lost";
+ default:
+ return null;
+ }
+ }
+
private static String getStringIpAddress(final IpAddress ipAddress) {
if (ipAddress.getIpv4Address() != null) {