Search in sources :

Example 1 with DefaultInfoRequestBuilder

use of org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder 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());
}
Also used : LispInfoRequest(org.onosproject.lisp.msg.protocols.LispInfoRequest) InfoRequestBuilder(org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder) DefaultInfoRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder) DefaultInfoRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder)

Example 2 with DefaultInfoRequestBuilder

use of org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder 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();
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) InfoRequestBuilder(org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder) DefaultInfoRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder) DefaultInfoRequestBuilder(org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder) Before(org.junit.Before)

Aggregations

DefaultInfoRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder)2 InfoRequestBuilder (org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder)2 Before (org.junit.Before)1 LispInfoRequest (org.onosproject.lisp.msg.protocols.LispInfoRequest)1 LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)1