use of org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder in project onos by opennetworkinglab.
the class LispMapServer method checkInfoRequestAuthData.
/**
* Checks the integrity of the received info-request message by calculating
* authentication data from received info-request message.
*
* @param request info-request message
* @return evaluation result
*/
private boolean checkInfoRequestAuthData(LispInfoRequest request) {
InfoRequestBuilder requestBuilder = new DefaultInfoRequestBuilder();
requestBuilder.withKeyId(request.getKeyId());
requestBuilder.withAuthKey(authConfig.lispAuthKey());
requestBuilder.withNonce(request.getNonce());
requestBuilder.withTtl(request.getTtl());
requestBuilder.withEidPrefix(request.getPrefix());
requestBuilder.withIsInfoReply(request.isInfoReply());
requestBuilder.withMaskLength(request.getMaskLength());
LispInfoRequest authRequest = requestBuilder.build();
return Arrays.equals(authRequest.getAuthData(), request.getAuthData());
}
use of org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder in project onos by opennetworkinglab.
the class DefaultLispInfoRequestTest method setup.
@Before
public void setup() {
InfoRequestBuilder builder1 = new DefaultInfoRequestBuilder();
LispIpv4Address address1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
request1 = builder1.withNonce(1L).withKeyId((short) 1).withAuthKey(AUTH_KEY).withIsInfoReply(false).withMaskLength((byte) 1).withEidPrefix(address1).build();
InfoRequestBuilder builder2 = new DefaultInfoRequestBuilder();
sameAsRequest1 = builder2.withNonce(1L).withKeyId((short) 1).withAuthKey(AUTH_KEY).withIsInfoReply(false).withMaskLength((byte) 1).withEidPrefix(address1).build();
InfoRequestBuilder builder3 = new DefaultInfoRequestBuilder();
LispIpv4Address address2 = new LispIpv4Address(IpAddress.valueOf("192.168.2.1"));
request2 = builder3.withNonce(2L).withKeyId((short) 2).withAuthKey(AUTH_KEY).withIsInfoReply(true).withMaskLength((byte) 1).withEidPrefix(address2).build();
}
Aggregations