Search in sources :

Example 1 with LispRouterFactory

use of org.onosproject.lisp.ctl.LispRouterFactory in project onos by opennetworkinglab.

the class LispMapServer method sendSmrMessage.

/**
 * Sends SMR (Solicit Map Request) to their subscribers.
 *
 * @param eidRecord the updated EID
 */
private void sendSmrMessage(LispEidRecord eidRecord) {
    RequestBuilder builder = new DefaultRequestBuilder();
    LispAfiAddress msAddress = null;
    try {
        msAddress = new LispIpv4Address(IpAddress.valueOf(InetAddress.getLocalHost()));
    } catch (UnknownHostException e) {
        log.warn("Source EID is not found, {}", e.getMessage());
    }
    LispMapRequest msg = builder.withIsSmr(true).withIsSmrInvoked(true).withIsProbe(false).withIsPitr(false).withIsAuthoritative(false).withIsMapDataPresent(false).withSourceEid(msAddress).withEidRecords(ImmutableList.of(eidRecord)).build();
    LispRouterFactory routerFactory = LispRouterFactory.getInstance();
    Collection<LispRouter> routers = routerFactory.getRouters();
    routers.forEach(router -> {
        if (isInEidRecordRange(eidRecord, router.getEidRecords())) {
            router.sendMessage(msg);
        }
    });
}
Also used : LispRouter(org.onosproject.lisp.ctl.LispRouter) DefaultRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder) RequestBuilder(org.onosproject.lisp.msg.protocols.LispMapRequest.RequestBuilder) InfoRequestBuilder(org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder) DefaultInfoRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder) UnknownHostException(java.net.UnknownHostException) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LispRouterFactory(org.onosproject.lisp.ctl.LispRouterFactory) DefaultRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder) LispAfiAddress(org.onosproject.lisp.msg.types.LispAfiAddress) LispMapRequest(org.onosproject.lisp.msg.protocols.LispMapRequest)

Aggregations

UnknownHostException (java.net.UnknownHostException)1 LispRouter (org.onosproject.lisp.ctl.LispRouter)1 LispRouterFactory (org.onosproject.lisp.ctl.LispRouterFactory)1 DefaultInfoRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder)1 DefaultRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder)1 InfoRequestBuilder (org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder)1 LispMapRequest (org.onosproject.lisp.msg.protocols.LispMapRequest)1 RequestBuilder (org.onosproject.lisp.msg.protocols.LispMapRequest.RequestBuilder)1 LispAfiAddress (org.onosproject.lisp.msg.types.LispAfiAddress)1 LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)1