VOL-4245: Migration to BAL3.10.2.2
Change-Id: I8b847660e949c91504ced760b1393e4def2300e8
diff --git a/agent/test/Makefile b/agent/test/Makefile
index 24a4382..26e984a 100644
--- a/agent/test/Makefile
+++ b/agent/test/Makefile
@@ -19,9 +19,9 @@
##
##
TOP_DIR=`pwd`
-OPENOLTDEVICE ?= asfvolt16
+OPENOLTDEVICE ?= sim
-OPENOLT_PROTO_VER ?= v4.2.0
+OPENOLT_PROTO_VER ?= v5.1.0
########################################################################
##
@@ -41,8 +41,14 @@
export CXX CXXFLAGS OPENOLT_PROTO_VER
-BAL_API_VER ?= bal-api-3.4.9.9
-BAL_API_DIR=$(BAL_API_VER)
+BAL_MAJOR_VER = 3
+BAL_MINOR_VER = 10
+BAL_REV_HOST_VER = 2
+BAL_REV_EMBEDDED_VER = 2
+BAL_API_SO_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_HOST_VER)
+BAL_API_VER = $(BAL_API_SO_VER).$(BAL_REV_EMBEDDED_VER)
+
+BAL_API_DIR=bal-oss-api-$(BAL_API_VER)
BALLIBNAME=bcm_host_api_stubs
BALLIBDIR=$(BAL_API_DIR)/stubs
BAL_INC = -I$(BAL_API_DIR)/include \
@@ -93,10 +99,17 @@
if [ -d $(BAL_API_DIR) ]; then \
echo "$(BAL_API_DIR) exists"; \
else \
- git clone https://github.com/balapi/$(BAL_API_VER).git ;\
- sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmos_system_test.h\"" ./$(BAL_API_DIR)/include/bcmos_system.h; \
- sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmos_common_test.h\"" ./$(BAL_API_DIR)/include/bcmos_common.h; \
- sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmolt_api_model_api_structs_test.h\"" ./$(BAL_API_DIR)/include/object_model/bcmolt_api_model_api_structs.h; \
+ mkdir -p $(BAL_API_DIR); \
+ mkdir -p lib; \
+ cd $(BAL_API_DIR); \
+ git clone https://github.com/balapi/bal-sdk.git -b $(BAL_API_VER); \
+ mv bal-sdk bal-sdk-$(BAL_API_VER); \
+ cd bal-sdk-$(BAL_API_VER); \
+ make BOARD=$(OPENOLTDEVICE); \
+ cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../lib/libbal_host_api-oss.so; \
+ cd .. && ln -s bal-sdk-$(BAL_API_VER)/build/fs/include include; \
+ sed -i 's/BUG_ON_PRINT((condition),/printf(/g' include/bcmos_system.h; \
+ cd ..;\
fi
# openoltapi
diff --git a/agent/test/inc/bcmcli_session.h b/agent/test/inc/bcmcli_session.h
index c9de0c3..42f1e83 100644
--- a/agent/test/inc/bcmcli_session.h
+++ b/agent/test/inc/bcmcli_session.h
@@ -20,17 +20,25 @@
typedef int bcmcli_session;
typedef char bcmcli_entry[50];
typedef char bcmcli_cmd_parm;
-struct bcmos_task {
- char task_name[50];
-};
typedef struct bcmcli_session_parm {
void *get_prompt;
int access_right;
} bcmcli_session_parm;
+typedef struct bcmcli_cmd_cb {
+ int dummy;
+} bcmcli_cmd_cb;
+
+typedef struct bcmcli_access_right {
+ int dummy;
+} bcmcli_access_right;
+
+typedef struct bcmcli_cmd_extra_parm {
+ int dummy;
+} bcmcli_cmd_extra_parm;
+
#define BCMCLI_ACCESS_ADMIN 0xff
-#define BUG_ON //
#define BCMCLI_MAKE_CMD_NOPARM(ptr, command1, command2, command3)
#define BAL_API_VERSION 3
diff --git a/agent/test/inc/bcmolt_conn_mgr.h b/agent/test/inc/bcmolt_conn_mgr.h
index 9b94fab..9fdfcb7 100644
--- a/agent/test/inc/bcmolt_conn_mgr.h
+++ b/agent/test/inc/bcmolt_conn_mgr.h
@@ -22,9 +22,5 @@
typedef int bcmolt_goid;
-typedef struct bcmos_fastlock {
- pthread_mutex_t lock;
-} bcmos_fastlock;
-
}
#endif
diff --git a/agent/test/inc/test_stub.h b/agent/test/inc/test_stub.h
index 9dc5814..5ad0df3 100644
--- a/agent/test/inc/test_stub.h
+++ b/agent/test/inc/test_stub.h
@@ -31,10 +31,6 @@
void bcmos_usleep(uint32_t us);
-void* bcmos_calloc(uint32_t size);
-void bcmos_fastlock_init(bcmos_fastlock *lock, uint32_t flags);
-long bcmos_fastlock_lock(bcmos_fastlock *lock);
-void bcmos_fastlock_unlock(bcmos_fastlock *lock, long flags);
#endif //__TEST_STUB_H__
diff --git a/agent/test/src/bal_stub.cc b/agent/test/src/bal_stub.cc
index 62eb931..73e9c5c 100644
--- a/agent/test/src/bal_stub.cc
+++ b/agent/test/src/bal_stub.cc
@@ -36,32 +36,12 @@
usleep (10000);
}
-void* bcmos_calloc(uint32_t size) {
- void *ptr = malloc(size);
- if (ptr) {
- memset(ptr, 0, size);
- }
- return ptr;
-}
-
void bcmos_free(void *ptr) {
if (ptr) {
free(ptr);
}
}
-void bcmos_fastlock_init(bcmos_fastlock *lock, uint32_t flags) {
- pthread_mutex_init(&(lock->lock), NULL);
-}
-
-long bcmos_fastlock_lock(bcmos_fastlock *lock) {
- pthread_mutex_lock(&(lock->lock));
-}
-
-void bcmos_fastlock_unlock(bcmos_fastlock *lock, long flags) {
- pthread_mutex_unlock(&(lock->lock));
-}
-
/* Initialize API layer */
bcmos_errno bcmolt_api_init(void)
{
@@ -323,4 +303,45 @@
printf ("-- stub bcmolt_api_conn_mgr_is_connected called --\n");
return true;
}
+
+bcmos_errno bcmos_mutex_create(bcmos_mutex *mutex, uint32_t flags, const char *name)
+{
+ pthread_mutexattr_t attr;
+ if (pthread_mutexattr_init(&attr) != 0) {
+ printf("pthread_mutex_attr_init() error");
+ exit(1);
+ }
+ pthread_mutex_init(&mutex->m, &attr);
+ return BCM_ERR_OK;
+}
+
+/* Destroy mutex */
+void bcmos_mutex_destroy(bcmos_mutex *mutex)
+{
+ pthread_mutex_destroy(&mutex->m);
+}
+
+/* Lock mutex */
+void bcmos_mutex_lock(bcmos_mutex *mutex)
+{
+ pthread_mutex_lock(&mutex->m);
+}
+
+/* Release mutex */
+void bcmos_mutex_unlock(bcmos_mutex *mutex)
+{
+ pthread_mutex_unlock(&mutex->m);
+}
+
+void *bcmos_alloc(uint32_t size)
+{
+ return malloc(size);
+}
+
+bcmos_errno bcmcli_cmd_add(bcmcli_entry *dir, const char *name, bcmcli_cmd_cb cmd_cb,
+ const char *help, bcmcli_access_right access_right,
+ const bcmcli_cmd_extra_parm *extras, bcmcli_cmd_parm parms[]) {
+ return BCM_ERR_OK;
+}
+
}