use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class MaskUtilTest method normalizeTest_withSourceDestKey.
/**
* Tests {@link MaskUtil#normalize} method with SourceDestKey.
*/
@Test
public void normalizeTest_withSourceDestKey() {
// expected result
final String expectedSourceAddress = "1.2.0.0" + MASK_2;
final String expectedDestAddress = "1.3.4.0";
final Eid resultEid = MaskUtil.normalize(EID_SOURCE_DEST_KEY);
final SourceDestKey resultAddr = (SourceDestKey) resultEid.getAddress();
final String resultSource = resultAddr.getSourceDestKey().getSource().getIpPrefix().getIpv4Prefix().getValue();
final String resultDest = resultAddr.getSourceDestKey().getDest().getIpAddress().getIpv4Address().getValue();
assertEquals(expectedSourceAddress, resultSource);
assertEquals(expectedDestAddress, resultDest);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class SourceDestKeyHelperTest method getDstTest_sourceDestKey.
/**
* Tests {@link SourceDestKeyHelper#getDst} method with SourceDestKey address type.
*/
@Test
public void getDstTest_sourceDestKey() {
final Eid expectedResult = new EidBuilder().setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IPV4_PREFIX_DEST).build()).setVirtualNetworkId(INSTANCE_ID).setAddressType(Ipv4PrefixAfi.class).build();
assertEquals(expectedResult, SourceDestKeyHelper.getDst(EID_SOURCE_DEST_KEY));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asTeLcafRloc.
/**
* Tests {@link LispAddressUtil#asSrcDstEid(SourceDestKey, InstanceIdType)} method.
*/
@Test
public void asTeLcafRloc() {
final List<IpAddress> ipAddresses = Arrays.asList(IP_ADDRESS_IPV4_TEST, IP_ADDRESS_IPV6_TEST);
final Rloc rloc = LispAddressUtil.asTeLcafRloc(ipAddresses);
assertNotNull(rloc);
assertEquals(ExplicitLocatorPathLcaf.class, rloc.getAddressType());
final List<Hop> hops = ((ExplicitLocatorPath) rloc.getAddress()).getExplicitLocatorPath().getHop();
assertEquals(hops.size(), ipAddresses.size());
for (IpAddress ipAddress : ipAddresses) {
assertTrue("Ip address " + ipAddress + "should be part of hops list.", isIpAddressInHops(ipAddress, hops));
}
for (Hop hop : hops) {
final Hop.LrsBits lrsBits = hop.getLrsBits();
assertFalse(lrsBits.isLookup());
assertFalse(lrsBits.isRlocProbe());
assertFalse(lrsBits.isStrict());
final IpAddress ipAddressFromHop = hop.getAddress().getIpAddress();
assertNotNull(ipAddressFromHop);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asSrcDstEid_addressesAsString.
/**
* Tests {@link LispAddressUtil#asSrcDstEid(String, String, int, int, int)} method.
*/
@Test
public void asSrcDstEid_addressesAsString() {
final Eid srcDstEid = LispAddressUtil.asSrcDstEid(IPV4_ADDRESS_VALUE_TEST, IPV6_ADDRESS_VALUE_TEST, MASK_OK_TEST, MASK_OK_TEST, INSTANCE_ID_TYPE_VALUE_SHORT_TEST);
assertNotNull(srcDstEid);
assertEquals(SourceDestKeyLcaf.class, srcDstEid.getAddressType());
final SourceDestKey sourceDestKey = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) srcDstEid.getAddress()).getSourceDestKey();
assertNotNull(sourceDestKey);
assertEquals(SIMPLE_ADDRESS_IPV4_PREFIX_TEST, sourceDestKey.getSource());
assertEquals(SIMPLE_ADDRESS_IPV6_PREFIX_TEST, sourceDestKey.getDest());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asSrcDst.
/**
* Tests {@link LispAddressUtil#asSrcDst(String, String, int, int)} method.
*/
@Test
public void asSrcDst() {
final SourceDestKey sourceDestKey = LispAddressUtil.asSrcDst(IPV4_ADDRESS_VALUE_TEST, IPV6_ADDRESS_VALUE_TEST, MASK_OK_TEST, MASK_OK_TEST);
assertNotNull(sourceDestKey);
assertEquals(SIMPLE_ADDRESS_IPV4_PREFIX_TEST, sourceDestKey.getSource());
assertEquals(SIMPLE_ADDRESS_IPV6_PREFIX_TEST, sourceDestKey.getDest());
}
Aggregations