VPP Object Model (VOM)

The VOM is a C++ library for use by clients/agents of VPP for programming
state. It uses the binary APIs to do so. Various other common client side
functions are also provided. Please see om.hpp for a more detailed description.

Change-Id: Ib756bfe99817093815a9e26ccf464aa5583fc523
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Co-authored-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/test/ext/Makefile b/test/ext/Makefile
index 1bd035d..5801553 100644
--- a/test/ext/Makefile
+++ b/test/ext/Makefile
@@ -1,38 +1,57 @@
-BINDIR = $(BR)/vapi_test/
-CBIN = $(addprefix $(BINDIR), vapi_c_test)
-CPPBIN = $(addprefix $(BINDIR), vapi_cpp_test)
+VAPI_BINDIR = $(BR)/vapi_test/
+VAPI_CBIN = $(addprefix $(VAPI_BINDIR), vapi_c_test)
+VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), vapi_cpp_test)
+VOM_BINDIR = $(BR)/vom_test/
+VOM_BIN = $(addprefix $(VOM_BINDIR), vom_test)
 
 ifeq ($(filter centos,$(OS_ID)),$(OS_ID))
-CPPBIN=
+VAPI_CPPBIN=
 endif
 
-LIBS = -L$(VPP_TEST_BUILD_DIR)/vpp/.libs/ -L$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
+VAPI_LIBS = -L$(VPP_TEST_BUILD_DIR)/vpp/.libs/ -L$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
 ifneq ($(filter opensuse,$(OS_ID)),$(OS_ID))
-LIBS += -lsubunit
+VAPI_LIBS += -lsubunit
 endif
-CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
-CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
+CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
+CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
 
-all: $(CBIN) $(CPPBIN)
+all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BINDIR) $(VOM_BIN)
 
-$(BINDIR):
-	mkdir -p $(BINDIR)
+$(VAPI_BINDIR):
+	mkdir -p $(VAPI_BINDIR)
 
 CSRC = vapi_c_test.c
 
-$(BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(BINDIR)
-	$(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(BINDIR) $<
+$(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR)
+	$(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $<
 
-$(BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(BINDIR)
-	$(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(BINDIR) $<
+$(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR)
+	$(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $<
 
-$(CBIN): $(CSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(BINDIR)/fake.api.vapi.h
-	$(CC) -o $@ $(CFLAGS) $(CSRC) $(LIBS)
+$(VAPI_CBIN): $(CSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(VAPI_BINDIR)/fake.api.vapi.h
+	$(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
 
 CPPSRC = vapi_cpp_test.cpp
 
-$(CPPBIN): $(CPPSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(BINDIR)/fake.api.vapi.hpp
-	$(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(LIBS)
+$(VAPI_CPPBIN): $(CPPSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(VAPI_BINDIR)/fake.api.vapi.hpp
+	$(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
+
+VOM_CPPSRC = vom_test.cpp
+
+$(VOM_BINDIR):
+	mkdir -p $(VOM_BINDIR)
+
+LIB_VOM = $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vom/.libs/libvom.so
+VOM_LIBS = $(LIB_VOM) 	\
+	-lboost_log					\
+	-lboost_thread					\
+	-lboost_system					\
+	-lboost_filesystem				\
+	-lboost_unit_test_framework			\
+	$(VAPI_LIBS)
+
+$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) $(LIB_VOM) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so
+	$(CXX) -o $@ $(CPPFLAGS) -DBOOST_LOG_DYN_LINK -O0 -g $(VOM_CPPSRC) $(VOM_LIBS)
 
 clean:
-	rm -rf $(BINDIR)
+	rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)