Bugfix for VES O1 pnfRegistration - both IPv4 and IPv6 were being used.
[sim/o1-interface.git] / ntsimulator / ntsim-ng / features / ves_o1_pnf_registration / ves_o1_pnf_registration.c
index 077a3c4..70d3085 100644 (file)
@@ -374,19 +374,22 @@ static cJSON* ves_create_o1_pnf_registration_fields(const char *nf_ip_v4_address
         return 0;
     }
 
-    if (nf_ip_v4_address != 0 && strlen(nf_ip_v4_address) > 0) {
-        if(cJSON_AddStringToObject(data, "oam-host", nf_ip_v4_address) == 0) {
-            log_error("cJSON_AddItemToObject failed\n");
-            cJSON_Delete(stnd_defined_fields);
-            return 0;
+    if (!framework_environment.settings.ip_v6_enabled) {
+        if (nf_ip_v4_address != 0 && strlen(nf_ip_v4_address) > 0) {
+            if(cJSON_AddStringToObject(data, "oam-host", nf_ip_v4_address) == 0) {
+                log_error("cJSON_AddItemToObject failed\n");
+                cJSON_Delete(stnd_defined_fields);
+                return 0;
+            }
         }
     }
-
-    if (nf_ip_v6_address != 0 && strlen(nf_ip_v6_address) > 0) {
-        if(cJSON_AddStringToObject(data, "oam-host", nf_ip_v6_address) == 0) {
-            log_error("cJSON_AddItemToObject failed\n");
-            cJSON_Delete(stnd_defined_fields);
-            return 0;
+    else {
+        if (nf_ip_v6_address != 0 && strlen(nf_ip_v6_address) > 0) {
+            if(cJSON_AddStringToObject(data, "oam-host", nf_ip_v6_address) == 0) {
+                log_error("cJSON_AddItemToObject failed\n");
+                cJSON_Delete(stnd_defined_fields);
+                return 0;
+            }
         }
     }