Search in sources :

Example 1 with LocatorBuilder

use of org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder in project onos by opennetworkinglab.

the class MappingEntryBuilderTest method getMapRecord.

/**
 * Obtains a MapRecord instance.
 *
 * @param afiType   AFI address type
 * @param lcafType  LCAF address type
 * @return a MapRecord instance
 */
private LispMapRecord getMapRecord(AddressFamilyIdentifierEnum afiType, LispCanonicalAddressFormatEnum lcafType) {
    MapRecordBuilder recordBuilder = new DefaultMapRecordBuilder();
    LispIpv4Address recordAddress = new LispIpv4Address(IpAddress.valueOf(IP_RECORD_ADDRESS));
    LocatorBuilder locatorBuilder = new DefaultLocatorBuilder();
    LispAfiAddress locatorAddress = getAfiAddress(afiType, lcafType);
    LispLocator locator = locatorBuilder.withPriority(UNIQUE_BYTE).withWeight(UNIQUE_BYTE).withMulticastPriority(UNIQUE_BYTE).withMulticastWeight(UNIQUE_BYTE).withLocalLocator(true).withRlocProbed(false).withRouted(true).withLocatorAfi(locatorAddress).build();
    return recordBuilder.withRecordTtl(UNIQUE_INT).withIsAuthoritative(true).withMapVersionNumber(UNIQUE_SHORT).withMaskLength((byte) IP_RECORD_MASK_LENGTH).withAction(LispMapReplyAction.NativelyForward).withEidPrefixAfi(recordAddress).withLocators(ImmutableList.of(locator)).build();
}
Also used : MapRecordBuilder(org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder) DefaultMapRecordBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder) DefaultLocatorBuilder(org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LispLocator(org.onosproject.lisp.msg.protocols.LispLocator) DefaultMapRecordBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder) LispAfiAddress(org.onosproject.lisp.msg.types.LispAfiAddress) LocatorBuilder(org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder) DefaultLocatorBuilder(org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder)

Example 2 with LocatorBuilder

use of org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder in project onos by opennetworkinglab.

the class DefaultLispLocatorTest method setup.

@Before
public void setup() {
    LispLocator.LocatorBuilder builder1 = new DefaultLocatorBuilder();
    LispIpv4Address ipv4Locator1 = new LispIpv4Address(IpAddress.valueOf(IP_ADDRESS_1));
    record1 = builder1.withPriority((byte) 0x01).withWeight((byte) 0x01).withMulticastPriority((byte) 0x01).withMulticastWeight((byte) 0x01).withLocalLocator(true).withRlocProbed(false).withRouted(true).withLocatorAfi(ipv4Locator1).build();
    LocatorBuilder builder2 = new DefaultLocatorBuilder();
    sameAsRecord1 = builder2.withPriority((byte) 0x01).withWeight((byte) 0x01).withMulticastPriority((byte) 0x01).withMulticastWeight((byte) 0x01).withLocalLocator(true).withRlocProbed(false).withRouted(true).withLocatorAfi(ipv4Locator1).build();
    LispLocator.LocatorBuilder builder3 = new DefaultLocatorBuilder();
    LispIpv4Address ipv4Locator2 = new LispIpv4Address(IpAddress.valueOf(IP_ADDRESS_2));
    record2 = builder3.withPriority((byte) 0x02).withWeight((byte) 0x02).withMulticastPriority((byte) 0x02).withMulticastWeight((byte) 0x02).withLocalLocator(false).withRlocProbed(true).withRouted(false).withLocatorAfi(ipv4Locator2).build();
}
Also used : DefaultLocatorBuilder(org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LocatorBuilder(org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder) DefaultLocatorBuilder(org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder) LocatorBuilder(org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder) Before(org.junit.Before)

Aggregations

DefaultLocatorBuilder (org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder)2 LocatorBuilder (org.onosproject.lisp.msg.protocols.LispLocator.LocatorBuilder)2 LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)2 Before (org.junit.Before)1 DefaultMapRecordBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder)1 LispLocator (org.onosproject.lisp.msg.protocols.LispLocator)1 MapRecordBuilder (org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder)1 LispAfiAddress (org.onosproject.lisp.msg.types.LispAfiAddress)1