Search in sources :

Example 6 with ResolvedRoute

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);
}
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 7 with ResolvedRoute

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);
}
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 8 with ResolvedRoute

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);
}
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 9 with ResolvedRoute

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);
}
Also used : 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 10 with ResolvedRoute

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);
}
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)

Aggregations

ResolvedRoute (org.onosproject.routeservice.ResolvedRoute)18 Test (org.junit.Test)14 RouteEvent (org.onosproject.routeservice.RouteEvent)9 Route (org.onosproject.routeservice.Route)8 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 RouteService (org.onosproject.routeservice.RouteService)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 DefaultNextObjective (org.onosproject.net.flowobjective.DefaultNextObjective)3 NextObjective (org.onosproject.net.flowobjective.NextObjective)3 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 IpPrefix (org.onlab.packet.IpPrefix)2 MacAddress (org.onlab.packet.MacAddress)2 VlanId (org.onlab.packet.VlanId)2 DefaultHost (org.onosproject.net.DefaultHost)2 Host (org.onosproject.net.Host)2 HostEvent (org.onosproject.net.host.HostEvent)2