use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class RouteManagerTest method verifyDelete.
/**
* Tests deleting a route and verifies that the correct event is sent to
* the route listener.
*
* @param route route to delete
* @param removedResolvedRoute the resolved route being removed
*/
private void verifyDelete(Route route, ResolvedRoute removedResolvedRoute) {
addRoute(route);
RouteEvent withdrawRouteEvent = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, removedResolvedRoute, Sets.newHashSet(removedResolvedRoute));
reset(routeListener);
routeListener.event(withdrawRouteEvent);
replay(routeListener);
routeManager.withdraw(Collections.singleton(route));
verify(routeListener);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class FibInstallerTest method testRouteUpdate.
/**
* Tests updating a route.
*
* We verify that the flowObjectiveService records the correct state and that the
* correct flow is submitted to the flowObjectiveService.
*/
@Test
public void testRouteUpdate() {
// Firstly add a route
testRouteAdd();
reset(flowObjectiveService);
ResolvedRoute oldRoute = createRoute(PREFIX1, NEXT_HOP1, MAC1);
ResolvedRoute route = createRoute(PREFIX1, NEXT_HOP2, MAC2);
// Create the next objective
NextObjective nextObjective = createNextObjective(MAC2, MAC2, SW1_ETH2.port(), VLAN1, true);
flowObjectiveService.next(DEVICE_ID, nextObjective);
// Create the flow objective
ForwardingObjective fwd = createForwardingObjective(PREFIX1, true);
flowObjectiveService.forward(DEVICE_ID, fwd);
EasyMock.expectLastCall().once();
setUpFlowObjectiveService();
// Send in the update event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, route, oldRoute));
verify(flowObjectiveService);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class SdnIpFibTest method testRouteAddToNoVlan.
/**
* Tests adding a route. The egress interface has no VLAN configured.
*
* We verify that the synchronizer records the correct state and that the
* correct intent is submitted to the IntentService.
*/
@Test
public void testRouteAddToNoVlan() {
// Build the expected route
ResolvedRoute route = createRoute(PREFIX1, IP3, MAC3);
MultiPointToSinglePointIntent intent = createIntentToThreeSrcOneTwo(PREFIX1);
// Setup the expected intents
intentSynchronizer.submit(eqExceptId(intent));
replay(intentSynchronizer);
// Send in the added event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
verify(intentSynchronizer);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class SdnIpFibTest method testRouteDelete.
/**
* Tests deleting a route.
*
* We verify that the synchronizer records the correct state and that the
* correct intent is withdrawn from the IntentService.
*/
@Test
public void testRouteDelete() {
// Add a route first
testRouteAddToNoVlan();
// Construct the existing route entry
ResolvedRoute route = createRoute(PREFIX1, IP3, MAC3);
// Create existing intent
MultiPointToSinglePointIntent removedIntent = createIntentToThreeSrcOneTwo(PREFIX1);
// Set up expectation
reset(intentSynchronizer);
// Setup the expected intents
intentSynchronizer.withdraw(eqExceptId(removedIntent));
replay(intentSynchronizer);
// Send in the removed event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route));
verify(intentSynchronizer);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class SdnIpFibTest method testRouteAddToVlan.
/**
* Tests adding a route. The egress interface has a VLAN configured.
*
* We verify that the synchronizer records the correct state and that the
* correct intent is submitted to the IntentService.
*/
@Test
public void testRouteAddToVlan() {
// Build the expected route
ResolvedRoute route = createRoute(PREFIX2, IP1, MAC1);
MultiPointToSinglePointIntent intent = createIntentToOne(PREFIX2);
// Setup the expected intents
intentSynchronizer.submit(eqExceptId(intent));
replay(intentSynchronizer);
// Send in the added event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
verify(intentSynchronizer);
}
Aggregations