use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.top.top.level.list.list1.list1._1.Cont in project controller by opendaylight.
the class CrossBrokerMountPointTest method testMountPoint.
@Test
public void testMountPoint() throws ReadFailedException, TimeoutException {
final Integer attrIntValue = 500;
domMountPointService.createMountPoint(TLL_INSTANCE_ID_BI).addService(DOMDataBroker.class, new DOMDataBroker() {
@Override
public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
throw new UnsupportedOperationException();
}
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
throw new UnsupportedOperationException();
}
@Override
public DOMDataReadWriteTransaction newReadWriteTransaction() {
return new DOMDataReadWriteTransaction() {
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
if (store == LogicalDatastoreType.OPERATIONAL && path.getLastPathArgument().equals(GROUP_STATISTICS_ID_BI.getLastPathArgument())) {
final ContainerNode data = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(AUG_CONT)).withChild(ImmutableNodes.leafNode(QName.create(AUG_CONT, "attr-int"), attrIntValue)).build();
return Futures.immediateCheckedFuture(Optional.<NormalizedNode<?, ?>>of(data));
}
return Futures.immediateFailedCheckedFuture(new ReadFailedException(TLL_NAME, new Exception()));
}
@Override
public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
throw new UnsupportedOperationException();
}
@Override
public Object getIdentifier() {
return this;
}
@Override
public boolean cancel() {
return false;
}
@Override
public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
throw new UnsupportedOperationException();
}
@Override
public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
throw new UnsupportedOperationException();
}
@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
throw new UnsupportedOperationException();
}
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
throw new UnsupportedOperationException();
}
};
}
@Override
public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
throw new UnsupportedOperationException();
}
@Override
public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
throw new UnsupportedOperationException();
}
@Override
public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
return Collections.emptyMap();
}
}).register();
final Optional<MountPoint> bindingMountPoint = bindingMountPointService.getMountPoint(TLL_INSTANCE_ID_BA);
assertTrue(bindingMountPoint.isPresent());
final Optional<DataBroker> dataBroker = bindingMountPoint.get().getService(DataBroker.class);
assertTrue(dataBroker.isPresent());
final Optional<Cont> data = dataBroker.get().newReadWriteTransaction().read(LogicalDatastoreType.OPERATIONAL, AUG_CONT_ID_BA).checkedGet(5, TimeUnit.SECONDS);
assertTrue(data.isPresent());
assertEquals(attrIntValue, data.get().getAttrInt());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.top.top.level.list.list1.list1._1.Cont in project bgpcep by opendaylight.
the class ASGenParserTest method parserTest.
@Test
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS_NUMBER).setLocalDiscriminator(LD).build()).build();
this.parser.serializeEsi(asGen, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
assertEquals(asGen, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME)).addChild(createValueBuilder(AS_MODEL, AS_NID).build()).addChild(createValueBuilder(LD, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
assertEquals(asGen, acmResult);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.top.top.level.list.list1.list1._1.Cont 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.top.top.level.list.list1.list1._1.Cont in project bgpcep by opendaylight.
the class EvpnNlriParser method extractDestination.
private static EvpnDestination extractDestination(final DataContainerNode<? extends PathArgument> evpnChoice, final ExtractionInterface extract) {
final EvpnRegistry reg = SimpleEvpnNlriRegistry.getInstance();
final ChoiceNode cont = (ChoiceNode) evpnChoice.getChild(EVPN_CHOICE_NID).get();
final EvpnChoice evpnValue = extract.check(reg, cont);
if (evpnValue == null) {
LOG.warn("Unrecognized Nlri {}", cont);
return null;
}
return new EvpnDestinationBuilder().setRouteDistinguisher(extractRouteDistinguisher(evpnChoice)).setEvpnChoice(evpnValue).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.top.top.level.list.list1.list1._1.Cont 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);
}
Aggregations