Search in sources :

Example 56 with NodeIdentifierWithPredicates

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.

the class BmpRouterImpl method createRouterEntry.

private synchronized void createRouterEntry() {
    Preconditions.checkState(isDatastoreWritable());
    final DOMDataWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
    wTx.put(LogicalDatastoreType.OPERATIONAL, this.routerYangIId, Builders.mapEntryBuilder().withNodeIdentifier(new NodeIdentifierWithPredicates(Router.QNAME, ROUTER_ID_QNAME, this.routerIp)).withChild(ImmutableNodes.leafNode(ROUTER_ID_QNAME, this.routerIp)).withChild(ImmutableNodes.leafNode(ROUTER_STATUS_QNAME, DOWN)).withChild(ImmutableNodes.mapNodeBuilder(Peer.QNAME).build()).build());
    wTx.submit();
}
Also used : NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 57 with NodeIdentifierWithPredicates

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.

the class RibSupportUtilsTest method toYangPathKey.

@Test
public void toYangPathKey() {
    final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME, AFI, SAFI);
    assertEquals(NII_PATH.toString(), result.toString());
}
Also used : NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) Test(org.junit.Test)

Example 58 with NodeIdentifierWithPredicates

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.

the class TableContext method createTable.

void createTable(final DOMDataWriteTransaction tx) {
    final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tb = ImmutableNodes.mapEntryBuilder();
    tb.withNodeIdentifier((NodeIdentifierWithPredicates) this.tableId.getLastPathArgument());
    tb.withChild(EMPTY_TABLE_ATTRIBUTES);
    // tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
    final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) this.tableId.getLastPathArgument();
    for (final Map.Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
        tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
    }
    final ChoiceNode routes = this.tableSupport.emptyRoutes();
    Verify.verifyNotNull(routes, "Null empty routes in %s", this.tableSupport);
    tx.put(LogicalDatastoreType.OPERATIONAL, this.tableId, tb.withChild(ImmutableChoiceNodeBuilder.create(routes).withNodeIdentifier(new NodeIdentifier(TablesUtil.BMP_ROUTES_QNAME)).build()).build());
}
Also used : QName(org.opendaylight.yangtools.yang.common.QName) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) Map(java.util.Map)

Example 59 with NodeIdentifierWithPredicates

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.

the class IdentifierUtilsTest method testPeerKey.

@Test
public void testPeerKey() throws Exception {
    final NodeIdentifierWithPredicates result = IdentifierUtils.peerKey(YII_PEER);
    assertEquals(NIWP_PEER, result);
}
Also used : NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) Test(org.junit.Test)

Example 60 with NodeIdentifierWithPredicates

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates in project bgpcep by opendaylight.

the class IdentifierUtilsTest method testTableKey.

@Test
public void testTableKey() throws Exception {
    final NodeIdentifierWithPredicates result = IdentifierUtils.tableKey(YII_TABLE);
    assertEquals(NIWP_TABLE, result);
}
Also used : NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) Test(org.junit.Test)

Aggregations

NodeIdentifierWithPredicates (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates)97 Test (org.junit.Test)52 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)49 ArrayList (java.util.ArrayList)37 Flowspec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.Flowspec)34 FlowspecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.FlowspecBuilder)34 NumericOperand (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.NumericOperand)20 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)20 QName (org.opendaylight.yangtools.yang.common.QName)15 DestinationFlowspecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.ipv4.DestinationFlowspecBuilder)12 PathArgument (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)11 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)10 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)10 DOMDataWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)9 DataContainerChild (org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild)7 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)6 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)6 BitmaskOperand (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.BitmaskOperand)6 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)5 DestinationFlowspecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.ipv6.DestinationFlowspecBuilder)5