import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.AdministrativeGroup;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Delay;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Ipv4RouterIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Ipv6RouterIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkProtectionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Loss;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.MplsProtocolMask;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.ProtocolId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.LinkMinMaxDelay;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.LinkMinMaxDelayBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.PeerAdjSid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.PeerAdjSidBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.PeerNodeSid;
private static final int PEER_NODE_SID_CODE = 1101;
private static final int PEER_ADJ_SID_CODE = 1102;
private static final int PEER_SET_SID_CODE = 1103;
+ // Performance Metrics
+ private static final int LINK_DELAY = 1114;
+ private static final int LINK_MIN_MAX_DELAY = 1115;
+ private static final int DELAY_VARIATION = 1116;
+ private static final int LINK_LOSS = 1117;
+ private static final int RESIDUAL_BANDWIDTH = 1118;
+ private static final int AVAILABLE_BANDWIDTH = 1119;
+ private static final int UTILIZED_BANDWIDTH = 1120;
private LinkAttributesParser() {
throw new UnsupportedOperationException();
peerSetSids.add(new PeerSetSidsBuilder(SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
LOG.debug("Parsed Peer Set Sid :{}", peerSetSids.get(peerSetSids.size() - 1));
break;
+ // Performance Metrics
+ case LINK_DELAY:
+ builder.setLinkDelay(new Delay(value.readUnsignedInt()));
+ LOG.debug("Parsed Link Delay {}", builder.getLinkDelay());
+ break;
+ case LINK_MIN_MAX_DELAY:
+ builder.setLinkMinMaxDelay(new LinkMinMaxDelayBuilder().setMinDelay(new Delay(value.readUnsignedInt()))
+ .setMaxDelay(new Delay(value.readUnsignedInt())).build());
+ LOG.debug("Parsed Link Min/Max Delay {}", builder.getLinkMinMaxDelay());
+ break;
+ case DELAY_VARIATION:
+ builder.setDelayVariation(new Delay(value.readUnsignedInt()));
+ LOG.debug("Parsed Delay Variation {}", builder.getDelayVariation());
+ break;
+ case LINK_LOSS:
+ builder.setLinkLoss(new Loss(value.readUnsignedInt()));
+ LOG.debug("Parsed Link Loss {}", builder.getLinkLoss());
+ break;
+ case RESIDUAL_BANDWIDTH:
+ builder.setResidualBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+ LOG.debug("Parsed Residual Bandwidth {}", builder.getResidualBandwidth());
+ break;
+ case AVAILABLE_BANDWIDTH:
+ builder.setAvailableBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+ LOG.debug("Parsed Available Bandwidth {}", builder.getAvailableBandwidth());
+ break;
+ case UTILIZED_BANDWIDTH:
+ builder.setUtilizedBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+ LOG.debug("Parsed Utilized Bandwidth {}", builder.getUtilizedBandwidth());
+ break;
default:
LOG.warn("TLV {} is not a valid link attribute, ignoring it", key);
}
ifPresentApply(linkAttributes.getPeerNodeSid(), value -> TlvUtil.writeTLV(PEER_NODE_SID_CODE, SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerNodeSid) value), output));
ifPresentApply(linkAttributes.getPeerAdjSid(), value -> TlvUtil.writeTLV(PEER_ADJ_SID_CODE, SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerAdjSid) value), output));
ifPresentApply(linkAttributes.getPeerSetSids(), value -> SrLinkAttributesParser.serializeAdjacencySegmentIdentifiers((List<PeerSetSids>) value, PEER_SET_SID_CODE, output));
+ // Performance Metrics
+ ifPresentApply(linkAttributes.getLinkDelay(), value -> TlvUtil.writeTLV(LINK_DELAY, Unpooled.copyInt((((Delay) value).getValue()).intValue()), output));
+ serializeLinkMinMaxDelay(linkAttributes.getLinkMinMaxDelay(), output);
+ ifPresentApply(linkAttributes.getDelayVariation(), value -> TlvUtil.writeTLV(DELAY_VARIATION, Unpooled.copyInt((((Delay) value).getValue()).intValue()), output));
+ ifPresentApply(linkAttributes.getLinkLoss(), value -> TlvUtil.writeTLV(LINK_LOSS, Unpooled.copyInt((((Loss) value).getValue()).intValue()), output));
+ ifPresentApply(linkAttributes.getResidualBandwidth(), value -> TlvUtil.writeTLV(RESIDUAL_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+ ifPresentApply(linkAttributes.getAvailableBandwidth(), value -> TlvUtil.writeTLV(AVAILABLE_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+ ifPresentApply(linkAttributes.getUtilizedBandwidth(), value -> TlvUtil.writeTLV(UTILIZED_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
LOG.trace("Finished serializing Link Attributes");
}
TlvUtil.writeTLV(MPLS_PROTOCOL, mplsProtocolMaskBuf, byteAggregator);
}
}
+
+ private static void serializeLinkMinMaxDelay(final LinkMinMaxDelay linkMinMaxDelay, final ByteBuf byteAggregator) {
+ if (linkMinMaxDelay != null) {
+ final ByteBuf linkMinMaxDelayBuf = Unpooled.buffer();
+ linkMinMaxDelayBuf.writeInt(linkMinMaxDelay.getMinDelay().getValue().intValue());
+ linkMinMaxDelayBuf.writeInt(linkMinMaxDelay.getMaxDelay().getValue().intValue());
+ TlvUtil.writeTLV(LINK_MIN_MAX_DELAY, linkMinMaxDelayBuf, byteAggregator);
+ }
+ }
}
description
"This module contains the base data model of a BGP message.
It rolls up the definitions contained in RFC4271
- and draft-ietf-idr-ls-distribution-03.
+ and RFC7752.
Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
http://www.eclipse.org/legal/epl-v10.html";
revision "2018-03-29" {
- description "Add support for add-path for all afi/safi.";
+ description "Add support for add-path for all afi/safi.
+ and Updated to include Performance Metric Extensions";
+ reference "draft-ietf-idr-te-pm-bgp-17";
}
revision "2017-12-07" {
}
enum ipv4-te-lsp {
status deprecated;
- reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03#section-4.1";
+ reference "http://tools.ietf.org/html/rfc7752#section-4.1";
value 5;
}
enum ipv6-te-lsp {
status deprecated;
- reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03#section-4.1";
+ reference "http://tools.ietf.org/html/rfc7752#section-4.1";
value 6;
}
}
}
enum rsvp-te {
status deprecated;
- reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03#section-2.1";
+ reference "http://tools.ietf.org/html/rfc7752#section-2.1";
value 8; // rsvp-te protocol-id TBD by IANA
}
enum segment-routing {
status deprecated;
- reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03#section-2.1";
+ reference "http://tools.ietf.org/html/rfc7752#section-2.1";
value 9; // segment-routing protocol-id TBD by IANA
}
}
// linkstate
typedef mpls-protocol-mask {
- reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.2.2";
+ reference "http://tools.ietf.org/html/rfc7752#section-3.3.2.2";
type bits {
bit ldp {
position 0;
}
}
+ typedef delay {
+ description "This 24-bit typedef describes delay over a configurable
+ interval in microseconds, encoded as an integer value. When set to
+ the maximum value 16,777,215 (16.777215 sec), then the delay is at
+ least that value, and it may be larger.";
+ reference "https://tools.ietf.org/html/rfc7471#section-4.1.5";
+ type uint32 {
+ range "0..16777215";
+ }
+ units microseconds;
+ }
+
+ typedef loss {
+ description "This 24-bit typedef describes packet loss as a percentage
+ of the total traffic sent over a configurable interval. The basic
+ unit is 0.000003%, where (2^24 - 2) is 50.331642%. This value is
+ the highest packet loss percentage that can be expressed.
+ Therefore, measured values that are larger than the field maximum
+ SHOULD be encoded as the maximum value.";
+ reference "https://tools.ietf.org/html/rfc7471#section-4.4.5";
+ type uint32 {
+ range "0..16777215";
+ }
+ units percent;
+ }
+
grouping linkstate-attribute {
- reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.2";
+ reference "http://tools.ietf.org/html/rfc7752#section-3.3.2";
leaf local-ipv4-router-id {
type ipv4-router-identifier;
}
reference "https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05#section-4.3";
uses bgp-sr:epe-adj-sid-tlv;
}
+ // Performance Metric https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2
+ leaf link-delay {
+ description "Unidirectional Link Delay";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.1";
+ type delay;
+ }
+ container link-min-max-delay {
+ description "Min/Max Unidirectional Link Delay";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.2";
+ leaf min-delay {
+ type delay;
+ }
+ leaf max-delay {
+ type delay;
+ }
+ }
+ leaf delay-variation {
+ description "Unidirectional Delay Variation";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.3";
+ type delay;
+ }
+ leaf link-loss {
+ description "Unidirectional Link Loss";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.4";
+ type loss;
+ }
+ leaf residual-bandwidth {
+ description "Unidirectional Residual Bandwidth";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.5";
+ type netc:bandwidth;
+ }
+ leaf available-bandwidth {
+ description "Unidirectional Available Bandwidth";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.6";
+ type netc:bandwidth;
+ }
+ leaf utilized-bandwidth {
+ description "Unidirectional Utilized Bandwidth";
+ reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.7";
+ type netc:bandwidth;
+ }
}
typedef route-tag {
case te-lsp-attributes-case {
status deprecated;
description "LSP Object";
- reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03#section-2.2";
+ reference "http://tools.ietf.org/html/rfc7752#section-2.2";
container te-lsp-attributes {
uses rsvp:tspec-object;
uses rsvp:flow-spec-object;
0x04, 0x4d, 0, 0x08, 0, 0x05, 0, 0, 0x0a, 0x0b, 0x0c, 0x0d, // peer-node-sid
0x04, 0x4e, 0, 0x08, 0, 0x05, 0, 0, 0x0a, 0x0b, 0x0c, 0x0f, // peer-adj-sid
0x04, 0x4f, 0, 0x08, 0, 0x05, 0, 0, 0x0a, 0x0b, 0x0c, 0x0e, // peer-set-sid
+ // Performace Metrics
+ 0x04, 0x5a, 0, 0x04, 0, 0, 0x27, 0x10, // Link Delay
+ 0x04, 0x5b, 0, 0x08, 0, 0, 0x13, (byte)0x88, 0, 0, 0x4e, 0x20, // Link Min-Max Delay
+ 0x04, 0x5c, 0, 0x04, 0, 0, 0x27, 0x10, // Link Delay Variation
+ 0x04, 0x5d, 0, 0x04, 0, 0, 0, 0, // Link Loss
+ 0x04, 0x5e, 0, 0x04, 0x46, 0x43, 0x50, 0, // Residual Bandwidth
+ 0x04, 0x5f, 0, 0x04, 0x46, 0x43, 0x50, 0, // Available Bandwidth
+ 0x04, 0x60, 0, 0x04, 0, 0, 0, 0, // Utilized Bandwidth
0x04, (byte) 0x88, 0, 0x01, 0x0a };
private static final byte[] NODE_ATTR = { 0x01, 0x07, 0, 0x04, 0, 0x2a, 0, 0x2b, 0x04, 0, 0, 0x01, (byte) 0xbc, 0x04, 0x02, 0,
assertEquals(new Long(168496143L), ((SidCase) ls.getPeerAdjSid().getSidLabelIndex()).getSid());
assertEquals(new Short("5"), ls.getPeerAdjSid().getWeight().getValue());
+ // Performance Metrics
+ assertEquals(new Long(10000L), ls.getLinkDelay().getValue());
+ assertEquals(new Long(5000L), ls.getLinkMinMaxDelay().getMinDelay().getValue());
+ assertEquals(new Long(20000L), ls.getLinkMinMaxDelay().getMaxDelay().getValue());
+ assertEquals(new Long(10000L), ls.getDelayVariation().getValue());
+ assertEquals(new Long(0L), ls.getLinkLoss().getValue());
+ assertArrayEquals(new byte[] { (byte) 0x46, (byte) 0x43, (byte) 0x50, (byte) 0x00 },
+ ls.getResidualBandwidth().getValue());
+ assertArrayEquals(new byte[] { (byte) 0x46, (byte) 0x43, (byte) 0x50, (byte) 0x00 },
+ ls.getAvailableBandwidth().getValue());
+ assertArrayEquals(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 },
+ ls.getUtilizedBandwidth().getValue());
+
//serialization
final ByteBuf buff = Unpooled.buffer();
this.parser.serializeAttribute(builder.build(), buff);
- buff.skipBytes(3);
+ // The LINK_ATTR buffer is now greater than 255 bytes. Need to skip one more byte
+ buff.skipBytes(4);
// there is unresolved TLV at the end, that needs to be cut off
assertArrayEquals(ByteArray.subByte(LINK_ATTR, 0, LINK_ATTR.length -5), ByteArray.getAllBytes(buff));