use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.
the class LinkstateRIBSupportTest method testRoutePath.
@Test
public void testRoutePath() {
final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
Assert.assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.
the class BmpRouterPeerImpl method createPeerEntry.
private MapEntryNode createPeerEntry(final PeerUpNotification peerUp) {
final PeerHeader peerHeader = peerUp.getPeerHeader();
final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders.mapEntryBuilder().withNodeIdentifier(new NodeIdentifierWithPredicates(Peer.QNAME, PEER_ID_QNAME, this.peerId.getValue())).withChild(ImmutableNodes.leafNode(PEER_ID_QNAME, this.peerId.getValue())).withChild(ImmutableNodes.leafNode(PEER_TYPE_QNAME, peerHeader.getType().name().toLowerCase(Locale.ENGLISH))).withChild(ImmutableNodes.leafNode(PEER_ADDRESS_QNAME, getStringIpAddress(peerHeader.getAddress()))).withChild(ImmutableNodes.leafNode(PEER_AS_QNAME, peerHeader.getAs().getValue())).withChild(ImmutableNodes.leafNode(PEER_BGP_ID_QNAME, peerHeader.getBgpId().getValue())).withChild(createPeerSessionUp(peerUp, peerHeader.getTimestampSec())).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());
final PeerDistinguisher pd = peerHeader.getPeerDistinguisher();
if (pd != null) {
mapEntryBuilder.withChild(ImmutableNodes.leafNode(PEER_DISTINGUISHER_QNAME, pd.getRouteDistinguisher()));
}
return mapEntryBuilder.build();
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.
the class TablesUtil method toYangTablesKey.
/**
* Creates Yang Instance Identifier path argument from supplied QNAMES and AFI and SAFI.
*
* @param nodeName QName reprenting node
* @param afi Class representing AFI
* @param safi Class representing SAFI
* @return NodeIdentifierWithPredicates for specified AFI, SAFI combination.
*/
public static NodeIdentifierWithPredicates toYangTablesKey(final QName nodeName, final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
final QName afiQname = QName.create(nodeName, "afi").intern();
final QName safiQname = QName.create(nodeName, "safi").intern();
final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(afiQname, BindingReflections.findQName(afi), safiQname, BindingReflections.findQName(safi));
return new NodeIdentifierWithPredicates(nodeName, keyValues);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.
the class BmpRibInWriter method createTableInstance.
/**
* Create new table instance.
*/
private static ImmutableMap.Builder<TablesKey, TableContext> createTableInstance(final Set<TablesKey> tableTypes, final YangInstanceIdentifier yangTableRootIId, final DOMDataWriteTransaction tx, final RIBExtensionConsumerContext ribExtensions, final BindingCodecTree tree) {
final ImmutableMap.Builder<TablesKey, TableContext> tb = ImmutableMap.builder();
for (final TablesKey k : tableTypes) {
final RIBSupport rs = ribExtensions.getRIBSupport(k);
if (rs == null) {
LOG.warn("No support for table type {}, skipping it", k);
continue;
}
final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(yangTableRootIId);
final NodeIdentifierWithPredicates key = TablesUtil.toYangTablesKey(k);
idb.nodeWithKey(key.getNodeType(), key.getKeyValues());
final TableContext ctx = new TableContext(rs, idb.build(), tree);
ctx.createTable(tx);
tx.put(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_FALSE.getNodeType()), ATTRIBUTES_UPTODATE_FALSE);
LOG.debug("Created table instance {}", ctx.getTableId());
tb.put(k, ctx);
}
return tb;
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.
the class IdentifierUtilsTest method testDomPeerId.
@Test
public void testDomPeerId() throws Exception {
final NodeIdentifierWithPredicates result = IdentifierUtils.domPeerId(PEER_ID);
assertEquals(NIWP_PEER, result);
}
Aggregations