Search in sources :

Example 31 with EidBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__SrcDestLCAF.

// ------------------------------- LCAF Tests ---------------------------
public void registerAndQuery__SrcDestLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipPrefix = "10.20.30.200/32";
    String macString = "01:02:03:04:05:06";
    SourceDestKeyBuilder builder = new SourceDestKeyBuilder();
    builder.setSource(new SimpleAddress(new IpPrefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipPrefix))));
    builder.setDest(new SimpleAddress(new MacAddress(macString)));
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(SourceDestKeyLcaf.class);
    eb.setVirtualNetworkId(null);
    eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(builder.build()).build());
    MapReply reply = registerAddressAndQuery(eb.build());
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(SourceDestKeyLcaf.class, fromNetwork.getAddressType());
    SourceDestKey sourceDestFromNetwork = (SourceDestKey) fromNetwork.getAddress();
    SimpleAddress receivedAddr1 = sourceDestFromNetwork.getSourceDestKey().getSource();
    SimpleAddress receivedAddr2 = sourceDestFromNetwork.getSourceDestKey().getDest();
    assertNotNull(receivedAddr1.getIpPrefix().getIpv4Prefix());
    assertNotNull(receivedAddr2.getMacAddress());
    IpPrefix receivedIP = receivedAddr1.getIpPrefix();
    MacAddress receivedMAC = receivedAddr2.getMacAddress();
    assertEquals(ipPrefix, receivedIP.getIpv4Prefix().getValue());
    assertEquals(macString, receivedMAC.getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKeyBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 32 with EidBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__ApplicationData.

public void registerAndQuery__ApplicationData() throws SocketTimeoutException {
    cleanUP();
    String ipString = "1.2.3.4";
    short protocol = 1;
    int ipTOs = 2;
    int localPortLow = 3;
    int localPortHigh = 4;
    int remotePortLow = 4;
    int remotePortHigh = 5;
    ApplicationDataBuilder builder = new ApplicationDataBuilder();
    builder.setIpTos(ipTOs);
    builder.setProtocol(protocol);
    builder.setLocalPortLow(new PortNumber(localPortLow));
    builder.setLocalPortHigh(new PortNumber(localPortHigh));
    builder.setRemotePortLow(new PortNumber(remotePortLow));
    builder.setRemotePortHigh(new PortNumber(remotePortHigh));
    builder.setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(ApplicationDataLcaf.class);
    eb.setVirtualNetworkId(null);
    eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(builder.build()).build());
    Eid addressToSend = eb.build();
    MapReply reply = registerAddressAndQuery(addressToSend);
    Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(ApplicationDataLcaf.class, receivedAddress.getAddressType());
    ApplicationData receivedApplicationDataAddress = (ApplicationData) receivedAddress.getAddress();
    assertEquals(protocol, receivedApplicationDataAddress.getApplicationData().getProtocol().intValue());
    assertEquals(ipTOs, receivedApplicationDataAddress.getApplicationData().getIpTos().intValue());
    assertEquals(localPortLow, receivedApplicationDataAddress.getApplicationData().getLocalPortLow().getValue().intValue());
    assertEquals(localPortHigh, receivedApplicationDataAddress.getApplicationData().getLocalPortHigh().getValue().intValue());
    assertEquals(remotePortLow, receivedApplicationDataAddress.getApplicationData().getRemotePortLow().getValue().intValue());
    assertEquals(remotePortHigh, receivedApplicationDataAddress.getApplicationData().getRemotePortHigh().getValue().intValue());
    SimpleAddress ipAddressReceived = receivedApplicationDataAddress.getApplicationData().getAddress();
    assertEquals(ipString, ipAddressReceived.getIpAddress().getIpv4Address().getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) ApplicationDataBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationDataBuilder) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) ApplicationData(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 33 with EidBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__TrafficEngineering.

public void registerAndQuery__TrafficEngineering() throws SocketTimeoutException {
    cleanUP();
    String macString = "01:02:03:04:05:06";
    String ipString = "10.20.255.30";
    HopBuilder hopBuilder = new HopBuilder();
    hopBuilder.setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
    hopBuilder.setLrsBits(new LrsBits(true, false, true));
    Hop hop1 = hopBuilder.build();
    hopBuilder.setAddress(new SimpleAddress(new MacAddress(macString)));
    hopBuilder.setLrsBits(new LrsBits(false, true, false));
    Hop hop2 = hopBuilder.build();
    ExplicitLocatorPathBuilder elpBuilder = new ExplicitLocatorPathBuilder();
    elpBuilder.setHop(new ArrayList<Hop>());
    elpBuilder.getHop().add(hop1);
    elpBuilder.getHop().add(hop2);
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(ExplicitLocatorPathLcaf.class);
    eb.setVirtualNetworkId(null);
    eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder().setExplicitLocatorPath(elpBuilder.build()).build());
    MapReply reply = registerAddressAndQuery(eb.build());
    assertEquals(ExplicitLocatorPathLcaf.class, reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddressType());
    ExplicitLocatorPath receivedAddress = (ExplicitLocatorPath) reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress();
    Hop receivedHop1 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(0);
    Hop receivedHop2 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(1);
    assertEquals(true, receivedHop1.getLrsBits().isLookup());
    assertEquals(false, receivedHop1.getLrsBits().isRlocProbe());
    assertEquals(true, receivedHop1.getLrsBits().isStrict());
    assertEquals(false, receivedHop2.getLrsBits().isLookup());
    assertEquals(true, receivedHop2.getLrsBits().isRlocProbe());
    assertEquals(false, receivedHop2.getLrsBits().isStrict());
    assertNotNull(receivedHop1.getAddress().getIpAddress().getIpv4Address());
    assertNotNull(receivedHop2.getAddress().getMacAddress());
    assertEquals(ipString, receivedHop1.getAddress().getIpAddress().getIpv4Address().getValue());
    assertEquals(macString, receivedHop2.getAddress().getMacAddress().getValue());
}
Also used : LrsBits(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop.LrsBits) HopBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.HopBuilder) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) Hop(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ExplicitLocatorPathBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.ExplicitLocatorPathBuilder) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) ExplicitLocatorPath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath)

Example 34 with EidBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder 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;
}
Also used : Ipv4PrefixBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4PrefixBinary) Ipv4BinaryAfi(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.Ipv4BinaryAfi) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) InetSocketAddress(java.net.InetSocketAddress) Ipv4BinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder) Ipv6PrefixBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary) Ipv4Binary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary) Ipv6BinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6BinaryBuilder) Ipv6Binary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6Binary)

Example 35 with EidBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder 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));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv4PrefixAfi(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi) Test(org.junit.Test)

Aggregations

EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)56 Test (org.junit.Test)9 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)9 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)7 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)7 Ipv4PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder)6 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)6 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)5 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)5 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)5 ByteBuffer (java.nio.ByteBuffer)4 InetAddress (java.net.InetAddress)3 InstanceIdType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)3 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)3 DistinguishedNameBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder)3 Ipv6PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6PrefixBuilder)3 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)3 Ipv4BinaryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder)3 Ipv6BinaryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6BinaryBuilder)3