Search in sources :

Example 1 with RouteStore

use of org.onosproject.routeservice.RouteStore in project onos by opennetworkinglab.

the class DhcpRelayWebResource method dhcpFpmDelete.

/**
 * Deletes the fpm route from fpm record.
 * Corresponding route from the route store
 *
 * @param prefix IpPrefix
 * @return 204 NO CONTENT, 404; 401
 */
@DELETE
@Path("fpm/{prefix}")
public Response dhcpFpmDelete(@PathParam("prefix") String prefix) {
    DhcpRelayService dhcpRelayService = get(DhcpRelayService.class);
    RouteStore routeStore = get(RouteStore.class);
    try {
        // removes fpm route from fpm record
        Optional<FpmRecord> fpmRecord = dhcpRelayService.removeFpmRecord(IpPrefix.valueOf(prefix));
        if (fpmRecord.isPresent()) {
            IpAddress nextHop = fpmRecord.get().nextHop();
            Route route = new Route(Route.Source.DHCP, IpPrefix.valueOf(prefix), nextHop);
            // removes DHCP route from route store
            routeStore.removeRoute(route);
        } else {
            LOG.warn("fpmRecord is not present");
        }
    } catch (IllegalArgumentException ex) {
        throw new IllegalArgumentException(ex);
    }
    return Response.noContent().build();
}
Also used : RouteStore(org.onosproject.routeservice.RouteStore) FpmRecord(org.onosproject.routing.fpm.api.FpmRecord) DhcpRelayService(org.onosproject.dhcprelay.api.DhcpRelayService) IpAddress(org.onlab.packet.IpAddress) Route(org.onosproject.routeservice.Route) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 2 with RouteStore

use of org.onosproject.routeservice.RouteStore in project onos by opennetworkinglab.

the class RouteStoreCommand method doExecute.

@Override
protected void doExecute() {
    RouteStore routeStore = AbstractShellCommand.get(RouteStore.class);
    print(routeStore.name());
}
Also used : RouteStore(org.onosproject.routeservice.RouteStore)

Aggregations

RouteStore (org.onosproject.routeservice.RouteStore)2 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 IpAddress (org.onlab.packet.IpAddress)1 DhcpRelayService (org.onosproject.dhcprelay.api.DhcpRelayService)1 Route (org.onosproject.routeservice.Route)1 FpmRecord (org.onosproject.routing.fpm.api.FpmRecord)1