Takahiro Suzuki | d7bf820 | 2020-12-17 20:21:59 +0900 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package l2oam |
| 18 | |
| 19 | import ( |
| 20 | "github.com/google/gopacket" |
| 21 | ) |
| 22 | |
| 23 | // GenerateSetQosPolicerRate generates QosPolicerRate message |
| 24 | func GenerateSetQosPolicerRate(pkgType string, idx int) gopacket.SerializableLayer { |
| 25 | if pkgType == OnuPkgTypeB { |
| 26 | return &TibitFrame{ |
| 27 | Data: []byte{ |
| 28 | 0x03, 0x00, 0x50, 0xfe, 0x90, 0x82, 0x60, 0x03, |
| 29 | 0xca, 0xfe, 0x00, 0xb7, 0x00, 0x0F, 0x20, 0x00, |
| 30 | 0x01, 0x86, 0xa0, 0x00, 0x01, 0x86, 0xa0, 0x00, |
| 31 | 0x01, 0x86, 0xa0, 0x00, 0x01, 0x86, 0xa0, 0x00, |
| 32 | 0x01, 0x86, 0xa0, 0x00, 0x01, 0x86, 0xa0, 0x00, |
| 33 | 0x01, 0x86, 0xa0, 0x00, 0x01, 0x86, 0xa0, |
| 34 | }, |
| 35 | } |
| 36 | } |
| 37 | switch idx { |
| 38 | case 1: |
| 39 | return &TibitFrame{ |
| 40 | Data: []byte{ |
| 41 | 0x03, 0x00, 0x50, 0xfe, 0x00, 0x10, 0x00, 0x03, |
| 42 | 0xd6, 0x00, 0x03, 0x01, 0x00, 0xd7, 0x06, 0x02, |
| 43 | 0x0a, 0xff, 0x00, 0x01, 0x00, 0x00, 0x04, |
| 44 | }, |
| 45 | } |
| 46 | case 2: |
| 47 | return &TibitFrame{ |
| 48 | Data: []byte{ |
| 49 | 0x03, 0x00, 0x50, 0xFE, 0x00, 0x10, 0x00, 0x03, |
| 50 | 0xD6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xD7, |
| 51 | 0x00, 0x24, |
| 52 | }, |
| 53 | } |
| 54 | case 3: |
| 55 | return &TibitFrame{ |
| 56 | Data: []byte{ |
| 57 | 0x03, 0x00, 0x50, 0xFE, 0x00, 0x10, 0x00, 0x03, |
| 58 | 0xD6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xD7, |
| 59 | 0x00, 0x25, |
| 60 | }, |
| 61 | } |
| 62 | case 4: |
| 63 | return &TibitFrame{ |
| 64 | Data: []byte{ |
| 65 | 0x03, 0x00, 0x50, 0xFE, 0x00, 0x10, 0x00, 0x03, |
| 66 | 0xD6, 0x00, 0x03, 0x00, 0xD7, 0x06, 0x02, 0x0A, |
| 67 | 0xFF, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 68 | 0x00, 0x00, |
| 69 | }, |
| 70 | } |
| 71 | case 5: |
| 72 | return &TibitFrame{ |
| 73 | Data: []byte{ |
| 74 | 0x03, 0x00, 0x50, 0xFE, 0x00, 0x10, 0x00, 0x03, |
| 75 | 0xD6, 0x00, 0x03, 0x00, 0xD7, 0x06, 0x03, 0x07, |
| 76 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 77 | }, |
| 78 | } |
| 79 | default: |
| 80 | return &TibitFrame{ |
| 81 | Data: []byte{}, |
| 82 | } |
| 83 | } |
| 84 | } |