Skip to main content

Crate spri

Crate spri 

Source
Expand description

§spri — S/PRI 4.x orders and messages, in Rust

S/PRI is the carrier interface of the German open-access fibre market, maintained by the AK S&P: a service provider (Auftraggeber) orders lines from a network owner (Leistungserbringer) — provisioning, cancellation, changes, fault repair, diagnostics and the provider switch that follows a WBCI pre-agreement — and the network owner answers with messages. This crate gives you those orders and messages as typed values, read and written as XML, without I/O:

You want to…Use
build an orderAuftrag with a Geschaeftsfall (NEU, KUE-AG, LAE, AEN-LMAE, EST, PV, GET, SET)
build or read a messageMeldung with a Meldungsinhalt (QEB, ABM, ABBM, ERLM, … 20 types)
answer with a technical receiptTeq::new, xml::ReadError::teq_code
write or read the XMLPayload::to_xml, Payload::to_soap, Payload::from_xml
look up a codeMeldungscode
store an attachmentAnlage::safe_file_name
follow an order’s lifecycle: what may come next, what is dueprocess::Process, deadline, Abbm::outcome
test your side against a simulated network owner and losing providersim::Leistungserbringer, sim::AbgebenderProvider
know whether the network owner will refuse itAuftrag::issues_at, Auftrag::issues_against, Meldung::issues → Issue

§A provider switch after WBCI

The Vorabstimmungs-ID is the same type as in the wbci crate, so the id of an agreed pre-agreement goes into the PV order without conversion.

use spri::*;

let kontakt = Ansprechpartner {
    person: Person { anrede: Anrede::Frau, vorname: None, nachname: Nachname::new("Auftragsmanagement")? },
    telefonnummer: Telefonnummer::new("030 1234567")?,
    mobilfunknummer: None,
    faxnummer: None,
    emailadresse: None,
};
let pv = Providerwechsel {
    line_id: "DEU.EKP2.1754639821".parse()?,
    vorabstimmungs_id: "DEU.EKP1.V000000013".parse()?, // from the WBCI RUEM-VA
    anlage: None,
    ansprechpartner: AnsprechpartnerAuftrag { auftragsmanagement: kontakt, weitere: vec![] },
    wunschtermin: "2027-01-15".parse::<Date>()?.into(),
    produkt: Produkt { bezeichner: Produktbezeichner::new("FTTH 1000")? },
    fttx: FttxProviderwechsel {
        standort_a: StandortA {
            inhaber: Inhaber::Person(Person {
                anrede: Anrede::Frau,
                vorname: Some(Vorname::new("Erika")?),
                nachname: Nachname::new("Mustermann")?,
            }),
            telefonnummer: None,
            mobilfunknummer: None,
            strasse: Strasse {
                strassenname: Strassenname::new("Hauptstraße")?,
                hausnummer: Hausnummer::new("12")?,
                hausnummern_zusatz: None,
            },
            gebaeudeteil: None,
            land: None,
            postleitzahl: Postleitzahl::new("10115")?,
            ort: Ort { ortsname: Ortsname::new("Berlin")?, ortsteil: None },
            lage_tae_ont: None,
        },
        montageleistung: None,
    },
    positionen: vec![],
};
let auftrag = Auftrag {
    externe_auftragsnummer: ExterneAuftragsnummer::new("A-2026-0001")?,
    auftraggeber: Auftraggeber {
        auftraggebernummer: Auftraggebernummer::new("4711")?,
        leistungsnummer: Leistungsnummer::new("RV-1")?,
    },
    besteller: None,
    geschaeftsfall: Geschaeftsfall::Pv(pv),
    geschaeftsfall_art: GeschaeftsfallArt::Endkundenanbieterwechsel,
    aenderungskennzeichen: Aenderungskennzeichen::Standard,
    termin_neu: None,
    kenner: None,
};

let sent: Timestamp = "2026-11-23T08:00:00Z".parse()?;
let signatur = SignaturId { issuer: SignaturText::new("CN=Example CA")?, serial: SignaturText::new("4711")? };
let payload = Payload::AuftragRequest { control: Control::new(sent, signatur), auftrag };
let xml = payload.to_xml()?;
assert!(xml.contains(r#"<geschaeftsfall xsi:type="order:ProviderwechselType">"#));
assert!(xml.contains("<vorabstimmungId>DEU.EKP1.V000000013</vorabstimmungId>"));

// The network owner reads it back as the same value.
assert_eq!(Payload::from_xml(xml.as_bytes())?, payload);

§What is covered

S/PRI 4.x with the schema 4.00.03 (namespaces http://spri.telekom.de/oss/v4/…, major release 04) and the FTTx products it defines, the Providervereinbarung S/PRI V4.4 and the message codes of the Arbeitshandbuch S/PRI 4.x V2.9.5 (215 codes, §6.3/§6.4): all eight order business cases, all twenty message types, the technical receipt and the four operation payloads (annehmenAuftrag, annehmenMeldung, request and response).

The order lifecycle follows the EPKs of Anlage 7 (V.13): process::Process checks which order, message and receipt may follow which per business case, with Storno, Terminverschiebung, the TAM/MTAM loop and the provider-switch leg with the losing provider, and reports the deadlines (deadline); its interpretations are listed in process. validate checks an order or message before it is sent, with 34 cited rules; its interpretations are marked in its rule table.

Not covered, by design: SOAP transport, WS-Security signing, TLS, persistence.

§Safety for untrusted input

The reader refuses DTDs, resolves only the five predefined entities, bounds input size, nesting, element count, text length, repetitions and attachment size (xml::Limits), and never panics. Names, phone numbers, e-mail addresses, street, house number, free text and attachment content print redacted in Debug; errors never contain values.

§Interpretations

Where the specifications leave room, this crate decides and says so: the Vorabstimmungs-ID and the LineID use the stricter WBCI/AK S&P formats (the S/PRI schema restricts only their length); the certificate issuer and serial use the WBCI character set (they are shared with WBCI); the release is written with two digits (04); the code list’s misprinted rows for 1586 and 2001 take the fact sheets’ texts; attachments are bounded to 1 MiB by default (the documents name no size).

Guides: https://hupe1980.github.io/telco-interop/docs/spri/.

Unofficial; not affiliated with or endorsed by the AK S&P, VATM, BUGLAS or Deutsche Telekom.

Re-exports§

pub use validate::Issue;
pub use validate::Severity;

Modules§

deadline
The deadlines of an S/PRI order, explained.
process
The life of one S/PRI order, as one party sees it.
sim
Simulated S/PRI peers, to test a service provider’s side without a partner: the network owner (Leistungserbringer) and, in a provider switch, the losing provider (AbgebenderProvider).
validate
Validation that predicts the network owner’s refusal.
xml
XML: reading and writing the four S/PRI payloads.

Structs§

A10nsp
The A10 network service provider of a line (a10nsp): 1–20.
Abbm
ABBM: the order is refused.
AbbmPv
ABBM-PV: the switch was aborted; the losing provider’s contract stays.
Abfragestelle
The operator position of a PBX line (abfragestelle): \d{1,6}.
Abm
ABM: the order is confirmed for a binding date.
AbmPv
ABM-PV: the switch date is confirmed to the losing provider.
AenderungPosition
A change position (AenderungPositionType): a product added, changed or removed.
AkmPv
AKM-PV: the network owner tells the losing provider about a provider switch.
Anlage
An attachment (AnlageMitTypType): a document embedded as base64.
Ansprechpartner
A contact person (complex:AnsprechpartnerType).
AnsprechpartnerAuftrag
The order’s contact persons (order:AnsprechpartnerType).
AnsprechpartnerMitRolle
A contact person with a role (AnsprechpartnerMitRolleType).
Antwortcode
The losing provider’s answer code in a provider switch (antwortcode): 1–10.
Antworttext
The losing provider’s answer text (antworttext): at most 255.
Auftrag
An order (AuftragType), sent by the service provider (Auftraggeber) to the network owner (Leistungserbringer) in annehmenAuftragRequest.
Auftraggeber
A party by its customer and contract number (AuftraggeberType), used for auftraggeber and besteller.
Auftraggebernummer
The service provider’s customer number at the network owner. XSD AuftraggebernummerType: 1–10.
Auftragskenner
auftragskenner: groups several orders.
Auftragstyp
The kind of order a message refers to (AuftragstypType).
Bereitstellung
NEU (BereitstellungType) with the FTTx product.
Beschreibung
The description of an attachment: 1–160.
Calendar
Which days count as working days.
CarrierCode
A carrier: ISO 3166 alpha-3 country code and ITU M.1400 carrier code, e.g. DEU.EKP1.
Control
control (WholesaleRequestType, WholesaleResponseType): sent with every payload.
Date
A representation of a civil date in the Gregorian calendar.
Dateiname
The file name of an attachment as sent: 1–255. Use crate::Anlage::safe_file_name before joining it to a folder.
Diagnose
GET and SET (DiagnoseGetType, DiagnoseSetType).
DiagnoseErgebnis
A diagnostic value (DiagnoseErgebnisType).
Diagnosename
A diagnostic operation (operation) or result name (name): 1–20.
Diagnosewert
A diagnostic result value (wert): 1–1 024.
Durchwahlnummer
The direct-dial number of a PBX line (durchwahlnummer): \d{1,8}.
Emailadresse
An e-mail address. XSD EmailadresseType: .+@(.+\.)+\w+, at most 320, collapsed.
Entm
ENTM: the billing date.
EntmPv
ENTM-PV: the losing provider’s billing ends.
EntstoerErgebnis
The result of a repair (EntstoerungErgebnisType).
Entstoerung
EST (EntstoerungType).
Erlm
ERLM: the service is realised.
ErlmK
ERLM-K: the service provider reports the service done without an appointment.
ErlmPv
ERLM-PV: the losing provider’s line was technically taken over.
ExterneAuftragsnummer
The service provider’s order number. XSD ExterneAuftragsnummerType: 1–20.
Firma
A company (FirmaType).
Firmenname
A company name (firmenname, typed VornameType in the schema): 1–30.
Freitext
Free text of up to 1 024 characters: fault description, complaint, reason, note, message.
FttxAnschluss
The line as confirmed (FTTxAnschlussType).
FttxBereitstellung
The FTTx data of a provisioning (FTTXBereitstellungType).
FttxProviderwechsel
The FTTx data of a provider switch (FTTXProviderwechselType).
Gebaeudeteil
A part of a building, e.g. Haus B. XSD GebaeudeteilNameType and GebaeudeteilZusatzType: 1–25.
GebaeudeteilAngabe
gebaeudeteil (GebaeudeteilType).
Hausnummer
A house number. XSD HausnummerType: \d{1,4}.
HausnummernZusatz
A house-number suffix, e.g. a. XSD HausnummernZusatzType: 1–6.
HomeId
The number of a Home-ID (homeIdNummer): 1–15.
Kdle
KDLE: the network owner announces the cancellation of a line.
Kenner
kenner (KennerType): project and order grouping.
KontaktEndkunde
The end customer to contact for a repair (AnsprechpartnerESTType).
Kuendigung
KUE-AG (KuendigungType).
LageTaeOnt
Where the TAE or ONT is (lageTAE_ONT): at most 60.
Land
A country code, de by default. XSD LandType: exactly 2, collapsed.
Leistungsaenderung
LAE (LeistungsaenderungType).
LeistungsmerkmalAenderung
AEN-LMAE (LeistungsmerkmalAenderungType).
Leistungsnummer
The framework contract the order is placed under. XSD LeistungsnummerType: 1–10.
LineId
The line identifier of a technical resource, e.g. DEU.EKP1.1754639821.
Meldung
A message (MeldungType): which order it is about and what it says.
Meldungstext
The text of a message position. XSD MeldungstextType: at most 255 characters.
Montagehinweis
A note for the installer (montagehinweis): 1–100.
Montageleistung
Installation at the customer (MontageleistungType).
Nachname
A surname, or the second part of a company name. XSD NachnameType: 1–30.
Onkz
An area code (onkz): \d{2,5}.
OnkzRufnummer
An area code and a number (onkz, rufnummer).
Ort
ort (OrtType).
Ortsname
A town. XSD OrtsnameType: 1–40.
Ortsteil
A district of a town. XSD OrtsteilType: 1–40.
Person
A person (PersonType).
Port
The port of a line (port): 1–10.
Portierungskenner
The porting identifier of a number porting (portierungskenner, xsd:string).
Position
A message position: a code and its text (MeldungspositionOhneAttributeType).
PositionAbm
An ABM position (MeldungspositionMitWitaErweiterungType with MeldungspositionsattributeABMType).
PositionQeb
A QEB position (MeldungspositionType with MeldungspositionsattributeQEBType).
PositionWita
A position with the WITA code and text it maps to (MeldungspositionOhneAttributeMitWitaErweiterungType).
Postleitzahl
A postcode. XSD PostleitzahlType: 1–6, collapsed.
Produkt
A product from the product catalogue (produkt, FTTx: ProduktFTTXType).
Produktbezeichner
A product from the product catalogue (S/PRI Anlage 4). XSD ProduktbezeichnerType: 1–100.
ProjektId
projektId.
Projektkenner
A project (projektkenner) or coupling (kopplungskenner) identifier: 1–30.
Providername
A provider’s name in a provider switch. XSD String60ZeichenType: 1–60, collapsed.
Providerwechsel
PV (ProviderwechselType): take over a line after a WBCI pre-agreement.
ProviderwechselAnkuendigung
The provider switch as announced to the losing provider (ProviderwechselAnkuendigungType).
ProviderwechselBestaetigung
The provider switch as confirmed to the losing provider (ProviderwechselBestaetigungType).
ProviderwechselRueckmeldung
The losing provider’s answer (ProviderwechselRueckmeldungType).
Qeb
QEB: the order is commercially admissible.
Reklamation
A complaint about an earlier repair (EntstoerungsReklamationType).
Release
majorRelease and minorRelease (S/PRI 4.4 §10.4: „AN 2“, digits only).
RuemPv
RUEM-PV: the losing provider agrees to or refuses the switch.
Rufnummer
A subscriber number (rufnummer): \d{1,14}.
RufnummernBlock
A bound of a number block (rnrBlockVon, rnrBlockBis): \d{1,6}.
RufnummernPortierung
The numbers to port (rufnummernPortierung).
Rufnummernblock
A block of PBX numbers (zuPortierenderRufnummernblock).
Sendungsnummer
A parcel tracking number (sendungsnummer): 1–40.
SeriennummerOnt
The serial number of an ONT (or a source MAC address). XSD SeriennummerONTType: 1–20, collapsed.
SignaturId
signaturId: identifies the sender’s signing certificate (WBCI 2.0 §10; S/PRI SignaturIdType).
SignaturText
Issuer or serial of the signing certificate. XSD SignatureIssuerType/SignatureSerialIdType.
StandortA
The line’s location (StandortAType): who is there, the address and where the socket is.
StandortVersand
Where to ship hardware (StandortVersandType).
StoerungsNr
A fault ticket number (stoerungsNrAuftraggeber, stoerungsNrLeistungserbringer): 1–30.
Strasse
strasse (StrasseType).
Strassenname
A street name. XSD StrassennameType: 1–40.
Tbk
TBK-LE and TBK-AG: an on-site appointment was agreed with the end customer.
Technologie
The access technology (technologie): 1–25.
Telefonnummer
A phone, mobile or fax number, e.g. 030 1234567 or +49 30 1234567.
Teq
The technical receipt (MessageTEQType), the quittung of both responses.
Termin
An appointment with time and time window (WunschterminMitZeitangabeUndZeitfensterType).
Terminanforderung
TAM and MTAM: a new appointment with the end customer is needed.
Time
A representation of civil “wall clock” time.
Timestamp
An instant in time represented as the number of nanoseconds since the Unix epoch.
ValueError
A value that does not satisfy its schema type.
VersandinfosOnt
ONT shipping data (FTTxVersandinfosONTType).
Versandunternehmen
A parcel carrier (unternehmen): 1–10.
Vertragsnummer
The network owner’s contract number for a line. XSD VertragsnummerType: 1–10.
Vlan
An S-VLAN or C-VLAN id (s-vlan, c-vlan): 1–4.
VorabstimmungsId
The id of a pre-agreement request, e.g. DEU.EKP1.V000000013.
Vormieter
The previous tenant (FTTxVormieterType).
VormieterPerson
The previous tenant’s name.
Vorname
A first name. XSD VornameType: 1–30.
Vzm
VZM: processing is delayed.
WitaExtendedInfos
WITA references, line search and number porting (WitaExtendedInfosGroup).
WitaInfos
WITA references (WitaInfosGroup).
WitaMeldungscode
The WITA code of a message position (witaMeldungscode): 1–10.
WitaMeldungstext
The WITA text of a message position (witaMeldungstext): at most 255.
WitaVertragsnummer
A WITA contract number (witaVertragsnummer): 1–10.
Wunschtermin
A requested or binding date with an optional time window (WunschterminType).
Zeitfenster
A time window for an appointment. XSD ZeitfensterType: the 125 values 1–99 and A–Z. The standard windows are 1 (working days 8–14 h), 2 (working days 14–20 h) and 3 (Saturdays 8–16 h), XSD 4.00.03 annotations; 20–41 are the special windows („Sonderzeitfenster“, by additional agreement) of AH 2.9.5 §3.3. The others are reserved.
Zeitstempel
zeitstempel: when the message was sent, with the sender’s UTC offset.
ZwmAg
ZWM-AG: an interim message from the service provider.
ZwmLe
ZWM-LE: an interim message from the network owner.

Enums§

AbbmOutcome
What an ABBM tells the service provider to do next, as the EPKs of Anlage 7 (V.13) draw it.
AbbmPhase
Where in an order’s life an ABBM arrives: the EPKs draw a different code set per phase.
Aenderungskennzeichen
Marks an order as standard, cancellation or postponement. XSD AenderungskennzeichenType.
Aktionscode
What a change position does. XSD AktionscodeType.
Anlagentyp
What an attachment is. XSD AnlagentypType.
Anrede
Salutation of a person. XSD AnredePersonType.
AnredeFirma
Salutation of a company. XSD AnredeFirmaType.
AnsprechpartnerRolle
The role of a contact person. XSD AnsprechpartnerRolleType.
Dokumenttyp
The MIME type of an attachment. XSD DokumenttypType.
Entstoerergebnis
The outcome of a fault repair (entstoerErgebnis/ergebnis).
Geschaeftsfall
The business case of an order: the concrete type of the abstract GeschaeftsfallType, written as xsi:type.
GeschaeftsfallArt
The kind of business case of an order. XSD GeschaeftsfallArtType.
GeschaeftsfallCode
The business case a message answers. XSD GeschaeftsfallMeldungType.
Inhaber
The person or company at a location (the choice person | firma).
JaNein
Yes or no. XSD JaNeinType.
Meldungscode
A message code (Meldungscode) with its official text.
Meldungsinhalt
The concrete message (meldungstyp, an extension of MeldungstypAbstractType).
Meldungstyp
The type of a message. XSD MeldungstypType; descriptions AH4S/PRI 2.9.5 §6.2.
Payload
One of the four payloads exchanged over S/PRI: the body of a SOAP call (spri.wsdl).
PortierungAnschluss
The numbers of a PBX or a single line.
UebergabepunktKunde
The hand-over point at the customer. XSD UebergabepunktKundeType.
ValueErrorKind
The facet a ValueError reports.

Constants§

MAX_AUFTRAGSKLAMMER
The largest auftragsklammer the schema admits.