Skip to content

A GO package and cli to access the ifm ovp8xx series of devices

License

Notifications You must be signed in to change notification settings

graugans/go-ovp8xx

Repository files navigation

Go client for the ifm OVP8xx series of devices

⚠️ This is my personal project it is not an official ifm product. Please use the official ifm3d project if you need an officially supported version ⚠️

Introduction

A GO module and cli to access the ifm OVP8xx series of devices.

GitHub go.mod Go version of a Go module Go Reference License example workflow codecov

Project status

This project is still a work in progress and will suffer from breaking API changes. Please be warned. In case you have any suggestions or want to contribute please feel free to open an issue or pull request.

CLI

One of the benefits of the Go language is the easy way of producing statically linked binaries to be used on all major platforms. One of the ovp8xx core features is the CLI interface. The design tries to stay as close as possible to the XML-RPC API.

With the CLI you can get the configuration from the device and filter it as you need. After transforming the config it can be written back to the device.

CLI Installation

Pre Build Binaries

The recommended and easiest way is to download the pre-build binary from the GitHub Release page.

⚠️ The Windows binary maybe flagged by a Virus Scanner, please also read the note from the Go Team ⚠️

Go get

If you have a decent Go version installed

go install github.com/graugans/go-ovp8xx/v2/cmd/ovp8xx@latest

API usage

Within in your Go project get the ovp8xx package first

go get github.com/graugans/go-ovp8xx/v2

The following example will query the software Version of your OVP8xx. This assumes that either the OVP8xx is using the default IP address of 192.168.0.69 or the environment variable OVP8XX_IP is set. In case you want to set the IP in code please use ovp8xx.NewClient(ovp8xx.WithHost("192.168.0.69")) to construct the client.

package main

import (
	"fmt"

	"github.com/graugans/go-ovp8xx/v2/pkg/ovp8xx"
)

func main() {
	o3r := ovp8xx.NewClient()
	config, err := o3r.Get([]string{"/device/swVersion"})
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(config)
}

The result depends on your specific device:

{
  "device": {
    "swVersion": {
      "euphrates": "1.32.1+8.e72bf7bb5",
      "firmware": "1.1.2-1335",
      "kernel": "4.9.140-l4t-r32.4+g8c7b68130d9a",
      "l4t": "r32.4.3",
      "schema": "v1.5.3",
      "tcu": "1.1.0"
    }
  }
}

Testing

Please ensure you have the Git Large File Storage extension installed. Some of the tests require blobs which are handled as Large File Storage files. In case the files are not populated as expected this may help:

git lfs fetch --all
git lfs pull