1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Shared helpers for live-device integration tests.
//!
//! These tests are **opt-in**: they only run when the
//! `RUSTNETCONF_TEST_VSRX_HOST` environment variable is set. Without it,
//! each test calls [`skip_unless_vsrx_configured`] which returns `None`
//! and the test early-returns as a no-op.
//!
//! ## Configuration
//!
//! | Env var | Required | Default | Notes |
//! |---|---|---|---|
//! | `RUSTNETCONF_TEST_VSRX_HOST` | yes | — | e.g. `192.168.1.227:830` |
//! | `RUSTNETCONF_TEST_VSRX_USER` | no | `srxoutpost` | Junos username |
//! | `RUSTNETCONF_TEST_VSRX_KEY` | no | `$HOME/.ssh/id_ed25519` | SSH private key path |
//!
//! ## Examples
//!
//! ```sh
//! # Run all integration tests against VM114 (CI-tester-vSRX):
//! RUSTNETCONF_TEST_VSRX_HOST=192.168.1.227:830 cargo test --test integration_vsrx
//!
//! # Use a different SSH key and user:
//! RUSTNETCONF_TEST_VSRX_HOST=10.0.0.1:830 \
//! RUSTNETCONF_TEST_VSRX_USER=netconf \
//! RUSTNETCONF_TEST_VSRX_KEY=~/.ssh/netconf_ed25519 \
//! cargo test --test integration_vendor_pool
//! ```
// each integration_*.rs file uses a different subset
/// Resolved coordinates for a live vSRX test target.
/// Returns `Some(VsrxTarget)` when `RUSTNETCONF_TEST_VSRX_HOST` is set,
/// otherwise `None`. Tests should early-return on `None` so the suite is a
/// no-op for contributors without a lab device.
/// Convenience for tests that just need to bail when no device is configured.
///
/// Use at the top of a test:
/// ```ignore
/// let target = match common::skip_unless_vsrx_configured() {
/// Some(t) => t,
/// None => return,
/// };
/// ```
/// Split a `host:port` endpoint into its parts. Useful when a test needs to
/// poke a *different* port on the same host (e.g. testing connection-refused
/// against a closed port on the live device).