blob: f319e526959bd1bd69a8516ac6f947470dfb383d [file] [log] [blame]
Takahiro Suzukid7bf8202020-12-17 20:21:59 +09001/*
2 * Copyright 2020-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package l2oam
18
19import (
20 "github.com/google/gopacket"
21)
22
23//GenerateSetHbtxTemplate generates "OAM/HBTx Template" message
24func GenerateSetHbtxTemplate() gopacket.SerializableLayer {
25
26 tibitData := &TOAMSetRequest{
27 // IEEE 1904.2
28 Opcode: 0x03,
29 // OAM Protocol
30 Flags: 0x0050,
31 OAMPDUCode: 0xfe,
32 OUId: []byte{0x2a, 0xea, 0x15},
33 // TiBit OLT Management Interface
34 TOMIOpcode: 0x03,
35 // Correlation Tag
36 CTBranch: 0x0c,
37 CTType: 0x0c7a,
38 CTLength: 4,
39 CTInstance: getOltInstance(),
40 // Object Context
41 OCBranch: 0x0c,
42 OCType: 0x0007,
43 OCLength: 4,
44 OCInstance: 0x00000000,
45 // Vc
46 VcBranch: 0x0a,
47 VcLeaf: 0x0003,
48 VcLength: 35,
49 // EC
50 ECLength: 34,
51 ECValue: []byte{
52 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02, 0xe8, 0xb4,
53 0x70, 0x70, 0x04, 0x07, 0x88, 0x09, 0x03, 0x00,
54 0x50, 0x00, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00,
55 0x1b, 0x04, 0xb0, 0x2a, 0xea, 0x15, 0x00, 0x00,
56 0x00, 0x23},
57 // End
58 EndBranch: 0x00,
59 }
60
61 return tibitData
62}