aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi Raju <ravir@employees.org>2019-09-09 18:23:56 -0700
committerRavi Raju <toravir@yahoo.com>2019-09-09 18:31:53 -0700
commit48198748bdfcc7d30c794cdac19de822da53f840 (patch)
treeea4d6f9a9127e40f69567c34cb3df6d51e6dda37
parentccb7b913d54fafdf08b36ac7eb36e462b1ecc9eb (diff)
add MockClearReplyHandlers() api for mock vpp adapter
Change-Id: I12285c77c9cf09a24c957a777b26ae54f082f317 Signed-off-by: Ravi Raju <ravir@employees.org>
-rw-r--r--adapter/mock/mock_vpp_adapter.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/adapter/mock/mock_vpp_adapter.go b/adapter/mock/mock_vpp_adapter.go
index 9dca2ba..c05148d 100644
--- a/adapter/mock/mock_vpp_adapter.go
+++ b/adapter/mock/mock_vpp_adapter.go
@@ -372,6 +372,16 @@ func (a *VppAdapter) MockReplyHandler(replyHandler ReplyHandler) {
a.mode = useReplyHandlers
}
+// MockClearReplyHanders clears all reply handlers that were registered
+// Will also set the mode to useReplyHandlers
+func (a *VppAdapter) MockClearReplyHandlers () {
+ a.repliesLock.Lock()
+ defer a.repliesLock.Unlock()
+
+ a.replyHandlers = a.replyHandlers[:0]
+ a.mode = useReplyHandlers
+}
+
func setSeqNum(context uint32, seqNum uint16) (newContext uint32) {
context &= 0xffff0000
context |= uint32(seqNum)