github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/mpls/mpls.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.10.0-dev 4 // VPP: 23.10-rc0~170-g6f1548434 5 // source: core/mpls.api.json 6 7 // Package mpls contains generated bindings for API file mpls.api. 8 // 9 // Contents: 10 // - 3 structs 11 // - 18 messages 12 package mpls 13 14 import ( 15 fib_types "github.com/networkservicemesh/govpp/binapi/fib_types" 16 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 17 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 18 api "go.fd.io/govpp/api" 19 codec "go.fd.io/govpp/codec" 20 ) 21 22 // This is a compile-time assertion to ensure that this generated file 23 // is compatible with the GoVPP api package it is being compiled against. 24 // A compilation error at this line likely means your copy of the 25 // GoVPP api package needs to be updated. 26 const _ = api.GoVppAPIPackageIsVersion2 27 28 const ( 29 APIFile = "mpls" 30 APIVersion = "1.1.1" 31 VersionCrc = 0xdf2aeee2 32 ) 33 34 // MplsRoute defines type 'mpls_route'. 35 type MplsRoute struct { 36 MrTableID uint32 `binapi:"u32,name=mr_table_id" json:"mr_table_id,omitempty"` 37 MrLabel uint32 `binapi:"u32,name=mr_label" json:"mr_label,omitempty"` 38 MrEos uint8 `binapi:"u8,name=mr_eos" json:"mr_eos,omitempty"` 39 MrEosProto uint8 `binapi:"u8,name=mr_eos_proto" json:"mr_eos_proto,omitempty"` 40 MrIsMulticast bool `binapi:"bool,name=mr_is_multicast" json:"mr_is_multicast,omitempty"` 41 MrNPaths uint8 `binapi:"u8,name=mr_n_paths" json:"-"` 42 MrPaths []fib_types.FibPath `binapi:"fib_path[mr_n_paths],name=mr_paths" json:"mr_paths,omitempty"` 43 } 44 45 // MplsTable defines type 'mpls_table'. 46 type MplsTable struct { 47 MtTableID uint32 `binapi:"u32,name=mt_table_id" json:"mt_table_id,omitempty"` 48 MtName string `binapi:"string[64],name=mt_name" json:"mt_name,omitempty"` 49 } 50 51 // MplsTunnel defines type 'mpls_tunnel'. 52 type MplsTunnel struct { 53 MtSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mt_sw_if_index" json:"mt_sw_if_index,omitempty"` 54 MtTunnelIndex uint32 `binapi:"u32,name=mt_tunnel_index" json:"mt_tunnel_index,omitempty"` 55 MtL2Only bool `binapi:"bool,name=mt_l2_only" json:"mt_l2_only,omitempty"` 56 MtIsMulticast bool `binapi:"bool,name=mt_is_multicast" json:"mt_is_multicast,omitempty"` 57 MtTag string `binapi:"string[64],name=mt_tag" json:"mt_tag,omitempty"` 58 MtNPaths uint8 `binapi:"u8,name=mt_n_paths" json:"-"` 59 MtPaths []fib_types.FibPath `binapi:"fib_path[mt_n_paths],name=mt_paths" json:"mt_paths,omitempty"` 60 } 61 62 // mpls enabled interface details 63 // MplsInterfaceDetails defines message 'mpls_interface_details'. 64 type MplsInterfaceDetails struct { 65 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 66 } 67 68 func (m *MplsInterfaceDetails) Reset() { *m = MplsInterfaceDetails{} } 69 func (*MplsInterfaceDetails) GetMessageName() string { return "mpls_interface_details" } 70 func (*MplsInterfaceDetails) GetCrcString() string { return "0b45011c" } 71 func (*MplsInterfaceDetails) GetMessageType() api.MessageType { 72 return api.ReplyMessage 73 } 74 75 func (m *MplsInterfaceDetails) Size() (size int) { 76 if m == nil { 77 return 0 78 } 79 size += 4 // m.SwIfIndex 80 return size 81 } 82 func (m *MplsInterfaceDetails) Marshal(b []byte) ([]byte, error) { 83 if b == nil { 84 b = make([]byte, m.Size()) 85 } 86 buf := codec.NewBuffer(b) 87 buf.EncodeUint32(uint32(m.SwIfIndex)) 88 return buf.Bytes(), nil 89 } 90 func (m *MplsInterfaceDetails) Unmarshal(b []byte) error { 91 buf := codec.NewBuffer(b) 92 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 93 return nil 94 } 95 96 // Dump mpls enabled interface(s) 97 // - sw_if_index - sw_if_index of a specific interface, or -1 (default) 98 // to return all MPLS enabled interfaces 99 // 100 // MplsInterfaceDump defines message 'mpls_interface_dump'. 101 type MplsInterfaceDump struct { 102 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` 103 } 104 105 func (m *MplsInterfaceDump) Reset() { *m = MplsInterfaceDump{} } 106 func (*MplsInterfaceDump) GetMessageName() string { return "mpls_interface_dump" } 107 func (*MplsInterfaceDump) GetCrcString() string { return "f9e6675e" } 108 func (*MplsInterfaceDump) GetMessageType() api.MessageType { 109 return api.RequestMessage 110 } 111 112 func (m *MplsInterfaceDump) Size() (size int) { 113 if m == nil { 114 return 0 115 } 116 size += 4 // m.SwIfIndex 117 return size 118 } 119 func (m *MplsInterfaceDump) Marshal(b []byte) ([]byte, error) { 120 if b == nil { 121 b = make([]byte, m.Size()) 122 } 123 buf := codec.NewBuffer(b) 124 buf.EncodeUint32(uint32(m.SwIfIndex)) 125 return buf.Bytes(), nil 126 } 127 func (m *MplsInterfaceDump) Unmarshal(b []byte) error { 128 buf := codec.NewBuffer(b) 129 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 130 return nil 131 } 132 133 // Bind/Unbind an MPLS local label to an IP prefix. i.e. create 134 // 135 // a per-prefix label entry. 136 // - mb_mpls_table_id - The MPLS table-id the MPLS entry will be added in 137 // - mb_label - The MPLS label value to bind 138 // - mb_ip_table_id - The IP table-id of the IP prefix to bind to. 139 // - mb_is_bind - Bind or unbind 140 // - mb_is_ip4 - The prefix to bind to is IPv4 141 // - mb_prefix - IP prefix 142 // 143 // MplsIPBindUnbind defines message 'mpls_ip_bind_unbind'. 144 type MplsIPBindUnbind struct { 145 MbMplsTableID uint32 `binapi:"u32,name=mb_mpls_table_id" json:"mb_mpls_table_id,omitempty"` 146 MbLabel uint32 `binapi:"u32,name=mb_label" json:"mb_label,omitempty"` 147 MbIPTableID uint32 `binapi:"u32,name=mb_ip_table_id" json:"mb_ip_table_id,omitempty"` 148 MbIsBind bool `binapi:"bool,name=mb_is_bind" json:"mb_is_bind,omitempty"` 149 MbPrefix ip_types.Prefix `binapi:"prefix,name=mb_prefix" json:"mb_prefix,omitempty"` 150 } 151 152 func (m *MplsIPBindUnbind) Reset() { *m = MplsIPBindUnbind{} } 153 func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" } 154 func (*MplsIPBindUnbind) GetCrcString() string { return "c7533b32" } 155 func (*MplsIPBindUnbind) GetMessageType() api.MessageType { 156 return api.RequestMessage 157 } 158 159 func (m *MplsIPBindUnbind) Size() (size int) { 160 if m == nil { 161 return 0 162 } 163 size += 4 // m.MbMplsTableID 164 size += 4 // m.MbLabel 165 size += 4 // m.MbIPTableID 166 size += 1 // m.MbIsBind 167 size += 1 // m.MbPrefix.Address.Af 168 size += 1 * 16 // m.MbPrefix.Address.Un 169 size += 1 // m.MbPrefix.Len 170 return size 171 } 172 func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) { 173 if b == nil { 174 b = make([]byte, m.Size()) 175 } 176 buf := codec.NewBuffer(b) 177 buf.EncodeUint32(m.MbMplsTableID) 178 buf.EncodeUint32(m.MbLabel) 179 buf.EncodeUint32(m.MbIPTableID) 180 buf.EncodeBool(m.MbIsBind) 181 buf.EncodeUint8(uint8(m.MbPrefix.Address.Af)) 182 buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 16) 183 buf.EncodeUint8(m.MbPrefix.Len) 184 return buf.Bytes(), nil 185 } 186 func (m *MplsIPBindUnbind) Unmarshal(b []byte) error { 187 buf := codec.NewBuffer(b) 188 m.MbMplsTableID = buf.DecodeUint32() 189 m.MbLabel = buf.DecodeUint32() 190 m.MbIPTableID = buf.DecodeUint32() 191 m.MbIsBind = buf.DecodeBool() 192 m.MbPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 193 copy(m.MbPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 194 m.MbPrefix.Len = buf.DecodeUint8() 195 return nil 196 } 197 198 // MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'. 199 type MplsIPBindUnbindReply struct { 200 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 201 } 202 203 func (m *MplsIPBindUnbindReply) Reset() { *m = MplsIPBindUnbindReply{} } 204 func (*MplsIPBindUnbindReply) GetMessageName() string { return "mpls_ip_bind_unbind_reply" } 205 func (*MplsIPBindUnbindReply) GetCrcString() string { return "e8d4e804" } 206 func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType { 207 return api.ReplyMessage 208 } 209 210 func (m *MplsIPBindUnbindReply) Size() (size int) { 211 if m == nil { 212 return 0 213 } 214 size += 4 // m.Retval 215 return size 216 } 217 func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) { 218 if b == nil { 219 b = make([]byte, m.Size()) 220 } 221 buf := codec.NewBuffer(b) 222 buf.EncodeInt32(m.Retval) 223 return buf.Bytes(), nil 224 } 225 func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error { 226 buf := codec.NewBuffer(b) 227 m.Retval = buf.DecodeInt32() 228 return nil 229 } 230 231 // MPLS Route Add / del route 232 // - mr_table_id - The MPLS table-id the route is added in 233 // - mr_is_add - Is this a route add or delete 234 // - mr_is_multipath - Is this route update a multipath - i.e. is this 235 // a path addition to an existing route 236 // - mr_route - The Route 237 // 238 // MplsRouteAddDel defines message 'mpls_route_add_del'. 239 type MplsRouteAddDel struct { 240 MrIsAdd bool `binapi:"bool,name=mr_is_add" json:"mr_is_add,omitempty"` 241 MrIsMultipath bool `binapi:"bool,name=mr_is_multipath" json:"mr_is_multipath,omitempty"` 242 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"` 243 } 244 245 func (m *MplsRouteAddDel) Reset() { *m = MplsRouteAddDel{} } 246 func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" } 247 func (*MplsRouteAddDel) GetCrcString() string { return "8e1d1e07" } 248 func (*MplsRouteAddDel) GetMessageType() api.MessageType { 249 return api.RequestMessage 250 } 251 252 func (m *MplsRouteAddDel) Size() (size int) { 253 if m == nil { 254 return 0 255 } 256 size += 1 // m.MrIsAdd 257 size += 1 // m.MrIsMultipath 258 size += 4 // m.MrRoute.MrTableID 259 size += 4 // m.MrRoute.MrLabel 260 size += 1 // m.MrRoute.MrEos 261 size += 1 // m.MrRoute.MrEosProto 262 size += 1 // m.MrRoute.MrIsMulticast 263 size += 1 // m.MrRoute.MrNPaths 264 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ { 265 var s2 fib_types.FibPath 266 _ = s2 267 if j2 < len(m.MrRoute.MrPaths) { 268 s2 = m.MrRoute.MrPaths[j2] 269 } 270 size += 4 // s2.SwIfIndex 271 size += 4 // s2.TableID 272 size += 4 // s2.RpfID 273 size += 1 // s2.Weight 274 size += 1 // s2.Preference 275 size += 4 // s2.Type 276 size += 4 // s2.Flags 277 size += 4 // s2.Proto 278 size += 1 * 16 // s2.Nh.Address 279 size += 4 // s2.Nh.ViaLabel 280 size += 4 // s2.Nh.ObjID 281 size += 4 // s2.Nh.ClassifyTableIndex 282 size += 1 // s2.NLabels 283 for j3 := 0; j3 < 16; j3++ { 284 size += 1 // s2.LabelStack[j3].IsUniform 285 size += 4 // s2.LabelStack[j3].Label 286 size += 1 // s2.LabelStack[j3].TTL 287 size += 1 // s2.LabelStack[j3].Exp 288 } 289 } 290 return size 291 } 292 func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) { 293 if b == nil { 294 b = make([]byte, m.Size()) 295 } 296 buf := codec.NewBuffer(b) 297 buf.EncodeBool(m.MrIsAdd) 298 buf.EncodeBool(m.MrIsMultipath) 299 buf.EncodeUint32(m.MrRoute.MrTableID) 300 buf.EncodeUint32(m.MrRoute.MrLabel) 301 buf.EncodeUint8(m.MrRoute.MrEos) 302 buf.EncodeUint8(m.MrRoute.MrEosProto) 303 buf.EncodeBool(m.MrRoute.MrIsMulticast) 304 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths))) 305 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { 306 var v1 fib_types.FibPath // MrPaths 307 if j1 < len(m.MrRoute.MrPaths) { 308 v1 = m.MrRoute.MrPaths[j1] 309 } 310 buf.EncodeUint32(v1.SwIfIndex) 311 buf.EncodeUint32(v1.TableID) 312 buf.EncodeUint32(v1.RpfID) 313 buf.EncodeUint8(v1.Weight) 314 buf.EncodeUint8(v1.Preference) 315 buf.EncodeUint32(uint32(v1.Type)) 316 buf.EncodeUint32(uint32(v1.Flags)) 317 buf.EncodeUint32(uint32(v1.Proto)) 318 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) 319 buf.EncodeUint32(v1.Nh.ViaLabel) 320 buf.EncodeUint32(v1.Nh.ObjID) 321 buf.EncodeUint32(v1.Nh.ClassifyTableIndex) 322 buf.EncodeUint8(v1.NLabels) 323 for j2 := 0; j2 < 16; j2++ { 324 buf.EncodeUint8(v1.LabelStack[j2].IsUniform) 325 buf.EncodeUint32(v1.LabelStack[j2].Label) 326 buf.EncodeUint8(v1.LabelStack[j2].TTL) 327 buf.EncodeUint8(v1.LabelStack[j2].Exp) 328 } 329 } 330 return buf.Bytes(), nil 331 } 332 func (m *MplsRouteAddDel) Unmarshal(b []byte) error { 333 buf := codec.NewBuffer(b) 334 m.MrIsAdd = buf.DecodeBool() 335 m.MrIsMultipath = buf.DecodeBool() 336 m.MrRoute.MrTableID = buf.DecodeUint32() 337 m.MrRoute.MrLabel = buf.DecodeUint32() 338 m.MrRoute.MrEos = buf.DecodeUint8() 339 m.MrRoute.MrEosProto = buf.DecodeUint8() 340 m.MrRoute.MrIsMulticast = buf.DecodeBool() 341 m.MrRoute.MrNPaths = buf.DecodeUint8() 342 m.MrRoute.MrPaths = make([]fib_types.FibPath, m.MrRoute.MrNPaths) 343 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { 344 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32() 345 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32() 346 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32() 347 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8() 348 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8() 349 m.MrRoute.MrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) 350 m.MrRoute.MrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) 351 m.MrRoute.MrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) 352 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) 353 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() 354 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32() 355 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() 356 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8() 357 for j2 := 0; j2 < 16; j2++ { 358 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() 359 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() 360 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() 361 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() 362 } 363 } 364 return nil 365 } 366 367 // MplsRouteAddDelReply defines message 'mpls_route_add_del_reply'. 368 type MplsRouteAddDelReply struct { 369 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 370 StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` 371 } 372 373 func (m *MplsRouteAddDelReply) Reset() { *m = MplsRouteAddDelReply{} } 374 func (*MplsRouteAddDelReply) GetMessageName() string { return "mpls_route_add_del_reply" } 375 func (*MplsRouteAddDelReply) GetCrcString() string { return "1992deab" } 376 func (*MplsRouteAddDelReply) GetMessageType() api.MessageType { 377 return api.ReplyMessage 378 } 379 380 func (m *MplsRouteAddDelReply) Size() (size int) { 381 if m == nil { 382 return 0 383 } 384 size += 4 // m.Retval 385 size += 4 // m.StatsIndex 386 return size 387 } 388 func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) { 389 if b == nil { 390 b = make([]byte, m.Size()) 391 } 392 buf := codec.NewBuffer(b) 393 buf.EncodeInt32(m.Retval) 394 buf.EncodeUint32(m.StatsIndex) 395 return buf.Bytes(), nil 396 } 397 func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error { 398 buf := codec.NewBuffer(b) 399 m.Retval = buf.DecodeInt32() 400 m.StatsIndex = buf.DecodeUint32() 401 return nil 402 } 403 404 // mpls FIB table response 405 // - table_id - MPLS fib table id 406 // - s_bit - End-of-stack bit 407 // - label - MPLS label value 408 // - count - the number of fib_path in path 409 // - path - array of of fib_path structures 410 // 411 // MplsRouteDetails defines message 'mpls_route_details'. 412 type MplsRouteDetails struct { 413 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"` 414 } 415 416 func (m *MplsRouteDetails) Reset() { *m = MplsRouteDetails{} } 417 func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" } 418 func (*MplsRouteDetails) GetCrcString() string { return "9b5043dc" } 419 func (*MplsRouteDetails) GetMessageType() api.MessageType { 420 return api.ReplyMessage 421 } 422 423 func (m *MplsRouteDetails) Size() (size int) { 424 if m == nil { 425 return 0 426 } 427 size += 4 // m.MrRoute.MrTableID 428 size += 4 // m.MrRoute.MrLabel 429 size += 1 // m.MrRoute.MrEos 430 size += 1 // m.MrRoute.MrEosProto 431 size += 1 // m.MrRoute.MrIsMulticast 432 size += 1 // m.MrRoute.MrNPaths 433 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ { 434 var s2 fib_types.FibPath 435 _ = s2 436 if j2 < len(m.MrRoute.MrPaths) { 437 s2 = m.MrRoute.MrPaths[j2] 438 } 439 size += 4 // s2.SwIfIndex 440 size += 4 // s2.TableID 441 size += 4 // s2.RpfID 442 size += 1 // s2.Weight 443 size += 1 // s2.Preference 444 size += 4 // s2.Type 445 size += 4 // s2.Flags 446 size += 4 // s2.Proto 447 size += 1 * 16 // s2.Nh.Address 448 size += 4 // s2.Nh.ViaLabel 449 size += 4 // s2.Nh.ObjID 450 size += 4 // s2.Nh.ClassifyTableIndex 451 size += 1 // s2.NLabels 452 for j3 := 0; j3 < 16; j3++ { 453 size += 1 // s2.LabelStack[j3].IsUniform 454 size += 4 // s2.LabelStack[j3].Label 455 size += 1 // s2.LabelStack[j3].TTL 456 size += 1 // s2.LabelStack[j3].Exp 457 } 458 } 459 return size 460 } 461 func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) { 462 if b == nil { 463 b = make([]byte, m.Size()) 464 } 465 buf := codec.NewBuffer(b) 466 buf.EncodeUint32(m.MrRoute.MrTableID) 467 buf.EncodeUint32(m.MrRoute.MrLabel) 468 buf.EncodeUint8(m.MrRoute.MrEos) 469 buf.EncodeUint8(m.MrRoute.MrEosProto) 470 buf.EncodeBool(m.MrRoute.MrIsMulticast) 471 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths))) 472 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { 473 var v1 fib_types.FibPath // MrPaths 474 if j1 < len(m.MrRoute.MrPaths) { 475 v1 = m.MrRoute.MrPaths[j1] 476 } 477 buf.EncodeUint32(v1.SwIfIndex) 478 buf.EncodeUint32(v1.TableID) 479 buf.EncodeUint32(v1.RpfID) 480 buf.EncodeUint8(v1.Weight) 481 buf.EncodeUint8(v1.Preference) 482 buf.EncodeUint32(uint32(v1.Type)) 483 buf.EncodeUint32(uint32(v1.Flags)) 484 buf.EncodeUint32(uint32(v1.Proto)) 485 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) 486 buf.EncodeUint32(v1.Nh.ViaLabel) 487 buf.EncodeUint32(v1.Nh.ObjID) 488 buf.EncodeUint32(v1.Nh.ClassifyTableIndex) 489 buf.EncodeUint8(v1.NLabels) 490 for j2 := 0; j2 < 16; j2++ { 491 buf.EncodeUint8(v1.LabelStack[j2].IsUniform) 492 buf.EncodeUint32(v1.LabelStack[j2].Label) 493 buf.EncodeUint8(v1.LabelStack[j2].TTL) 494 buf.EncodeUint8(v1.LabelStack[j2].Exp) 495 } 496 } 497 return buf.Bytes(), nil 498 } 499 func (m *MplsRouteDetails) Unmarshal(b []byte) error { 500 buf := codec.NewBuffer(b) 501 m.MrRoute.MrTableID = buf.DecodeUint32() 502 m.MrRoute.MrLabel = buf.DecodeUint32() 503 m.MrRoute.MrEos = buf.DecodeUint8() 504 m.MrRoute.MrEosProto = buf.DecodeUint8() 505 m.MrRoute.MrIsMulticast = buf.DecodeBool() 506 m.MrRoute.MrNPaths = buf.DecodeUint8() 507 m.MrRoute.MrPaths = make([]fib_types.FibPath, m.MrRoute.MrNPaths) 508 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { 509 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32() 510 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32() 511 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32() 512 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8() 513 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8() 514 m.MrRoute.MrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) 515 m.MrRoute.MrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) 516 m.MrRoute.MrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) 517 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) 518 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() 519 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32() 520 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() 521 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8() 522 for j2 := 0; j2 < 16; j2++ { 523 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() 524 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() 525 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() 526 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() 527 } 528 } 529 return nil 530 } 531 532 // Dump MPLS fib table 533 // MplsRouteDump defines message 'mpls_route_dump'. 534 type MplsRouteDump struct { 535 Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"` 536 } 537 538 func (m *MplsRouteDump) Reset() { *m = MplsRouteDump{} } 539 func (*MplsRouteDump) GetMessageName() string { return "mpls_route_dump" } 540 func (*MplsRouteDump) GetCrcString() string { return "935fdefa" } 541 func (*MplsRouteDump) GetMessageType() api.MessageType { 542 return api.RequestMessage 543 } 544 545 func (m *MplsRouteDump) Size() (size int) { 546 if m == nil { 547 return 0 548 } 549 size += 4 // m.Table.MtTableID 550 size += 64 // m.Table.MtName 551 return size 552 } 553 func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) { 554 if b == nil { 555 b = make([]byte, m.Size()) 556 } 557 buf := codec.NewBuffer(b) 558 buf.EncodeUint32(m.Table.MtTableID) 559 buf.EncodeString(m.Table.MtName, 64) 560 return buf.Bytes(), nil 561 } 562 func (m *MplsRouteDump) Unmarshal(b []byte) error { 563 buf := codec.NewBuffer(b) 564 m.Table.MtTableID = buf.DecodeUint32() 565 m.Table.MtName = buf.DecodeString(64) 566 return nil 567 } 568 569 // MPLS Route Add / del route 570 // - mt_table_id - The MPLS table-id the route is added in 571 // - mt_is_add - Is this a route add or delete 572 // - mt_name - A client provided name/tag for the table. If this 573 // is not set by the client, then VPP will generate 574 // something meaningful. 575 // 576 // MplsTableAddDel defines message 'mpls_table_add_del'. 577 type MplsTableAddDel struct { 578 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"` 579 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"` 580 } 581 582 func (m *MplsTableAddDel) Reset() { *m = MplsTableAddDel{} } 583 func (*MplsTableAddDel) GetMessageName() string { return "mpls_table_add_del" } 584 func (*MplsTableAddDel) GetCrcString() string { return "57817512" } 585 func (*MplsTableAddDel) GetMessageType() api.MessageType { 586 return api.RequestMessage 587 } 588 589 func (m *MplsTableAddDel) Size() (size int) { 590 if m == nil { 591 return 0 592 } 593 size += 1 // m.MtIsAdd 594 size += 4 // m.MtTable.MtTableID 595 size += 64 // m.MtTable.MtName 596 return size 597 } 598 func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) { 599 if b == nil { 600 b = make([]byte, m.Size()) 601 } 602 buf := codec.NewBuffer(b) 603 buf.EncodeBool(m.MtIsAdd) 604 buf.EncodeUint32(m.MtTable.MtTableID) 605 buf.EncodeString(m.MtTable.MtName, 64) 606 return buf.Bytes(), nil 607 } 608 func (m *MplsTableAddDel) Unmarshal(b []byte) error { 609 buf := codec.NewBuffer(b) 610 m.MtIsAdd = buf.DecodeBool() 611 m.MtTable.MtTableID = buf.DecodeUint32() 612 m.MtTable.MtName = buf.DecodeString(64) 613 return nil 614 } 615 616 // MplsTableAddDelReply defines message 'mpls_table_add_del_reply'. 617 type MplsTableAddDelReply struct { 618 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 619 } 620 621 func (m *MplsTableAddDelReply) Reset() { *m = MplsTableAddDelReply{} } 622 func (*MplsTableAddDelReply) GetMessageName() string { return "mpls_table_add_del_reply" } 623 func (*MplsTableAddDelReply) GetCrcString() string { return "e8d4e804" } 624 func (*MplsTableAddDelReply) GetMessageType() api.MessageType { 625 return api.ReplyMessage 626 } 627 628 func (m *MplsTableAddDelReply) Size() (size int) { 629 if m == nil { 630 return 0 631 } 632 size += 4 // m.Retval 633 return size 634 } 635 func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) { 636 if b == nil { 637 b = make([]byte, m.Size()) 638 } 639 buf := codec.NewBuffer(b) 640 buf.EncodeInt32(m.Retval) 641 return buf.Bytes(), nil 642 } 643 func (m *MplsTableAddDelReply) Unmarshal(b []byte) error { 644 buf := codec.NewBuffer(b) 645 m.Retval = buf.DecodeInt32() 646 return nil 647 } 648 649 // MplsTableDetails defines message 'mpls_table_details'. 650 type MplsTableDetails struct { 651 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"` 652 } 653 654 func (m *MplsTableDetails) Reset() { *m = MplsTableDetails{} } 655 func (*MplsTableDetails) GetMessageName() string { return "mpls_table_details" } 656 func (*MplsTableDetails) GetCrcString() string { return "f03ecdc8" } 657 func (*MplsTableDetails) GetMessageType() api.MessageType { 658 return api.ReplyMessage 659 } 660 661 func (m *MplsTableDetails) Size() (size int) { 662 if m == nil { 663 return 0 664 } 665 size += 4 // m.MtTable.MtTableID 666 size += 64 // m.MtTable.MtName 667 return size 668 } 669 func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) { 670 if b == nil { 671 b = make([]byte, m.Size()) 672 } 673 buf := codec.NewBuffer(b) 674 buf.EncodeUint32(m.MtTable.MtTableID) 675 buf.EncodeString(m.MtTable.MtName, 64) 676 return buf.Bytes(), nil 677 } 678 func (m *MplsTableDetails) Unmarshal(b []byte) error { 679 buf := codec.NewBuffer(b) 680 m.MtTable.MtTableID = buf.DecodeUint32() 681 m.MtTable.MtName = buf.DecodeString(64) 682 return nil 683 } 684 685 // Dump MPLS fib table 686 // MplsTableDump defines message 'mpls_table_dump'. 687 type MplsTableDump struct{} 688 689 func (m *MplsTableDump) Reset() { *m = MplsTableDump{} } 690 func (*MplsTableDump) GetMessageName() string { return "mpls_table_dump" } 691 func (*MplsTableDump) GetCrcString() string { return "51077d14" } 692 func (*MplsTableDump) GetMessageType() api.MessageType { 693 return api.RequestMessage 694 } 695 696 func (m *MplsTableDump) Size() (size int) { 697 if m == nil { 698 return 0 699 } 700 return size 701 } 702 func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) { 703 if b == nil { 704 b = make([]byte, m.Size()) 705 } 706 buf := codec.NewBuffer(b) 707 return buf.Bytes(), nil 708 } 709 func (m *MplsTableDump) Unmarshal(b []byte) error { 710 return nil 711 } 712 713 // MplsTunnelAddDel defines message 'mpls_tunnel_add_del'. 714 type MplsTunnelAddDel struct { 715 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"` 716 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"` 717 } 718 719 func (m *MplsTunnelAddDel) Reset() { *m = MplsTunnelAddDel{} } 720 func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" } 721 func (*MplsTunnelAddDel) GetCrcString() string { return "44350ac1" } 722 func (*MplsTunnelAddDel) GetMessageType() api.MessageType { 723 return api.RequestMessage 724 } 725 726 func (m *MplsTunnelAddDel) Size() (size int) { 727 if m == nil { 728 return 0 729 } 730 size += 1 // m.MtIsAdd 731 size += 4 // m.MtTunnel.MtSwIfIndex 732 size += 4 // m.MtTunnel.MtTunnelIndex 733 size += 1 // m.MtTunnel.MtL2Only 734 size += 1 // m.MtTunnel.MtIsMulticast 735 size += 64 // m.MtTunnel.MtTag 736 size += 1 // m.MtTunnel.MtNPaths 737 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ { 738 var s2 fib_types.FibPath 739 _ = s2 740 if j2 < len(m.MtTunnel.MtPaths) { 741 s2 = m.MtTunnel.MtPaths[j2] 742 } 743 size += 4 // s2.SwIfIndex 744 size += 4 // s2.TableID 745 size += 4 // s2.RpfID 746 size += 1 // s2.Weight 747 size += 1 // s2.Preference 748 size += 4 // s2.Type 749 size += 4 // s2.Flags 750 size += 4 // s2.Proto 751 size += 1 * 16 // s2.Nh.Address 752 size += 4 // s2.Nh.ViaLabel 753 size += 4 // s2.Nh.ObjID 754 size += 4 // s2.Nh.ClassifyTableIndex 755 size += 1 // s2.NLabels 756 for j3 := 0; j3 < 16; j3++ { 757 size += 1 // s2.LabelStack[j3].IsUniform 758 size += 4 // s2.LabelStack[j3].Label 759 size += 1 // s2.LabelStack[j3].TTL 760 size += 1 // s2.LabelStack[j3].Exp 761 } 762 } 763 return size 764 } 765 func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) { 766 if b == nil { 767 b = make([]byte, m.Size()) 768 } 769 buf := codec.NewBuffer(b) 770 buf.EncodeBool(m.MtIsAdd) 771 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex)) 772 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex) 773 buf.EncodeBool(m.MtTunnel.MtL2Only) 774 buf.EncodeBool(m.MtTunnel.MtIsMulticast) 775 buf.EncodeString(m.MtTunnel.MtTag, 64) 776 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths))) 777 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { 778 var v1 fib_types.FibPath // MtPaths 779 if j1 < len(m.MtTunnel.MtPaths) { 780 v1 = m.MtTunnel.MtPaths[j1] 781 } 782 buf.EncodeUint32(v1.SwIfIndex) 783 buf.EncodeUint32(v1.TableID) 784 buf.EncodeUint32(v1.RpfID) 785 buf.EncodeUint8(v1.Weight) 786 buf.EncodeUint8(v1.Preference) 787 buf.EncodeUint32(uint32(v1.Type)) 788 buf.EncodeUint32(uint32(v1.Flags)) 789 buf.EncodeUint32(uint32(v1.Proto)) 790 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) 791 buf.EncodeUint32(v1.Nh.ViaLabel) 792 buf.EncodeUint32(v1.Nh.ObjID) 793 buf.EncodeUint32(v1.Nh.ClassifyTableIndex) 794 buf.EncodeUint8(v1.NLabels) 795 for j2 := 0; j2 < 16; j2++ { 796 buf.EncodeUint8(v1.LabelStack[j2].IsUniform) 797 buf.EncodeUint32(v1.LabelStack[j2].Label) 798 buf.EncodeUint8(v1.LabelStack[j2].TTL) 799 buf.EncodeUint8(v1.LabelStack[j2].Exp) 800 } 801 } 802 return buf.Bytes(), nil 803 } 804 func (m *MplsTunnelAddDel) Unmarshal(b []byte) error { 805 buf := codec.NewBuffer(b) 806 m.MtIsAdd = buf.DecodeBool() 807 m.MtTunnel.MtSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 808 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32() 809 m.MtTunnel.MtL2Only = buf.DecodeBool() 810 m.MtTunnel.MtIsMulticast = buf.DecodeBool() 811 m.MtTunnel.MtTag = buf.DecodeString(64) 812 m.MtTunnel.MtNPaths = buf.DecodeUint8() 813 m.MtTunnel.MtPaths = make([]fib_types.FibPath, m.MtTunnel.MtNPaths) 814 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { 815 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32() 816 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32() 817 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32() 818 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8() 819 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8() 820 m.MtTunnel.MtPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) 821 m.MtTunnel.MtPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) 822 m.MtTunnel.MtPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) 823 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) 824 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32() 825 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32() 826 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() 827 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8() 828 for j2 := 0; j2 < 16; j2++ { 829 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() 830 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() 831 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() 832 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() 833 } 834 } 835 return nil 836 } 837 838 // Reply for MPLS tunnel add / del request 839 // - retval - return code 840 // - sw_if_index - SW interface index of the tunnel created 841 // 842 // MplsTunnelAddDelReply defines message 'mpls_tunnel_add_del_reply'. 843 type MplsTunnelAddDelReply struct { 844 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 845 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 846 TunnelIndex uint32 `binapi:"u32,name=tunnel_index" json:"tunnel_index,omitempty"` 847 } 848 849 func (m *MplsTunnelAddDelReply) Reset() { *m = MplsTunnelAddDelReply{} } 850 func (*MplsTunnelAddDelReply) GetMessageName() string { return "mpls_tunnel_add_del_reply" } 851 func (*MplsTunnelAddDelReply) GetCrcString() string { return "afb01472" } 852 func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType { 853 return api.ReplyMessage 854 } 855 856 func (m *MplsTunnelAddDelReply) Size() (size int) { 857 if m == nil { 858 return 0 859 } 860 size += 4 // m.Retval 861 size += 4 // m.SwIfIndex 862 size += 4 // m.TunnelIndex 863 return size 864 } 865 func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { 866 if b == nil { 867 b = make([]byte, m.Size()) 868 } 869 buf := codec.NewBuffer(b) 870 buf.EncodeInt32(m.Retval) 871 buf.EncodeUint32(uint32(m.SwIfIndex)) 872 buf.EncodeUint32(m.TunnelIndex) 873 return buf.Bytes(), nil 874 } 875 func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error { 876 buf := codec.NewBuffer(b) 877 m.Retval = buf.DecodeInt32() 878 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 879 m.TunnelIndex = buf.DecodeUint32() 880 return nil 881 } 882 883 // mpls tunnel details 884 // MplsTunnelDetails defines message 'mpls_tunnel_details'. 885 type MplsTunnelDetails struct { 886 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"` 887 } 888 889 func (m *MplsTunnelDetails) Reset() { *m = MplsTunnelDetails{} } 890 func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" } 891 func (*MplsTunnelDetails) GetCrcString() string { return "57118ae3" } 892 func (*MplsTunnelDetails) GetMessageType() api.MessageType { 893 return api.ReplyMessage 894 } 895 896 func (m *MplsTunnelDetails) Size() (size int) { 897 if m == nil { 898 return 0 899 } 900 size += 4 // m.MtTunnel.MtSwIfIndex 901 size += 4 // m.MtTunnel.MtTunnelIndex 902 size += 1 // m.MtTunnel.MtL2Only 903 size += 1 // m.MtTunnel.MtIsMulticast 904 size += 64 // m.MtTunnel.MtTag 905 size += 1 // m.MtTunnel.MtNPaths 906 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ { 907 var s2 fib_types.FibPath 908 _ = s2 909 if j2 < len(m.MtTunnel.MtPaths) { 910 s2 = m.MtTunnel.MtPaths[j2] 911 } 912 size += 4 // s2.SwIfIndex 913 size += 4 // s2.TableID 914 size += 4 // s2.RpfID 915 size += 1 // s2.Weight 916 size += 1 // s2.Preference 917 size += 4 // s2.Type 918 size += 4 // s2.Flags 919 size += 4 // s2.Proto 920 size += 1 * 16 // s2.Nh.Address 921 size += 4 // s2.Nh.ViaLabel 922 size += 4 // s2.Nh.ObjID 923 size += 4 // s2.Nh.ClassifyTableIndex 924 size += 1 // s2.NLabels 925 for j3 := 0; j3 < 16; j3++ { 926 size += 1 // s2.LabelStack[j3].IsUniform 927 size += 4 // s2.LabelStack[j3].Label 928 size += 1 // s2.LabelStack[j3].TTL 929 size += 1 // s2.LabelStack[j3].Exp 930 } 931 } 932 return size 933 } 934 func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) { 935 if b == nil { 936 b = make([]byte, m.Size()) 937 } 938 buf := codec.NewBuffer(b) 939 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex)) 940 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex) 941 buf.EncodeBool(m.MtTunnel.MtL2Only) 942 buf.EncodeBool(m.MtTunnel.MtIsMulticast) 943 buf.EncodeString(m.MtTunnel.MtTag, 64) 944 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths))) 945 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { 946 var v1 fib_types.FibPath // MtPaths 947 if j1 < len(m.MtTunnel.MtPaths) { 948 v1 = m.MtTunnel.MtPaths[j1] 949 } 950 buf.EncodeUint32(v1.SwIfIndex) 951 buf.EncodeUint32(v1.TableID) 952 buf.EncodeUint32(v1.RpfID) 953 buf.EncodeUint8(v1.Weight) 954 buf.EncodeUint8(v1.Preference) 955 buf.EncodeUint32(uint32(v1.Type)) 956 buf.EncodeUint32(uint32(v1.Flags)) 957 buf.EncodeUint32(uint32(v1.Proto)) 958 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) 959 buf.EncodeUint32(v1.Nh.ViaLabel) 960 buf.EncodeUint32(v1.Nh.ObjID) 961 buf.EncodeUint32(v1.Nh.ClassifyTableIndex) 962 buf.EncodeUint8(v1.NLabels) 963 for j2 := 0; j2 < 16; j2++ { 964 buf.EncodeUint8(v1.LabelStack[j2].IsUniform) 965 buf.EncodeUint32(v1.LabelStack[j2].Label) 966 buf.EncodeUint8(v1.LabelStack[j2].TTL) 967 buf.EncodeUint8(v1.LabelStack[j2].Exp) 968 } 969 } 970 return buf.Bytes(), nil 971 } 972 func (m *MplsTunnelDetails) Unmarshal(b []byte) error { 973 buf := codec.NewBuffer(b) 974 m.MtTunnel.MtSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 975 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32() 976 m.MtTunnel.MtL2Only = buf.DecodeBool() 977 m.MtTunnel.MtIsMulticast = buf.DecodeBool() 978 m.MtTunnel.MtTag = buf.DecodeString(64) 979 m.MtTunnel.MtNPaths = buf.DecodeUint8() 980 m.MtTunnel.MtPaths = make([]fib_types.FibPath, m.MtTunnel.MtNPaths) 981 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { 982 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32() 983 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32() 984 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32() 985 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8() 986 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8() 987 m.MtTunnel.MtPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) 988 m.MtTunnel.MtPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) 989 m.MtTunnel.MtPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) 990 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) 991 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32() 992 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32() 993 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() 994 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8() 995 for j2 := 0; j2 < 16; j2++ { 996 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() 997 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() 998 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() 999 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() 1000 } 1001 } 1002 return nil 1003 } 1004 1005 // Dump mpls eth tunnel table 1006 // - sw_if_index - sw_if_index of the MPLS tunnel 1007 // (as returned from the create) 1008 // 1009 // MplsTunnelDump defines message 'mpls_tunnel_dump'. 1010 type MplsTunnelDump struct { 1011 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` 1012 } 1013 1014 func (m *MplsTunnelDump) Reset() { *m = MplsTunnelDump{} } 1015 func (*MplsTunnelDump) GetMessageName() string { return "mpls_tunnel_dump" } 1016 func (*MplsTunnelDump) GetCrcString() string { return "f9e6675e" } 1017 func (*MplsTunnelDump) GetMessageType() api.MessageType { 1018 return api.RequestMessage 1019 } 1020 1021 func (m *MplsTunnelDump) Size() (size int) { 1022 if m == nil { 1023 return 0 1024 } 1025 size += 4 // m.SwIfIndex 1026 return size 1027 } 1028 func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) { 1029 if b == nil { 1030 b = make([]byte, m.Size()) 1031 } 1032 buf := codec.NewBuffer(b) 1033 buf.EncodeUint32(uint32(m.SwIfIndex)) 1034 return buf.Bytes(), nil 1035 } 1036 func (m *MplsTunnelDump) Unmarshal(b []byte) error { 1037 buf := codec.NewBuffer(b) 1038 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 1039 return nil 1040 } 1041 1042 // Enable or Disable MPLS on and interface 1043 // - sw_if_index - index of the interface 1044 // - enable - if non-zero enable, else disable 1045 // 1046 // SwInterfaceSetMplsEnable defines message 'sw_interface_set_mpls_enable'. 1047 type SwInterfaceSetMplsEnable struct { 1048 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 1049 Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` 1050 } 1051 1052 func (m *SwInterfaceSetMplsEnable) Reset() { *m = SwInterfaceSetMplsEnable{} } 1053 func (*SwInterfaceSetMplsEnable) GetMessageName() string { return "sw_interface_set_mpls_enable" } 1054 func (*SwInterfaceSetMplsEnable) GetCrcString() string { return "ae6cfcfb" } 1055 func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType { 1056 return api.RequestMessage 1057 } 1058 1059 func (m *SwInterfaceSetMplsEnable) Size() (size int) { 1060 if m == nil { 1061 return 0 1062 } 1063 size += 4 // m.SwIfIndex 1064 size += 1 // m.Enable 1065 return size 1066 } 1067 func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) { 1068 if b == nil { 1069 b = make([]byte, m.Size()) 1070 } 1071 buf := codec.NewBuffer(b) 1072 buf.EncodeUint32(uint32(m.SwIfIndex)) 1073 buf.EncodeBool(m.Enable) 1074 return buf.Bytes(), nil 1075 } 1076 func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error { 1077 buf := codec.NewBuffer(b) 1078 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 1079 m.Enable = buf.DecodeBool() 1080 return nil 1081 } 1082 1083 // SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'. 1084 type SwInterfaceSetMplsEnableReply struct { 1085 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 1086 } 1087 1088 func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} } 1089 func (*SwInterfaceSetMplsEnableReply) GetMessageName() string { 1090 return "sw_interface_set_mpls_enable_reply" 1091 } 1092 func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" } 1093 func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType { 1094 return api.ReplyMessage 1095 } 1096 1097 func (m *SwInterfaceSetMplsEnableReply) Size() (size int) { 1098 if m == nil { 1099 return 0 1100 } 1101 size += 4 // m.Retval 1102 return size 1103 } 1104 func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) { 1105 if b == nil { 1106 b = make([]byte, m.Size()) 1107 } 1108 buf := codec.NewBuffer(b) 1109 buf.EncodeInt32(m.Retval) 1110 return buf.Bytes(), nil 1111 } 1112 func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error { 1113 buf := codec.NewBuffer(b) 1114 m.Retval = buf.DecodeInt32() 1115 return nil 1116 } 1117 1118 func init() { file_mpls_binapi_init() } 1119 func file_mpls_binapi_init() { 1120 api.RegisterMessage((*MplsInterfaceDetails)(nil), "mpls_interface_details_0b45011c") 1121 api.RegisterMessage((*MplsInterfaceDump)(nil), "mpls_interface_dump_f9e6675e") 1122 api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_c7533b32") 1123 api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804") 1124 api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_8e1d1e07") 1125 api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab") 1126 api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_9b5043dc") 1127 api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa") 1128 api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512") 1129 api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804") 1130 api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8") 1131 api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14") 1132 api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_44350ac1") 1133 api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472") 1134 api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_57118ae3") 1135 api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e") 1136 api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb") 1137 api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804") 1138 } 1139 1140 // Messages returns list of all messages in this module. 1141 func AllMessages() []api.Message { 1142 return []api.Message{ 1143 (*MplsInterfaceDetails)(nil), 1144 (*MplsInterfaceDump)(nil), 1145 (*MplsIPBindUnbind)(nil), 1146 (*MplsIPBindUnbindReply)(nil), 1147 (*MplsRouteAddDel)(nil), 1148 (*MplsRouteAddDelReply)(nil), 1149 (*MplsRouteDetails)(nil), 1150 (*MplsRouteDump)(nil), 1151 (*MplsTableAddDel)(nil), 1152 (*MplsTableAddDelReply)(nil), 1153 (*MplsTableDetails)(nil), 1154 (*MplsTableDump)(nil), 1155 (*MplsTunnelAddDel)(nil), 1156 (*MplsTunnelAddDelReply)(nil), 1157 (*MplsTunnelDetails)(nil), 1158 (*MplsTunnelDump)(nil), 1159 (*SwInterfaceSetMplsEnable)(nil), 1160 (*SwInterfaceSetMplsEnableReply)(nil), 1161 } 1162 }