aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple-client/simple_client.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-10-23 11:40:18 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-10-30 10:00:00 +0000
commit0f46871b4cc45f2c3bd5bdb0aa0f7615795a2c6d (patch)
tree3d3de8febc3e2becfbbbd648538fc5dd1748374f /examples/simple-client/simple_client.go
parentcb540dc166c12180adba024d5b8fd463d2582928 (diff)
Fix encoding for float64 and generate conversion for Timestamp
- fixes encoding/decoding of float64 - uses little endian (contrary to all other types) - generates helper methods for vpe_types.Timestamp type - adds usage code to simple-client and binapi-types examples Change-Id: I2e83eee0629eb67964049406c50c7ee0a692ccaf Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'examples/simple-client/simple_client.go')
-rw-r--r--examples/simple-client/simple_client.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go
index 0898c0a..10a0ea6 100644
--- a/examples/simple-client/simple_client.go
+++ b/examples/simple-client/simple_client.go
@@ -84,6 +84,7 @@ func main() {
// use request/reply (channel API)
getVppVersion(ch)
+ getSystemTime(ch)
idx := createLoopback(ch)
interfaceDump(ch)
addIPAddress(ch, idx)
@@ -107,6 +108,22 @@ func getVppVersion(ch api.Channel) {
fmt.Println()
}
+func getSystemTime(ch api.Channel) {
+ fmt.Println("Retrieving system time..")
+
+ req := &vpe.ShowVpeSystemTime{}
+ reply := &vpe.ShowVpeSystemTimeReply{}
+
+ if err := ch.SendRequest(req).ReceiveReply(reply); err != nil {
+ logError(err, "retrieving system time")
+ return
+ }
+
+ fmt.Printf("system time: %v\n", reply.VpeSystemTime)
+ fmt.Println("OK")
+ fmt.Println()
+}
+
func createLoopback(ch api.Channel) interface_types.InterfaceIndex {
fmt.Println("Creating loopback interface..")