Search in sources :

Example 6 with Ipv6Case

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case in project bgpcep by opendaylight.

the class PathComputationImpl method getDestinationVertexKey.

private VertexKey getDestinationVertexKey(final EndpointsObj endPoints) {
    IpAddress address = null;
    if (endPoints.getAddressFamily() instanceof Ipv4Case) {
        address = new IpAddress(((Ipv4Case) endPoints.getAddressFamily()).getIpv4().getDestinationIpv4Address());
    }
    if (endPoints.getAddressFamily() instanceof Ipv6Case) {
        address = new IpAddress(((Ipv6Case) endPoints.getAddressFamily()).getIpv6().getDestinationIpv6Address());
    }
    if (address == null) {
        return null;
    }
    ConnectedVertex vertex = tedGraph.getConnectedVertex(address);
    LOG.debug("Compute path to Destination {}", vertex != null ? vertex : "Unknown");
    return vertex != null ? vertex.getVertex().key() : null;
}
Also used : Ipv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case) ConnectedVertex(org.opendaylight.graph.ConnectedVertex) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case)

Example 7 with Ipv6Case

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case in project bgpcep by opendaylight.

the class PathComputationImpl method getSourceVertexKey.

private VertexKey getSourceVertexKey(final EndpointsObj endPoints) {
    IpAddress address = null;
    if (endPoints.getAddressFamily() instanceof Ipv4Case) {
        address = new IpAddress(((Ipv4Case) endPoints.getAddressFamily()).getIpv4().getSourceIpv4Address());
    }
    if (endPoints.getAddressFamily() instanceof Ipv6Case) {
        address = new IpAddress(((Ipv6Case) endPoints.getAddressFamily()).getIpv6().getSourceIpv6Address());
    }
    if (address == null) {
        return null;
    }
    ConnectedVertex vertex = tedGraph.getConnectedVertex(address);
    LOG.debug("Compute path from Source {}", vertex != null ? vertex : "Unknown");
    return vertex != null ? vertex.getVertex().key() : null;
}
Also used : Ipv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case) ConnectedVertex(org.opendaylight.graph.ConnectedVertex) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case)

Example 8 with Ipv6Case

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case in project bgpcep by opendaylight.

the class NodeChangedListener method create.

private void create(final ReadWriteTransaction trans, final InstanceIdentifier<ReportedLsp> identifier, final ReportedLsp value) throws ExecutionException, InterruptedException {
    final InstanceIdentifier<Node> ni = identifier.firstIdentifierOf(Node.class);
    final Path1 rl = value.nonnullPath().values().iterator().next().augmentation(Path1.class);
    final AddressFamily af = rl.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
    /*
         * We are trying to ensure we have source and destination nodes.
         */
    final IpAddress srcIp;
    final IpAddress dstIp;
    if (af instanceof Ipv4Case) {
        final Ipv4 ipv4 = ((Ipv4Case) af).getIpv4();
        srcIp = new IpAddress(ipv4.getIpv4TunnelSenderAddress());
        dstIp = new IpAddress(ipv4.getIpv4TunnelEndpointAddress());
    } else if (af instanceof Ipv6Case) {
        final Ipv6 ipv6 = ((Ipv6Case) af).getIpv6();
        srcIp = new IpAddress(ipv6.getIpv6TunnelSenderAddress());
        dstIp = new IpAddress(ipv6.getIpv6TunnelSenderAddress());
    } else {
        throw new IllegalArgumentException("Unsupported address family: " + af.implementedInterface());
    }
    final Path path0 = value.nonnullPath().values().iterator().next();
    final Link1Builder lab = new Link1Builder();
    if (path0.getBandwidth() != null) {
        lab.setBandwidth(path0.getBandwidth().getBandwidth());
    }
    if (path0.getClassType() != null) {
        lab.setClassType(path0.getClassType().getClassType());
    }
    lab.setSymbolicPathName(value.getName());
    final InstanceIdentifier<TerminationPoint> dst = getIpTerminationPoint(trans, dstIp, null, Boolean.FALSE);
    final InstanceIdentifier<TerminationPoint> src = getIpTerminationPoint(trans, srcIp, ni, rl.getLsp().getDelegate());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Link1Builder slab = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Link1Builder();
    slab.setOperationalStatus(rl.getLsp().getOperational());
    slab.setAdministrativeStatus(rl.getLsp().getAdministrative() ? AdministrativeStatus.Active : AdministrativeStatus.Inactive);
    final LinkId id = linkIdForLsp(identifier, value);
    final LinkBuilder lb = new LinkBuilder();
    lb.setLinkId(id);
    lb.setSource(new SourceBuilder().setSourceNode(src.firstKeyOf(Node.class).getNodeId()).setSourceTp(src.firstKeyOf(TerminationPoint.class).getTpId()).build());
    lb.setDestination(new DestinationBuilder().setDestNode(dst.firstKeyOf(Node.class).getNodeId()).setDestTp(dst.firstKeyOf(TerminationPoint.class).getTpId()).build());
    lb.addAugmentation(lab.build());
    lb.addAugmentation(slab.build());
    trans.put(LogicalDatastoreType.OPERATIONAL, linkForLsp(id), lb.build());
}
Also used : Preconditions(com.google.common.base.Preconditions) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Link1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev181109.Link1Builder) Path1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.AddressFamily) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4Case) Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path) Ipv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6) SourceBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.SourceBuilder) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4) LinkBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder) Ipv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case) DestinationBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.DestinationBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) LinkId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId)

Example 9 with Ipv6Case

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case in project bgpcep by opendaylight.

the class DetourObjectIpv6Parser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
    final ByteBuf plrId = byteBuf.readSlice(byteBuf.capacity() / 2);
    final Ipv6DetourObjectBuilder ipv6Case = new Ipv6DetourObjectBuilder();
    final List<PlrId> plrIdList = new ArrayList<>();
    while (plrId.isReadable()) {
        final PlrIdBuilder plr = new PlrIdBuilder();
        plr.setPlrId(Ipv6Util.addressForByteBuf(plrId));
        plrIdList.add(plr.build());
    }
    final List<AvoidNode> avoidNodeList = new ArrayList<>();
    while (byteBuf.isReadable()) {
        final AvoidNodeBuilder plr = new AvoidNodeBuilder();
        plr.setAvoidNode(Ipv6Util.addressForByteBuf(byteBuf));
        avoidNodeList.add(plr.build());
    }
    return ipv6Case.setPlrId(plrIdList).setAvoidNode(avoidNodeList).build();
}
Also used : PlrIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrIdBuilder) AvoidNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode) ArrayList(java.util.ArrayList) Ipv6DetourObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObjectBuilder) AvoidNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNodeBuilder) PlrId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId) ByteBuf(io.netty.buffer.ByteBuf)

Example 10 with Ipv6Case

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case 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)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)6 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 Ipv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case)3 Ipv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case)3 ConnectedVertex (org.opendaylight.graph.ConnectedVertex)2 Ipv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case)2 Ipv6 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6)2 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.AddressFamily)2 Ipv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv6Case)2 EndpointsObj (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObj)2 Preconditions (com.google.common.base.Preconditions)1 ArrayList (java.util.ArrayList)1 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)1 TeLspCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.TeLspCase)1 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.te.lsp._case.AddressFamily)1 Ipv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.te.lsp._case.address.family.Ipv4Case)1 LspIdentifiers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers)1 Ipv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6Case)1 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)1 Path1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1)1