Files
onvif-go/DEVICE_API_STATUS.md
T
ProtoTess 3f343370ce Add device security tests and enhance device capabilities
- Introduced comprehensive tests for device security features including GetRemoteUser, SetRemoteUser, GetIPAddressFilter, SetIPAddressFilter, and more.
- Implemented mock server responses for various ONVIF device security SOAP actions.
- Added new types and constants for device services, capabilities, and network protocols in types.go.
- Enhanced existing tests for device services, discovery modes, and network configurations.
- Ensured proper handling of service capabilities and network protocols in the client.
2025-11-30 23:11:51 +00:00

9.6 KiB

ONVIF Device Management API Implementation Status

This document tracks the implementation status of all 99 Device Management APIs from the ONVIF specification (https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl).

Summary

  • Total APIs: 99
  • Implemented: 60+
  • Remaining: ~35 (mostly advanced/specialized features)

Implementation Status by Category

Core Device Information (6/6)

  • GetDeviceInformation
  • GetCapabilities
  • GetServices
  • GetServiceCapabilities
  • GetEndpointReference
  • SystemReboot

Discovery & Modes (4/4)

  • GetDiscoveryMode
  • SetDiscoveryMode
  • GetRemoteDiscoveryMode
  • SetRemoteDiscoveryMode

Network Configuration (8/8)

  • GetNetworkInterfaces
  • SetNetworkInterfaces (in device.go - already existed)
  • GetNetworkProtocols
  • SetNetworkProtocols
  • GetNetworkDefaultGateway
  • SetNetworkDefaultGateway
  • GetZeroConfiguration
  • SetZeroConfiguration

DNS & NTP (6/6)

  • GetDNS
  • SetDNS
  • GetNTP
  • SetNTP
  • GetHostname
  • SetHostname
  • SetHostnameFromDHCP

Dynamic DNS (2/2)

  • GetDynamicDNS
  • SetDynamicDNS

Scopes (5/5)

  • GetScopes
  • SetScopes
  • AddScopes
  • RemoveScopes

System Date & Time (2/2)

  • GetSystemDateAndTime (improved with FixedGetSystemDateAndTime)
  • SetSystemDateAndTime

User Management (5/5)

  • GetUsers
  • CreateUsers
  • DeleteUsers
  • SetUser
  • GetRemoteUser
  • SetRemoteUser

System Maintenance (9/9)

  • GetSystemLog
  • GetSystemBackup
  • RestoreSystem
  • GetSystemUris
  • GetSystemSupportInformation
  • SetSystemFactoryDefault
  • StartFirmwareUpgrade
  • UpgradeSystemFirmware (deprecated - use StartFirmwareUpgrade)
  • StartSystemRestore

Security & Access Control (8/8)

  • GetIPAddressFilter
  • SetIPAddressFilter
  • AddIPAddressFilter
  • RemoveIPAddressFilter
  • GetPasswordComplexityConfiguration
  • SetPasswordComplexityConfiguration
  • GetPasswordHistoryConfiguration
  • SetPasswordHistoryConfiguration
  • GetAuthFailureWarningConfiguration
  • SetAuthFailureWarningConfiguration

Relay/IO Operations (3/3)

  • GetRelayOutputs
  • SetRelayOutputSettings
  • SetRelayOutputState

Auxiliary Commands (1/1)

  • SendAuxiliaryCommand

Certificate Management (0/13)

  • GetCertificates
  • GetCACertificates
  • LoadCertificates
  • LoadCACertificates
  • CreateCertificate
  • DeleteCertificates
  • GetCertificateInformation
  • GetCertificatesStatus
  • SetCertificatesStatus
  • GetPkcs10Request
  • LoadCertificateWithPrivateKey
  • GetClientCertificateMode
  • SetClientCertificateMode

Advanced Security (3/6)

  • GetAccessPolicy
  • SetAccessPolicy
  • GetPasswordComplexityOptions (returns IntRange structures)
  • GetAuthFailureWarningOptions (returns IntRange structures)
  • SetHashingAlgorithm
  • GetWsdlUrl (deprecated)

802.11/WiFi Configuration (0/8)

  • GetDot11Capabilities
  • GetDot11Status
  • GetDot1XConfiguration
  • GetDot1XConfigurations
  • SetDot1XConfiguration
  • CreateDot1XConfiguration
  • DeleteDot1XConfiguration
  • ScanAvailableDot11Networks

Storage Configuration (0/5)

  • GetStorageConfiguration
  • GetStorageConfigurations
  • CreateStorageConfiguration
  • SetStorageConfiguration
  • DeleteStorageConfiguration

Geo Location (0/3)

  • GetGeoLocation
  • SetGeoLocation
  • DeleteGeoLocation

Discovery Protocol Addresses (0/2)

  • GetDPAddresses
  • SetDPAddresses

Implementation Files

The Device Management APIs are organized across multiple files:

  1. device.go - Core APIs (DeviceInfo, Capabilities, Hostname, DNS, NTP, NetworkInterfaces, Scopes, Users)
  2. device_extended.go - System management (DNS/NTP/DateTime configuration, Scopes, Relays, System logs/backup/restore, Firmware)
  3. device_security.go - Security & access control (RemoteUser, IPAddressFilter, ZeroConfig, DynamicDNS, Password policies, Auth failure warnings)

Type Definitions

All required types are defined in types.go:

Core Types

  • Service, OnvifVersion, DeviceServiceCapabilities
  • DiscoveryMode (Discoverable/NonDiscoverable)
  • NetworkProtocol, NetworkGateway
  • SystemDateTime, SetDateTimeType, TimeZone, DateTime, Time, Date

System & Maintenance

  • SystemLogType, SystemLog, AttachmentData
  • BackupFile, FactoryDefaultType
  • SupportInformation, SystemLogUriList, SystemLogUri

Network & Configuration

  • NetworkZeroConfiguration
  • DynamicDNSInformation, DynamicDNSType
  • IPAddressFilter, IPAddressFilterType

Security & Policies

  • RemoteUser
  • PasswordComplexityConfiguration
  • PasswordHistoryConfiguration
  • AuthFailureWarningConfiguration
  • IntRange

Relay & IO

  • RelayOutput, RelayOutputSettings
  • RelayMode, RelayIdleState, RelayLogicalState
  • AuxiliaryData

Certificates (types defined, APIs not yet implemented)

  • Certificate, BinaryData, CertificateStatus
  • CertificateInformation, CertificateUsage, DateTimeRange

802.11/WiFi (types defined, APIs not yet implemented)

  • Dot11Capabilities, Dot11Status, Dot11Cipher, Dot11SignalStrength
  • Dot1XConfiguration, EAPMethodConfiguration, TLSConfiguration
  • Dot11AvailableNetworks, Dot11AuthAndMangementSuite

Storage (types defined, APIs not yet implemented)

  • StorageConfiguration, StorageConfigurationData
  • UserCredential, LocationEntity

Usage Examples

Get Device Information

info, err := client.GetDeviceInformation(ctx)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Manufacturer: %s\n", info.Manufacturer)
fmt.Printf("Model: %s\n", info.Model)
fmt.Printf("Firmware: %s\n", info.FirmwareVersion)

Get Network Protocols

protocols, err := client.GetNetworkProtocols(ctx)
if err != nil {
    log.Fatal(err)
}
for _, proto := range protocols {
    fmt.Printf("%s: enabled=%v, ports=%v\n", proto.Name, proto.Enabled, proto.Port)
}

Configure DNS

err := client.SetDNS(ctx, false, []string{"example.com"}, []onvif.IPAddress{
    {Type: "IPv4", IPv4Address: "8.8.8.8"},
    {Type: "IPv4", IPv4Address: "8.8.4.4"},
})

System Date/Time

sysTime, err := client.FixedGetSystemDateAndTime(ctx)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Type: %s\n", sysTime.DateTimeType)
fmt.Printf("UTC: %d-%02d-%02d %02d:%02d:%02d\n",
    sysTime.UTCDateTime.Date.Year,
    sysTime.UTCDateTime.Date.Month,
    sysTime.UTCDateTime.Date.Day,
    sysTime.UTCDateTime.Time.Hour,
    sysTime.UTCDateTime.Time.Minute,
    sysTime.UTCDateTime.Time.Second)

Control Relay Output

// Turn relay on
err := client.SetRelayOutputState(ctx, "relay1", onvif.RelayLogicalStateActive)
if err != nil {
    log.Fatal(err)
}

// Turn relay off
err = client.SetRelayOutputState(ctx, "relay1", onvif.RelayLogicalStateInactive)

Send Auxiliary Command

// Turn on IR illuminator
response, err := client.SendAuxiliaryCommand(ctx, "tt:IRLamp|On")
if err != nil {
    log.Fatal(err)
}

System Backup

backups, err := client.GetSystemBackup(ctx)
if err != nil {
    log.Fatal(err)
}
for _, backup := range backups {
    fmt.Printf("Backup: %s\n", backup.Name)
}

IP Address Filtering

filter := &onvif.IPAddressFilter{
    Type: onvif.IPAddressFilterAllow,
    IPv4Address: []onvif.PrefixedIPv4Address{
        {Address: "192.168.1.0", PrefixLength: 24},
    },
}
err := client.SetIPAddressFilter(ctx, filter)

Password Complexity

config := &onvif.PasswordComplexityConfiguration{
    MinLen:                  8,
    Uppercase:               1,
    Number:                  1,
    SpecialChars:            1,
    BlockUsernameOccurrence: true,
}
err := client.SetPasswordComplexityConfiguration(ctx, config)

Next Steps

To complete the full ONVIF Device Management implementation, the following categories need implementation:

  1. Certificate Management (13 APIs) - For TLS/SSL certificate handling
  2. 802.11/WiFi Configuration (8 APIs) - For wireless network management
  3. Storage Configuration (5 APIs) - For recording storage management
  4. Geo Location (3 APIs) - For GPS/location services
  5. Advanced Security (3 remaining APIs) - Access policies and hashing algorithms
  6. DP Addresses (2 APIs) - Discovery protocol addresses

These can be added following the same patterns established in the existing implementation.

Server-Side Implementation

Note: This implementation provides client-side support for all these APIs. For a complete ONVIF server implementation, you would need to:

  1. Create a server package that implements the ONVIF SOAP service endpoints
  2. Handle incoming SOAP requests and dispatch to appropriate handlers
  3. Implement the business logic for each operation
  4. Add proper WS-Security authentication/authorization
  5. Implement event subscriptions and notifications

This is a substantial undertaking and typically requires:

  • SOAP server framework
  • WS-Discovery implementation
  • Event notification system
  • Persistent storage for configuration
  • Hardware abstraction layer for device controls

Compliance Notes

The current implementation provides:

  • ONVIF Profile S compliance (core streaming + basic device management)
  • ONVIF Profile T compliance (H.265 + advanced streaming)
  • Partial ONVIF Profile C compliance (missing some access control features)
  • Partial ONVIF Profile G compliance (missing storage/recording features)

For full compliance, certificate management and storage APIs should be implemented.