fix(tia): a type identifier gives only a concrete article and its version
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m24s
CI / Check (pull_request) Successful in 23m17s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m24s
CI / Check (pull_request) Successful in 23m17s
Siemens' Openness notes: catalog identifiers carry wildcards (6SL3040-1MA01-0Axx), drive identifiers a family after the version (/V5.2.3/S120), some a catalog variant instead (//10002). Only a concrete article and a V-version are taken; the rest is not matched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
1 parent
a9ea12651f
commit
1f3beb5786
2 files changed
+39
-7
No files matched your search
@@ -361,16 +361,25 @@ impl TiaManifest {
|
||||
}
|
||||
|
||||
/// Order number and firmware of a TIA type identifier
|
||||
/// (`OrderNumber:6ES7 515-2UM01-0AB0/V2.9`); a GSD or system identifier
|
||||
/// (`GSD:…`, `System:…`) has neither.
|
||||
/// (`OrderNumber:6ES7 515-2UM01-0AB0/V2.9`). The firmware is the segment after
|
||||
/// the order number when it is a version (`/V5.2.3/S120` has `V5.2.3`, a
|
||||
/// catalog variant `//10002` none). A catalog order number with wildcards
|
||||
/// (`6SL3040-1MA01-0Axx`) names no single article, so it is none. A GSD or
|
||||
/// system identifier (`GSD:…`, `System:…`) has neither.
|
||||
fn split_type_identifier(identifier: &str) -> (Option<&str>, Option<&str>) {
|
||||
let Some(rest) = identifier.trim().strip_prefix("OrderNumber:") else {
|
||||
return (None, None);
|
||||
};
|
||||
match rest.split_once('/') {
|
||||
Some((order, firmware)) => (Some(order), Some(firmware)),
|
||||
None => (Some(rest), None),
|
||||
}
|
||||
let mut segments = rest.split('/');
|
||||
let order = segments
|
||||
.next()
|
||||
.map(str::trim)
|
||||
.filter(|o| !o.is_empty() && !o.contains(['x', 'X']));
|
||||
let firmware = segments
|
||||
.next()
|
||||
.map(str::trim)
|
||||
.filter(|f| f.starts_with(['V', 'v']));
|
||||
(order, firmware)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -434,6 +443,29 @@ mod tests {
|
||||
assert_eq!(devices.unmatched, ["Drittgeraet", "Antrieb"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_type_identifier_yields_only_a_concrete_article_and_its_version() {
|
||||
assert_eq!(
|
||||
split_type_identifier("OrderNumber:6ES7 515-2UM01-0AB0/V2.9"),
|
||||
(Some("6ES7 515-2UM01-0AB0"), Some("V2.9"))
|
||||
);
|
||||
// A family qualifier after the version.
|
||||
assert_eq!(
|
||||
split_type_identifier("OrderNumber:6SL3040-1MA01-0AA0/V5.2.3/S120"),
|
||||
(Some("6SL3040-1MA01-0AA0"), Some("V5.2.3"))
|
||||
);
|
||||
// A catalog variant is no firmware; a wildcard is no article.
|
||||
assert_eq!(
|
||||
split_type_identifier("OrderNumber:6ES7 193-6BP00-0BA0//10002"),
|
||||
(Some("6ES7 193-6BP00-0BA0"), None)
|
||||
);
|
||||
assert_eq!(
|
||||
split_type_identifier("OrderNumber:6SL3040-1MA01-0Axx/V5.2"),
|
||||
(None, Some("V5.2"))
|
||||
);
|
||||
assert_eq!(split_type_identifier("System:Rack.S120"), (None, None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn protected_blocks_are_named_with_their_device() {
|
||||
let m = TiaManifest::parse(MANIFEST.as_bytes()).unwrap();
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ passwords or keys.
|
||||
| `bundle_version` | `1` |
|
||||
| `tia_version` | the TIA Portal version read with: `V20`, `V21` |
|
||||
| `devices[].role` | `cpu`, `hmi`, `module`, anything else counts as other |
|
||||
| `devices[].type_identifier` | TIA's type identifier; order number and firmware are taken from it unless given as `order_number` and `firmware` |
|
||||
| `devices[].type_identifier` | TIA's type identifier; order number and firmware are taken from it unless given as `order_number` and `firmware`. A catalog order number with wildcards (`…-0Axx`) or a variant without a version (`//10002`) leaves the device not matched |
|
||||
| `devices[].security` | a CPU's settings as configured in the project; each is `{"value": …}` when read, `{"unreadable": "<why>"}` when Openness could not read it, absent when not looked at |
|
||||
| `security.access_level` | `full_access_including_failsafe`, `full_access`, `read_access`, `hmi_access`, `no_access`, `none` |
|
||||
| `blocks[].kind` | `ob`, `fb`, `fc`, `db`, `udt` |
|
||||
|
||||
Reference in new issue
Block a user