use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class LabeledUnicastIpv4RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() throws Exception {
final Routes empty = new LabeledUnicastRoutesCaseBuilder().setLabeledUnicastRoutes(new LabeledUnicastRoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build()).build();
final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class LabeledUnicastIpv6RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() {
final Routes empty = new LabeledUnicastIpv6RoutesCaseBuilder().setLabeledUnicastIpv6Routes(new LabeledUnicastIpv6RoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build()).build();
final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class VpnIpv6RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() {
final Routes empty = new VpnIpv6RoutesCaseBuilder().setVpnIpv6Routes(new VpnIpv6RoutesBuilder().setVpnRoute(Collections.emptyList()).build()).build();
final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class LinkstateNlriParser method extractLinkstateDestination.
public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
serializeCommonParts(builder, linkstate);
final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
serializeAdvertisedNodeDescriptor(builder, objectType);
} else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
serializeLocalNodeDescriptor(builder, objectType);
} else if (objectType.getChild(NODE_DESCRIPTORS_NID).isPresent()) {
serializeNodeDescriptor(builder, objectType);
} else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
} else {
LOG.warn("Unknown Object Type: {}.", objectType);
}
return builder.build();
}
use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class RibImplTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Mockito.doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
Mockito.doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
final NodeIdentifier nii = new NodeIdentifier(QName.create("", "test").intern());
Mockito.doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
Mockito.doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
final ChoiceNode choiceNode = mock(ChoiceNode.class);
Mockito.doReturn(choiceNode).when(this.ribSupport).emptyRoutes();
Mockito.doReturn(nii).when(choiceNode).getIdentifier();
Mockito.doReturn(QName.create("", "test").intern()).when(choiceNode).getNodeType();
Mockito.doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService)).when(this.domDataBroker).getSupportedExtensions();
Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
Mockito.doNothing().when(this.dataTreeRegistration).close();
Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService).registerDataTreeChangeListener(any(), any());
Mockito.doNothing().when(this.serviceRegistration).unregister();
}
Aggregations