blob: 6013ce3f2a88e27e9f3300cac9d24a224e5d921a [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// GenerateL2switchingDomainActionLnletEntryDs generates "L2 Switching Domain/Action Add Inlet entry(for downstream)"
24func GenerateL2switchingDomainActionLnletEntryDs(oc *TomiObjectContext, tmTpidValue []byte, tmVidValue []byte) gopacket.SerializableLayer {
25
26 tibitData := &L2switchingDomainRequest{
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: oc.Branch,
42 OCType: oc.Type,
43 OCLength: oc.Length,
44 OCInstance: oc.Instance,
45 // Vc
46 VcBranch: 0x5d,
47 VcLeaf: 0x7001,
48 //VcLength: uint8(24 + len(tmTpidValue) + len(tmVidValue)), //27
49 VcLength: uint8(23 + len(tmTpidValue) + len(tmVidValue)), //26
50 // Source OC
51 SOLength: 5,
52 SOBranch: 0x0c,
53 SOType: 0x0eca,
54 SOValLength: 1,
55 SOInstance: 0x00,
56 // TagMatchList
57 //TMLLength: uint8(7 + len(tmTpidValue) + len(tmVidValue)), //10
58 TMLLength: uint8(6 + len(tmTpidValue) + len(tmVidValue)), //9
59 TMLList: []TpidVid{
60 {Length: uint8(2 + len(tmTpidValue) + len(tmVidValue)),
61 TpIDLength: uint8(len(tmTpidValue)),
62 TpIDValue: tmTpidValue,
63 VIdLength: uint8(len(tmVidValue)),
64 VIdValue: tmVidValue},
65 ////{Length: 5, TpIdLength: 2, TpIdValue: []byte{0x88, 0xa8}, VIdLength: 1, VIdValue: []byte{0x64}}
66
67 //{Length: 3, TpIdLength: 128, TpIdValue: []byte{0}, VIdLength: 1, VIdValue: []byte{0x00}}},
68 {Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0x00}}},
69 // TagOpPop(UI)
70 TOPopLength: 1,
71 TOPopValue: 0x01,
72 // TagOpSetList
73 TOSLength: 3,
74 TOSList: []TpidVid{
75 {Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0}}},
76 // TagOpPushList
77 TOPushLength: 3,
78 TOPushList: []TpidVid{
79 {Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0}}},
80 // End
81 EndBranch: 0x00,
82 }
83
84 return tibitData
85}