Rewrite NTS Framework.
[sim/o1-interface.git] / ntsimulator / deploy / base / build_ntsim-ng.sh
diff --git a/ntsimulator/deploy/base/build_ntsim-ng.sh b/ntsimulator/deploy/base/build_ntsim-ng.sh
new file mode 100755 (executable)
index 0000000..dbabaab
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# /*************************************************************************
+# *
+# * Copyright 2020 highstreet technologies GmbH and others
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# ***************************************************************************/
+
+files=(
+    "core/context.c"
+    "core/docker.c"
+    "core/framework.c"
+    "core/test.c"
+    "core/session.c"
+    "core/nc_config.c"
+    "core/app/manager.c"
+    "core/app/manager_operations.c"
+    "core/app/network_function.c"
+    "core/datastore/schema.c"
+    "core/datastore/populate.c"
+    "core/datastore/populate_rec.c"
+    "core/faults/faults.c"
+    "core/faults/faults_counters.c"
+    "core/faults/faults_processing.c"
+    "core/faults/faults_logic.c"
+    "core/faults/faults_ves.c"
+    "utils/log_utils.c"
+    "utils/rand_utils.c"
+    "utils/type_utils.c"
+    "utils/sys_utils.c"
+    "utils/http_client.c"
+    "utils/nts_utils.c"
+    "utils/nc_client.c"
+    "features/ves_pnf_registration/ves_pnf_registration.c"
+    "features/ves_heartbeat/ves_heartbeat.c"
+    "features/ves_file_ready/ves_file_ready.c"
+    "features/netconf_call_home/netconf_call_home.c"
+    "features/manual_notification/manual_notification.c"
+    "main.c"
+)
+
+libs=(
+    "argp"
+    "m"
+    "yang"
+    "sysrepo"
+    "netconf2"
+    "cjson"
+    "curl"
+    "pthread"
+)
+
+sources=""
+for i in ${files[@]}
+do
+    sources="$sources source/$i"
+done
+
+libraries=""
+for i in ${libs[@]}
+do
+    libraries="$libraries -l$i"
+done
+
+output="ntsim-ng"
+
+build="gcc -Wall -pedantic -Isource $sources $libraries -o$output"
+
+echo "Building with command: $build"
+$build
+if [ "$?" -ne "0" ]; then
+  echo "Build failed"
+  exit 1
+fi