use of org.onosproject.bgpio.types.BgpEvpnEsi in project onos by opennetworkinglab.
the class BgpEvpnRouteType2Nlri method read.
/**
* Reads the Evpn type 2 attributes.
*
* @param cb channel buffer
* @return type2 route
* @throws BgpParseException parse exception
*/
public static BgpEvpnRouteType2Nlri read(ChannelBuffer cb) throws BgpParseException {
if (cb.readableBytes() == 0) {
return null;
}
RouteDistinguisher rd = RouteDistinguisher.read(cb);
BgpEvpnEsi esi = BgpEvpnEsi.read(cb);
int ethernetTagID = cb.readInt();
byte macAddressLength = cb.readByte();
MacAddress macAddress = Validation.toMacAddress(macAddressLength / 8, cb);
byte ipAddressLength = cb.readByte();
InetAddress ipAddress = null;
if (ipAddressLength > 0) {
ipAddress = Validation.toInetAddress(ipAddressLength / 8, cb);
}
BgpEvpnLabel mplsLabel1 = BgpEvpnLabel.read(cb);
BgpEvpnLabel mplsLabel2 = null;
if (cb.readableBytes() > 0) {
mplsLabel2 = BgpEvpnLabel.read(cb);
}
return new BgpEvpnRouteType2Nlri(rd, esi, ethernetTagID, macAddress, ipAddress, mplsLabel1, mplsLabel2);
}
Aggregations