use of org.onosproject.routeservice.RouteEvent 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.RouteEvent 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);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class FibInstallerTest method testRouteAddWithVlan.
/**
* Tests adding a route with to a next hop in a VLAN.
*
* We verify that the flowObjectiveService records the correct state and that the
* correct flowObjectiveService is submitted to the flowObjectiveService.
*/
@Test
public void testRouteAddWithVlan() {
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 add event
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
verify(flowObjectiveService);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class SdnIpFibTest method testRouteUpdatesToNoVlan.
/**
* Tests updating a route.
*
* We first add a route from a next-hop with a vlan. We then announce the
* same route from another next-hop with no vlan.
*
* We verify that the synchronizer records the correct state and that the
* correct intent is submitted to the IntentService.
*/
@Test
public void testRouteUpdatesToNoVlan() {
// Add a route first to a destination with no VLAN
testRouteAddToVlan();
// Build the new route entries for prefix1 and prefix2
ResolvedRoute oldRoutePrefix = createRoute(PREFIX2, IP1, MAC1);
ResolvedRoute routePrefix = createRoute(PREFIX2, IP3, MAC3);
// Create the new expected intents
MultiPointToSinglePointIntent newPrefixIntent = createIntentToThreeSrcOneTwo(PREFIX2);
// Set up test expectation
reset(intentSynchronizer);
// Setup the expected intents
intentSynchronizer.submit(eqExceptId(newPrefixIntent));
replay(intentSynchronizer);
// Send in the update events
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, routePrefix, oldRoutePrefix));
verify(intentSynchronizer);
}
use of org.onosproject.routeservice.RouteEvent in project onos by opennetworkinglab.
the class SdnIpFibTest method testRouteUpdatesToVlan.
/**
* Tests updating a route.
*
* We first add a route from a next-hop with no vlan. We then announce the
* same route from another next-hop with a vlan.
*
* We verify that the synchronizer records the correct state and that the
* correct intent is submitted to the IntentService.
*/
@Test
public void testRouteUpdatesToVlan() {
// Add a route first to a destination with no VLAN
testRouteAddToNoVlan();
// Build the new route entries for prefix1 and prefix2
ResolvedRoute oldRoutePrefixOne = createRoute(PREFIX1, IP3, MAC3);
ResolvedRoute routePrefixOne = createRoute(PREFIX1, IP1, MAC1);
// Create the new expected intents
MultiPointToSinglePointIntent newPrefixOneIntent = createIntentToOne(PREFIX1);
// Set up test expectation
reset(intentSynchronizer);
// Setup the expected intents
intentSynchronizer.submit(eqExceptId(newPrefixOneIntent));
replay(intentSynchronizer);
// Send in the update events
routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, routePrefixOne, oldRoutePrefixOne));
verify(intentSynchronizer);
}
Aggregations