Fix switch serial number type 06/92706/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 25 Sep 2020 08:35:59 +0000 (10:35 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 25 Sep 2020 09:06:44 +0000 (11:06 +0200)
This is a day-0 bug in the definition: X509Certificate's serial
number can be any unbounded number, not just uint64.

Change the definition to be string-based so we do not get errors
if the serial number is negative or quite large.

Change-Id: I41292cc329c4eac81a7c671821e29b6851030056
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowjava/openflow-protocol-api/src/main/yang/system-notifications.yang
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImpl.java

index 83421ca08e49e6acc0f9a9b330cf24f05bca4a3b..db02f8c1546f7c001d43091987f1a549009b2adf 100644 (file)
@@ -50,7 +50,9 @@
             type yang:date-and-time;
         }
         leaf serial-number {
-            type uint64;
+            type string {
+                pattern "0|(-?[1-9][0-9]*)";
+            }
         }
         leaf-list subject-alternate-names {
             type string;
index ca42ef01dd680ed89ec81c05e400dd96ee691546..3b35622b6b13bdf4e76d4bfbcdbbaf6756a897b4 100644 (file)
@@ -295,7 +295,7 @@ public class ConnectionAdapterImpl extends AbstractConnectionAdapterStatistics i
             } catch (InvalidNameException e) {
                 LOG.error("Exception ", e);
             }
-            switchCertificateBuilder.setSerialNumber(switchCertificate.getSerialNumber());
+            switchCertificateBuilder.setSerialNumber(switchCertificate.getSerialNumber().toString());
             try {
                 if (switchCertificate.getSubjectAlternativeNames() != null) {
                     List<String> subjectAlternateNames = new ArrayList<>();