use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class ArbitraryParserTest method parserTest.
@Test
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
final ArbitraryCase arbitrary = new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ARB_VALUE).build()).build();
this.parser.serializeEsi(arbitrary, buff);
assertArrayEquals(ARB_RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(ARB_VALUE));
assertEquals(arbitrary, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(Arbitrary.QNAME)).addChild(createValueBuilder(ARB_VALUE, ARB_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
assertEquals(arbitrary, acmResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class MacParserTest method parserTest.
@Test
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder().setLocalDiscriminator(UINT24_LD).setSystemMacAddress(MAC).build()).build();
this.parser.serializeEsi(macAuto, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
assertEquals(macAuto, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, SYSTEM_MAC_NID).build()).addChild(createValueBuilder(UINT24_LD_MODEL, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
assertEquals(macAuto, acmResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class RouterIdParserTest method createRouterIdCase.
public static ChoiceNode createRouterIdCase() {
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> nextHop = Builders.choiceBuilder();
nextHop.withNodeIdentifier(new NodeIdentifier(RouterIdGeneratedCase.QNAME));
return nextHop.addChild(createRouteContainer()).build();
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project controller by opendaylight.
the class PrefixedShardConfigWriter method writeInitialParent.
private void writeInitialParent() {
final ClientTransaction tx = history.createTransaction();
final DOMDataTreeWriteCursor cursor = tx.openCursor();
final ContainerNode root = ImmutableContainerNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(ClusterUtils.PREFIX_SHARDS_QNAME)).withChild(ImmutableMapNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(ClusterUtils.SHARD_LIST_QNAME)).build()).build();
cursor.merge(ClusterUtils.PREFIX_SHARDS_PATH.getLastPathArgument(), root);
cursor.close();
final DOMStoreThreePhaseCommitCohort cohort = tx.ready();
submitBlocking(cohort);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project controller by opendaylight.
the class NormalizedNodePrunerTest method testAnyXMLNodeNotPrunedWhenHasParent.
@Test
public void testAnyXMLNodeNotPrunedWhenHasParent() throws IOException {
NormalizedNodePruner pruner = prunerFullSchema(TestModel.TEST_PATH);
AnyXmlNode child = Builders.anyXmlBuilder().withNodeIdentifier(new NodeIdentifier(TestModel.ANY_XML_QNAME)).withValue(mock(DOMSource.class)).build();
NormalizedNode<?, ?> input = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(pruner).write(input);
NormalizedNode<?, ?> actual = pruner.normalizedNode();
assertEquals("normalizedNode", input, actual);
}
Aggregations