Fixing O1 compilation 93/6893/2
authorwahidw <abdulwahid.w@nokia.com>
Wed, 20 Oct 2021 07:50:27 +0000 (07:50 +0000)
committerwahidw <abdulwahid.w@nokia.com>
Wed, 20 Oct 2021 08:29:47 +0000 (08:29 +0000)
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
Change-Id: Iafbdcb048a18514a476ba2be87567e10677cb0ce

Dockerfile
agent/pkg/nbi/helper.c

index 96c782d..e89a3f2 100755 (executable)
 #----------------------------------------------------------
 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 AS o1mediator-build
 
+RUN apt update && apt install --reinstall -y \
+  ca-certificates \
+  && \
+  update-ca-certificates
+
 RUN apt-get update -y && apt-get install -y jq \
       git \
       cmake \
       build-essential \
       vim \
       supervisor \
-      libpcre2-dev \
+      libpcre3-dev \
       pkg-config \
       libavl-dev \
       libev-dev \
@@ -58,7 +63,7 @@ WORKDIR /opt/dev
 # libyang
 RUN \
       cd /opt/dev && \
-      git clone https://github.com/CESNET/libyang.git && \
+      git clone -b libyang1 https://github.com/CESNET/libyang.git && \
       cd libyang && mkdir build && cd build && \
       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
       make -j2 && \
@@ -67,7 +72,7 @@ RUN \
 # sysrepo
 RUN \
       cd /opt/dev && \
-      git clone https://github.com/sysrepo/sysrepo.git && \
+      git clone -b libyang1 https://github.com/sysrepo/sysrepo.git && \
       cd sysrepo && sed -i -e 's/2000/30000/g;s/5000/30000/g' src/common.h.in && \
       mkdir build && cd build && \
       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_TESTS=OFF -DREPOSITORY_LOC:PATH=/etc/sysrepo .. && \
@@ -87,7 +92,7 @@ RUN \
 # libnetconf2
 RUN \
       cd /opt/dev && \
-      git clone https://github.com/CESNET/libnetconf2.git && \
+      git clone -b libyang1 https://github.com/CESNET/libnetconf2.git && \
       cd libnetconf2 && mkdir build && cd build && \
       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
       make -j2 && \
@@ -97,7 +102,7 @@ RUN \
 # netopeer2
 RUN \
       cd /opt/dev && \
-      git clone https://github.com/CESNET/Netopeer2.git && \
+      git clone -b libyang1 https://github.com/CESNET/Netopeer2.git && \
       cd Netopeer2 && mkdir build && cd build && \
       cmake -DCMAKE_BUILD_TYPE:String="Release" -DNP2SRV_DATA_CHANGE_TIMEOUT=30000 -DNP2SRV_DATA_CHANGE_WAIT=ON .. && \
       make -j2 && \
@@ -166,7 +171,7 @@ RUN apt-get update -y && apt-get install -y jq \
       supervisor \
       openssl \
       python-pip \
-      libpcre2-dev \
+      libpcre3-dev \
       pkg-config \
       libavl-dev \
       libev-dev \
index 1ad907b..ab1d797 100755 (executable)
@@ -37,7 +37,6 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_
     sr_val_t *val = NULL;
     char *json_str = NULL;
     struct lyd_node *root = NULL;
-    struct lyd_node *node = NULL;
 
     rc = sr_get_changes_iter(session, "//." , &it);
     if (rc != SR_ERR_OK) {
@@ -49,9 +48,9 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_
         val = oper == SR_OP_CREATED ? new_value : old_value;
         char *leaf = sr_val_to_str(val);
         if (root) {
-            lyd_new_path(root, NULL, val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &node);
+            lyd_new_path(root, NULL, val->xpath, (void *) leaf, 0, 1);
         } else {
-            lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &root);
+            root = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, 0, 1);
         }
 
         sr_free_val(old_value);
@@ -62,7 +61,7 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_
     }
 
     if (root) {
-        lyd_print_mem(&json_str, root, LYD_JSON, LYD_PRINT_WITHSIBLINGS);
+        lyd_print_mem(&json_str, root, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT);
         printf("\n%s\n", json_str);
     }
 
@@ -86,7 +85,7 @@ char * get_data_json(sr_session_ctx_t *session, const char *module_name) {
     }
 
     if (data) {
-        lyd_print_mem(&json_str, data, LYD_JSON, LYD_PRINT_WITHSIBLINGS);
+        lyd_print_mem(&json_str, data, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT);
     }
     return json_str;
 }
@@ -101,11 +100,10 @@ int gnb_status_cb(sr_session_ctx_t *session, const char *module_name, const char
 
 void create_new_path(sr_session_ctx_t *session, char **parent, char *key, char *value) {
     struct lyd_node **p = (struct lyd_node **)parent;
-    struct lyd_node *node;
 
     if (*parent == NULL) {
-        lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node);
+        *p = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0);
     } else {
-        lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node);
+        lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0);
     }
 }