- private static boolean isCloseSession(final NetconfMessage incommingDocument) {
- final Document document = incommingDocument.getDocument();
+ private void checkMessageId(Node rootNode) throws NetconfDocumentedException {
+ NamedNodeMap attributes = rootNode.getAttributes();
+ if(attributes.getNamedItemNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.MESSAGE_ID)!=null) {
+ return;
+ }
+
+ if(attributes.getNamedItem(XmlNetconfConstants.MESSAGE_ID)!=null) {
+ return;
+ }
+
+ throw new NetconfDocumentedException("Missing attribute" + rootNode.getNodeName(),
+ NetconfDocumentedException.ErrorType.protocol, NetconfDocumentedException.ErrorTag.missing_attribute,
+ NetconfDocumentedException.ErrorSeverity.error, ImmutableMap.of(NetconfDocumentedException.ErrorTag.missing_attribute.toString(),
+ XmlNetconfConstants.MESSAGE_ID));
+ }
+
+ private static boolean isCloseSession(final NetconfMessage incomingDocument) {
+ final Document document = incomingDocument.getDocument();