Allowing message-id > 99 in NETCONF rcp-reply

Change-Id: If6fbc0c3ea432e8d33f6d790491342312333cee4
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
index fde6bc2..9ae5acc 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
@@ -427,7 +427,7 @@
         rpc.append(EDIT_CONFIG_CLOSE).append("\n");
         rpc.append(RPC_CLOSE);
         rpc.append(ENDPATTERN);
-        log.info(rpc.toString());
+        log.debug(rpc.toString());
         String reply = sendRequest(rpc.toString());
         return checkReply(reply);
     }
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
index 307c917..64e7210 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
@@ -34,6 +34,8 @@
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Thread that gets spawned each time a session is established and handles all the input
@@ -50,6 +52,7 @@
     private static final String RPC_ERROR = "rpc-error";
     private static final String NOTIFICATION_LABEL = "<notification";
     private static final String MESSAGE_ID = "message-id=";
+    private static final Pattern MSGID_PATTERN = Pattern.compile(MESSAGE_ID + "\"(\\d+)\"");
 
     private PrintWriter outputStream;
     private final InputStream err;
@@ -220,15 +223,13 @@
     }
 
     private static Optional<Integer> getMsgId(String reply) {
-        if (reply.contains(MESSAGE_ID)) {
-            String[] outer = reply.split(MESSAGE_ID);
-            Preconditions.checkArgument(outer.length != 1,
-                                        "Error in retrieving the message id");
-            String messageID = outer[1].substring(0, 3).replace("\"", "");
-            Preconditions.checkNotNull(Integer.parseInt(messageID),
-                                       "Error in retrieving the message id");
-            return Optional.of(Integer.parseInt(messageID));
-        } else if (reply.contains(HELLO)) {
+        Matcher matcher = MSGID_PATTERN.matcher(reply);
+        if (matcher.find()) {
+            Integer messageId = Integer.parseInt(matcher.group(1));
+            Preconditions.checkNotNull(messageId, "Error in retrieving the message id");
+            return Optional.of(messageId);
+        }
+        if (reply.contains(HELLO)) {
             return Optional.of(0);
         }
         return Optional.empty();