Support mocking reply for more multi requests at once
[govpp.git] / api / api.go
index fe6a34a..98932fa 100644 (file)
@@ -28,11 +28,13 @@ const (
        RequestMessage MessageType = iota
        // ReplyMessage represents a VPP reply message
        ReplyMessage
+       // EventMessage represents a VPP notification event message
+       EventMessage
        // OtherMessage represents other VPP message (e.g. counters)
        OtherMessage
 )
 
-// Message is an interface that is implemented by all VPP Binary API messages generated by the binapi-generator.
+// Message is an interface that is implemented by all VPP Binary API messages generated by the binapigenerator.
 type Message interface {
        // GetMessageName returns the original VPP name of the message, as defined in the VPP API.
        GetMessageName() string
@@ -44,7 +46,7 @@ type Message interface {
        GetCrcString() string
 }
 
-// DataType is an interface that is implemented by all VPP Binary API data types by the binapi-generator.
+// DataType is an interface that is implemented by all VPP Binary API data types by the binapi_generator.
 type DataType interface {
        // GetTypeName returns the original VPP name of the data type, as defined in the VPP API.
        GetTypeName() string
@@ -231,15 +233,15 @@ func (ch *Channel) receiveReplyInternal(msg Message) (LastReplyReceived bool, er
                        return false, err
                }
                if vppReply.MessageID != expMsgID {
-                       err = fmt.Errorf("invalid message ID %d, expected %d "+
-                               "(also check if multiple goroutines are not sharing one GoVPP channel)", vppReply.MessageID, expMsgID)
+                       err = fmt.Errorf("received invalid message ID, expected %d (%s), but got %d (check if multiple goroutines are not sharing single GoVPP channel)",
+                               expMsgID, msg.GetMessageName(), vppReply.MessageID)
                        return false, err
                }
                // decode the message
                err = ch.MsgDecoder.DecodeMsg(vppReply.Data, msg)
 
        case <-time.After(ch.replyTimeout):
-               err = fmt.Errorf("no reply received within the timeout period %ds", ch.replyTimeout/time.Second)
+               err = fmt.Errorf("no reply received within the timeout period %s", ch.replyTimeout)
        }
        return
 }