use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.routes.FlowspecRoutesBuilder in project bgpcep by opendaylight.
the class FlowspecIpv4RIBSupportTest method testEmptyRoute.
@Test
public void testEmptyRoute() throws Exception {
final Routes empty = new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder().setFlowspecRoute(Collections.emptyList()).build()).build();
final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.routes.FlowspecRoutesBuilder in project bgpcep by opendaylight.
the class FlowspecIpv4RIBSupportTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
final BGPActivator act = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
act.start(context);
this.ribSupport = new FlowspecIpv4RIBSupport(this.adapter.currentSerializer());
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST).setAttributes(new AttributesBuilder().build()).build();
this.routes = new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route)).build();
setUpTestCustomizer(this.ribSupport);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.routes.FlowspecRoutesBuilder in project bgpcep by opendaylight.
the class FlowspecIpv4RIBSupportTest method testChangedRoutes.
@Test
public void testChangedRoutes() {
final Routes emptyCase = new FlowspecRoutesCaseBuilder().build();
DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
final Routes emptyRoutes = new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder().build()).build();
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route)).build()).build())).getRootNode();
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
Aggregations