This commit is contained in:
ProtoTess
2026-01-16 04:58:24 +00:00
parent 19db372cdc
commit 9cf30e2c41
541 changed files with 1880 additions and 185062 deletions
+158
View File
@@ -0,0 +1,158 @@
# Test Data for ONVIF Camera Testing
This directory contains discovered camera data for testing the onvif-go library.
## Files
### discovered_cameras_20260113.json
JSON file containing structured data for all 8 cameras discovered on the network:
- Complete endpoint information
- XAddrs (service URLs)
- Manufacturer and model details
- Supported ONVIF profiles
- Network configuration (IP, port)
- HTTPS support status
### test_cameras_config.go
Go package providing programmatic access to test camera data:
- `TestCameras` slice with all discovered cameras
- `GetCameraByManufacturer()` - filter by manufacturer
- `GetCameraByProfile()` - filter by ONVIF profile support
- `GetHTTPSCameras()` - get cameras with HTTPS support
## Discovery Summary (2026-01-13)
**Total Cameras Found:** 8
### By Manufacturer:
- **AXIS:** 3 cameras (P3818-PVE, Q3819-PVE, P5655-E)
- **Bosch:** 3 cameras (AUTODOME IP starlight 5000i, FLEXIDOME IP starlight 8000i, FLEXIDOME panoramic 5100i)
- **Reolink:** 2 cameras (E1Zoom, ReolinkTrackMixWiFi)
### By ONVIF Profile Support:
- **Profile Streaming:** 8/8 (100%)
- **Profile T (Streaming):** 8/8 (100%)
- **Profile G (Recording):** 6/8 (75%)
- **Profile M (Metadata):** 4/8 (50%)
### Network Configuration:
- Network: 192.168.2.0/24
- HTTPS Support: 6/8 cameras
- Port 80: 6 cameras
- Port 8000: 2 cameras (Reolink)
## Usage in Tests
### Example 1: Using JSON Data
```go
import (
"encoding/json"
"os"
)
type CameraData struct {
Cameras []struct {
IP string `json:"ip"`
XAddrs []string `json:"xaddrs"`
Manufacturer string `json:"manufacturer"`
Model string `json:"model"`
} `json:"cameras"`
}
func loadTestCameras() (*CameraData, error) {
data, err := os.ReadFile("testdata/discovered_cameras_20260113.json")
if err != nil {
return nil, err
}
var cameras CameraData
err = json.Unmarshal(data, &cameras)
return &cameras, err
}
```
### Example 2: Using Go Package
```go
import "github.com/yourusername/onvif-go/testdata"
func TestWithAxisCameras(t *testing.T) {
axisCameras := testdata.GetCameraByManufacturer("AXIS")
for _, cam := range axisCameras {
t.Logf("Testing with %s %s at %s", cam.Manufacturer, cam.Model, cam.IP)
// Run your tests...
}
}
func TestProfileM(t *testing.T) {
metadataCameras := testdata.GetCameraByProfile("M")
if len(metadataCameras) == 0 {
t.Skip("No cameras with Profile M support")
}
// Test metadata operations...
}
func TestHTTPS(t *testing.T) {
httpsCameras := testdata.GetHTTPSCameras()
for _, cam := range httpsCameras {
// Test HTTPS connections...
}
}
```
## Camera Details
### High-End Cameras (Profile G + M)
- AXIS P3818-PVE (192.168.2.82)
- AXIS Q3819-PVE (192.168.2.190) - Dual network interfaces
- AXIS P5655-E (192.168.2.30)
- Bosch FLEXIDOME panoramic 5100i (192.168.2.24)
### Mid-Range Cameras (Profile G)
- Bosch AUTODOME IP starlight 5000i (192.168.2.57)
- Bosch FLEXIDOME IP starlight 8000i (192.168.2.200)
### Basic Cameras (Profile T only)
- Reolink E1Zoom (192.168.2.61:8000)
- Reolink ReolinkTrackMixWiFi (192.168.2.236:8000)
## Notes
1. **Credentials Required:** These endpoints require authentication. Set test credentials using environment variables:
```bash
export ONVIF_TEST_USERNAME="your_username"
export ONVIF_TEST_PASSWORD="your_password"
```
2. **Network Access:** Tests require access to the 192.168.2.0/24 network.
3. **Camera Availability:** Ensure cameras are powered on and network-accessible before running tests.
4. **HTTPS Certificates:** AXIS and Bosch cameras use self-signed certificates. Tests may need to skip certificate verification:
```go
client.HTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
```
5. **Rate Limiting:** Some cameras may rate-limit requests. Add delays between test runs if needed.
## Updating Test Data
To refresh the discovered camera data:
```bash
# Run discovery and save output
./bin/discover 2>&1 | tee camera-discovery-$(date +%Y%m%d-%H%M%S).log
# Discovery will run for ~10 seconds
# Press Ctrl+C to stop when cameras are found
# Update JSON and Go files with new data as needed
```
## See Also
- [Main Testing Documentation](../docs/testing/)
- [Camera Test Reports](../CAMERA_TEST_REPORT.md)
- [Quick Start Guide](../docs/QUICKSTART.md)
+32 -6
View File
@@ -1,20 +1,42 @@
//go:build real_camera
package onvif
import (
"context"
"os"
"testing"
"time"
"github.com/0x524a/onvif-go"
)
// getTestCredentials returns ONVIF credentials from environment variables.
// Required environment variables:
// - ONVIF_ENDPOINT: Camera endpoint URL (e.g., http://192.168.1.201/onvif/device_service)
// - ONVIF_USERNAME: ONVIF username
// - ONVIF_PASSWORD: ONVIF password
func getTestCredentials(t *testing.T) (endpoint, username, password string) {
endpoint = os.Getenv("ONVIF_ENDPOINT")
username = os.Getenv("ONVIF_USERNAME")
password = os.Getenv("ONVIF_PASSWORD")
if endpoint == "" || username == "" || password == "" {
t.Skip("ONVIF credentials not configured. Set ONVIF_ENDPOINT, ONVIF_USERNAME, and ONVIF_PASSWORD environment variables.")
}
return endpoint, username, password
}
// TestEnhancedDeviceFeatures tests new Device service methods with real camera data
// Based on test results from Bosch FLEXIDOME indoor 5100i IR (8.71.0066)
func TestEnhancedDeviceFeatures(t *testing.T) {
endpoint, username, password := getTestCredentials(t)
// Create client with test credentials
client, err := onvif.NewClient(
"http://192.168.1.201/onvif/device_service",
onvif.WithCredentials("service", "Service.1234"),
endpoint,
onvif.WithCredentials(username, password),
onvif.WithTimeout(30*time.Second),
)
if err != nil {
@@ -191,9 +213,11 @@ func TestEnhancedDeviceFeatures(t *testing.T) {
// TestEnhancedMediaFeatures tests new Media service methods
func TestEnhancedMediaFeatures(t *testing.T) {
endpoint, username, password := getTestCredentials(t)
client, err := onvif.NewClient(
"http://192.168.1.201/onvif/device_service",
onvif.WithCredentials("service", "Service.1234"),
endpoint,
onvif.WithCredentials(username, password),
onvif.WithTimeout(30*time.Second),
)
if err != nil {
@@ -283,9 +307,11 @@ func TestEnhancedMediaFeatures(t *testing.T) {
// TestEnhancedImagingFeatures tests new Imaging service methods
func TestEnhancedImagingFeatures(t *testing.T) {
endpoint, username, password := getTestCredentials(t)
client, err := onvif.NewClient(
"http://192.168.1.201/onvif/device_service",
onvif.WithCredentials("service", "Service.1234"),
endpoint,
onvif.WithCredentials(username, password),
onvif.WithTimeout(30*time.Second),
)
if err != nil {
+141
View File
@@ -0,0 +1,141 @@
{
"discovery_date": "2026-01-13T13:22:10",
"total_cameras": 8,
"cameras": [
{
"id": 1,
"endpoint": "urn:uuid:15020314-0204-0408-1500-ec71db465af7",
"xaddrs": [
"http://192.168.2.61:8000/onvif/device_service"
],
"manufacturer": "Reolink",
"model": "E1Zoom",
"ip": "192.168.2.61",
"port": 8000,
"profiles": ["Streaming", "T"],
"location": "china"
},
{
"id": 2,
"endpoint": "urn:uuid:00075fe0-a604-04a6-e05f-0700075fe05f",
"xaddrs": [
"http://192.168.2.57/onvif/device_service",
"https://192.168.2.57/onvif/device_service"
],
"manufacturer": "Bosch",
"model": "AUTODOME_IP_starlight_5000i",
"ip": "192.168.2.57",
"port": 80,
"profiles": ["Streaming", "G", "T"],
"location": "",
"supports_https": true
},
{
"id": 3,
"endpoint": "urn:uuid:555a3d17-6698-43d9-9a52-2a199ff14dec",
"xaddrs": [
"http://192.168.2.82/onvif/device_service"
],
"manufacturer": "AXIS",
"model": "P3818-PVE",
"ip": "192.168.2.82",
"port": 80,
"profiles": ["Streaming", "G", "M", "T"],
"location": ""
},
{
"id": 4,
"endpoint": "urn:uuid:12060714-0005-0000-0302-ec71dbe838cc",
"xaddrs": [
"http://192.168.2.236:8000/onvif/device_service"
],
"manufacturer": "Reolink",
"model": "ReolinkTrackMixWiFi",
"ip": "192.168.2.236",
"port": 8000,
"profiles": ["Streaming", "T"],
"location": "china"
},
{
"id": 5,
"endpoint": "urn:uuid:00075fca-f8fa-faf8-ca5f-0700075fca5f",
"xaddrs": [
"http://192.168.2.200/onvif/device_service",
"https://192.168.2.200/onvif/device_service"
],
"manufacturer": "Bosch",
"model": "FLEXIDOME_IP_starlight_8000i",
"ip": "192.168.2.200",
"port": 80,
"profiles": ["Streaming", "G", "T"],
"location": "",
"supports_https": true
},
{
"id": 6,
"endpoint": "urn:uuid:00075fd5-9fbe-be9f-d55f-0700075fd55f",
"xaddrs": [
"http://192.168.2.24/onvif/device_service",
"https://192.168.2.24/onvif/device_service"
],
"manufacturer": "Bosch",
"model": "FLEXIDOME_panoramic_5100i",
"ip": "192.168.2.24",
"port": 80,
"profiles": ["Streaming", "G", "T", "M"],
"location": "",
"supports_https": true
},
{
"id": 7,
"endpoint": "urn:uuid:cbc93166-2a81-4635-9fe3-dcd5e99528d3",
"xaddrs": [
"http://192.168.2.190/onvif/device_service",
"https://192.168.2.190/onvif/device_service",
"http://169.254.34.187/onvif/device_service",
"https://169.254.34.187/onvif/device_service"
],
"manufacturer": "AXIS",
"model": "Q3819-PVE",
"ip": "192.168.2.190",
"port": 80,
"profiles": ["Streaming", "G", "M", "T"],
"location": "",
"supports_https": true,
"additional_ips": ["169.254.34.187"]
},
{
"id": 8,
"endpoint": "urn:uuid:9e8de0a1-c818-448d-90eb-85670b2b9872",
"xaddrs": [
"http://192.168.2.30/onvif/device_service",
"https://192.168.2.30/onvif/device_service"
],
"manufacturer": "AXIS",
"model": "P5655-E",
"ip": "192.168.2.30",
"port": 80,
"profiles": ["Streaming", "G", "M", "T"],
"location": "",
"supports_https": true
}
],
"manufacturers": {
"Reolink": 2,
"Bosch": 3,
"AXIS": 3
},
"profile_support": {
"Streaming": 8,
"T": 8,
"G": 6,
"M": 4
},
"notes": [
"All cameras discovered on 192.168.2.0/24 network",
"3 Bosch cameras support HTTPS",
"3 AXIS cameras support HTTPS and Profile M (metadata)",
"2 Reolink cameras are basic (Profile T only)",
"Camera 7 (AXIS Q3819-PVE) has dual network interfaces"
]
}
+110
View File
@@ -0,0 +1,110 @@
Discovering ONVIF cameras on the network...
Found 8 camera(s):
Camera 1:
Endpoint: urn:uuid:15020314-0204-0408-1500-ec71db465af7
XAddr: http://192.168.2.61:8000/onvif/device_service
Scopes:
- onvif://www.onvif.org/type/video_encoder
- onvif://www.onvif.org/location/country/china
- onvif://www.onvif.org/type/network_video_transmitter
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/name/IPC-BO
- onvif://www.onvif.org/hardware/E1Zoom
- onvif://www.onvif.org/name/IPC
Camera 2:
Endpoint: urn:uuid:00075fe0-a604-04a6-e05f-0700075fe05f
XAddr: http://192.168.2.57/onvif/device_service
XAddr: https://192.168.2.57/onvif/device_service
Scopes:
- onvif://www.onvif.org/type/Network_Video_Transmitter
- onvif://www.onvif.org/name/Bosch
- onvif://www.onvif.org/location/
- onvif://www.onvif.org/hardware/AUTODOME_IP_starlight_5000i
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/Profile/T
Camera 3:
Endpoint: urn:uuid:555a3d17-6698-43d9-9a52-2a199ff14dec
XAddr: http://192.168.2.82/onvif/device_service
Scopes:
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/hardware/P3818-PVE
- onvif://www.onvif.org/name/AXIS%20P3818-PVE
- onvif://www.onvif.org/Profile/M
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/location/
Camera 4:
Endpoint: urn:uuid:12060714-0005-0000-0302-ec71dbe838cc
XAddr: http://192.168.2.236:8000/onvif/device_service
Scopes:
- onvif://www.onvif.org/type/video_encoder
- onvif://www.onvif.org/location/country/china
- onvif://www.onvif.org/type/network_video_transmitter
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/name/IPC-BO
- onvif://www.onvif.org/hardware/ReolinkTrackMixWiFi
- onvif://www.onvif.org/name/IPC
Camera 5:
Endpoint: urn:uuid:00075fca-f8fa-faf8-ca5f-0700075fca5f
XAddr: http://192.168.2.200/onvif/device_service
XAddr: https://192.168.2.200/onvif/device_service
Scopes:
- onvif://www.onvif.org/type/Network_Video_Transmitter
- onvif://www.onvif.org/name/Bosch
- onvif://www.onvif.org/location/
- onvif://www.onvif.org/hardware/FLEXIDOME_IP_starlight_8000i
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/Profile/T
Camera 6:
Endpoint: urn:uuid:00075fd5-9fbe-be9f-d55f-0700075fd55f
XAddr: http://192.168.2.24/onvif/device_service
XAddr: https://192.168.2.24/onvif/device_service
Scopes:
- onvif://www.onvif.org/type/Network_Video_Transmitter
- onvif://www.onvif.org/name/Bosch
- onvif://www.onvif.org/location/
- onvif://www.onvif.org/hardware/FLEXIDOME_panoramic_5100i
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/Profile/M
Camera 7:
Endpoint: urn:uuid:cbc93166-2a81-4635-9fe3-dcd5e99528d3
XAddr: http://192.168.2.190/onvif/device_service
XAddr: https://192.168.2.190/onvif/device_service
XAddr: http://169.254.34.187/onvif/device_service
XAddr: https://169.254.34.187/onvif/device_service
Scopes:
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/hardware/Q3819-PVE
- onvif://www.onvif.org/name/AXIS%20Q3819-PVE
- onvif://www.onvif.org/Profile/M
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/location/
Camera 8:
Endpoint: urn:uuid:9e8de0a1-c818-448d-90eb-85670b2b9872
XAddr: http://192.168.2.30/onvif/device_service
XAddr: https://192.168.2.30/onvif/device_service
Scopes:
- onvif://www.onvif.org/Profile/Streaming
- onvif://www.onvif.org/Profile/G
- onvif://www.onvif.org/hardware/P5655-E
- onvif://www.onvif.org/name/AXIS%20P5655-E
- onvif://www.onvif.org/Profile/M
- onvif://www.onvif.org/Profile/T
- onvif://www.onvif.org/location/
+141
View File
@@ -0,0 +1,141 @@
// Package testdata provides camera configuration data for testing
// Auto-generated from network discovery on 2026-01-13
package testdata
// DiscoveredCamera represents a camera found on the network
type DiscoveredCamera struct {
ID int
Endpoint string
XAddrs []string
Manufacturer string
Model string
IP string
Port int
Profiles []string
SupportsHTTPS bool
}
// TestCameras contains the discovered cameras for testing
var TestCameras = []DiscoveredCamera{
{
ID: 1,
Endpoint: "urn:uuid:15020314-0204-0408-1500-ec71db465af7",
XAddrs: []string{"http://192.168.2.61:8000/onvif/device_service"},
Manufacturer: "Reolink",
Model: "E1Zoom",
IP: "192.168.2.61",
Port: 8000,
Profiles: []string{"Streaming", "T"},
},
{
ID: 2,
Endpoint: "urn:uuid:00075fe0-a604-04a6-e05f-0700075fe05f",
XAddrs: []string{"http://192.168.2.57/onvif/device_service", "https://192.168.2.57/onvif/device_service"},
Manufacturer: "Bosch",
Model: "AUTODOME_IP_starlight_5000i",
IP: "192.168.2.57",
Port: 80,
Profiles: []string{"Streaming", "G", "T"},
SupportsHTTPS: true,
},
{
ID: 3,
Endpoint: "urn:uuid:555a3d17-6698-43d9-9a52-2a199ff14dec",
XAddrs: []string{"http://192.168.2.82/onvif/device_service"},
Manufacturer: "AXIS",
Model: "P3818-PVE",
IP: "192.168.2.82",
Port: 80,
Profiles: []string{"Streaming", "G", "M", "T"},
},
{
ID: 4,
Endpoint: "urn:uuid:12060714-0005-0000-0302-ec71dbe838cc",
XAddrs: []string{"http://192.168.2.236:8000/onvif/device_service"},
Manufacturer: "Reolink",
Model: "ReolinkTrackMixWiFi",
IP: "192.168.2.236",
Port: 8000,
Profiles: []string{"Streaming", "T"},
},
{
ID: 5,
Endpoint: "urn:uuid:00075fca-f8fa-faf8-ca5f-0700075fca5f",
XAddrs: []string{"http://192.168.2.200/onvif/device_service", "https://192.168.2.200/onvif/device_service"},
Manufacturer: "Bosch",
Model: "FLEXIDOME_IP_starlight_8000i",
IP: "192.168.2.200",
Port: 80,
Profiles: []string{"Streaming", "G", "T"},
SupportsHTTPS: true,
},
{
ID: 6,
Endpoint: "urn:uuid:00075fd5-9fbe-be9f-d55f-0700075fd55f",
XAddrs: []string{"http://192.168.2.24/onvif/device_service", "https://192.168.2.24/onvif/device_service"},
Manufacturer: "Bosch",
Model: "FLEXIDOME_panoramic_5100i",
IP: "192.168.2.24",
Port: 80,
Profiles: []string{"Streaming", "G", "T", "M"},
SupportsHTTPS: true,
},
{
ID: 7,
Endpoint: "urn:uuid:cbc93166-2a81-4635-9fe3-dcd5e99528d3",
XAddrs: []string{"http://192.168.2.190/onvif/device_service", "https://192.168.2.190/onvif/device_service"},
Manufacturer: "AXIS",
Model: "Q3819-PVE",
IP: "192.168.2.190",
Port: 80,
Profiles: []string{"Streaming", "G", "M", "T"},
SupportsHTTPS: true,
},
{
ID: 8,
Endpoint: "urn:uuid:9e8de0a1-c818-448d-90eb-85670b2b9872",
XAddrs: []string{"http://192.168.2.30/onvif/device_service", "https://192.168.2.30/onvif/device_service"},
Manufacturer: "AXIS",
Model: "P5655-E",
IP: "192.168.2.30",
Port: 80,
Profiles: []string{"Streaming", "G", "M", "T"},
SupportsHTTPS: true,
},
}
// GetCameraByManufacturer returns cameras filtered by manufacturer
func GetCameraByManufacturer(manufacturer string) []DiscoveredCamera {
var result []DiscoveredCamera
for _, cam := range TestCameras {
if cam.Manufacturer == manufacturer {
result = append(result, cam)
}
}
return result
}
// GetCameraByProfile returns cameras that support a specific profile
func GetCameraByProfile(profile string) []DiscoveredCamera {
var result []DiscoveredCamera
for _, cam := range TestCameras {
for _, p := range cam.Profiles {
if p == profile {
result = append(result, cam)
break
}
}
}
return result
}
// GetHTTPSCameras returns cameras that support HTTPS
func GetHTTPSCameras() []DiscoveredCamera {
var result []DiscoveredCamera
for _, cam := range TestCameras {
if cam.SupportsHTTPS {
result = append(result, cam)
}
}
return result
}