use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary in project lispflowmapping by opendaylight.
the class HashMapDb method tryRemoveFromTrie.
private void tryRemoveFromTrie(Object key) {
if (key instanceof Eid) {
Eid eid = (Eid) key;
if (eid.getAddress() instanceof Ipv4PrefixBinary) {
Ipv4PrefixBinary prefix = (Ipv4PrefixBinary) eid.getAddress();
ip4Trie.remove(prefix.getIpv4AddressBinary().getValue(), prefix.getIpv4MaskLength());
} else if (eid.getAddress() instanceof Ipv6PrefixBinary) {
Ipv6PrefixBinary prefix = (Ipv6PrefixBinary) eid.getAddress();
ip6Trie.remove(prefix.getIpv6AddressBinary().getValue(), prefix.getIpv6MaskLength());
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method removePrefixIfNecessary.
static Eid removePrefixIfNecessary(Eid eid) {
EidBuilder eb = new EidBuilder(eid);
Address address = eid.getAddress();
if (address instanceof Ipv4PrefixBinary) {
Ipv4Binary convertedEid = new Ipv4BinaryBuilder().setIpv4Binary(((Ipv4PrefixBinary) address).getIpv4AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv4BinaryAfi.class).build();
} else if (address instanceof Ipv6PrefixBinary) {
Ipv6Binary convertedEid = new Ipv6BinaryBuilder().setIpv6Binary(((Ipv6PrefixBinary) address).getIpv6AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv6BinaryAfi.class).build();
}
return eid;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary in project lispflowmapping by opendaylight.
the class MaskUtilTest method normalizeTest_withIpv6PrefixBinary_withMask.
/**
* Tests {@link MaskUtil#normalize(Eid eid, short mask)} method with Ipv6PrefixBinary.
*/
@Test
public void normalizeTest_withIpv6PrefixBinary_withMask() throws UnknownHostException {
// input ip: 1111:2222:3333:4444:5555:6666:7777:8888, mask: 66
final Eid result = MaskUtil.normalize(EID_IPV6_PREFIX_BINARY, (short) 66);
final Ipv6PrefixBinary resultPrefix = (Ipv6PrefixBinary) result.getAddress();
// expected result
assertArrayEquals(ipv6ExpectedByteAddress, resultPrefix.getIpv6AddressBinary().getValue());
assertEquals((short) 66, (short) resultPrefix.getIpv6MaskLength());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary in project lispflowmapping by opendaylight.
the class MaskUtilTest method normalizeTest_withIpv6PrefixBinary.
/**
* Tests {@link MaskUtil#normalize(Eid eid)} method with Ipv6PrefixBinary.
*/
@Test
public void normalizeTest_withIpv6PrefixBinary() throws UnknownHostException {
// input ip: 1111:2222:3333:4444:5555:6666:7777:8888, mask: 66
final Eid result = MaskUtil.normalize(EID_IPV6_PREFIX_BINARY);
final Ipv6PrefixBinary resultPrefix = (Ipv6PrefixBinary) result.getAddress();
// expected result
final byte[] expectedResult = Inet6Address.getByName("1111:2222:3333:4444:4000::").getAddress();
assertArrayEquals(expectedResult, resultPrefix.getIpv6AddressBinary().getValue());
assertEquals((short) 66, (short) resultPrefix.getIpv6MaskLength());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method toEid_ipv6PrefixBinary.
/**
* Test
* - {@link LispAddressUtil#toEid(Ipv6PrefixBinary, InstanceIdType)}
* - {@link LispAddressUtil#asIpv6PrefixBinaryEid(String)}
* - {@link LispAddressUtil#asIpv6PrefixBinaryEid(String, InstanceIdType)}
* - {@link LispAddressUtil#asIpv6PrefixBinaryEid(Eid, byte[], short)}
* method.
*/
@Test
public void toEid_ipv6PrefixBinary() {
Eid eidFromIpv6PrefixBinary = LispAddressUtil.toEid(IPV6_ADDRESS_PREFIX_BINARY_1, INSTANCE_ID_TYPE_TEST);
verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_VALUE_TEST);
verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, false, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_VALUE_TEST, INSTANCE_ID_TYPE_TEST);
verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_BINARY_EID_1, IPV6_ADDRESS_BYTES_A_TEST, MASK_OK_TEST);
verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
}
Aggregations