Search in sources :

Example 16 with TunnelId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId in project bgpcep by opendaylight.

the class Stateful07LSPIdentifierIpv4TlvParser method serializeTlv.

@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
    Preconditions.checkArgument(tlv instanceof LspIdentifiers, "LspIdentifiersTlv is mandatory.");
    final LspIdentifiers lsp = (LspIdentifiers) tlv;
    final AddressFamily afi = lsp.getAddressFamily();
    final ByteBuf body = Unpooled.buffer();
    if (afi.getImplementedInterface().equals(Ipv6Case.class)) {
        new Stateful07LSPIdentifierIpv6TlvParser().serializeTlv(tlv, buffer);
    }
    final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
    Preconditions.checkArgument(ipv4.getIpv4TunnelSenderAddress() != null, "Ipv4TunnelSenderAddress is mandatory.");
    writeIpv4Address(ipv4.getIpv4TunnelSenderAddress(), body);
    Preconditions.checkArgument(lsp.getLspId() != null, "LspId is mandatory.");
    writeShort(lsp.getLspId().getValue().shortValue(), body);
    Preconditions.checkArgument(lsp.getTunnelId() != null, "TunnelId is mandatory.");
    writeUnsignedShort(lsp.getTunnelId().getValue(), body);
    Preconditions.checkArgument(ipv4.getIpv4ExtendedTunnelId() != null, "Ipv4ExtendedTunnelId is mandatory.");
    writeIpv4Address(ipv4.getIpv4ExtendedTunnelId(), body);
    Preconditions.checkArgument(ipv4.getIpv4TunnelEndpointAddress() != null, "Ipv4TunnelEndpointAddress is mandatory.");
    writeIpv4Address(ipv4.getIpv4TunnelEndpointAddress(), body);
    TlvUtil.formatTlv(TYPE, body, buffer);
}
Also used : LspIdentifiers(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.AddressFamily) ByteBuf(io.netty.buffer.ByteBuf) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4Case)

Example 17 with TunnelId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId in project bgpcep by opendaylight.

the class Stateful07LSPIdentifierIpv6TlvParser method serializeTlv.

@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
    Preconditions.checkArgument(tlv instanceof LspIdentifiers, "LspIdentifiersTlv is mandatory.");
    final LspIdentifiers lsp = (LspIdentifiers) tlv;
    final ByteBuf body = Unpooled.buffer();
    final Ipv6 ipv6 = ((Ipv6Case) lsp.getAddressFamily()).getIpv6();
    Preconditions.checkArgument(ipv6.getIpv6TunnelSenderAddress() != null, "Ipv6TunnelSenderAddress is mandatory.");
    writeIpv6Address(ipv6.getIpv6TunnelSenderAddress(), body);
    Preconditions.checkArgument(lsp.getLspId() != null, "LspId is mandatory.");
    writeShort(lsp.getLspId().getValue().shortValue(), body);
    Preconditions.checkArgument(lsp.getTunnelId() != null, "TunnelId is mandatory.");
    writeUnsignedShort(lsp.getTunnelId().getValue(), body);
    Preconditions.checkArgument(ipv6.getIpv6ExtendedTunnelId() != null, "Ipv6ExtendedTunnelId is mandatory.");
    writeIpv6Address(ipv6.getIpv6ExtendedTunnelId(), body);
    Preconditions.checkArgument(ipv6.getIpv6TunnelEndpointAddress() != null, "Ipv6TunnelEndpointAddress is mandatory.");
    writeIpv6Address(ipv6.getIpv6TunnelEndpointAddress(), body);
    TlvUtil.formatTlv(TYPE, body, buffer);
}
Also used : LspIdentifiers(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers) Ipv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case) Ipv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6) ByteBuf(io.netty.buffer.ByteBuf)

Example 18 with TunnelId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId in project bgpcep by opendaylight.

the class Stateful07LSPIdentifierIpv6TlvParser method parseTlv.

@Override
public LspIdentifiers parseTlv(final ByteBuf buffer) throws PCEPDeserializerException {
    if (buffer == null) {
        return null;
    }
    Preconditions.checkArgument(buffer.readableBytes() == V6_LENGTH, "Length %s does not match LSP Identifiers Ipv6 tlv length.", buffer.readableBytes());
    final Ipv6Builder builder = new Ipv6Builder();
    builder.setIpv6TunnelSenderAddress(Ipv6Util.addressForByteBuf(buffer));
    final LspId lspId = new LspId((long) buffer.readUnsignedShort());
    final TunnelId tunnelId = new TunnelId(buffer.readUnsignedShort());
    builder.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForByteBuf(buffer)));
    builder.setIpv6TunnelEndpointAddress(Ipv6Util.addressForByteBuf(buffer));
    final AddressFamily afi = new Ipv6CaseBuilder().setIpv6(builder.build()).build();
    return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId) LspIdentifiersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder) Ipv6CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6CaseBuilder) Ipv6Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6Builder) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.AddressFamily) TunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId) Ipv6ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv6ExtendedTunnelId) Ipv6ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv6ExtendedTunnelId)

Example 19 with TunnelId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId in project bgpcep by opendaylight.

the class PcRptMessageCodecTest method testGetValidReportsPositive.

@Test
public void testGetValidReportsPositive() {
    final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
    final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
    final Ipv4Builder builder = new Ipv4Builder();
    builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
    builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
    builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
    final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
    final LspId lspId = new LspId(1L);
    final TunnelId tunnelId = new TunnelId(1);
    final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
    final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
    final Ero ero = new EroBuilder().build();
    final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
    final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
    assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
    assertTrue(objects.isEmpty());
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId) LspIdentifiersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder) LspIdentifiers(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers) Ero(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero) BandwidthUsage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.bandwidth.usage.object.BandwidthUsage) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp) Reports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports) Ipv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder) TunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId) Ipv4ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder) Ipv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4CaseBuilder) Bandwidth1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) EroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder) Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object) Ipv4ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.AddressFamily) BandwidthUsageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.bandwidth.usage.object.BandwidthUsageBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId) Test(org.junit.Test)

Example 20 with TunnelId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId in project bgpcep by opendaylight.

the class TeLspIpv4NlriParser method parseObjectType.

@Override
protected ObjectType parseObjectType(final ByteBuf buffer) {
    final TeLspCaseBuilder builder = new TeLspCaseBuilder();
    final Ipv4CaseBuilder ipv4CaseBuilder = new Ipv4CaseBuilder();
    ipv4CaseBuilder.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(buffer));
    builder.setTunnelId(new TunnelId(buffer.readUnsignedShort()));
    builder.setLspId(new LspId((long) buffer.readUnsignedShort()));
    ipv4CaseBuilder.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(buffer));
    return builder.setAddressFamily(ipv4CaseBuilder.build()).build();
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId) Ipv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.te.lsp._case.address.family.Ipv4CaseBuilder) TeLspCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.TeLspCaseBuilder) TunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId)

Aggregations

LspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId)11 TunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId)11 BigInteger (java.math.BigInteger)10 Test (org.junit.Test)7 LspIdentifiers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers)7 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder)7 ByteBuf (io.netty.buffer.ByteBuf)6 Ipv4ExtendedTunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId)6 Ipv4CaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4CaseBuilder)5 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)4 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.AddressFamily)4 ExecutionException (java.util.concurrent.ExecutionException)3 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)3 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)3 GetEgressActionsForInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder)3 GetEgressActionsForInterfaceOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput)3 TunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder)3 TeLspCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.TeLspCaseBuilder)3 Ipv4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder)3 ArrayList (java.util.ArrayList)2