Skip to content

Latest commit

 

History

History
106 lines (77 loc) · 3.91 KB

README.md

File metadata and controls

106 lines (77 loc) · 3.91 KB

Siemens Industrial Edge Edgeshark

IED App Engine Data Access

PkgGoDev GitHub build and test file descriptors Go Report Card Coverage

ieddata is part of the "Edgeshark" project that consist of several repositories:

Installation

go get github.com/siemens/ieddata@latest

Note: ieddata supports versions of Go 1 that are noted by the Go release policy, that is, major versions N and N-1 (where N is the current major version).

Usage

This example queries a Siemens Industrial Edge (virtual) device's...

  • ...device name and its owner,
  • ...and the list of installed applications.

Error handling has been left out for brevity.

db, _ := ieddata.Open("platformbox.db")
defer db.Close()

di, _ := db.DeviceInfo()
fmt.Printf("device name: %s\nowner name: %s\n", di["deviceName"], di["ownerName"])

apps, _ := db.Apps()
slices.SortFunc(apps, func(a, b ieddata.App) bool { return a.Title < b.Title })
for _, app := range apps {
   fmt.Printf("app: %q %s\n", app.Title, app.Id)
}

Nota bene: the IED's platformbox.db is opened always in read-only mode. Thus, the underlying database connection on purpose does not allow callers to modify the IED's databases using this module.

View Package Documentation Locally

make pkgsite

Then navigate to http://localhost:6060/github.com/siemens/ieddata.

Deployment

Please note that an application using this Go module needs to have capability CAP_SYS_PTRACE requested in its composer file, as well as your binary needs to be executed with CAP_SYS_PTRACE also effective, not just permitted. If you run your binary under a non-UID0 user, then you need to assign file capabilities to your binary (see also setcap(8)).

Additionally, you need to deploy any container that leverages this Go module with pid:host in order to access the file system view (mount namespaces) of other containers.

Unit Tests

This Go module comes with unit tests and some of these unit tests need to be run as root (UID 0). The unit tests additionally require an operational Docker container engine to be up and running (for simulating a fake IED edge core runtime container). To run the tests, simply do:

make test

The unit tests also include checks for file descriptor leaks.

Contributing

Please see CONTRIBUTING.md.

License and Copyright

(c) Siemens AG 2023

SPDX-License-Identifier: MIT