use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class RIBSupportContextImpl method createEmptyTableStructure.
@Override
public void createEmptyTableStructure(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tableId) {
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tb = ImmutableNodes.mapEntryBuilder();
tb.withNodeIdentifier((NodeIdentifierWithPredicates) 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) tableId.getLastPathArgument();
for (final Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
}
final ChoiceNode routes = this.ribSupport.emptyRoutes();
Verify.verifyNotNull(routes, "Null empty routes in %s", this.ribSupport);
Verify.verify(Routes.QNAME.equals(routes.getNodeType()), "Empty routes have unexpected identifier %s, expected %s", routes.getNodeType(), Routes.QNAME);
tx.put(LogicalDatastoreType.OPERATIONAL, tableId, tb.withChild(routes).build());
}
use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.
the class FlowspecL3vpnIpv6RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() {
final Routes empty = new FlowspecL3vpnIpv6RoutesCaseBuilder().setFlowspecL3vpnIpv6Routes(new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(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 FlowspecIpv6RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() throws Exception {
final Routes empty = new FlowspecIpv6RoutesCaseBuilder().setFlowspecIpv6Routes(new FlowspecIpv6RoutesBuilder().setFlowspecRoute(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 IPv4RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() {
final Routes empty = new Ipv4RoutesCaseBuilder().setIpv4Routes(EMPTY_ROUTES).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 VpnIpv4RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() {
final Routes empty = new VpnIpv4RoutesCaseBuilder().setVpnIpv4Routes(new VpnIpv4RoutesBuilder().setVpnRoute(Collections.emptyList()).build()).build();
final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
Aggregations