use of org.onosproject.routeservice.ResolvedRoute 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.ResolvedRoute 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);
}
use of org.onosproject.routeservice.ResolvedRoute 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.ResolvedRoute in project onos by opennetworkinglab.
the class FibInstallerTest method testRouteDelete.
/**
* Tests deleting a route.
*
* We verify that the flowObjectiveService records the correct state and that the
* correct flow is withdrawn from the flowObjectiveService.
*/
@Test
public void testRouteDelete() {
// Firstly add a route
testRouteAdd();
// Construct the existing route
ResolvedRoute route = createRoute(PREFIX1, NEXT_HOP1, MAC1);
// Create the flow objective
reset(flowObjectiveService);
ForwardingObjective fwd = createForwardingObjective(PREFIX1, false);
flowObjectiveService.forward(DEVICE_ID, fwd);
replay(flowObjectiveService);
// Send in the delete event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route));
verify(flowObjectiveService);
}
use of org.onosproject.routeservice.ResolvedRoute in project onos by opennetworkinglab.
the class FibInstallerTest method testRouteAdd.
/**
* Tests adding a route.
*
* We verify that the flowObjectiveService records the correct state and that the
* correct flow is submitted to the flowObjectiveService.
*/
@Test
public void testRouteAdd() {
ResolvedRoute resolvedRoute = createRoute(PREFIX1, NEXT_HOP1, MAC1);
// Create the next objective
NextObjective nextObjective = createNextObjective(MAC1, MAC1, SW1_ETH1.port(), VlanId.NONE, 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 add event
RouteEvent routeEvent = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, resolvedRoute);
routeListener.event(routeEvent);
verify(flowObjectiveService);
}
Aggregations