use of org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder 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);
}
});
}
use of org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder in project onos by opennetworkinglab.
the class DefaultLispMapRequestTest method setup.
@Before
public void setup() {
RequestBuilder builder1 = new DefaultRequestBuilder();
LispIpv4Address ipv4Eid1 = new LispIpv4Address(IpAddress.valueOf(EID_IP_ADDRESS_1));
LispIpv4Address ipv4Rloc1 = new LispIpv4Address(IpAddress.valueOf(RLOC_IP_ADDRESS_1_1));
LispIpv4Address ipv4Rloc2 = new LispIpv4Address(IpAddress.valueOf(RLOC_IP_ADDRESS_1_2));
List<LispAfiAddress> rlocs1 = ImmutableList.of(ipv4Rloc1, ipv4Rloc2);
List<LispEidRecord> records1 = ImmutableList.of(getEidRecord(), getEidRecord());
request1 = builder1.withIsAuthoritative(true).withIsMapDataPresent(true).withIsPitr(false).withIsProbe(false).withIsSmr(true).withIsSmrInvoked(false).withSourceEid(ipv4Eid1).withItrRlocs(rlocs1).withEidRecords(records1).withNonce(1L).withReplyRecord(1).build();
RequestBuilder builder2 = new DefaultRequestBuilder();
List<LispEidRecord> records2 = ImmutableList.of(getEidRecord(), getEidRecord());
sameAsRequest1 = builder2.withIsAuthoritative(true).withIsMapDataPresent(true).withIsPitr(false).withIsProbe(false).withIsSmr(true).withIsSmrInvoked(false).withSourceEid(ipv4Eid1).withItrRlocs(rlocs1).withEidRecords(records2).withNonce(1L).withReplyRecord(1).build();
RequestBuilder builder3 = new DefaultRequestBuilder();
LispIpv4Address ipv4Eid2 = new LispIpv4Address(IpAddress.valueOf(EID_IP_ADDRESS_2));
LispIpv4Address ipv4Rloc3 = new LispIpv4Address(IpAddress.valueOf(RLOC_IP_ADDRESS_2_1));
LispIpv4Address ipv4Rloc4 = new LispIpv4Address(IpAddress.valueOf(RLOC_IP_ADDRESS_2_2));
List<LispAfiAddress> rlocs2 = ImmutableList.of(ipv4Rloc3, ipv4Rloc4);
request2 = builder3.withIsAuthoritative(false).withIsMapDataPresent(false).withIsPitr(true).withIsProbe(true).withIsSmr(false).withIsSmrInvoked(true).withSourceEid(ipv4Eid2).withItrRlocs(rlocs2).withNonce(2L).withReplyRecord(2).build();
}
Aggregations