Search in sources :

Example 26 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class LispExtensionMappingAddressInterpreterTest method getLcafMappingAddress.

private LispLcafAddress getLcafMappingAddress(ExtensionMappingAddressType type) {
    LispLcafAddress address = null;
    LispAfiAddress ipv4Addr = new LispIpv4Address(IPV4_ADDRESS);
    LispAfiAddress ipv6Addr = new LispIpv6Address(IPV6_ADDRESS);
    if (type.equals(LIST_ADDRESS.type())) {
        address = new LispListLcafAddress(ImmutableList.of(ipv4Addr, ipv6Addr));
    }
    if (type.equals(SEGMENT_ADDRESS.type())) {
        address = new LispSegmentLcafAddress.SegmentAddressBuilder().withInstanceId(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(AS_ADDRESS.type())) {
        address = new LispAsLcafAddress.AsAddressBuilder().withAsNumber(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(APPLICATION_DATA_ADDRESS.type())) {
        address = new LispAppDataLcafAddress.AppDataAddressBuilder().withProtocol(UNIQUE_BYTE).withIpTos(UNIQUE_INT).withLocalPortLow(UNIQUE_SHORT).withLocalPortHigh(UNIQUE_SHORT).withRemotePortLow(UNIQUE_SHORT).withRemotePortHigh(UNIQUE_SHORT).withAddress(ipv4Addr).build();
    }
    if (type.equals(GEO_COORDINATE_ADDRESS.type())) {
        address = new LispGeoCoordinateLcafAddress.GeoCoordinateAddressBuilder().withIsNorth(UNIQUE_BOOLEAN).withLatitudeDegree(UNIQUE_SHORT).withLatitudeMinute(UNIQUE_BYTE).withLatitudeSecond(UNIQUE_BYTE).withIsEast(UNIQUE_BOOLEAN).withLongitudeDegree(UNIQUE_SHORT).withLongitudeMinute(UNIQUE_BYTE).withLongitudeSecond(UNIQUE_BYTE).withAltitude(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(NAT_ADDRESS.type())) {
        address = new LispNatLcafAddress.NatAddressBuilder().withMsUdpPortNumber(UNIQUE_SHORT).withEtrUdpPortNumber(UNIQUE_SHORT).withGlobalEtrRlocAddress(ipv4Addr).withMsRlocAddress(ipv4Addr).withPrivateEtrRlocAddress(ipv4Addr).withRtrRlocAddresses(ImmutableList.of(ipv4Addr, ipv6Addr)).build();
    }
    if (type.equals(NONCE_ADDRESS.type())) {
        address = new LispNonceLcafAddress.NonceAddressBuilder().withNonce(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(MULTICAST_ADDRESS.type())) {
        address = new LispMulticastLcafAddress.MulticastAddressBuilder().withInstanceId(UNIQUE_INT).withSrcMaskLength(UNIQUE_BYTE).withSrcAddress(ipv4Addr).withGrpMaskLength(UNIQUE_BYTE).withGrpAddress(ipv4Addr).build();
    }
    if (type.equals(TRAFFIC_ENGINEERING_ADDRESS.type())) {
        LispTeRecord tr = new LispTeRecord.TeRecordBuilder().withIsLookup(UNIQUE_BOOLEAN).withIsRlocProbe(UNIQUE_BOOLEAN).withIsStrict(UNIQUE_BOOLEAN).withRtrRlocAddress(ipv4Addr).build();
        address = new LispTeLcafAddress.TeAddressBuilder().withTeRecords(ImmutableList.of(tr)).build();
    }
    if (type.equals(SOURCE_DEST_ADDRESS.type())) {
        address = new LispSourceDestLcafAddress.SourceDestAddressBuilder().withSrcMaskLength(UNIQUE_BYTE).withSrcPrefix(ipv4Addr).withDstMaskLength(UNIQUE_BYTE).withDstPrefix(ipv4Addr).build();
    }
    return address;
}
Also used : LispTeRecord(org.onosproject.lisp.msg.types.lcaf.LispTeRecord) LispListLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispListLcafAddress) LispMulticastLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispMulticastLcafAddress) LispAfiAddress(org.onosproject.lisp.msg.types.LispAfiAddress) LispLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispLcafAddress) LispIpv6Address(org.onosproject.lisp.msg.types.LispIpv6Address) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LispAppDataLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispAppDataLcafAddress) LispTeLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispTeLcafAddress)

Example 27 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address 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)

Example 28 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class DefaultLispMapNotifyTest method getMapRecord.

private LispMapRecord getMapRecord() {
    MapRecordBuilder builder1 = new DefaultMapRecordBuilder();
    LispIpv4Address ipv4Locator1 = new LispIpv4Address(IpAddress.valueOf(IP_ADDRESS));
    return builder1.withRecordTtl(100).withIsAuthoritative(true).withMapVersionNumber((short) 1).withMaskLength((byte) 0x01).withAction(LispMapReplyAction.NativelyForward).withEidPrefixAfi(ipv4Locator1).build();
}
Also used : MapRecordBuilder(org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder) DefaultMapRecordBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) DefaultMapRecordBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder)

Example 29 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address 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)

Example 30 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class DefaultLispLocatorTest method testConstruction.

@Test
public void testConstruction() {
    DefaultLispLocator record = (DefaultLispLocator) record1;
    LispIpv4Address ipv4Locator = new LispIpv4Address(IpAddress.valueOf(IP_ADDRESS_1));
    assertThat(record.getPriority(), is((byte) 0x01));
    assertThat(record.getWeight(), is((byte) 0x01));
    assertThat(record.getMulticastPriority(), is((byte) 0x01));
    assertThat(record.getMulticastWeight(), is((byte) 0x01));
    assertThat(record.isLocalLocator(), is(true));
    assertThat(record.isRlocProbed(), is(false));
    assertThat(record.isRouted(), is(true));
    assertThat(record.getLocatorAfi(), is(ipv4Locator));
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) Test(org.junit.Test)

Aggregations

LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)49 Test (org.junit.Test)19 Before (org.junit.Before)18 LispAfiAddress (org.onosproject.lisp.msg.types.LispAfiAddress)10 DefaultMapRecordBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder)8 MapRecordBuilder (org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder)8 LispIpv6Address (org.onosproject.lisp.msg.types.LispIpv6Address)6 LispEidRecord (org.onosproject.lisp.msg.protocols.LispEidRecord)4 LispMapRecord (org.onosproject.lisp.msg.protocols.LispMapRecord)4 NatAddressBuilder (org.onosproject.lisp.msg.types.lcaf.LispNatLcafAddress.NatAddressBuilder)4 IpAddress (org.onlab.packet.IpAddress)3 DefaultLocatorBuilder (org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder)3 UnknownHostException (java.net.UnknownHostException)2 IpPrefix (org.onlab.packet.IpPrefix)2 DefaultInfoReplyBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoReply.DefaultInfoReplyBuilder)2 DefaultInfoRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder)2 DefaultRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder)2 DefaultReferralRecordBuilder (org.onosproject.lisp.msg.protocols.DefaultLispReferralRecord.DefaultReferralRecordBuilder)2 InfoReplyBuilder (org.onosproject.lisp.msg.protocols.LispInfoReply.InfoReplyBuilder)2 InfoRequestBuilder (org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder)2