Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 1 | /* |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 2 | Copyright 2020 the original author or authors. |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 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 | package openflow |
| 17 | |
| 18 | import ( |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 19 | "bytes" |
| 20 | "encoding/binary" |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 21 | "encoding/json" |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 22 | "github.com/opencord/goloxi" |
| 23 | ofp "github.com/opencord/goloxi/of13" |
David K. Bainbridge | aea73cd | 2020-01-27 10:44:50 -0800 | [diff] [blame] | 24 | "github.com/opencord/voltha-lib-go/v3/pkg/log" |
| 25 | "github.com/opencord/voltha-protos/v3/go/openflow_13" |
| 26 | "github.com/opencord/voltha-protos/v3/go/voltha" |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 27 | ) |
| 28 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 29 | func parseOxm(ofbField *openflow_13.OfpOxmOfbField) goloxi.IOxm { |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 30 | if logger.V(log.DebugLevel) { |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 31 | js, _ := json.Marshal(ofbField) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 32 | logger.Debugw("parseOxm called", |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 33 | log.Fields{"ofbField": js}) |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 34 | } |
| 35 | |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 36 | switch ofbField.Type { |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 37 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_IN_PORT: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 38 | ofpInPort := ofp.NewOxmInPort() |
| 39 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_Port) |
| 40 | ofpInPort.Value = ofp.Port(val.Port) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 41 | return ofpInPort |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 42 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_ETH_TYPE: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 43 | ofpEthType := ofp.NewOxmEthType() |
| 44 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_EthType) |
| 45 | ofpEthType.Value = ofp.EthernetType(val.EthType) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 46 | return ofpEthType |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 47 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_IN_PHY_PORT: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 48 | ofpInPhyPort := ofp.NewOxmInPhyPort() |
| 49 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_PhysicalPort) |
| 50 | ofpInPhyPort.Value = ofp.Port(val.PhysicalPort) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 51 | return ofpInPhyPort |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 52 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_IP_PROTO: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 53 | ofpIpProto := ofp.NewOxmIpProto() |
| 54 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_IpProto) |
| 55 | ofpIpProto.Value = ofp.IpPrototype(val.IpProto) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 56 | return ofpIpProto |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 57 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_IPV4_DST: |
| 58 | ofpIpv4Dst := ofp.NewOxmIpv4Dst() |
| 59 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_Ipv4Dst) |
| 60 | buf := new(bytes.Buffer) |
| 61 | err := binary.Write(buf, binary.BigEndian, val.Ipv4Dst) |
| 62 | if err != nil { |
| 63 | logger.Errorw("error writing ipv4 address %v", |
| 64 | log.Fields{"error": err}) |
| 65 | } |
| 66 | ofpIpv4Dst.Value = buf.Bytes() |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 67 | return ofpIpv4Dst |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 68 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_UDP_SRC: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 69 | ofpUdpSrc := ofp.NewOxmUdpSrc() |
| 70 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_UdpSrc) |
| 71 | ofpUdpSrc.Value = uint16(val.UdpSrc) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 72 | return ofpUdpSrc |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 73 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_UDP_DST: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 74 | ofpUdpDst := ofp.NewOxmUdpDst() |
| 75 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_UdpDst) |
| 76 | ofpUdpDst.Value = uint16(val.UdpDst) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 77 | return ofpUdpDst |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 78 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 79 | ofpVlanVid := ofp.NewOxmVlanVid() |
| 80 | val := ofbField.GetValue() |
Don Newton | 7fe70f7 | 2020-02-21 13:54:11 -0500 | [diff] [blame] | 81 | if val == nil { |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 82 | ofpVlanVid.Value = uint16(0) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 83 | return ofpVlanVid |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 84 | } |
Don Newton | 7fe70f7 | 2020-02-21 13:54:11 -0500 | [diff] [blame] | 85 | vlanId := val.(*openflow_13.OfpOxmOfbField_VlanVid) |
| 86 | if ofbField.HasMask { |
| 87 | ofpVlanVidMasked := ofp.NewOxmVlanVidMasked() |
| 88 | valMask := ofbField.GetMask() |
| 89 | vlanMask := valMask.(*openflow_13.OfpOxmOfbField_VlanVidMask) |
| 90 | if vlanId.VlanVid == 4096 && vlanMask.VlanVidMask == 4096 { |
| 91 | ofpVlanVidMasked.Value = uint16(vlanId.VlanVid) |
| 92 | ofpVlanVidMasked.ValueMask = uint16(vlanMask.VlanVidMask) |
| 93 | } else { |
| 94 | ofpVlanVidMasked.Value = uint16(vlanId.VlanVid) | 0x1000 |
| 95 | ofpVlanVidMasked.ValueMask = uint16(vlanMask.VlanVidMask) |
| 96 | |
| 97 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 98 | return ofpVlanVidMasked |
Don Newton | 7fe70f7 | 2020-02-21 13:54:11 -0500 | [diff] [blame] | 99 | } |
| 100 | ofpVlanVid.Value = uint16(vlanId.VlanVid) | 0x1000 |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 101 | return ofpVlanVid |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 102 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_METADATA: |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 103 | ofpMetadata := ofp.NewOxmMetadata() |
| 104 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_TableMetadata) |
| 105 | ofpMetadata.Value = val.TableMetadata |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 106 | return ofpMetadata |
Gamze Abaka | 3e2b2ce | 2020-05-09 10:21:40 +0000 | [diff] [blame] | 107 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP: |
| 108 | ofpVlanPcp := ofp.NewOxmVlanPcp() |
| 109 | val := ofbField.GetValue() |
| 110 | vlanPcp := val.(*openflow_13.OfpOxmOfbField_VlanPcp) |
| 111 | ofpVlanPcp.Value = uint8(vlanPcp.VlanPcp) |
| 112 | return ofpVlanPcp |
| 113 | case voltha.OxmOfbFieldTypes_OFPXMT_OFB_ETH_DST: |
| 114 | ofpEthDst := ofp.NewOxmEthDst() |
| 115 | val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_EthDst) |
| 116 | ofpEthDst.Value = val.EthDst |
| 117 | return ofpEthDst |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 118 | default: |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 119 | if logger.V(log.WarnLevel) { |
| 120 | js, _ := json.Marshal(ofbField) |
| 121 | logger.Warnw("ParseOXM Unhandled OxmField", |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 122 | log.Fields{"OfbField": js}) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 123 | } |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 124 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 125 | return nil |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 126 | } |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 127 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 128 | func parseInstructions(ofpInstruction *openflow_13.OfpInstruction) ofp.IInstruction { |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 129 | if logger.V(log.DebugLevel) { |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 130 | js, _ := json.Marshal(ofpInstruction) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 131 | logger.Debugw("parseInstructions called", |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 132 | log.Fields{"Instruction": js}) |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 133 | } |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 134 | instType := ofpInstruction.Type |
| 135 | data := ofpInstruction.GetData() |
| 136 | switch instType { |
| 137 | case ofp.OFPITWriteMetadata: |
| 138 | instruction := ofp.NewInstructionWriteMetadata() |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 139 | metadata := data.(*openflow_13.OfpInstruction_WriteMetadata).WriteMetadata |
| 140 | instruction.Metadata = uint64(metadata.Metadata) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 141 | return instruction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 142 | case ofp.OFPITMeter: |
| 143 | instruction := ofp.NewInstructionMeter() |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 144 | meter := data.(*openflow_13.OfpInstruction_Meter).Meter |
| 145 | instruction.MeterId = meter.MeterId |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 146 | return instruction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 147 | case ofp.OFPITGotoTable: |
| 148 | instruction := ofp.NewInstructionGotoTable() |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 149 | gotoTable := data.(*openflow_13.OfpInstruction_GotoTable).GotoTable |
| 150 | instruction.TableId = uint8(gotoTable.TableId) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 151 | return instruction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 152 | case ofp.OFPITApplyActions: |
| 153 | instruction := ofp.NewInstructionApplyActions() |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 154 | |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 155 | var actions []goloxi.IAction |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 156 | for _, ofpAction := range ofpInstruction.GetActions().Actions { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 157 | action := parseAction(ofpAction) |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 158 | actions = append(actions, action) |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 159 | } |
| 160 | instruction.Actions = actions |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 161 | if logger.V(log.DebugLevel) { |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 162 | js, _ := json.Marshal(instruction) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 163 | logger.Debugw("parseInstructions returning", |
| 164 | log.Fields{ |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 165 | "parsed-instruction": js}) |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 166 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 167 | return instruction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 168 | } |
| 169 | //shouldn't have reached here :< |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 170 | return nil |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 171 | } |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 172 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 173 | func parseAction(ofpAction *openflow_13.OfpAction) goloxi.IAction { |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 174 | if logger.V(log.DebugLevel) { |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 175 | js, _ := json.Marshal(ofpAction) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 176 | logger.Debugw("parseAction called", |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 177 | log.Fields{"action": js}) |
Don Newton | 7577f07 | 2020-01-06 12:41:11 -0500 | [diff] [blame] | 178 | } |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 179 | switch ofpAction.Type { |
| 180 | case openflow_13.OfpActionType_OFPAT_OUTPUT: |
| 181 | ofpOutputAction := ofpAction.GetOutput() |
| 182 | outputAction := ofp.NewActionOutput() |
| 183 | outputAction.Port = ofp.Port(ofpOutputAction.Port) |
| 184 | outputAction.MaxLen = uint16(ofpOutputAction.MaxLen) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 185 | return outputAction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 186 | case openflow_13.OfpActionType_OFPAT_PUSH_VLAN: |
| 187 | ofpPushVlanAction := ofp.NewActionPushVlan() |
| 188 | ofpPushVlanAction.Ethertype = uint16(ofpAction.GetPush().Ethertype) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 189 | return ofpPushVlanAction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 190 | case openflow_13.OfpActionType_OFPAT_POP_VLAN: |
| 191 | ofpPopVlanAction := ofp.NewActionPopVlan() |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 192 | return ofpPopVlanAction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 193 | case openflow_13.OfpActionType_OFPAT_SET_FIELD: |
| 194 | ofpActionSetField := ofpAction.GetSetField() |
| 195 | setFieldAction := ofp.NewActionSetField() |
| 196 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 197 | iOxm := parseOxm(ofpActionSetField.GetField().GetOfbField()) |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 198 | setFieldAction.Field = iOxm |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 199 | return setFieldAction |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 200 | case openflow_13.OfpActionType_OFPAT_GROUP: |
| 201 | ofpGroupAction := ofpAction.GetGroup() |
| 202 | groupAction := ofp.NewActionGroup() |
| 203 | groupAction.GroupId = ofpGroupAction.GroupId |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 204 | return groupAction |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 205 | default: |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 206 | if logger.V(log.WarnLevel) { |
| 207 | js, _ := json.Marshal(ofpAction) |
| 208 | logger.Warnw("parseAction unknow action", |
Jonathan Hart | 60c5d77 | 2020-03-30 18:28:40 -0700 | [diff] [blame] | 209 | log.Fields{"action": js}) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 210 | } |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 211 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 212 | return nil |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 213 | } |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 214 | |
| 215 | func parsePortStats(port *voltha.LogicalPort) *ofp.PortStatsEntry { |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 216 | stats := port.OfpPortStats |
| 217 | port.OfpPort.GetPortNo() |
| 218 | var entry ofp.PortStatsEntry |
| 219 | entry.SetPortNo(ofp.Port(port.OfpPort.GetPortNo())) |
| 220 | entry.SetRxPackets(stats.GetRxPackets()) |
| 221 | entry.SetTxPackets(stats.GetTxPackets()) |
| 222 | entry.SetRxBytes(stats.GetRxBytes()) |
| 223 | entry.SetTxBytes(stats.GetTxBytes()) |
| 224 | entry.SetRxDropped(stats.GetRxDropped()) |
| 225 | entry.SetTxDropped(stats.GetTxDropped()) |
| 226 | entry.SetRxErrors(stats.GetRxErrors()) |
| 227 | entry.SetTxErrors(stats.GetTxErrors()) |
| 228 | entry.SetRxFrameErr(stats.GetRxFrameErr()) |
| 229 | entry.SetRxOverErr(stats.GetRxOverErr()) |
| 230 | entry.SetRxCrcErr(stats.GetRxCrcErr()) |
| 231 | entry.SetCollisions(stats.GetCollisions()) |
| 232 | entry.SetDurationSec(stats.GetDurationSec()) |
| 233 | entry.SetDurationNsec(stats.GetDurationNsec()) |
David K. Bainbridge | 157bdab | 2020-01-16 14:38:05 -0800 | [diff] [blame] | 234 | return &entry |
Don Newton | e0d34a8 | 2019-11-14 10:58:06 -0500 | [diff] [blame] | 235 | } |