scapy.contrib.oam
Operation, administration and maintenance (OAM)
- author:
Sergey Matsievskiy, matsievskiysv@gmail.com
- description:
This module provides Scapy layers for the OAM protocol.
- normative references:
ITU-T Rec. G.8013/Y.1731 (08/2019) - Operation, administration and maintenance (OAM) functions and mechanisms for Ethernet-based networks (https://www.itu.int/rec/T-REC-G.8013)
ITU-T Rec. G.8031/Y.1342 (01/2015) - Ethernet linear protection switching (https://www.itu.int/rec/T-REC-G.8031)
ITU-T Rec. G.8032/Y.1344 (02/2022) - Ethernet ring protection switching (https://www.itu.int/rec/T-REC-G.8032)
- class scapy.contrib.oam.APS(_pkt, /, *, req_st=0, prot_type=<Flag 0 ()>, req_sig=0, br_sig=0, br_type=<Flag 0 ()>)[source]
Bases:
Packet
Linear protective switching APS data packet
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | REQ ST|PROT TY| REQ SIG | BR SIG | BR TYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. APS
APS fields req_st
0
prot_type
<Flag 0 ()>
req_sig
0
br_sig
0
br_type
<Flag 0 ()>
- class scapy.contrib.oam.MegId(_pkt, /, *, resv=1, format=0, length=None, values=None)[source]
Bases:
Packet
MEG ID
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESV | FORMAT | LENGTH | VALUES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. MegId
MegId fields resv
1
format
0
length
MultipleTypeField
(LenField, LenField, LenField)45
values
None
- class scapy.contrib.oam.MepIdField(name, default)[source]
Bases:
ShortField
Short field with insignificant three leading bytes
- class scapy.contrib.oam.OAM(_pkt, /, *, mel=0, version=None, opcode=None, flags=None, period=None, tlv_offset=None, seq_num=0, trans_id=0, oui=None, subopcode=None, mep_id=0, meg_id=<MegId |>, src_mep_id=0, rcv_mep_id=0, test_id=0, txfcf=0, rxfcb=0, rxfcf=0, txfcb=0, resv=0, ttl=0, orig_mac=None, targ_mac=None, relay_act=None, txtsf=<PTP_TIMESTAMP |>, rxtsf=<PTP_TIMESTAMP |>, txtsb=<PTP_TIMESTAMP |>, rxtsb=<PTP_TIMESTAMP |>, expct_dur=None, nom_bdw=None, curr_bdw=None, port_id=None, aps=<APS |>, raps=<RAPS |>, tlvs=[], opt_data=None, end_tlv=0)[source]
Bases:
Packet
OAM data unit
- BNM_PERIOD_FLAGS = {4: '1 frame per second', 5: '1 frame per 10 seconds', 6: '1 frame per minute'}
- OPCODES = {1: 'Continuity Check Message (CCM)', 2: 'Loopback Reply (LBR)', 3: 'Loopback Message (LBM)', 4: 'Linktrace Reply (LTR)', 5: 'Linktrace Message (LTM)', 32: 'Generic Notification Message (GNM)', 33: 'Alarm Indication Signal (AIS)', 35: 'Lock Signal (LCK)', 37: 'Test Signal (TST)', 39: 'Automatic Protection Switching (APS)', 40: 'Ring-Automatic Protection Switching (R-APS)', 41: 'Maintenance Communication Channel (MCC)', 42: 'Loss Measurement Reply (LMR)', 43: 'Loss Measurement Message (LMM)', 45: 'One Way Delay Measurement (1DM)', 46: 'Delay Measurement Reply (DMR)', 47: 'Delay Measurement Message (DMM)', 48: 'Experimental OAM Reply (EXR)', 49: 'Experimental OAM Message (EXM)', 50: 'Vendor Specific Reply (VSR)', 51: 'Vendor Specific Message (VSM)', 52: 'Client Signal Fail (CSF)', 53: 'One Way Synthetic Loss Measurement (1SL)', 54: 'Synthetic Loss Reply (SLR)', 55: 'Synthetic Loss Message (SLM)'}
- PERIOD_FLAGS = {4: '1 frame per second', 6: '1 frame per minute'}
- TIME_FLAGS = {0: 'Invalid value', 1: 'Trans Int 3.33ms', 2: 'Trans Int 10ms', 3: 'Trans Int 100ms', 4: 'Trans Int 1s', 5: 'Trans Int 10s', 6: 'Trans Int 1min', 7: 'Trans Int 10min'}
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MEL | VERSION | OPCODE | FLAGS |PERIO|TLV OFFSE| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SEQ NUM | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | TRANS ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | OUI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SUBOPCODE | MEP ID | MEG ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SRC MEP ID |RCV MEP I| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | TEST ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-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-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | RAPS | TLVS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | OPT DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | END TLV | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM
OAM fields mel
BitField
(3 bits)0
version
MultipleTypeField
(BitField, BitField)0
opcode
None
flags
MultipleTypeField
(FlagsField, FlagsField, FlagsField, BitField, FlagsField, BitEnumField, ByteField)0
period
MultipleTypeField
(Cond, BitEnumField, BitEnumField, BitEnumField)6
tlv_offset
MultipleTypeField
(ByteField, ByteField, ByteField, ByteField, ByteField, ByteField, ByteField, ByteField, ByteField, ByteField)0
seq_num
IntField
(Cond)0
trans_id
IntField
(Cond)0
oui
OUIField
(Cond)None
subopcode
MultipleTypeField
(Cond, ByteField, ByteField)0
mep_id
MepIdField
(Cond)0
meg_id
PacketField
(Cond)<MegId |>
src_mep_id
ShortField
(Cond)0
rcv_mep_id
ShortField
(Cond)0
test_id
IntField
(Cond)0
txfcf
IntField
(Cond)0
rxfcb
IntField
(Cond)0
rxfcf
IntField
(Cond)0
txfcb
IntField
(Cond)0
resv
IntField
(Cond)0
ttl
ByteField
(Cond)0
orig_mac
MACField
(Cond)None
targ_mac
MACField
(Cond)None
relay_act
ByteField
(Cond)None
txtsf
PacketField
(Cond)<PTP_TIMESTAMP |>
rxtsf
PacketField
(Cond)<PTP_TIMESTAMP |>
txtsb
PacketField
(Cond)<PTP_TIMESTAMP |>
rxtsb
PacketField
(Cond)<PTP_TIMESTAMP |>
expct_dur
IntField
(Cond)None
nom_bdw
IntField
(Cond)None
curr_bdw
IntField
(Cond)None
port_id
IntField
(Cond)None
aps
PacketField
(Cond)<APS |>
raps
PacketField
(Cond)<RAPS |>
tlvs
PacketListField
(Cond)[]
opt_data
IntField
(Cond)None
end_tlv
0
- class scapy.contrib.oam.OAM_DATA_TLV(_pkt, /, *, type=3, length=None)[source]
Bases:
Packet
OAM Data TLV
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_DATA_TLV
OAM_DATA_TLV fields type
3
length
None
- class scapy.contrib.oam.OAM_LTM_TLV(_pkt, /, *, type=7, length=8, egress_id=0)[source]
Bases:
Packet
OAM LTM TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | EGRESS ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_LTM_TLV
OAM_LTM_TLV fields type
7
length
8
egress_id
0
- class scapy.contrib.oam.OAM_LTR_EG_TLV(_pkt, /, *, type=6, length=7, egress_act=0, egress_mac=None)[source]
Bases:
Packet
OAM LTR TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | EGRESS ACT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EGRESS MAC | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_LTR_EG_TLV
OAM_LTR_EG_TLV fields type
6
length
7
egress_act
0
egress_mac
None
- class scapy.contrib.oam.OAM_LTR_IG_TLV(_pkt, /, *, type=5, length=7, ingress_act=0, ingress_mac=None)[source]
Bases:
Packet
OAM LTR TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | INGRESS ACT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | INGRESS MAC | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_LTR_IG_TLV
OAM_LTR_IG_TLV fields type
5
length
7
ingress_act
0
ingress_mac
None
- class scapy.contrib.oam.OAM_LTR_TLV(_pkt, /, *, type=8, length=16, last_egress_id=0, next_egress_id=0)[source]
Bases:
Packet
OAM LTR TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | LAST EGRESS ID| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+ | | NEXT EGRESS ID| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_LTR_TLV
OAM_LTR_TLV fields type
8
length
16
last_egress_id
0
next_egress_id
0
- class scapy.contrib.oam.OAM_TEST_ID_TLV(_pkt, /, *, type=36, length=32, test_id=0)[source]
Bases:
Packet
OAM Test ID TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | TEST ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_TEST_ID_TLV
OAM_TEST_ID_TLV fields type
36
length
32
test_id
0
- class scapy.contrib.oam.OAM_TEST_TLV(_pkt, /, *, type=32, length=None, pat_type=0, crc=None)[source]
Bases:
Packet
OAM test TLV data
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LENGTH | PAT TYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CRC | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. OAM_TEST_TLV
OAM_TEST_TLV fields type
32
length
MultipleTypeField
(LenField, LenField)None
pat_type
0
crc
FCSField
(Cond)None
- class scapy.contrib.oam.OAM_TLV(_pkt, /, *, type=1, length=None)[source]
Bases:
Packet
OAM TLV
- aliastypes
- class scapy.contrib.oam.PTP_TIMESTAMP(_pkt, /, *, seconds=0, nanoseconds=0)[source]
Bases:
Packet
PTP timestamp
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SECONDS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NANOSECONDS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. PTP_TIMESTAMP
PTP_TIMESTAMP fields seconds
0
nanoseconds
0
- class scapy.contrib.oam.RAPS(_pkt, /, *, req_st=0, sub_code=None, status=<Flag 0 ()>, node_id=None, resv=0)[source]
Bases:
Packet
Ring protective switching R-APS data packet
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | REQ ST|SUB COD| STATUS | NODE ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESV | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. RAPS
RAPS fields req_st
0
sub_code
MultipleTypeField
(BitEnumField, BitField)0
status
<Flag 0 ()>
node_id
None
resv
0