+ /**
+ * Check for presence of well known mandatory attribute LOCAL_PREF in Update message
+ *
+ * @param message Update message
+ * @throws BGPDocumentedException
+ */
+ private void checkMandatoryAttributesPresence(final Update message) throws BGPDocumentedException {
+ if (MessageUtil.isAnyNlriPresent(message)) {
+ final Attributes attrs = message.getAttributes();
+ if (this.peerRole == PeerRole.Ibgp && (attrs == null || attrs.getLocalPref() == null)) {
+ throw new BGPDocumentedException(BGPError.MANDATORY_ATTR_MISSING_MSG + "LOCAL_PREF",
+ BGPError.WELL_KNOWN_ATTR_MISSING,
+ new byte[] { LocalPreferenceAttributeParser.TYPE });
+ }
+ }
+ }
+
+ /**
+ * Process Update message received.
+ * Calls {@link #checkMandatoryAttributesPresence(Update)} to check for presence of mandatory attributes.
+ *
+ * @param message Update message
+ * @throws BGPDocumentedException
+ */
+ private void onUpdateMessage(final Update message) throws BGPDocumentedException {
+ checkMandatoryAttributesPresence(message);
+