use of 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 in project bgpcep by opendaylight.
the class UriBuilder method add.
UriBuilder add(final LinkCase link) {
addPrefix("local-", link.getLocalNodeDescriptors());
addPrefix("remote-", link.getRemoteNodeDescriptors());
final LinkDescriptors ld = link.getLinkDescriptors();
if (ld.getIpv4InterfaceAddress() != null) {
add("ipv4-iface", ld.getIpv4InterfaceAddress().getValue());
}
if (ld.getIpv4NeighborAddress() != null) {
add("ipv4-neigh", ld.getIpv4NeighborAddress().getValue());
}
if (ld.getIpv6InterfaceAddress() != null) {
add("ipv6-iface", ld.getIpv6InterfaceAddress().getValue());
}
if (ld.getIpv6NeighborAddress() != null) {
add("ipv6-neigh", ld.getIpv6NeighborAddress().getValue());
}
if (ld.getMultiTopologyId() != null) {
add("mt", ld.getMultiTopologyId().getValue());
}
add("local-id", ld.getLinkLocalIdentifier());
add("remote-id", ld.getLinkRemoteIdentifier());
return this;
}
use of 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 in project bgpcep by opendaylight.
the class PCEPUnreachDestinationSerializer method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof UnreachDestinationObj, "Wrong instance of PCEPObject. Passed %s. Needed UnreachDestinationObj.", object.getClass());
final UnreachDestinationObj uPObj = (UnreachDestinationObj) object;
final Destination destination = uPObj.getDestination();
final Boolean processing = object.getProcessingRule();
final Boolean ignore = object.getIgnore();
if (destination instanceof Ipv6DestinationCase) {
final Ipv6DestinationCase ipv6 = (Ipv6DestinationCase) destination;
PCEPIpv6UnreachDestinationParser.serializeObject(processing, ignore, ipv6, buffer);
} else if (destination instanceof Ipv4DestinationCase) {
final Ipv4DestinationCase ipv4 = (Ipv4DestinationCase) destination;
PCEPIpv4UnreachDestinationParser.serializeObject(processing, ignore, ipv4, buffer);
}
}
use of 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 in project bgpcep by opendaylight.
the class PCEPEndPointsObjectSerializer method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof EndpointsObj, "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
final EndpointsObj ePObj = (EndpointsObj) object;
final AddressFamily afi = ePObj.getAddressFamily();
final Boolean processing = object.getProcessingRule();
final Boolean ignore = object.getIgnore();
if (afi instanceof Ipv6Case) {
final Ipv6 ipv6 = ((Ipv6Case) afi).getIpv6();
PCEPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
} else if (afi instanceof Ipv4Case) {
final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
PCEPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
} else if (afi instanceof P2mpIpv4Case) {
final P2mpIpv4 ipv4 = ((P2mpIpv4Case) afi).getP2mpIpv4();
PCEPP2MPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
} else if (afi instanceof P2mpIpv6Case) {
final P2mpIpv6 ipv6 = ((P2mpIpv6Case) afi).getP2mpIpv6();
PCEPP2MPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
}
}
use of 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 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());
}
use of 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 in project bgpcep by opendaylight.
the class GenericConditionPolicyHandler method createPrefixes.
private static List<IpPrefix> createPrefixes(final Prefix prefixContainer) {
final IpPrefix prefix = prefixContainer.getIpPrefix();
if (prefixContainer.getMasklengthRange().equals(EXACT)) {
return Collections.singletonList(prefix);
}
final String[] range = prefixContainer.getMasklengthRange().split("\\..");
boolean ipv4 = false;
final String prefixString;
if (prefix.getIpv4Prefix() != null) {
prefixString = prefix.getIpv4Prefix().getValue();
ipv4 = true;
} else {
prefixString = prefix.getIpv6Prefix().getValue();
}
int from = Integer.parseInt(range[0]);
final List<IpPrefix> prefixes = new ArrayList<>();
while (from <= Integer.parseInt(range[1])) {
final String prefixVal = StringUtils.replacePattern(prefixString, "[/][0-9]+", "/" + Integer.toString(from));
if (ipv4) {
prefixes.add(new IpPrefix(new Ipv4Prefix(prefixVal)));
} else {
prefixes.add(new IpPrefix(new Ipv6Prefix(prefixVal)));
}
from++;
}
return prefixes;
}
Aggregations