Search in sources :

Example 1 with RouteEvent

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);
}
Also used : RouteEvent(org.onosproject.routeservice.RouteEvent)

Example 2 with RouteEvent

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);
}
Also used : DefaultNextObjective(org.onosproject.net.flowobjective.DefaultNextObjective) NextObjective(org.onosproject.net.flowobjective.NextObjective) RouteEvent(org.onosproject.routeservice.RouteEvent) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) Test(org.junit.Test)

Example 3 with RouteEvent

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);
}
Also used : RouteEvent(org.onosproject.routeservice.RouteEvent) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Example 4 with RouteEvent

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);
}
Also used : RouteEvent(org.onosproject.routeservice.RouteEvent) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Example 5 with RouteEvent

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);
}
Also used : RouteEvent(org.onosproject.routeservice.RouteEvent) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Aggregations

RouteEvent (org.onosproject.routeservice.RouteEvent)10 Test (org.junit.Test)9 ResolvedRoute (org.onosproject.routeservice.ResolvedRoute)9 AbstractIntentTest (org.onosproject.net.intent.AbstractIntentTest)5 MultiPointToSinglePointIntent (org.onosproject.net.intent.MultiPointToSinglePointIntent)5 DefaultForwardingObjective (org.onosproject.net.flowobjective.DefaultForwardingObjective)4 ForwardingObjective (org.onosproject.net.flowobjective.ForwardingObjective)4 DefaultNextObjective (org.onosproject.net.flowobjective.DefaultNextObjective)3 NextObjective (org.onosproject.net.flowobjective.NextObjective)3