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;
}
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();
}
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();
}
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();
}
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));
}
Aggregations