/*
 * Copyright 2017-present Open Networking Foundation

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

 * http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Code generated by protoc-gen-go.
// source: voltha.proto
// DO NOT EDIT!

/*
Package voltha is a generated protocol buffer package.

It is generated from these files:
	voltha.proto

It has these top-level messages:
	DeviceGroup
	DeviceGroups
	AlarmFilterRuleKey
	AlarmFilterRule
	AlarmFilter
	AlarmFilters
	VolthaInstance
	VolthaInstances
	Voltha
*/
package voltha

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import google_protobuf "github.com/golang/protobuf/ptypes/empty"
import _ "github.com/golang/protobuf/ptypes/any"
import voltha2 "github.com/opencord/voltha/netconf/translator/voltha/meta"
import voltha3 "github.com/opencord/voltha/netconf/translator/voltha/common"
import voltha4 "github.com/opencord/voltha/netconf/translator/voltha/health"
import voltha5 "github.com/opencord/voltha/netconf/translator/voltha/logical_device"
import voltha6 "github.com/opencord/voltha/netconf/translator/voltha/device"
import voltha7 "github.com/opencord/voltha/netconf/translator/voltha/adapter"
import openflow_13 "github.com/opencord/voltha/netconf/translator/voltha/openflow_13"

import (
	context "golang.org/x/net/context"
	grpc "google.golang.org/grpc"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package

// ChildNode from public import meta.proto
type ChildNode voltha2.ChildNode

func (m *ChildNode) Reset()         { (*voltha2.ChildNode)(m).Reset() }
func (m *ChildNode) String() string { return (*voltha2.ChildNode)(m).String() }
func (*ChildNode) ProtoMessage()    {}
func (m *ChildNode) GetKey() string { return (*voltha2.ChildNode)(m).GetKey() }

// Access from public import meta.proto
type Access voltha2.Access

var Access_name = voltha2.Access_name
var Access_value = voltha2.Access_value

func (x Access) String() string { return (voltha2.Access)(x).String() }

const Access_CONFIG = Access(voltha2.Access_CONFIG)
const Access_READ_ONLY = Access(voltha2.Access_READ_ONLY)
const Access_REAL_TIME = Access(voltha2.Access_REAL_TIME)

// child_node from public import meta.proto
var E_ChildNode = voltha2.E_ChildNode

// access from public import meta.proto
var E_Access = voltha2.E_Access

// ID from public import common.proto
type ID voltha3.ID

func (m *ID) Reset()         { (*voltha3.ID)(m).Reset() }
func (m *ID) String() string { return (*voltha3.ID)(m).String() }
func (*ID) ProtoMessage()    {}
func (m *ID) GetId() string  { return (*voltha3.ID)(m).GetId() }

// LogLevel from public import common.proto
type LogLevel voltha3.LogLevel

func (m *LogLevel) Reset()         { (*voltha3.LogLevel)(m).Reset() }
func (m *LogLevel) String() string { return (*voltha3.LogLevel)(m).String() }
func (*LogLevel) ProtoMessage()    {}

// AdminState from public import common.proto
type AdminState voltha3.AdminState

func (m *AdminState) Reset()         { (*voltha3.AdminState)(m).Reset() }
func (m *AdminState) String() string { return (*voltha3.AdminState)(m).String() }
func (*AdminState) ProtoMessage()    {}

// OperStatus from public import common.proto
type OperStatus voltha3.OperStatus

func (m *OperStatus) Reset()         { (*voltha3.OperStatus)(m).Reset() }
func (m *OperStatus) String() string { return (*voltha3.OperStatus)(m).String() }
func (*OperStatus) ProtoMessage()    {}

// ConnectStatus from public import common.proto
type ConnectStatus voltha3.ConnectStatus

func (m *ConnectStatus) Reset()         { (*voltha3.ConnectStatus)(m).Reset() }
func (m *ConnectStatus) String() string { return (*voltha3.ConnectStatus)(m).String() }
func (*ConnectStatus) ProtoMessage()    {}

// LogLevel from public import common.proto
type LogLevel_LogLevel voltha3.LogLevel_LogLevel

var LogLevel_LogLevel_name = voltha3.LogLevel_LogLevel_name
var LogLevel_LogLevel_value = voltha3.LogLevel_LogLevel_value

func (x LogLevel_LogLevel) String() string { return (voltha3.LogLevel_LogLevel)(x).String() }

const LogLevel_DEBUG = LogLevel_LogLevel(voltha3.LogLevel_DEBUG)
const LogLevel_INFO = LogLevel_LogLevel(voltha3.LogLevel_INFO)
const LogLevel_WARNING = LogLevel_LogLevel(voltha3.LogLevel_WARNING)
const LogLevel_ERROR = LogLevel_LogLevel(voltha3.LogLevel_ERROR)
const LogLevel_CRITICAL = LogLevel_LogLevel(voltha3.LogLevel_CRITICAL)

// AdminState from public import common.proto
type AdminState_AdminState voltha3.AdminState_AdminState

var AdminState_AdminState_name = voltha3.AdminState_AdminState_name
var AdminState_AdminState_value = voltha3.AdminState_AdminState_value

func (x AdminState_AdminState) String() string { return (voltha3.AdminState_AdminState)(x).String() }

const AdminState_UNKNOWN = AdminState_AdminState(voltha3.AdminState_UNKNOWN)
const AdminState_PREPROVISIONED = AdminState_AdminState(voltha3.AdminState_PREPROVISIONED)
const AdminState_ENABLED = AdminState_AdminState(voltha3.AdminState_ENABLED)
const AdminState_DISABLED = AdminState_AdminState(voltha3.AdminState_DISABLED)

// OperStatus from public import common.proto
type OperStatus_OperStatus voltha3.OperStatus_OperStatus

var OperStatus_OperStatus_name = voltha3.OperStatus_OperStatus_name
var OperStatus_OperStatus_value = voltha3.OperStatus_OperStatus_value

func (x OperStatus_OperStatus) String() string { return (voltha3.OperStatus_OperStatus)(x).String() }

const OperStatus_UNKNOWN = OperStatus_OperStatus(voltha3.OperStatus_UNKNOWN)
const OperStatus_DISCOVERED = OperStatus_OperStatus(voltha3.OperStatus_DISCOVERED)
const OperStatus_ACTIVATING = OperStatus_OperStatus(voltha3.OperStatus_ACTIVATING)
const OperStatus_TESTING = OperStatus_OperStatus(voltha3.OperStatus_TESTING)
const OperStatus_ACTIVE = OperStatus_OperStatus(voltha3.OperStatus_ACTIVE)
const OperStatus_FAILED = OperStatus_OperStatus(voltha3.OperStatus_FAILED)

// ConnectStatus from public import common.proto
type ConnectStatus_ConnectStatus voltha3.ConnectStatus_ConnectStatus

var ConnectStatus_ConnectStatus_name = voltha3.ConnectStatus_ConnectStatus_name
var ConnectStatus_ConnectStatus_value = voltha3.ConnectStatus_ConnectStatus_value

func (x ConnectStatus_ConnectStatus) String() string {
	return (voltha3.ConnectStatus_ConnectStatus)(x).String()
}

const ConnectStatus_UNKNOWN = ConnectStatus_ConnectStatus(voltha3.ConnectStatus_UNKNOWN)
const ConnectStatus_UNREACHABLE = ConnectStatus_ConnectStatus(voltha3.ConnectStatus_UNREACHABLE)
const ConnectStatus_REACHABLE = ConnectStatus_ConnectStatus(voltha3.ConnectStatus_REACHABLE)

// HealthStatus from public import health.proto
type HealthStatus voltha4.HealthStatus

func (m *HealthStatus) Reset()         { (*voltha4.HealthStatus)(m).Reset() }
func (m *HealthStatus) String() string { return (*voltha4.HealthStatus)(m).String() }
func (*HealthStatus) ProtoMessage()    {}
func (m *HealthStatus) GetState() HealthStatus_HealthState {
	return (HealthStatus_HealthState)((*voltha4.HealthStatus)(m).GetState())
}

// HealthState from public import health.proto
type HealthStatus_HealthState voltha4.HealthStatus_HealthState

var HealthStatus_HealthState_name = voltha4.HealthStatus_HealthState_name
var HealthStatus_HealthState_value = voltha4.HealthStatus_HealthState_value

func (x HealthStatus_HealthState) String() string {
	return (voltha4.HealthStatus_HealthState)(x).String()
}

const HealthStatus_HEALTHY = HealthStatus_HealthState(voltha4.HealthStatus_HEALTHY)
const HealthStatus_OVERLOADED = HealthStatus_HealthState(voltha4.HealthStatus_OVERLOADED)
const HealthStatus_DYING = HealthStatus_HealthState(voltha4.HealthStatus_DYING)

// LogicalPort from public import logical_device.proto
type LogicalPort voltha5.LogicalPort

func (m *LogicalPort) Reset()                  { (*voltha5.LogicalPort)(m).Reset() }
func (m *LogicalPort) String() string          { return (*voltha5.LogicalPort)(m).String() }
func (*LogicalPort) ProtoMessage()             {}
func (m *LogicalPort) GetId() string           { return (*voltha5.LogicalPort)(m).GetId() }
func (m *LogicalPort) GetDeviceId() string     { return (*voltha5.LogicalPort)(m).GetDeviceId() }
func (m *LogicalPort) GetDevicePortNo() uint32 { return (*voltha5.LogicalPort)(m).GetDevicePortNo() }
func (m *LogicalPort) GetRootPort() bool       { return (*voltha5.LogicalPort)(m).GetRootPort() }

// LogicalPorts from public import logical_device.proto
type LogicalPorts voltha5.LogicalPorts

func (m *LogicalPorts) Reset()         { (*voltha5.LogicalPorts)(m).Reset() }
func (m *LogicalPorts) String() string { return (*voltha5.LogicalPorts)(m).String() }
func (*LogicalPorts) ProtoMessage()    {}
func (m *LogicalPorts) GetItems() []*LogicalPort {
	o := (*voltha5.LogicalPorts)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*LogicalPort, len(o))
	for i, x := range o {
		s[i] = (*LogicalPort)(x)
	}
	return s
}

// LogicalDevice from public import logical_device.proto
type LogicalDevice voltha5.LogicalDevice

func (m *LogicalDevice) Reset()                  { (*voltha5.LogicalDevice)(m).Reset() }
func (m *LogicalDevice) String() string          { return (*voltha5.LogicalDevice)(m).String() }
func (*LogicalDevice) ProtoMessage()             {}
func (m *LogicalDevice) GetId() string           { return (*voltha5.LogicalDevice)(m).GetId() }
func (m *LogicalDevice) GetDatapathId() uint64   { return (*voltha5.LogicalDevice)(m).GetDatapathId() }
func (m *LogicalDevice) GetRootDeviceId() string { return (*voltha5.LogicalDevice)(m).GetRootDeviceId() }
func (m *LogicalDevice) GetPorts() []*LogicalPort {
	o := (*voltha5.LogicalDevice)(m).GetPorts()
	if o == nil {
		return nil
	}
	s := make([]*LogicalPort, len(o))
	for i, x := range o {
		s[i] = (*LogicalPort)(x)
	}
	return s
}

// LogicalDevices from public import logical_device.proto
type LogicalDevices voltha5.LogicalDevices

func (m *LogicalDevices) Reset()         { (*voltha5.LogicalDevices)(m).Reset() }
func (m *LogicalDevices) String() string { return (*voltha5.LogicalDevices)(m).String() }
func (*LogicalDevices) ProtoMessage()    {}
func (m *LogicalDevices) GetItems() []*LogicalDevice {
	o := (*voltha5.LogicalDevices)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*LogicalDevice, len(o))
	for i, x := range o {
		s[i] = (*LogicalDevice)(x)
	}
	return s
}

// DeviceType from public import device.proto
type DeviceType voltha6.DeviceType

func (m *DeviceType) Reset()             { (*voltha6.DeviceType)(m).Reset() }
func (m *DeviceType) String() string     { return (*voltha6.DeviceType)(m).String() }
func (*DeviceType) ProtoMessage()        {}
func (m *DeviceType) GetId() string      { return (*voltha6.DeviceType)(m).GetId() }
func (m *DeviceType) GetAdapter() string { return (*voltha6.DeviceType)(m).GetAdapter() }
func (m *DeviceType) GetAcceptsBulkFlowUpdate() bool {
	return (*voltha6.DeviceType)(m).GetAcceptsBulkFlowUpdate()
}
func (m *DeviceType) GetAcceptsAddRemoveFlowUpdates() bool {
	return (*voltha6.DeviceType)(m).GetAcceptsAddRemoveFlowUpdates()
}

// DeviceTypes from public import device.proto
type DeviceTypes voltha6.DeviceTypes

func (m *DeviceTypes) Reset()         { (*voltha6.DeviceTypes)(m).Reset() }
func (m *DeviceTypes) String() string { return (*voltha6.DeviceTypes)(m).String() }
func (*DeviceTypes) ProtoMessage()    {}
func (m *DeviceTypes) GetItems() []*DeviceType {
	o := (*voltha6.DeviceTypes)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*DeviceType, len(o))
	for i, x := range o {
		s[i] = (*DeviceType)(x)
	}
	return s
}

// PmConfig from public import device.proto
type PmConfig voltha6.PmConfig

func (m *PmConfig) Reset()          { (*voltha6.PmConfig)(m).Reset() }
func (m *PmConfig) String() string  { return (*voltha6.PmConfig)(m).String() }
func (*PmConfig) ProtoMessage()     {}
func (m *PmConfig) GetName() string { return (*voltha6.PmConfig)(m).GetName() }
func (m *PmConfig) GetType() PmConfig_PmType {
	return (PmConfig_PmType)((*voltha6.PmConfig)(m).GetType())
}
func (m *PmConfig) GetEnabled() bool      { return (*voltha6.PmConfig)(m).GetEnabled() }
func (m *PmConfig) GetSampleFreq() uint32 { return (*voltha6.PmConfig)(m).GetSampleFreq() }

// PmGroupConfig from public import device.proto
type PmGroupConfig voltha6.PmGroupConfig

func (m *PmGroupConfig) Reset()               { (*voltha6.PmGroupConfig)(m).Reset() }
func (m *PmGroupConfig) String() string       { return (*voltha6.PmGroupConfig)(m).String() }
func (*PmGroupConfig) ProtoMessage()          {}
func (m *PmGroupConfig) GetGroupName() string { return (*voltha6.PmGroupConfig)(m).GetGroupName() }
func (m *PmGroupConfig) GetGroupFreq() uint32 { return (*voltha6.PmGroupConfig)(m).GetGroupFreq() }
func (m *PmGroupConfig) GetEnabled() bool     { return (*voltha6.PmGroupConfig)(m).GetEnabled() }
func (m *PmGroupConfig) GetMetrics() []*PmConfig {
	o := (*voltha6.PmGroupConfig)(m).GetMetrics()
	if o == nil {
		return nil
	}
	s := make([]*PmConfig, len(o))
	for i, x := range o {
		s[i] = (*PmConfig)(x)
	}
	return s
}

// PmConfigs from public import device.proto
type PmConfigs voltha6.PmConfigs

func (m *PmConfigs) Reset()                 { (*voltha6.PmConfigs)(m).Reset() }
func (m *PmConfigs) String() string         { return (*voltha6.PmConfigs)(m).String() }
func (*PmConfigs) ProtoMessage()            {}
func (m *PmConfigs) GetId() string          { return (*voltha6.PmConfigs)(m).GetId() }
func (m *PmConfigs) GetDefaultFreq() uint32 { return (*voltha6.PmConfigs)(m).GetDefaultFreq() }
func (m *PmConfigs) GetGrouped() bool       { return (*voltha6.PmConfigs)(m).GetGrouped() }
func (m *PmConfigs) GetFreqOverride() bool  { return (*voltha6.PmConfigs)(m).GetFreqOverride() }
func (m *PmConfigs) GetGroups() []*PmGroupConfig {
	o := (*voltha6.PmConfigs)(m).GetGroups()
	if o == nil {
		return nil
	}
	s := make([]*PmGroupConfig, len(o))
	for i, x := range o {
		s[i] = (*PmGroupConfig)(x)
	}
	return s
}
func (m *PmConfigs) GetMetrics() []*PmConfig {
	o := (*voltha6.PmConfigs)(m).GetMetrics()
	if o == nil {
		return nil
	}
	s := make([]*PmConfig, len(o))
	for i, x := range o {
		s[i] = (*PmConfig)(x)
	}
	return s
}

// Port from public import device.proto
type Port voltha6.Port

func (m *Port) Reset()                 { (*voltha6.Port)(m).Reset() }
func (m *Port) String() string         { return (*voltha6.Port)(m).String() }
func (*Port) ProtoMessage()            {}
func (m *Port) GetPortNo() uint32      { return (*voltha6.Port)(m).GetPortNo() }
func (m *Port) GetLabel() string       { return (*voltha6.Port)(m).GetLabel() }
func (m *Port) GetType() Port_PortType { return (Port_PortType)((*voltha6.Port)(m).GetType()) }
func (m *Port) GetDeviceId() string    { return (*voltha6.Port)(m).GetDeviceId() }
func (m *Port) GetPeers() []*Port_PeerPort {
	o := (*voltha6.Port)(m).GetPeers()
	if o == nil {
		return nil
	}
	s := make([]*Port_PeerPort, len(o))
	for i, x := range o {
		s[i] = (*Port_PeerPort)(x)
	}
	return s
}

// PeerPort from public import device.proto
type Port_PeerPort voltha6.Port_PeerPort

func (m *Port_PeerPort) Reset()              { (*voltha6.Port_PeerPort)(m).Reset() }
func (m *Port_PeerPort) String() string      { return (*voltha6.Port_PeerPort)(m).String() }
func (*Port_PeerPort) ProtoMessage()         {}
func (m *Port_PeerPort) GetDeviceId() string { return (*voltha6.Port_PeerPort)(m).GetDeviceId() }
func (m *Port_PeerPort) GetPortNo() uint32   { return (*voltha6.Port_PeerPort)(m).GetPortNo() }

// Ports from public import device.proto
type Ports voltha6.Ports

func (m *Ports) Reset()         { (*voltha6.Ports)(m).Reset() }
func (m *Ports) String() string { return (*voltha6.Ports)(m).String() }
func (*Ports) ProtoMessage()    {}
func (m *Ports) GetItems() []*Port {
	o := (*voltha6.Ports)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*Port, len(o))
	for i, x := range o {
		s[i] = (*Port)(x)
	}
	return s
}

// Device from public import device.proto
type Device voltha6.Device

func (m *Device) Reset()         { (*voltha6.Device)(m).Reset() }
func (m *Device) String() string { return (*voltha6.Device)(m).String() }
func (*Device) ProtoMessage()    {}
func (m *Device) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _Device_OneofMarshaler, _Device_OneofUnmarshaler, _Device_OneofSizer, nil
}
func _Device_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*Device)
	m0 := (*voltha6.Device)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _Device_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Device)
	m0 := (*voltha6.Device)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _Device_OneofSizer(msg proto.Message) int {
	m := msg.(*Device)
	m0 := (*voltha6.Device)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *Device) GetId() string              { return (*voltha6.Device)(m).GetId() }
func (m *Device) GetType() string            { return (*voltha6.Device)(m).GetType() }
func (m *Device) GetRoot() bool              { return (*voltha6.Device)(m).GetRoot() }
func (m *Device) GetParentId() string        { return (*voltha6.Device)(m).GetParentId() }
func (m *Device) GetParentPortNo() uint32    { return (*voltha6.Device)(m).GetParentPortNo() }
func (m *Device) GetVendor() string          { return (*voltha6.Device)(m).GetVendor() }
func (m *Device) GetModel() string           { return (*voltha6.Device)(m).GetModel() }
func (m *Device) GetHardwareVersion() string { return (*voltha6.Device)(m).GetHardwareVersion() }
func (m *Device) GetFirmwareVersion() string { return (*voltha6.Device)(m).GetFirmwareVersion() }
func (m *Device) GetSoftwareVersion() string { return (*voltha6.Device)(m).GetSoftwareVersion() }
func (m *Device) GetSerialNumber() string    { return (*voltha6.Device)(m).GetSerialNumber() }
func (m *Device) GetAdapter() string         { return (*voltha6.Device)(m).GetAdapter() }
func (m *Device) GetVlan() uint32            { return (*voltha6.Device)(m).GetVlan() }
func (m *Device) GetMacAddress() string      { return (*voltha6.Device)(m).GetMacAddress() }
func (m *Device) GetIpv4Address() string     { return (*voltha6.Device)(m).GetIpv4Address() }
func (m *Device) GetIpv6Address() string     { return (*voltha6.Device)(m).GetIpv6Address() }
func (m *Device) GetHostAndPort() string     { return (*voltha6.Device)(m).GetHostAndPort() }
func (m *Device) GetProxyAddress() *Device_ProxyAddress {
	return (*Device_ProxyAddress)((*voltha6.Device)(m).GetProxyAddress())
}
func (m *Device) GetReason() string { return (*voltha6.Device)(m).GetReason() }
func (m *Device) GetPorts() []*Port {
	o := (*voltha6.Device)(m).GetPorts()
	if o == nil {
		return nil
	}
	s := make([]*Port, len(o))
	for i, x := range o {
		s[i] = (*Port)(x)
	}
	return s
}
func (m *Device) GetPmConfigs() *PmConfigs { return (*PmConfigs)((*voltha6.Device)(m).GetPmConfigs()) }

// ProxyAddress from public import device.proto
type Device_ProxyAddress voltha6.Device_ProxyAddress

func (m *Device_ProxyAddress) Reset()         { (*voltha6.Device_ProxyAddress)(m).Reset() }
func (m *Device_ProxyAddress) String() string { return (*voltha6.Device_ProxyAddress)(m).String() }
func (*Device_ProxyAddress) ProtoMessage()    {}
func (m *Device_ProxyAddress) GetDeviceId() string {
	return (*voltha6.Device_ProxyAddress)(m).GetDeviceId()
}
func (m *Device_ProxyAddress) GetChannelId() uint32 {
	return (*voltha6.Device_ProxyAddress)(m).GetChannelId()
}
func (m *Device_ProxyAddress) GetOnuId() uint32 { return (*voltha6.Device_ProxyAddress)(m).GetOnuId() }
func (m *Device_ProxyAddress) GetOnuSessionId() uint32 {
	return (*voltha6.Device_ProxyAddress)(m).GetOnuSessionId()
}

// Devices from public import device.proto
type Devices voltha6.Devices

func (m *Devices) Reset()         { (*voltha6.Devices)(m).Reset() }
func (m *Devices) String() string { return (*voltha6.Devices)(m).String() }
func (*Devices) ProtoMessage()    {}
func (m *Devices) GetItems() []*Device {
	o := (*voltha6.Devices)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*Device, len(o))
	for i, x := range o {
		s[i] = (*Device)(x)
	}
	return s
}

// PmType from public import device.proto
type PmConfig_PmType voltha6.PmConfig_PmType

var PmConfig_PmType_name = voltha6.PmConfig_PmType_name
var PmConfig_PmType_value = voltha6.PmConfig_PmType_value

func (x PmConfig_PmType) String() string { return (voltha6.PmConfig_PmType)(x).String() }

const PmConfig_COUNTER = PmConfig_PmType(voltha6.PmConfig_COUNTER)
const PmConfig_GUAGE = PmConfig_PmType(voltha6.PmConfig_GUAGE)
const PmConfig_STATE = PmConfig_PmType(voltha6.PmConfig_STATE)

// PortType from public import device.proto
type Port_PortType voltha6.Port_PortType

var Port_PortType_name = voltha6.Port_PortType_name
var Port_PortType_value = voltha6.Port_PortType_value

func (x Port_PortType) String() string { return (voltha6.Port_PortType)(x).String() }

const Port_UNKNOWN = Port_PortType(voltha6.Port_UNKNOWN)
const Port_ETHERNET_NNI = Port_PortType(voltha6.Port_ETHERNET_NNI)
const Port_ETHERNET_UNI = Port_PortType(voltha6.Port_ETHERNET_UNI)
const Port_PON_OLT = Port_PortType(voltha6.Port_PON_OLT)
const Port_PON_ONU = Port_PortType(voltha6.Port_PON_ONU)

// AdapterConfig from public import adapter.proto
type AdapterConfig voltha7.AdapterConfig

func (m *AdapterConfig) Reset()         { (*voltha7.AdapterConfig)(m).Reset() }
func (m *AdapterConfig) String() string { return (*voltha7.AdapterConfig)(m).String() }
func (*AdapterConfig) ProtoMessage()    {}

// Adapter from public import adapter.proto
type Adapter voltha7.Adapter

func (m *Adapter) Reset()             { (*voltha7.Adapter)(m).Reset() }
func (m *Adapter) String() string     { return (*voltha7.Adapter)(m).String() }
func (*Adapter) ProtoMessage()        {}
func (m *Adapter) GetId() string      { return (*voltha7.Adapter)(m).GetId() }
func (m *Adapter) GetVendor() string  { return (*voltha7.Adapter)(m).GetVendor() }
func (m *Adapter) GetVersion() string { return (*voltha7.Adapter)(m).GetVersion() }
func (m *Adapter) GetConfig() *AdapterConfig {
	return (*AdapterConfig)((*voltha7.Adapter)(m).GetConfig())
}
func (m *Adapter) GetLogicalDeviceIds() []string { return (*voltha7.Adapter)(m).GetLogicalDeviceIds() }

// Adapters from public import adapter.proto
type Adapters voltha7.Adapters

func (m *Adapters) Reset()         { (*voltha7.Adapters)(m).Reset() }
func (m *Adapters) String() string { return (*voltha7.Adapters)(m).String() }
func (*Adapters) ProtoMessage()    {}
func (m *Adapters) GetItems() []*Adapter {
	o := (*voltha7.Adapters)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*Adapter, len(o))
	for i, x := range o {
		s[i] = (*Adapter)(x)
	}
	return s
}

// ofp_header from public import openflow_13.proto
type OfpHeader openflow_13.OfpHeader

func (m *OfpHeader) Reset()             { (*openflow_13.OfpHeader)(m).Reset() }
func (m *OfpHeader) String() string     { return (*openflow_13.OfpHeader)(m).String() }
func (*OfpHeader) ProtoMessage()        {}
func (m *OfpHeader) GetVersion() uint32 { return (*openflow_13.OfpHeader)(m).GetVersion() }
func (m *OfpHeader) GetType() OfpType   { return (OfpType)((*openflow_13.OfpHeader)(m).GetType()) }
func (m *OfpHeader) GetXid() uint32     { return (*openflow_13.OfpHeader)(m).GetXid() }

// ofp_hello_elem_header from public import openflow_13.proto
type OfpHelloElemHeader openflow_13.OfpHelloElemHeader

func (m *OfpHelloElemHeader) Reset()         { (*openflow_13.OfpHelloElemHeader)(m).Reset() }
func (m *OfpHelloElemHeader) String() string { return (*openflow_13.OfpHelloElemHeader)(m).String() }
func (*OfpHelloElemHeader) ProtoMessage()    {}
func (m *OfpHelloElemHeader) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpHelloElemHeader_OneofMarshaler, _OfpHelloElemHeader_OneofUnmarshaler, _OfpHelloElemHeader_OneofSizer, nil
}
func _OfpHelloElemHeader_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpHelloElemHeader)
	m0 := (*openflow_13.OfpHelloElemHeader)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpHelloElemHeader_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpHelloElemHeader)
	m0 := (*openflow_13.OfpHelloElemHeader)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpHelloElemHeader_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpHelloElemHeader)
	m0 := (*openflow_13.OfpHelloElemHeader)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpHelloElemHeader) GetType() OfpHelloElemType {
	return (OfpHelloElemType)((*openflow_13.OfpHelloElemHeader)(m).GetType())
}
func (m *OfpHelloElemHeader) GetVersionbitmap() *OfpHelloElemVersionbitmap {
	return (*OfpHelloElemVersionbitmap)((*openflow_13.OfpHelloElemHeader)(m).GetVersionbitmap())
}

// ofp_hello_elem_versionbitmap from public import openflow_13.proto
type OfpHelloElemVersionbitmap openflow_13.OfpHelloElemVersionbitmap

func (m *OfpHelloElemVersionbitmap) Reset() { (*openflow_13.OfpHelloElemVersionbitmap)(m).Reset() }
func (m *OfpHelloElemVersionbitmap) String() string {
	return (*openflow_13.OfpHelloElemVersionbitmap)(m).String()
}
func (*OfpHelloElemVersionbitmap) ProtoMessage() {}
func (m *OfpHelloElemVersionbitmap) GetBitmaps() []uint32 {
	return (*openflow_13.OfpHelloElemVersionbitmap)(m).GetBitmaps()
}

// ofp_hello from public import openflow_13.proto
type OfpHello openflow_13.OfpHello

func (m *OfpHello) Reset()         { (*openflow_13.OfpHello)(m).Reset() }
func (m *OfpHello) String() string { return (*openflow_13.OfpHello)(m).String() }
func (*OfpHello) ProtoMessage()    {}
func (m *OfpHello) GetElements() []*OfpHelloElemHeader {
	o := (*openflow_13.OfpHello)(m).GetElements()
	if o == nil {
		return nil
	}
	s := make([]*OfpHelloElemHeader, len(o))
	for i, x := range o {
		s[i] = (*OfpHelloElemHeader)(x)
	}
	return s
}

// ofp_switch_config from public import openflow_13.proto
type OfpSwitchConfig openflow_13.OfpSwitchConfig

func (m *OfpSwitchConfig) Reset()           { (*openflow_13.OfpSwitchConfig)(m).Reset() }
func (m *OfpSwitchConfig) String() string   { return (*openflow_13.OfpSwitchConfig)(m).String() }
func (*OfpSwitchConfig) ProtoMessage()      {}
func (m *OfpSwitchConfig) GetFlags() uint32 { return (*openflow_13.OfpSwitchConfig)(m).GetFlags() }
func (m *OfpSwitchConfig) GetMissSendLen() uint32 {
	return (*openflow_13.OfpSwitchConfig)(m).GetMissSendLen()
}

// ofp_table_mod from public import openflow_13.proto
type OfpTableMod openflow_13.OfpTableMod

func (m *OfpTableMod) Reset()             { (*openflow_13.OfpTableMod)(m).Reset() }
func (m *OfpTableMod) String() string     { return (*openflow_13.OfpTableMod)(m).String() }
func (*OfpTableMod) ProtoMessage()        {}
func (m *OfpTableMod) GetTableId() uint32 { return (*openflow_13.OfpTableMod)(m).GetTableId() }
func (m *OfpTableMod) GetConfig() uint32  { return (*openflow_13.OfpTableMod)(m).GetConfig() }

// ofp_port from public import openflow_13.proto
type OfpPort openflow_13.OfpPort

func (m *OfpPort) Reset()                { (*openflow_13.OfpPort)(m).Reset() }
func (m *OfpPort) String() string        { return (*openflow_13.OfpPort)(m).String() }
func (*OfpPort) ProtoMessage()           {}
func (m *OfpPort) GetPortNo() uint32     { return (*openflow_13.OfpPort)(m).GetPortNo() }
func (m *OfpPort) GetHwAddr() []uint32   { return (*openflow_13.OfpPort)(m).GetHwAddr() }
func (m *OfpPort) GetName() string       { return (*openflow_13.OfpPort)(m).GetName() }
func (m *OfpPort) GetConfig() uint32     { return (*openflow_13.OfpPort)(m).GetConfig() }
func (m *OfpPort) GetState() uint32      { return (*openflow_13.OfpPort)(m).GetState() }
func (m *OfpPort) GetCurr() uint32       { return (*openflow_13.OfpPort)(m).GetCurr() }
func (m *OfpPort) GetAdvertised() uint32 { return (*openflow_13.OfpPort)(m).GetAdvertised() }
func (m *OfpPort) GetSupported() uint32  { return (*openflow_13.OfpPort)(m).GetSupported() }
func (m *OfpPort) GetPeer() uint32       { return (*openflow_13.OfpPort)(m).GetPeer() }
func (m *OfpPort) GetCurrSpeed() uint32  { return (*openflow_13.OfpPort)(m).GetCurrSpeed() }
func (m *OfpPort) GetMaxSpeed() uint32   { return (*openflow_13.OfpPort)(m).GetMaxSpeed() }

// ofp_switch_features from public import openflow_13.proto
type OfpSwitchFeatures openflow_13.OfpSwitchFeatures

func (m *OfpSwitchFeatures) Reset()         { (*openflow_13.OfpSwitchFeatures)(m).Reset() }
func (m *OfpSwitchFeatures) String() string { return (*openflow_13.OfpSwitchFeatures)(m).String() }
func (*OfpSwitchFeatures) ProtoMessage()    {}
func (m *OfpSwitchFeatures) GetDatapathId() uint64 {
	return (*openflow_13.OfpSwitchFeatures)(m).GetDatapathId()
}
func (m *OfpSwitchFeatures) GetNBuffers() uint32 {
	return (*openflow_13.OfpSwitchFeatures)(m).GetNBuffers()
}
func (m *OfpSwitchFeatures) GetNTables() uint32 {
	return (*openflow_13.OfpSwitchFeatures)(m).GetNTables()
}
func (m *OfpSwitchFeatures) GetAuxiliaryId() uint32 {
	return (*openflow_13.OfpSwitchFeatures)(m).GetAuxiliaryId()
}
func (m *OfpSwitchFeatures) GetCapabilities() uint32 {
	return (*openflow_13.OfpSwitchFeatures)(m).GetCapabilities()
}

// ofp_port_status from public import openflow_13.proto
type OfpPortStatus openflow_13.OfpPortStatus

func (m *OfpPortStatus) Reset()         { (*openflow_13.OfpPortStatus)(m).Reset() }
func (m *OfpPortStatus) String() string { return (*openflow_13.OfpPortStatus)(m).String() }
func (*OfpPortStatus) ProtoMessage()    {}
func (m *OfpPortStatus) GetReason() OfpPortReason {
	return (OfpPortReason)((*openflow_13.OfpPortStatus)(m).GetReason())
}
func (m *OfpPortStatus) GetDesc() *OfpPort {
	return (*OfpPort)((*openflow_13.OfpPortStatus)(m).GetDesc())
}

// ofp_port_mod from public import openflow_13.proto
type OfpPortMod openflow_13.OfpPortMod

func (m *OfpPortMod) Reset()               { (*openflow_13.OfpPortMod)(m).Reset() }
func (m *OfpPortMod) String() string       { return (*openflow_13.OfpPortMod)(m).String() }
func (*OfpPortMod) ProtoMessage()          {}
func (m *OfpPortMod) GetPortNo() uint32    { return (*openflow_13.OfpPortMod)(m).GetPortNo() }
func (m *OfpPortMod) GetHwAddr() []uint32  { return (*openflow_13.OfpPortMod)(m).GetHwAddr() }
func (m *OfpPortMod) GetConfig() uint32    { return (*openflow_13.OfpPortMod)(m).GetConfig() }
func (m *OfpPortMod) GetMask() uint32      { return (*openflow_13.OfpPortMod)(m).GetMask() }
func (m *OfpPortMod) GetAdvertise() uint32 { return (*openflow_13.OfpPortMod)(m).GetAdvertise() }

// ofp_match from public import openflow_13.proto
type OfpMatch openflow_13.OfpMatch

func (m *OfpMatch) Reset()                { (*openflow_13.OfpMatch)(m).Reset() }
func (m *OfpMatch) String() string        { return (*openflow_13.OfpMatch)(m).String() }
func (*OfpMatch) ProtoMessage()           {}
func (m *OfpMatch) GetType() OfpMatchType { return (OfpMatchType)((*openflow_13.OfpMatch)(m).GetType()) }
func (m *OfpMatch) GetOxmFields() []*OfpOxmField {
	o := (*openflow_13.OfpMatch)(m).GetOxmFields()
	if o == nil {
		return nil
	}
	s := make([]*OfpOxmField, len(o))
	for i, x := range o {
		s[i] = (*OfpOxmField)(x)
	}
	return s
}

// ofp_oxm_field from public import openflow_13.proto
type OfpOxmField openflow_13.OfpOxmField

func (m *OfpOxmField) Reset()         { (*openflow_13.OfpOxmField)(m).Reset() }
func (m *OfpOxmField) String() string { return (*openflow_13.OfpOxmField)(m).String() }
func (*OfpOxmField) ProtoMessage()    {}
func (m *OfpOxmField) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpOxmField_OneofMarshaler, _OfpOxmField_OneofUnmarshaler, _OfpOxmField_OneofSizer, nil
}
func _OfpOxmField_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpOxmField)
	m0 := (*openflow_13.OfpOxmField)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpOxmField_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpOxmField)
	m0 := (*openflow_13.OfpOxmField)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpOxmField_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpOxmField)
	m0 := (*openflow_13.OfpOxmField)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpOxmField) GetOxmClass() OfpOxmClass {
	return (OfpOxmClass)((*openflow_13.OfpOxmField)(m).GetOxmClass())
}
func (m *OfpOxmField) GetOfbField() *OfpOxmOfbField {
	return (*OfpOxmOfbField)((*openflow_13.OfpOxmField)(m).GetOfbField())
}
func (m *OfpOxmField) GetExperimenterField() *OfpOxmExperimenterField {
	return (*OfpOxmExperimenterField)((*openflow_13.OfpOxmField)(m).GetExperimenterField())
}

// ofp_oxm_ofb_field from public import openflow_13.proto
type OfpOxmOfbField openflow_13.OfpOxmOfbField

func (m *OfpOxmOfbField) Reset()         { (*openflow_13.OfpOxmOfbField)(m).Reset() }
func (m *OfpOxmOfbField) String() string { return (*openflow_13.OfpOxmOfbField)(m).String() }
func (*OfpOxmOfbField) ProtoMessage()    {}
func (m *OfpOxmOfbField) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpOxmOfbField_OneofMarshaler, _OfpOxmOfbField_OneofUnmarshaler, _OfpOxmOfbField_OneofSizer, nil
}
func _OfpOxmOfbField_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpOxmOfbField)
	m0 := (*openflow_13.OfpOxmOfbField)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpOxmOfbField_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpOxmOfbField)
	m0 := (*openflow_13.OfpOxmOfbField)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpOxmOfbField_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpOxmOfbField)
	m0 := (*openflow_13.OfpOxmOfbField)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpOxmOfbField) GetType() OxmOfbFieldTypes {
	return (OxmOfbFieldTypes)((*openflow_13.OfpOxmOfbField)(m).GetType())
}
func (m *OfpOxmOfbField) GetHasMask() bool { return (*openflow_13.OfpOxmOfbField)(m).GetHasMask() }
func (m *OfpOxmOfbField) GetPort() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetPort() }
func (m *OfpOxmOfbField) GetPhysicalPort() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetPhysicalPort()
}
func (m *OfpOxmOfbField) GetTableMetadata() uint64 {
	return (*openflow_13.OfpOxmOfbField)(m).GetTableMetadata()
}
func (m *OfpOxmOfbField) GetEthDst() []byte  { return (*openflow_13.OfpOxmOfbField)(m).GetEthDst() }
func (m *OfpOxmOfbField) GetEthSrc() []byte  { return (*openflow_13.OfpOxmOfbField)(m).GetEthSrc() }
func (m *OfpOxmOfbField) GetEthType() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetEthType() }
func (m *OfpOxmOfbField) GetVlanVid() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetVlanVid() }
func (m *OfpOxmOfbField) GetVlanPcp() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetVlanPcp() }
func (m *OfpOxmOfbField) GetIpDscp() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetIpDscp() }
func (m *OfpOxmOfbField) GetIpEcn() uint32   { return (*openflow_13.OfpOxmOfbField)(m).GetIpEcn() }
func (m *OfpOxmOfbField) GetIpProto() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetIpProto() }
func (m *OfpOxmOfbField) GetIpv4Src() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetIpv4Src() }
func (m *OfpOxmOfbField) GetIpv4Dst() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetIpv4Dst() }
func (m *OfpOxmOfbField) GetTcpSrc() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetTcpSrc() }
func (m *OfpOxmOfbField) GetTcpDst() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetTcpDst() }
func (m *OfpOxmOfbField) GetUdpSrc() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetUdpSrc() }
func (m *OfpOxmOfbField) GetUdpDst() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetUdpDst() }
func (m *OfpOxmOfbField) GetSctpSrc() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetSctpSrc() }
func (m *OfpOxmOfbField) GetSctpDst() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetSctpDst() }
func (m *OfpOxmOfbField) GetIcmpv4Type() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIcmpv4Type()
}
func (m *OfpOxmOfbField) GetIcmpv4Code() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIcmpv4Code()
}
func (m *OfpOxmOfbField) GetArpOp() uint32   { return (*openflow_13.OfpOxmOfbField)(m).GetArpOp() }
func (m *OfpOxmOfbField) GetArpSpa() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetArpSpa() }
func (m *OfpOxmOfbField) GetArpTpa() uint32  { return (*openflow_13.OfpOxmOfbField)(m).GetArpTpa() }
func (m *OfpOxmOfbField) GetArpSha() []byte  { return (*openflow_13.OfpOxmOfbField)(m).GetArpSha() }
func (m *OfpOxmOfbField) GetArpTha() []byte  { return (*openflow_13.OfpOxmOfbField)(m).GetArpTha() }
func (m *OfpOxmOfbField) GetIpv6Src() []byte { return (*openflow_13.OfpOxmOfbField)(m).GetIpv6Src() }
func (m *OfpOxmOfbField) GetIpv6Dst() []byte { return (*openflow_13.OfpOxmOfbField)(m).GetIpv6Dst() }
func (m *OfpOxmOfbField) GetIpv6Flabel() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6Flabel()
}
func (m *OfpOxmOfbField) GetIcmpv6Type() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIcmpv6Type()
}
func (m *OfpOxmOfbField) GetIcmpv6Code() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIcmpv6Code()
}
func (m *OfpOxmOfbField) GetIpv6NdTarget() []byte {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6NdTarget()
}
func (m *OfpOxmOfbField) GetIpv6NdSsl() []byte { return (*openflow_13.OfpOxmOfbField)(m).GetIpv6NdSsl() }
func (m *OfpOxmOfbField) GetIpv6NdTll() []byte { return (*openflow_13.OfpOxmOfbField)(m).GetIpv6NdTll() }
func (m *OfpOxmOfbField) GetMplsLabel() uint32 { return (*openflow_13.OfpOxmOfbField)(m).GetMplsLabel() }
func (m *OfpOxmOfbField) GetMplsTc() uint32    { return (*openflow_13.OfpOxmOfbField)(m).GetMplsTc() }
func (m *OfpOxmOfbField) GetMplsBos() uint32   { return (*openflow_13.OfpOxmOfbField)(m).GetMplsBos() }
func (m *OfpOxmOfbField) GetPbbIsid() uint32   { return (*openflow_13.OfpOxmOfbField)(m).GetPbbIsid() }
func (m *OfpOxmOfbField) GetTunnelId() uint64  { return (*openflow_13.OfpOxmOfbField)(m).GetTunnelId() }
func (m *OfpOxmOfbField) GetIpv6Exthdr() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6Exthdr()
}
func (m *OfpOxmOfbField) GetTableMetadataMask() uint64 {
	return (*openflow_13.OfpOxmOfbField)(m).GetTableMetadataMask()
}
func (m *OfpOxmOfbField) GetEthDstMask() []byte {
	return (*openflow_13.OfpOxmOfbField)(m).GetEthDstMask()
}
func (m *OfpOxmOfbField) GetEthSrcMask() []byte {
	return (*openflow_13.OfpOxmOfbField)(m).GetEthSrcMask()
}
func (m *OfpOxmOfbField) GetVlanVidMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetVlanVidMask()
}
func (m *OfpOxmOfbField) GetIpv4SrcMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv4SrcMask()
}
func (m *OfpOxmOfbField) GetIpv4DstMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv4DstMask()
}
func (m *OfpOxmOfbField) GetArpSpaMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetArpSpaMask()
}
func (m *OfpOxmOfbField) GetArpTpaMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetArpTpaMask()
}
func (m *OfpOxmOfbField) GetIpv6SrcMask() []byte {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6SrcMask()
}
func (m *OfpOxmOfbField) GetIpv6DstMask() []byte {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6DstMask()
}
func (m *OfpOxmOfbField) GetIpv6FlabelMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6FlabelMask()
}
func (m *OfpOxmOfbField) GetPbbIsidMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetPbbIsidMask()
}
func (m *OfpOxmOfbField) GetTunnelIdMask() uint64 {
	return (*openflow_13.OfpOxmOfbField)(m).GetTunnelIdMask()
}
func (m *OfpOxmOfbField) GetIpv6ExthdrMask() uint32 {
	return (*openflow_13.OfpOxmOfbField)(m).GetIpv6ExthdrMask()
}

// ofp_oxm_experimenter_field from public import openflow_13.proto
type OfpOxmExperimenterField openflow_13.OfpOxmExperimenterField

func (m *OfpOxmExperimenterField) Reset() { (*openflow_13.OfpOxmExperimenterField)(m).Reset() }
func (m *OfpOxmExperimenterField) String() string {
	return (*openflow_13.OfpOxmExperimenterField)(m).String()
}
func (*OfpOxmExperimenterField) ProtoMessage() {}
func (m *OfpOxmExperimenterField) GetOxmHeader() uint32 {
	return (*openflow_13.OfpOxmExperimenterField)(m).GetOxmHeader()
}
func (m *OfpOxmExperimenterField) GetExperimenter() uint32 {
	return (*openflow_13.OfpOxmExperimenterField)(m).GetExperimenter()
}

// ofp_action from public import openflow_13.proto
type OfpAction openflow_13.OfpAction

func (m *OfpAction) Reset()         { (*openflow_13.OfpAction)(m).Reset() }
func (m *OfpAction) String() string { return (*openflow_13.OfpAction)(m).String() }
func (*OfpAction) ProtoMessage()    {}
func (m *OfpAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpAction_OneofMarshaler, _OfpAction_OneofUnmarshaler, _OfpAction_OneofSizer, nil
}
func _OfpAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpAction)
	m0 := (*openflow_13.OfpAction)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpAction)
	m0 := (*openflow_13.OfpAction)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpAction_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpAction)
	m0 := (*openflow_13.OfpAction)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpAction) GetType() OfpActionType {
	return (OfpActionType)((*openflow_13.OfpAction)(m).GetType())
}
func (m *OfpAction) GetOutput() *OfpActionOutput {
	return (*OfpActionOutput)((*openflow_13.OfpAction)(m).GetOutput())
}
func (m *OfpAction) GetMplsTtl() *OfpActionMplsTtl {
	return (*OfpActionMplsTtl)((*openflow_13.OfpAction)(m).GetMplsTtl())
}
func (m *OfpAction) GetPush() *OfpActionPush {
	return (*OfpActionPush)((*openflow_13.OfpAction)(m).GetPush())
}
func (m *OfpAction) GetPopMpls() *OfpActionPopMpls {
	return (*OfpActionPopMpls)((*openflow_13.OfpAction)(m).GetPopMpls())
}
func (m *OfpAction) GetGroup() *OfpActionGroup {
	return (*OfpActionGroup)((*openflow_13.OfpAction)(m).GetGroup())
}
func (m *OfpAction) GetNwTtl() *OfpActionNwTtl {
	return (*OfpActionNwTtl)((*openflow_13.OfpAction)(m).GetNwTtl())
}
func (m *OfpAction) GetSetField() *OfpActionSetField {
	return (*OfpActionSetField)((*openflow_13.OfpAction)(m).GetSetField())
}
func (m *OfpAction) GetExperimenter() *OfpActionExperimenter {
	return (*OfpActionExperimenter)((*openflow_13.OfpAction)(m).GetExperimenter())
}

// ofp_action_output from public import openflow_13.proto
type OfpActionOutput openflow_13.OfpActionOutput

func (m *OfpActionOutput) Reset()            { (*openflow_13.OfpActionOutput)(m).Reset() }
func (m *OfpActionOutput) String() string    { return (*openflow_13.OfpActionOutput)(m).String() }
func (*OfpActionOutput) ProtoMessage()       {}
func (m *OfpActionOutput) GetPort() uint32   { return (*openflow_13.OfpActionOutput)(m).GetPort() }
func (m *OfpActionOutput) GetMaxLen() uint32 { return (*openflow_13.OfpActionOutput)(m).GetMaxLen() }

// ofp_action_mpls_ttl from public import openflow_13.proto
type OfpActionMplsTtl openflow_13.OfpActionMplsTtl

func (m *OfpActionMplsTtl) Reset()             { (*openflow_13.OfpActionMplsTtl)(m).Reset() }
func (m *OfpActionMplsTtl) String() string     { return (*openflow_13.OfpActionMplsTtl)(m).String() }
func (*OfpActionMplsTtl) ProtoMessage()        {}
func (m *OfpActionMplsTtl) GetMplsTtl() uint32 { return (*openflow_13.OfpActionMplsTtl)(m).GetMplsTtl() }

// ofp_action_push from public import openflow_13.proto
type OfpActionPush openflow_13.OfpActionPush

func (m *OfpActionPush) Reset()               { (*openflow_13.OfpActionPush)(m).Reset() }
func (m *OfpActionPush) String() string       { return (*openflow_13.OfpActionPush)(m).String() }
func (*OfpActionPush) ProtoMessage()          {}
func (m *OfpActionPush) GetEthertype() uint32 { return (*openflow_13.OfpActionPush)(m).GetEthertype() }

// ofp_action_pop_mpls from public import openflow_13.proto
type OfpActionPopMpls openflow_13.OfpActionPopMpls

func (m *OfpActionPopMpls) Reset()         { (*openflow_13.OfpActionPopMpls)(m).Reset() }
func (m *OfpActionPopMpls) String() string { return (*openflow_13.OfpActionPopMpls)(m).String() }
func (*OfpActionPopMpls) ProtoMessage()    {}
func (m *OfpActionPopMpls) GetEthertype() uint32 {
	return (*openflow_13.OfpActionPopMpls)(m).GetEthertype()
}

// ofp_action_group from public import openflow_13.proto
type OfpActionGroup openflow_13.OfpActionGroup

func (m *OfpActionGroup) Reset()             { (*openflow_13.OfpActionGroup)(m).Reset() }
func (m *OfpActionGroup) String() string     { return (*openflow_13.OfpActionGroup)(m).String() }
func (*OfpActionGroup) ProtoMessage()        {}
func (m *OfpActionGroup) GetGroupId() uint32 { return (*openflow_13.OfpActionGroup)(m).GetGroupId() }

// ofp_action_nw_ttl from public import openflow_13.proto
type OfpActionNwTtl openflow_13.OfpActionNwTtl

func (m *OfpActionNwTtl) Reset()           { (*openflow_13.OfpActionNwTtl)(m).Reset() }
func (m *OfpActionNwTtl) String() string   { return (*openflow_13.OfpActionNwTtl)(m).String() }
func (*OfpActionNwTtl) ProtoMessage()      {}
func (m *OfpActionNwTtl) GetNwTtl() uint32 { return (*openflow_13.OfpActionNwTtl)(m).GetNwTtl() }

// ofp_action_set_field from public import openflow_13.proto
type OfpActionSetField openflow_13.OfpActionSetField

func (m *OfpActionSetField) Reset()         { (*openflow_13.OfpActionSetField)(m).Reset() }
func (m *OfpActionSetField) String() string { return (*openflow_13.OfpActionSetField)(m).String() }
func (*OfpActionSetField) ProtoMessage()    {}
func (m *OfpActionSetField) GetField() *OfpOxmField {
	return (*OfpOxmField)((*openflow_13.OfpActionSetField)(m).GetField())
}

// ofp_action_experimenter from public import openflow_13.proto
type OfpActionExperimenter openflow_13.OfpActionExperimenter

func (m *OfpActionExperimenter) Reset() { (*openflow_13.OfpActionExperimenter)(m).Reset() }
func (m *OfpActionExperimenter) String() string {
	return (*openflow_13.OfpActionExperimenter)(m).String()
}
func (*OfpActionExperimenter) ProtoMessage() {}
func (m *OfpActionExperimenter) GetExperimenter() uint32 {
	return (*openflow_13.OfpActionExperimenter)(m).GetExperimenter()
}
func (m *OfpActionExperimenter) GetData() []byte {
	return (*openflow_13.OfpActionExperimenter)(m).GetData()
}

// ofp_instruction from public import openflow_13.proto
type OfpInstruction openflow_13.OfpInstruction

func (m *OfpInstruction) Reset()         { (*openflow_13.OfpInstruction)(m).Reset() }
func (m *OfpInstruction) String() string { return (*openflow_13.OfpInstruction)(m).String() }
func (*OfpInstruction) ProtoMessage()    {}
func (m *OfpInstruction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpInstruction_OneofMarshaler, _OfpInstruction_OneofUnmarshaler, _OfpInstruction_OneofSizer, nil
}
func _OfpInstruction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpInstruction)
	m0 := (*openflow_13.OfpInstruction)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpInstruction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpInstruction)
	m0 := (*openflow_13.OfpInstruction)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpInstruction_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpInstruction)
	m0 := (*openflow_13.OfpInstruction)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpInstruction) GetType() uint32 { return (*openflow_13.OfpInstruction)(m).GetType() }
func (m *OfpInstruction) GetGotoTable() *OfpInstructionGotoTable {
	return (*OfpInstructionGotoTable)((*openflow_13.OfpInstruction)(m).GetGotoTable())
}
func (m *OfpInstruction) GetWriteMetadata() *OfpInstructionWriteMetadata {
	return (*OfpInstructionWriteMetadata)((*openflow_13.OfpInstruction)(m).GetWriteMetadata())
}
func (m *OfpInstruction) GetActions() *OfpInstructionActions {
	return (*OfpInstructionActions)((*openflow_13.OfpInstruction)(m).GetActions())
}
func (m *OfpInstruction) GetMeter() *OfpInstructionMeter {
	return (*OfpInstructionMeter)((*openflow_13.OfpInstruction)(m).GetMeter())
}
func (m *OfpInstruction) GetExperimenter() *OfpInstructionExperimenter {
	return (*OfpInstructionExperimenter)((*openflow_13.OfpInstruction)(m).GetExperimenter())
}

// ofp_instruction_goto_table from public import openflow_13.proto
type OfpInstructionGotoTable openflow_13.OfpInstructionGotoTable

func (m *OfpInstructionGotoTable) Reset() { (*openflow_13.OfpInstructionGotoTable)(m).Reset() }
func (m *OfpInstructionGotoTable) String() string {
	return (*openflow_13.OfpInstructionGotoTable)(m).String()
}
func (*OfpInstructionGotoTable) ProtoMessage() {}
func (m *OfpInstructionGotoTable) GetTableId() uint32 {
	return (*openflow_13.OfpInstructionGotoTable)(m).GetTableId()
}

// ofp_instruction_write_metadata from public import openflow_13.proto
type OfpInstructionWriteMetadata openflow_13.OfpInstructionWriteMetadata

func (m *OfpInstructionWriteMetadata) Reset() { (*openflow_13.OfpInstructionWriteMetadata)(m).Reset() }
func (m *OfpInstructionWriteMetadata) String() string {
	return (*openflow_13.OfpInstructionWriteMetadata)(m).String()
}
func (*OfpInstructionWriteMetadata) ProtoMessage() {}
func (m *OfpInstructionWriteMetadata) GetMetadata() uint64 {
	return (*openflow_13.OfpInstructionWriteMetadata)(m).GetMetadata()
}
func (m *OfpInstructionWriteMetadata) GetMetadataMask() uint64 {
	return (*openflow_13.OfpInstructionWriteMetadata)(m).GetMetadataMask()
}

// ofp_instruction_actions from public import openflow_13.proto
type OfpInstructionActions openflow_13.OfpInstructionActions

func (m *OfpInstructionActions) Reset() { (*openflow_13.OfpInstructionActions)(m).Reset() }
func (m *OfpInstructionActions) String() string {
	return (*openflow_13.OfpInstructionActions)(m).String()
}
func (*OfpInstructionActions) ProtoMessage() {}
func (m *OfpInstructionActions) GetActions() []*OfpAction {
	o := (*openflow_13.OfpInstructionActions)(m).GetActions()
	if o == nil {
		return nil
	}
	s := make([]*OfpAction, len(o))
	for i, x := range o {
		s[i] = (*OfpAction)(x)
	}
	return s
}

// ofp_instruction_meter from public import openflow_13.proto
type OfpInstructionMeter openflow_13.OfpInstructionMeter

func (m *OfpInstructionMeter) Reset()         { (*openflow_13.OfpInstructionMeter)(m).Reset() }
func (m *OfpInstructionMeter) String() string { return (*openflow_13.OfpInstructionMeter)(m).String() }
func (*OfpInstructionMeter) ProtoMessage()    {}
func (m *OfpInstructionMeter) GetMeterId() uint32 {
	return (*openflow_13.OfpInstructionMeter)(m).GetMeterId()
}

// ofp_instruction_experimenter from public import openflow_13.proto
type OfpInstructionExperimenter openflow_13.OfpInstructionExperimenter

func (m *OfpInstructionExperimenter) Reset() { (*openflow_13.OfpInstructionExperimenter)(m).Reset() }
func (m *OfpInstructionExperimenter) String() string {
	return (*openflow_13.OfpInstructionExperimenter)(m).String()
}
func (*OfpInstructionExperimenter) ProtoMessage() {}
func (m *OfpInstructionExperimenter) GetExperimenter() uint32 {
	return (*openflow_13.OfpInstructionExperimenter)(m).GetExperimenter()
}
func (m *OfpInstructionExperimenter) GetData() []byte {
	return (*openflow_13.OfpInstructionExperimenter)(m).GetData()
}

// ofp_flow_mod from public import openflow_13.proto
type OfpFlowMod openflow_13.OfpFlowMod

func (m *OfpFlowMod) Reset()                { (*openflow_13.OfpFlowMod)(m).Reset() }
func (m *OfpFlowMod) String() string        { return (*openflow_13.OfpFlowMod)(m).String() }
func (*OfpFlowMod) ProtoMessage()           {}
func (m *OfpFlowMod) GetCookie() uint64     { return (*openflow_13.OfpFlowMod)(m).GetCookie() }
func (m *OfpFlowMod) GetCookieMask() uint64 { return (*openflow_13.OfpFlowMod)(m).GetCookieMask() }
func (m *OfpFlowMod) GetTableId() uint32    { return (*openflow_13.OfpFlowMod)(m).GetTableId() }
func (m *OfpFlowMod) GetCommand() OfpFlowModCommand {
	return (OfpFlowModCommand)((*openflow_13.OfpFlowMod)(m).GetCommand())
}
func (m *OfpFlowMod) GetIdleTimeout() uint32 { return (*openflow_13.OfpFlowMod)(m).GetIdleTimeout() }
func (m *OfpFlowMod) GetHardTimeout() uint32 { return (*openflow_13.OfpFlowMod)(m).GetHardTimeout() }
func (m *OfpFlowMod) GetPriority() uint32    { return (*openflow_13.OfpFlowMod)(m).GetPriority() }
func (m *OfpFlowMod) GetBufferId() uint32    { return (*openflow_13.OfpFlowMod)(m).GetBufferId() }
func (m *OfpFlowMod) GetOutPort() uint32     { return (*openflow_13.OfpFlowMod)(m).GetOutPort() }
func (m *OfpFlowMod) GetOutGroup() uint32    { return (*openflow_13.OfpFlowMod)(m).GetOutGroup() }
func (m *OfpFlowMod) GetFlags() uint32       { return (*openflow_13.OfpFlowMod)(m).GetFlags() }
func (m *OfpFlowMod) GetMatch() *OfpMatch    { return (*OfpMatch)((*openflow_13.OfpFlowMod)(m).GetMatch()) }
func (m *OfpFlowMod) GetInstructions() []*OfpInstruction {
	o := (*openflow_13.OfpFlowMod)(m).GetInstructions()
	if o == nil {
		return nil
	}
	s := make([]*OfpInstruction, len(o))
	for i, x := range o {
		s[i] = (*OfpInstruction)(x)
	}
	return s
}

// ofp_bucket from public import openflow_13.proto
type OfpBucket openflow_13.OfpBucket

func (m *OfpBucket) Reset()                { (*openflow_13.OfpBucket)(m).Reset() }
func (m *OfpBucket) String() string        { return (*openflow_13.OfpBucket)(m).String() }
func (*OfpBucket) ProtoMessage()           {}
func (m *OfpBucket) GetWeight() uint32     { return (*openflow_13.OfpBucket)(m).GetWeight() }
func (m *OfpBucket) GetWatchPort() uint32  { return (*openflow_13.OfpBucket)(m).GetWatchPort() }
func (m *OfpBucket) GetWatchGroup() uint32 { return (*openflow_13.OfpBucket)(m).GetWatchGroup() }
func (m *OfpBucket) GetActions() []*OfpAction {
	o := (*openflow_13.OfpBucket)(m).GetActions()
	if o == nil {
		return nil
	}
	s := make([]*OfpAction, len(o))
	for i, x := range o {
		s[i] = (*OfpAction)(x)
	}
	return s
}

// ofp_group_mod from public import openflow_13.proto
type OfpGroupMod openflow_13.OfpGroupMod

func (m *OfpGroupMod) Reset()         { (*openflow_13.OfpGroupMod)(m).Reset() }
func (m *OfpGroupMod) String() string { return (*openflow_13.OfpGroupMod)(m).String() }
func (*OfpGroupMod) ProtoMessage()    {}
func (m *OfpGroupMod) GetCommand() OfpGroupModCommand {
	return (OfpGroupModCommand)((*openflow_13.OfpGroupMod)(m).GetCommand())
}
func (m *OfpGroupMod) GetType() OfpGroupType {
	return (OfpGroupType)((*openflow_13.OfpGroupMod)(m).GetType())
}
func (m *OfpGroupMod) GetGroupId() uint32 { return (*openflow_13.OfpGroupMod)(m).GetGroupId() }
func (m *OfpGroupMod) GetBuckets() []*OfpBucket {
	o := (*openflow_13.OfpGroupMod)(m).GetBuckets()
	if o == nil {
		return nil
	}
	s := make([]*OfpBucket, len(o))
	for i, x := range o {
		s[i] = (*OfpBucket)(x)
	}
	return s
}

// ofp_packet_out from public import openflow_13.proto
type OfpPacketOut openflow_13.OfpPacketOut

func (m *OfpPacketOut) Reset()              { (*openflow_13.OfpPacketOut)(m).Reset() }
func (m *OfpPacketOut) String() string      { return (*openflow_13.OfpPacketOut)(m).String() }
func (*OfpPacketOut) ProtoMessage()         {}
func (m *OfpPacketOut) GetBufferId() uint32 { return (*openflow_13.OfpPacketOut)(m).GetBufferId() }
func (m *OfpPacketOut) GetInPort() uint32   { return (*openflow_13.OfpPacketOut)(m).GetInPort() }
func (m *OfpPacketOut) GetActions() []*OfpAction {
	o := (*openflow_13.OfpPacketOut)(m).GetActions()
	if o == nil {
		return nil
	}
	s := make([]*OfpAction, len(o))
	for i, x := range o {
		s[i] = (*OfpAction)(x)
	}
	return s
}
func (m *OfpPacketOut) GetData() []byte { return (*openflow_13.OfpPacketOut)(m).GetData() }

// ofp_packet_in from public import openflow_13.proto
type OfpPacketIn openflow_13.OfpPacketIn

func (m *OfpPacketIn) Reset()              { (*openflow_13.OfpPacketIn)(m).Reset() }
func (m *OfpPacketIn) String() string      { return (*openflow_13.OfpPacketIn)(m).String() }
func (*OfpPacketIn) ProtoMessage()         {}
func (m *OfpPacketIn) GetBufferId() uint32 { return (*openflow_13.OfpPacketIn)(m).GetBufferId() }
func (m *OfpPacketIn) GetReason() OfpPacketInReason {
	return (OfpPacketInReason)((*openflow_13.OfpPacketIn)(m).GetReason())
}
func (m *OfpPacketIn) GetTableId() uint32 { return (*openflow_13.OfpPacketIn)(m).GetTableId() }
func (m *OfpPacketIn) GetCookie() uint64  { return (*openflow_13.OfpPacketIn)(m).GetCookie() }
func (m *OfpPacketIn) GetMatch() *OfpMatch {
	return (*OfpMatch)((*openflow_13.OfpPacketIn)(m).GetMatch())
}
func (m *OfpPacketIn) GetData() []byte { return (*openflow_13.OfpPacketIn)(m).GetData() }

// ofp_flow_removed from public import openflow_13.proto
type OfpFlowRemoved openflow_13.OfpFlowRemoved

func (m *OfpFlowRemoved) Reset()              { (*openflow_13.OfpFlowRemoved)(m).Reset() }
func (m *OfpFlowRemoved) String() string      { return (*openflow_13.OfpFlowRemoved)(m).String() }
func (*OfpFlowRemoved) ProtoMessage()         {}
func (m *OfpFlowRemoved) GetCookie() uint64   { return (*openflow_13.OfpFlowRemoved)(m).GetCookie() }
func (m *OfpFlowRemoved) GetPriority() uint32 { return (*openflow_13.OfpFlowRemoved)(m).GetPriority() }
func (m *OfpFlowRemoved) GetReason() OfpFlowRemovedReason {
	return (OfpFlowRemovedReason)((*openflow_13.OfpFlowRemoved)(m).GetReason())
}
func (m *OfpFlowRemoved) GetTableId() uint32 { return (*openflow_13.OfpFlowRemoved)(m).GetTableId() }
func (m *OfpFlowRemoved) GetDurationSec() uint32 {
	return (*openflow_13.OfpFlowRemoved)(m).GetDurationSec()
}
func (m *OfpFlowRemoved) GetDurationNsec() uint32 {
	return (*openflow_13.OfpFlowRemoved)(m).GetDurationNsec()
}
func (m *OfpFlowRemoved) GetIdleTimeout() uint32 {
	return (*openflow_13.OfpFlowRemoved)(m).GetIdleTimeout()
}
func (m *OfpFlowRemoved) GetHardTimeout() uint32 {
	return (*openflow_13.OfpFlowRemoved)(m).GetHardTimeout()
}
func (m *OfpFlowRemoved) GetPacketCount() uint64 {
	return (*openflow_13.OfpFlowRemoved)(m).GetPacketCount()
}
func (m *OfpFlowRemoved) GetByteCount() uint64 { return (*openflow_13.OfpFlowRemoved)(m).GetByteCount() }
func (m *OfpFlowRemoved) GetMatch() *OfpMatch {
	return (*OfpMatch)((*openflow_13.OfpFlowRemoved)(m).GetMatch())
}

// ofp_meter_band_header from public import openflow_13.proto
type OfpMeterBandHeader openflow_13.OfpMeterBandHeader

func (m *OfpMeterBandHeader) Reset()         { (*openflow_13.OfpMeterBandHeader)(m).Reset() }
func (m *OfpMeterBandHeader) String() string { return (*openflow_13.OfpMeterBandHeader)(m).String() }
func (*OfpMeterBandHeader) ProtoMessage()    {}
func (m *OfpMeterBandHeader) GetType() OfpMeterBandType {
	return (OfpMeterBandType)((*openflow_13.OfpMeterBandHeader)(m).GetType())
}
func (m *OfpMeterBandHeader) GetLen() uint32  { return (*openflow_13.OfpMeterBandHeader)(m).GetLen() }
func (m *OfpMeterBandHeader) GetRate() uint32 { return (*openflow_13.OfpMeterBandHeader)(m).GetRate() }
func (m *OfpMeterBandHeader) GetBurstSize() uint32 {
	return (*openflow_13.OfpMeterBandHeader)(m).GetBurstSize()
}

// ofp_meter_band_drop from public import openflow_13.proto
type OfpMeterBandDrop openflow_13.OfpMeterBandDrop

func (m *OfpMeterBandDrop) Reset()          { (*openflow_13.OfpMeterBandDrop)(m).Reset() }
func (m *OfpMeterBandDrop) String() string  { return (*openflow_13.OfpMeterBandDrop)(m).String() }
func (*OfpMeterBandDrop) ProtoMessage()     {}
func (m *OfpMeterBandDrop) GetType() uint32 { return (*openflow_13.OfpMeterBandDrop)(m).GetType() }
func (m *OfpMeterBandDrop) GetLen() uint32  { return (*openflow_13.OfpMeterBandDrop)(m).GetLen() }
func (m *OfpMeterBandDrop) GetRate() uint32 { return (*openflow_13.OfpMeterBandDrop)(m).GetRate() }
func (m *OfpMeterBandDrop) GetBurstSize() uint32 {
	return (*openflow_13.OfpMeterBandDrop)(m).GetBurstSize()
}

// ofp_meter_band_dscp_remark from public import openflow_13.proto
type OfpMeterBandDscpRemark openflow_13.OfpMeterBandDscpRemark

func (m *OfpMeterBandDscpRemark) Reset() { (*openflow_13.OfpMeterBandDscpRemark)(m).Reset() }
func (m *OfpMeterBandDscpRemark) String() string {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).String()
}
func (*OfpMeterBandDscpRemark) ProtoMessage() {}
func (m *OfpMeterBandDscpRemark) GetType() uint32 {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).GetType()
}
func (m *OfpMeterBandDscpRemark) GetLen() uint32 {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).GetLen()
}
func (m *OfpMeterBandDscpRemark) GetRate() uint32 {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).GetRate()
}
func (m *OfpMeterBandDscpRemark) GetBurstSize() uint32 {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).GetBurstSize()
}
func (m *OfpMeterBandDscpRemark) GetPrecLevel() uint32 {
	return (*openflow_13.OfpMeterBandDscpRemark)(m).GetPrecLevel()
}

// ofp_meter_band_experimenter from public import openflow_13.proto
type OfpMeterBandExperimenter openflow_13.OfpMeterBandExperimenter

func (m *OfpMeterBandExperimenter) Reset() { (*openflow_13.OfpMeterBandExperimenter)(m).Reset() }
func (m *OfpMeterBandExperimenter) String() string {
	return (*openflow_13.OfpMeterBandExperimenter)(m).String()
}
func (*OfpMeterBandExperimenter) ProtoMessage() {}
func (m *OfpMeterBandExperimenter) GetType() OfpMeterBandType {
	return (OfpMeterBandType)((*openflow_13.OfpMeterBandExperimenter)(m).GetType())
}
func (m *OfpMeterBandExperimenter) GetLen() uint32 {
	return (*openflow_13.OfpMeterBandExperimenter)(m).GetLen()
}
func (m *OfpMeterBandExperimenter) GetRate() uint32 {
	return (*openflow_13.OfpMeterBandExperimenter)(m).GetRate()
}
func (m *OfpMeterBandExperimenter) GetBurstSize() uint32 {
	return (*openflow_13.OfpMeterBandExperimenter)(m).GetBurstSize()
}
func (m *OfpMeterBandExperimenter) GetExperimenter() uint32 {
	return (*openflow_13.OfpMeterBandExperimenter)(m).GetExperimenter()
}

// ofp_meter_mod from public import openflow_13.proto
type OfpMeterMod openflow_13.OfpMeterMod

func (m *OfpMeterMod) Reset()         { (*openflow_13.OfpMeterMod)(m).Reset() }
func (m *OfpMeterMod) String() string { return (*openflow_13.OfpMeterMod)(m).String() }
func (*OfpMeterMod) ProtoMessage()    {}
func (m *OfpMeterMod) GetCommand() OfpMeterModCommand {
	return (OfpMeterModCommand)((*openflow_13.OfpMeterMod)(m).GetCommand())
}
func (m *OfpMeterMod) GetFlags() uint32   { return (*openflow_13.OfpMeterMod)(m).GetFlags() }
func (m *OfpMeterMod) GetMeterId() uint32 { return (*openflow_13.OfpMeterMod)(m).GetMeterId() }
func (m *OfpMeterMod) GetBands() []*OfpMeterBandHeader {
	o := (*openflow_13.OfpMeterMod)(m).GetBands()
	if o == nil {
		return nil
	}
	s := make([]*OfpMeterBandHeader, len(o))
	for i, x := range o {
		s[i] = (*OfpMeterBandHeader)(x)
	}
	return s
}

// ofp_error_msg from public import openflow_13.proto
type OfpErrorMsg openflow_13.OfpErrorMsg

func (m *OfpErrorMsg) Reset()          { (*openflow_13.OfpErrorMsg)(m).Reset() }
func (m *OfpErrorMsg) String() string  { return (*openflow_13.OfpErrorMsg)(m).String() }
func (*OfpErrorMsg) ProtoMessage()     {}
func (m *OfpErrorMsg) GetType() uint32 { return (*openflow_13.OfpErrorMsg)(m).GetType() }
func (m *OfpErrorMsg) GetCode() uint32 { return (*openflow_13.OfpErrorMsg)(m).GetCode() }
func (m *OfpErrorMsg) GetData() []byte { return (*openflow_13.OfpErrorMsg)(m).GetData() }

// ofp_error_experimenter_msg from public import openflow_13.proto
type OfpErrorExperimenterMsg openflow_13.OfpErrorExperimenterMsg

func (m *OfpErrorExperimenterMsg) Reset() { (*openflow_13.OfpErrorExperimenterMsg)(m).Reset() }
func (m *OfpErrorExperimenterMsg) String() string {
	return (*openflow_13.OfpErrorExperimenterMsg)(m).String()
}
func (*OfpErrorExperimenterMsg) ProtoMessage() {}
func (m *OfpErrorExperimenterMsg) GetType() uint32 {
	return (*openflow_13.OfpErrorExperimenterMsg)(m).GetType()
}
func (m *OfpErrorExperimenterMsg) GetExpType() uint32 {
	return (*openflow_13.OfpErrorExperimenterMsg)(m).GetExpType()
}
func (m *OfpErrorExperimenterMsg) GetExperimenter() uint32 {
	return (*openflow_13.OfpErrorExperimenterMsg)(m).GetExperimenter()
}
func (m *OfpErrorExperimenterMsg) GetData() []byte {
	return (*openflow_13.OfpErrorExperimenterMsg)(m).GetData()
}

// ofp_multipart_request from public import openflow_13.proto
type OfpMultipartRequest openflow_13.OfpMultipartRequest

func (m *OfpMultipartRequest) Reset()         { (*openflow_13.OfpMultipartRequest)(m).Reset() }
func (m *OfpMultipartRequest) String() string { return (*openflow_13.OfpMultipartRequest)(m).String() }
func (*OfpMultipartRequest) ProtoMessage()    {}
func (m *OfpMultipartRequest) GetType() OfpMultipartType {
	return (OfpMultipartType)((*openflow_13.OfpMultipartRequest)(m).GetType())
}
func (m *OfpMultipartRequest) GetFlags() uint32 {
	return (*openflow_13.OfpMultipartRequest)(m).GetFlags()
}
func (m *OfpMultipartRequest) GetBody() []byte { return (*openflow_13.OfpMultipartRequest)(m).GetBody() }

// ofp_multipart_reply from public import openflow_13.proto
type OfpMultipartReply openflow_13.OfpMultipartReply

func (m *OfpMultipartReply) Reset()         { (*openflow_13.OfpMultipartReply)(m).Reset() }
func (m *OfpMultipartReply) String() string { return (*openflow_13.OfpMultipartReply)(m).String() }
func (*OfpMultipartReply) ProtoMessage()    {}
func (m *OfpMultipartReply) GetType() OfpMultipartType {
	return (OfpMultipartType)((*openflow_13.OfpMultipartReply)(m).GetType())
}
func (m *OfpMultipartReply) GetFlags() uint32 { return (*openflow_13.OfpMultipartReply)(m).GetFlags() }
func (m *OfpMultipartReply) GetBody() []byte  { return (*openflow_13.OfpMultipartReply)(m).GetBody() }

// ofp_desc from public import openflow_13.proto
type OfpDesc openflow_13.OfpDesc

func (m *OfpDesc) Reset()               { (*openflow_13.OfpDesc)(m).Reset() }
func (m *OfpDesc) String() string       { return (*openflow_13.OfpDesc)(m).String() }
func (*OfpDesc) ProtoMessage()          {}
func (m *OfpDesc) GetMfrDesc() string   { return (*openflow_13.OfpDesc)(m).GetMfrDesc() }
func (m *OfpDesc) GetHwDesc() string    { return (*openflow_13.OfpDesc)(m).GetHwDesc() }
func (m *OfpDesc) GetSwDesc() string    { return (*openflow_13.OfpDesc)(m).GetSwDesc() }
func (m *OfpDesc) GetSerialNum() string { return (*openflow_13.OfpDesc)(m).GetSerialNum() }
func (m *OfpDesc) GetDpDesc() string    { return (*openflow_13.OfpDesc)(m).GetDpDesc() }

// ofp_flow_stats_request from public import openflow_13.proto
type OfpFlowStatsRequest openflow_13.OfpFlowStatsRequest

func (m *OfpFlowStatsRequest) Reset()         { (*openflow_13.OfpFlowStatsRequest)(m).Reset() }
func (m *OfpFlowStatsRequest) String() string { return (*openflow_13.OfpFlowStatsRequest)(m).String() }
func (*OfpFlowStatsRequest) ProtoMessage()    {}
func (m *OfpFlowStatsRequest) GetTableId() uint32 {
	return (*openflow_13.OfpFlowStatsRequest)(m).GetTableId()
}
func (m *OfpFlowStatsRequest) GetOutPort() uint32 {
	return (*openflow_13.OfpFlowStatsRequest)(m).GetOutPort()
}
func (m *OfpFlowStatsRequest) GetOutGroup() uint32 {
	return (*openflow_13.OfpFlowStatsRequest)(m).GetOutGroup()
}
func (m *OfpFlowStatsRequest) GetCookie() uint64 {
	return (*openflow_13.OfpFlowStatsRequest)(m).GetCookie()
}
func (m *OfpFlowStatsRequest) GetCookieMask() uint64 {
	return (*openflow_13.OfpFlowStatsRequest)(m).GetCookieMask()
}
func (m *OfpFlowStatsRequest) GetMatch() *OfpMatch {
	return (*OfpMatch)((*openflow_13.OfpFlowStatsRequest)(m).GetMatch())
}

// ofp_flow_stats from public import openflow_13.proto
type OfpFlowStats openflow_13.OfpFlowStats

func (m *OfpFlowStats) Reset()                 { (*openflow_13.OfpFlowStats)(m).Reset() }
func (m *OfpFlowStats) String() string         { return (*openflow_13.OfpFlowStats)(m).String() }
func (*OfpFlowStats) ProtoMessage()            {}
func (m *OfpFlowStats) GetId() uint64          { return (*openflow_13.OfpFlowStats)(m).GetId() }
func (m *OfpFlowStats) GetTableId() uint32     { return (*openflow_13.OfpFlowStats)(m).GetTableId() }
func (m *OfpFlowStats) GetDurationSec() uint32 { return (*openflow_13.OfpFlowStats)(m).GetDurationSec() }
func (m *OfpFlowStats) GetDurationNsec() uint32 {
	return (*openflow_13.OfpFlowStats)(m).GetDurationNsec()
}
func (m *OfpFlowStats) GetPriority() uint32    { return (*openflow_13.OfpFlowStats)(m).GetPriority() }
func (m *OfpFlowStats) GetIdleTimeout() uint32 { return (*openflow_13.OfpFlowStats)(m).GetIdleTimeout() }
func (m *OfpFlowStats) GetHardTimeout() uint32 { return (*openflow_13.OfpFlowStats)(m).GetHardTimeout() }
func (m *OfpFlowStats) GetFlags() uint32       { return (*openflow_13.OfpFlowStats)(m).GetFlags() }
func (m *OfpFlowStats) GetCookie() uint64      { return (*openflow_13.OfpFlowStats)(m).GetCookie() }
func (m *OfpFlowStats) GetPacketCount() uint64 { return (*openflow_13.OfpFlowStats)(m).GetPacketCount() }
func (m *OfpFlowStats) GetByteCount() uint64   { return (*openflow_13.OfpFlowStats)(m).GetByteCount() }
func (m *OfpFlowStats) GetMatch() *OfpMatch {
	return (*OfpMatch)((*openflow_13.OfpFlowStats)(m).GetMatch())
}
func (m *OfpFlowStats) GetInstructions() []*OfpInstruction {
	o := (*openflow_13.OfpFlowStats)(m).GetInstructions()
	if o == nil {
		return nil
	}
	s := make([]*OfpInstruction, len(o))
	for i, x := range o {
		s[i] = (*OfpInstruction)(x)
	}
	return s
}

// ofp_aggregate_stats_request from public import openflow_13.proto
type OfpAggregateStatsRequest openflow_13.OfpAggregateStatsRequest

func (m *OfpAggregateStatsRequest) Reset() { (*openflow_13.OfpAggregateStatsRequest)(m).Reset() }
func (m *OfpAggregateStatsRequest) String() string {
	return (*openflow_13.OfpAggregateStatsRequest)(m).String()
}
func (*OfpAggregateStatsRequest) ProtoMessage() {}
func (m *OfpAggregateStatsRequest) GetTableId() uint32 {
	return (*openflow_13.OfpAggregateStatsRequest)(m).GetTableId()
}
func (m *OfpAggregateStatsRequest) GetOutPort() uint32 {
	return (*openflow_13.OfpAggregateStatsRequest)(m).GetOutPort()
}
func (m *OfpAggregateStatsRequest) GetOutGroup() uint32 {
	return (*openflow_13.OfpAggregateStatsRequest)(m).GetOutGroup()
}
func (m *OfpAggregateStatsRequest) GetCookie() uint64 {
	return (*openflow_13.OfpAggregateStatsRequest)(m).GetCookie()
}
func (m *OfpAggregateStatsRequest) GetCookieMask() uint64 {
	return (*openflow_13.OfpAggregateStatsRequest)(m).GetCookieMask()
}
func (m *OfpAggregateStatsRequest) GetMatch() *OfpMatch {
	return (*OfpMatch)((*openflow_13.OfpAggregateStatsRequest)(m).GetMatch())
}

// ofp_aggregate_stats_reply from public import openflow_13.proto
type OfpAggregateStatsReply openflow_13.OfpAggregateStatsReply

func (m *OfpAggregateStatsReply) Reset() { (*openflow_13.OfpAggregateStatsReply)(m).Reset() }
func (m *OfpAggregateStatsReply) String() string {
	return (*openflow_13.OfpAggregateStatsReply)(m).String()
}
func (*OfpAggregateStatsReply) ProtoMessage() {}
func (m *OfpAggregateStatsReply) GetPacketCount() uint64 {
	return (*openflow_13.OfpAggregateStatsReply)(m).GetPacketCount()
}
func (m *OfpAggregateStatsReply) GetByteCount() uint64 {
	return (*openflow_13.OfpAggregateStatsReply)(m).GetByteCount()
}
func (m *OfpAggregateStatsReply) GetFlowCount() uint32 {
	return (*openflow_13.OfpAggregateStatsReply)(m).GetFlowCount()
}

// ofp_table_feature_property from public import openflow_13.proto
type OfpTableFeatureProperty openflow_13.OfpTableFeatureProperty

func (m *OfpTableFeatureProperty) Reset() { (*openflow_13.OfpTableFeatureProperty)(m).Reset() }
func (m *OfpTableFeatureProperty) String() string {
	return (*openflow_13.OfpTableFeatureProperty)(m).String()
}
func (*OfpTableFeatureProperty) ProtoMessage() {}
func (m *OfpTableFeatureProperty) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _OfpTableFeatureProperty_OneofMarshaler, _OfpTableFeatureProperty_OneofUnmarshaler, _OfpTableFeatureProperty_OneofSizer, nil
}
func _OfpTableFeatureProperty_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*OfpTableFeatureProperty)
	m0 := (*openflow_13.OfpTableFeatureProperty)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _OfpTableFeatureProperty_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OfpTableFeatureProperty)
	m0 := (*openflow_13.OfpTableFeatureProperty)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _OfpTableFeatureProperty_OneofSizer(msg proto.Message) int {
	m := msg.(*OfpTableFeatureProperty)
	m0 := (*openflow_13.OfpTableFeatureProperty)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *OfpTableFeatureProperty) GetType() OfpTableFeaturePropType {
	return (OfpTableFeaturePropType)((*openflow_13.OfpTableFeatureProperty)(m).GetType())
}
func (m *OfpTableFeatureProperty) GetInstructions() *OfpTableFeaturePropInstructions {
	return (*OfpTableFeaturePropInstructions)((*openflow_13.OfpTableFeatureProperty)(m).GetInstructions())
}
func (m *OfpTableFeatureProperty) GetNextTables() *OfpTableFeaturePropNextTables {
	return (*OfpTableFeaturePropNextTables)((*openflow_13.OfpTableFeatureProperty)(m).GetNextTables())
}
func (m *OfpTableFeatureProperty) GetActions() *OfpTableFeaturePropActions {
	return (*OfpTableFeaturePropActions)((*openflow_13.OfpTableFeatureProperty)(m).GetActions())
}
func (m *OfpTableFeatureProperty) GetOxm() *OfpTableFeaturePropOxm {
	return (*OfpTableFeaturePropOxm)((*openflow_13.OfpTableFeatureProperty)(m).GetOxm())
}
func (m *OfpTableFeatureProperty) GetExperimenter() *OfpTableFeaturePropExperimenter {
	return (*OfpTableFeaturePropExperimenter)((*openflow_13.OfpTableFeatureProperty)(m).GetExperimenter())
}

// ofp_table_feature_prop_instructions from public import openflow_13.proto
type OfpTableFeaturePropInstructions openflow_13.OfpTableFeaturePropInstructions

func (m *OfpTableFeaturePropInstructions) Reset() {
	(*openflow_13.OfpTableFeaturePropInstructions)(m).Reset()
}
func (m *OfpTableFeaturePropInstructions) String() string {
	return (*openflow_13.OfpTableFeaturePropInstructions)(m).String()
}
func (*OfpTableFeaturePropInstructions) ProtoMessage() {}
func (m *OfpTableFeaturePropInstructions) GetInstructions() []*OfpInstruction {
	o := (*openflow_13.OfpTableFeaturePropInstructions)(m).GetInstructions()
	if o == nil {
		return nil
	}
	s := make([]*OfpInstruction, len(o))
	for i, x := range o {
		s[i] = (*OfpInstruction)(x)
	}
	return s
}

// ofp_table_feature_prop_next_tables from public import openflow_13.proto
type OfpTableFeaturePropNextTables openflow_13.OfpTableFeaturePropNextTables

func (m *OfpTableFeaturePropNextTables) Reset() {
	(*openflow_13.OfpTableFeaturePropNextTables)(m).Reset()
}
func (m *OfpTableFeaturePropNextTables) String() string {
	return (*openflow_13.OfpTableFeaturePropNextTables)(m).String()
}
func (*OfpTableFeaturePropNextTables) ProtoMessage() {}
func (m *OfpTableFeaturePropNextTables) GetNextTableIds() []uint32 {
	return (*openflow_13.OfpTableFeaturePropNextTables)(m).GetNextTableIds()
}

// ofp_table_feature_prop_actions from public import openflow_13.proto
type OfpTableFeaturePropActions openflow_13.OfpTableFeaturePropActions

func (m *OfpTableFeaturePropActions) Reset() { (*openflow_13.OfpTableFeaturePropActions)(m).Reset() }
func (m *OfpTableFeaturePropActions) String() string {
	return (*openflow_13.OfpTableFeaturePropActions)(m).String()
}
func (*OfpTableFeaturePropActions) ProtoMessage() {}
func (m *OfpTableFeaturePropActions) GetActions() []*OfpAction {
	o := (*openflow_13.OfpTableFeaturePropActions)(m).GetActions()
	if o == nil {
		return nil
	}
	s := make([]*OfpAction, len(o))
	for i, x := range o {
		s[i] = (*OfpAction)(x)
	}
	return s
}

// ofp_table_feature_prop_oxm from public import openflow_13.proto
type OfpTableFeaturePropOxm openflow_13.OfpTableFeaturePropOxm

func (m *OfpTableFeaturePropOxm) Reset() { (*openflow_13.OfpTableFeaturePropOxm)(m).Reset() }
func (m *OfpTableFeaturePropOxm) String() string {
	return (*openflow_13.OfpTableFeaturePropOxm)(m).String()
}
func (*OfpTableFeaturePropOxm) ProtoMessage() {}
func (m *OfpTableFeaturePropOxm) GetOxmIds() []uint32 {
	return (*openflow_13.OfpTableFeaturePropOxm)(m).GetOxmIds()
}

// ofp_table_feature_prop_experimenter from public import openflow_13.proto
type OfpTableFeaturePropExperimenter openflow_13.OfpTableFeaturePropExperimenter

func (m *OfpTableFeaturePropExperimenter) Reset() {
	(*openflow_13.OfpTableFeaturePropExperimenter)(m).Reset()
}
func (m *OfpTableFeaturePropExperimenter) String() string {
	return (*openflow_13.OfpTableFeaturePropExperimenter)(m).String()
}
func (*OfpTableFeaturePropExperimenter) ProtoMessage() {}
func (m *OfpTableFeaturePropExperimenter) GetExperimenter() uint32 {
	return (*openflow_13.OfpTableFeaturePropExperimenter)(m).GetExperimenter()
}
func (m *OfpTableFeaturePropExperimenter) GetExpType() uint32 {
	return (*openflow_13.OfpTableFeaturePropExperimenter)(m).GetExpType()
}
func (m *OfpTableFeaturePropExperimenter) GetExperimenterData() []uint32 {
	return (*openflow_13.OfpTableFeaturePropExperimenter)(m).GetExperimenterData()
}

// ofp_table_features from public import openflow_13.proto
type OfpTableFeatures openflow_13.OfpTableFeatures

func (m *OfpTableFeatures) Reset()             { (*openflow_13.OfpTableFeatures)(m).Reset() }
func (m *OfpTableFeatures) String() string     { return (*openflow_13.OfpTableFeatures)(m).String() }
func (*OfpTableFeatures) ProtoMessage()        {}
func (m *OfpTableFeatures) GetTableId() uint32 { return (*openflow_13.OfpTableFeatures)(m).GetTableId() }
func (m *OfpTableFeatures) GetName() string    { return (*openflow_13.OfpTableFeatures)(m).GetName() }
func (m *OfpTableFeatures) GetMetadataMatch() uint64 {
	return (*openflow_13.OfpTableFeatures)(m).GetMetadataMatch()
}
func (m *OfpTableFeatures) GetMetadataWrite() uint64 {
	return (*openflow_13.OfpTableFeatures)(m).GetMetadataWrite()
}
func (m *OfpTableFeatures) GetConfig() uint32 { return (*openflow_13.OfpTableFeatures)(m).GetConfig() }
func (m *OfpTableFeatures) GetMaxEntries() uint32 {
	return (*openflow_13.OfpTableFeatures)(m).GetMaxEntries()
}
func (m *OfpTableFeatures) GetProperties() []*OfpTableFeatureProperty {
	o := (*openflow_13.OfpTableFeatures)(m).GetProperties()
	if o == nil {
		return nil
	}
	s := make([]*OfpTableFeatureProperty, len(o))
	for i, x := range o {
		s[i] = (*OfpTableFeatureProperty)(x)
	}
	return s
}

// ofp_table_stats from public import openflow_13.proto
type OfpTableStats openflow_13.OfpTableStats

func (m *OfpTableStats) Reset()             { (*openflow_13.OfpTableStats)(m).Reset() }
func (m *OfpTableStats) String() string     { return (*openflow_13.OfpTableStats)(m).String() }
func (*OfpTableStats) ProtoMessage()        {}
func (m *OfpTableStats) GetTableId() uint32 { return (*openflow_13.OfpTableStats)(m).GetTableId() }
func (m *OfpTableStats) GetActiveCount() uint32 {
	return (*openflow_13.OfpTableStats)(m).GetActiveCount()
}
func (m *OfpTableStats) GetLookupCount() uint64 {
	return (*openflow_13.OfpTableStats)(m).GetLookupCount()
}
func (m *OfpTableStats) GetMatchedCount() uint64 {
	return (*openflow_13.OfpTableStats)(m).GetMatchedCount()
}

// ofp_port_stats_request from public import openflow_13.proto
type OfpPortStatsRequest openflow_13.OfpPortStatsRequest

func (m *OfpPortStatsRequest) Reset()         { (*openflow_13.OfpPortStatsRequest)(m).Reset() }
func (m *OfpPortStatsRequest) String() string { return (*openflow_13.OfpPortStatsRequest)(m).String() }
func (*OfpPortStatsRequest) ProtoMessage()    {}
func (m *OfpPortStatsRequest) GetPortNo() uint32 {
	return (*openflow_13.OfpPortStatsRequest)(m).GetPortNo()
}

// ofp_port_stats from public import openflow_13.proto
type OfpPortStats openflow_13.OfpPortStats

func (m *OfpPortStats) Reset()                 { (*openflow_13.OfpPortStats)(m).Reset() }
func (m *OfpPortStats) String() string         { return (*openflow_13.OfpPortStats)(m).String() }
func (*OfpPortStats) ProtoMessage()            {}
func (m *OfpPortStats) GetPortNo() uint32      { return (*openflow_13.OfpPortStats)(m).GetPortNo() }
func (m *OfpPortStats) GetRxPackets() uint64   { return (*openflow_13.OfpPortStats)(m).GetRxPackets() }
func (m *OfpPortStats) GetTxPackets() uint64   { return (*openflow_13.OfpPortStats)(m).GetTxPackets() }
func (m *OfpPortStats) GetRxBytes() uint64     { return (*openflow_13.OfpPortStats)(m).GetRxBytes() }
func (m *OfpPortStats) GetTxBytes() uint64     { return (*openflow_13.OfpPortStats)(m).GetTxBytes() }
func (m *OfpPortStats) GetRxDropped() uint64   { return (*openflow_13.OfpPortStats)(m).GetRxDropped() }
func (m *OfpPortStats) GetTxDropped() uint64   { return (*openflow_13.OfpPortStats)(m).GetTxDropped() }
func (m *OfpPortStats) GetRxErrors() uint64    { return (*openflow_13.OfpPortStats)(m).GetRxErrors() }
func (m *OfpPortStats) GetTxErrors() uint64    { return (*openflow_13.OfpPortStats)(m).GetTxErrors() }
func (m *OfpPortStats) GetRxFrameErr() uint64  { return (*openflow_13.OfpPortStats)(m).GetRxFrameErr() }
func (m *OfpPortStats) GetRxOverErr() uint64   { return (*openflow_13.OfpPortStats)(m).GetRxOverErr() }
func (m *OfpPortStats) GetRxCrcErr() uint64    { return (*openflow_13.OfpPortStats)(m).GetRxCrcErr() }
func (m *OfpPortStats) GetCollisions() uint64  { return (*openflow_13.OfpPortStats)(m).GetCollisions() }
func (m *OfpPortStats) GetDurationSec() uint32 { return (*openflow_13.OfpPortStats)(m).GetDurationSec() }
func (m *OfpPortStats) GetDurationNsec() uint32 {
	return (*openflow_13.OfpPortStats)(m).GetDurationNsec()
}

// ofp_group_stats_request from public import openflow_13.proto
type OfpGroupStatsRequest openflow_13.OfpGroupStatsRequest

func (m *OfpGroupStatsRequest) Reset()         { (*openflow_13.OfpGroupStatsRequest)(m).Reset() }
func (m *OfpGroupStatsRequest) String() string { return (*openflow_13.OfpGroupStatsRequest)(m).String() }
func (*OfpGroupStatsRequest) ProtoMessage()    {}
func (m *OfpGroupStatsRequest) GetGroupId() uint32 {
	return (*openflow_13.OfpGroupStatsRequest)(m).GetGroupId()
}

// ofp_bucket_counter from public import openflow_13.proto
type OfpBucketCounter openflow_13.OfpBucketCounter

func (m *OfpBucketCounter) Reset()         { (*openflow_13.OfpBucketCounter)(m).Reset() }
func (m *OfpBucketCounter) String() string { return (*openflow_13.OfpBucketCounter)(m).String() }
func (*OfpBucketCounter) ProtoMessage()    {}
func (m *OfpBucketCounter) GetPacketCount() uint64 {
	return (*openflow_13.OfpBucketCounter)(m).GetPacketCount()
}
func (m *OfpBucketCounter) GetByteCount() uint64 {
	return (*openflow_13.OfpBucketCounter)(m).GetByteCount()
}

// ofp_group_stats from public import openflow_13.proto
type OfpGroupStats openflow_13.OfpGroupStats

func (m *OfpGroupStats) Reset()              { (*openflow_13.OfpGroupStats)(m).Reset() }
func (m *OfpGroupStats) String() string      { return (*openflow_13.OfpGroupStats)(m).String() }
func (*OfpGroupStats) ProtoMessage()         {}
func (m *OfpGroupStats) GetGroupId() uint32  { return (*openflow_13.OfpGroupStats)(m).GetGroupId() }
func (m *OfpGroupStats) GetRefCount() uint32 { return (*openflow_13.OfpGroupStats)(m).GetRefCount() }
func (m *OfpGroupStats) GetPacketCount() uint64 {
	return (*openflow_13.OfpGroupStats)(m).GetPacketCount()
}
func (m *OfpGroupStats) GetByteCount() uint64 { return (*openflow_13.OfpGroupStats)(m).GetByteCount() }
func (m *OfpGroupStats) GetDurationSec() uint32 {
	return (*openflow_13.OfpGroupStats)(m).GetDurationSec()
}
func (m *OfpGroupStats) GetDurationNsec() uint32 {
	return (*openflow_13.OfpGroupStats)(m).GetDurationNsec()
}
func (m *OfpGroupStats) GetBucketStats() []*OfpBucketCounter {
	o := (*openflow_13.OfpGroupStats)(m).GetBucketStats()
	if o == nil {
		return nil
	}
	s := make([]*OfpBucketCounter, len(o))
	for i, x := range o {
		s[i] = (*OfpBucketCounter)(x)
	}
	return s
}

// ofp_group_desc from public import openflow_13.proto
type OfpGroupDesc openflow_13.OfpGroupDesc

func (m *OfpGroupDesc) Reset()         { (*openflow_13.OfpGroupDesc)(m).Reset() }
func (m *OfpGroupDesc) String() string { return (*openflow_13.OfpGroupDesc)(m).String() }
func (*OfpGroupDesc) ProtoMessage()    {}
func (m *OfpGroupDesc) GetType() OfpGroupType {
	return (OfpGroupType)((*openflow_13.OfpGroupDesc)(m).GetType())
}
func (m *OfpGroupDesc) GetGroupId() uint32 { return (*openflow_13.OfpGroupDesc)(m).GetGroupId() }
func (m *OfpGroupDesc) GetBuckets() []*OfpBucket {
	o := (*openflow_13.OfpGroupDesc)(m).GetBuckets()
	if o == nil {
		return nil
	}
	s := make([]*OfpBucket, len(o))
	for i, x := range o {
		s[i] = (*OfpBucket)(x)
	}
	return s
}

// ofp_group_entry from public import openflow_13.proto
type OfpGroupEntry openflow_13.OfpGroupEntry

func (m *OfpGroupEntry) Reset()         { (*openflow_13.OfpGroupEntry)(m).Reset() }
func (m *OfpGroupEntry) String() string { return (*openflow_13.OfpGroupEntry)(m).String() }
func (*OfpGroupEntry) ProtoMessage()    {}
func (m *OfpGroupEntry) GetDesc() *OfpGroupDesc {
	return (*OfpGroupDesc)((*openflow_13.OfpGroupEntry)(m).GetDesc())
}
func (m *OfpGroupEntry) GetStats() *OfpGroupStats {
	return (*OfpGroupStats)((*openflow_13.OfpGroupEntry)(m).GetStats())
}

// ofp_group_features from public import openflow_13.proto
type OfpGroupFeatures openflow_13.OfpGroupFeatures

func (m *OfpGroupFeatures) Reset()           { (*openflow_13.OfpGroupFeatures)(m).Reset() }
func (m *OfpGroupFeatures) String() string   { return (*openflow_13.OfpGroupFeatures)(m).String() }
func (*OfpGroupFeatures) ProtoMessage()      {}
func (m *OfpGroupFeatures) GetTypes() uint32 { return (*openflow_13.OfpGroupFeatures)(m).GetTypes() }
func (m *OfpGroupFeatures) GetCapabilities() uint32 {
	return (*openflow_13.OfpGroupFeatures)(m).GetCapabilities()
}
func (m *OfpGroupFeatures) GetMaxGroups() []uint32 {
	return (*openflow_13.OfpGroupFeatures)(m).GetMaxGroups()
}
func (m *OfpGroupFeatures) GetActions() []uint32 {
	return (*openflow_13.OfpGroupFeatures)(m).GetActions()
}

// ofp_meter_multipart_request from public import openflow_13.proto
type OfpMeterMultipartRequest openflow_13.OfpMeterMultipartRequest

func (m *OfpMeterMultipartRequest) Reset() { (*openflow_13.OfpMeterMultipartRequest)(m).Reset() }
func (m *OfpMeterMultipartRequest) String() string {
	return (*openflow_13.OfpMeterMultipartRequest)(m).String()
}
func (*OfpMeterMultipartRequest) ProtoMessage() {}
func (m *OfpMeterMultipartRequest) GetMeterId() uint32 {
	return (*openflow_13.OfpMeterMultipartRequest)(m).GetMeterId()
}

// ofp_meter_band_stats from public import openflow_13.proto
type OfpMeterBandStats openflow_13.OfpMeterBandStats

func (m *OfpMeterBandStats) Reset()         { (*openflow_13.OfpMeterBandStats)(m).Reset() }
func (m *OfpMeterBandStats) String() string { return (*openflow_13.OfpMeterBandStats)(m).String() }
func (*OfpMeterBandStats) ProtoMessage()    {}
func (m *OfpMeterBandStats) GetPacketBandCount() uint64 {
	return (*openflow_13.OfpMeterBandStats)(m).GetPacketBandCount()
}
func (m *OfpMeterBandStats) GetByteBandCount() uint64 {
	return (*openflow_13.OfpMeterBandStats)(m).GetByteBandCount()
}

// ofp_meter_stats from public import openflow_13.proto
type OfpMeterStats openflow_13.OfpMeterStats

func (m *OfpMeterStats) Reset()               { (*openflow_13.OfpMeterStats)(m).Reset() }
func (m *OfpMeterStats) String() string       { return (*openflow_13.OfpMeterStats)(m).String() }
func (*OfpMeterStats) ProtoMessage()          {}
func (m *OfpMeterStats) GetMeterId() uint32   { return (*openflow_13.OfpMeterStats)(m).GetMeterId() }
func (m *OfpMeterStats) GetFlowCount() uint32 { return (*openflow_13.OfpMeterStats)(m).GetFlowCount() }
func (m *OfpMeterStats) GetPacketInCount() uint64 {
	return (*openflow_13.OfpMeterStats)(m).GetPacketInCount()
}
func (m *OfpMeterStats) GetByteInCount() uint64 {
	return (*openflow_13.OfpMeterStats)(m).GetByteInCount()
}
func (m *OfpMeterStats) GetDurationSec() uint32 {
	return (*openflow_13.OfpMeterStats)(m).GetDurationSec()
}
func (m *OfpMeterStats) GetDurationNsec() uint32 {
	return (*openflow_13.OfpMeterStats)(m).GetDurationNsec()
}
func (m *OfpMeterStats) GetBandStats() []*OfpMeterBandStats {
	o := (*openflow_13.OfpMeterStats)(m).GetBandStats()
	if o == nil {
		return nil
	}
	s := make([]*OfpMeterBandStats, len(o))
	for i, x := range o {
		s[i] = (*OfpMeterBandStats)(x)
	}
	return s
}

// ofp_meter_config from public import openflow_13.proto
type OfpMeterConfig openflow_13.OfpMeterConfig

func (m *OfpMeterConfig) Reset()             { (*openflow_13.OfpMeterConfig)(m).Reset() }
func (m *OfpMeterConfig) String() string     { return (*openflow_13.OfpMeterConfig)(m).String() }
func (*OfpMeterConfig) ProtoMessage()        {}
func (m *OfpMeterConfig) GetFlags() uint32   { return (*openflow_13.OfpMeterConfig)(m).GetFlags() }
func (m *OfpMeterConfig) GetMeterId() uint32 { return (*openflow_13.OfpMeterConfig)(m).GetMeterId() }
func (m *OfpMeterConfig) GetBands() []*OfpMeterBandHeader {
	o := (*openflow_13.OfpMeterConfig)(m).GetBands()
	if o == nil {
		return nil
	}
	s := make([]*OfpMeterBandHeader, len(o))
	for i, x := range o {
		s[i] = (*OfpMeterBandHeader)(x)
	}
	return s
}

// ofp_meter_features from public import openflow_13.proto
type OfpMeterFeatures openflow_13.OfpMeterFeatures

func (m *OfpMeterFeatures) Reset()         { (*openflow_13.OfpMeterFeatures)(m).Reset() }
func (m *OfpMeterFeatures) String() string { return (*openflow_13.OfpMeterFeatures)(m).String() }
func (*OfpMeterFeatures) ProtoMessage()    {}
func (m *OfpMeterFeatures) GetMaxMeter() uint32 {
	return (*openflow_13.OfpMeterFeatures)(m).GetMaxMeter()
}
func (m *OfpMeterFeatures) GetBandTypes() uint32 {
	return (*openflow_13.OfpMeterFeatures)(m).GetBandTypes()
}
func (m *OfpMeterFeatures) GetCapabilities() uint32 {
	return (*openflow_13.OfpMeterFeatures)(m).GetCapabilities()
}
func (m *OfpMeterFeatures) GetMaxBands() uint32 {
	return (*openflow_13.OfpMeterFeatures)(m).GetMaxBands()
}
func (m *OfpMeterFeatures) GetMaxColor() uint32 {
	return (*openflow_13.OfpMeterFeatures)(m).GetMaxColor()
}

// ofp_experimenter_multipart_header from public import openflow_13.proto
type OfpExperimenterMultipartHeader openflow_13.OfpExperimenterMultipartHeader

func (m *OfpExperimenterMultipartHeader) Reset() {
	(*openflow_13.OfpExperimenterMultipartHeader)(m).Reset()
}
func (m *OfpExperimenterMultipartHeader) String() string {
	return (*openflow_13.OfpExperimenterMultipartHeader)(m).String()
}
func (*OfpExperimenterMultipartHeader) ProtoMessage() {}
func (m *OfpExperimenterMultipartHeader) GetExperimenter() uint32 {
	return (*openflow_13.OfpExperimenterMultipartHeader)(m).GetExperimenter()
}
func (m *OfpExperimenterMultipartHeader) GetExpType() uint32 {
	return (*openflow_13.OfpExperimenterMultipartHeader)(m).GetExpType()
}
func (m *OfpExperimenterMultipartHeader) GetData() []byte {
	return (*openflow_13.OfpExperimenterMultipartHeader)(m).GetData()
}

// ofp_experimenter_header from public import openflow_13.proto
type OfpExperimenterHeader openflow_13.OfpExperimenterHeader

func (m *OfpExperimenterHeader) Reset() { (*openflow_13.OfpExperimenterHeader)(m).Reset() }
func (m *OfpExperimenterHeader) String() string {
	return (*openflow_13.OfpExperimenterHeader)(m).String()
}
func (*OfpExperimenterHeader) ProtoMessage() {}
func (m *OfpExperimenterHeader) GetExperimenter() uint32 {
	return (*openflow_13.OfpExperimenterHeader)(m).GetExperimenter()
}
func (m *OfpExperimenterHeader) GetExpType() uint32 {
	return (*openflow_13.OfpExperimenterHeader)(m).GetExpType()
}
func (m *OfpExperimenterHeader) GetData() []byte {
	return (*openflow_13.OfpExperimenterHeader)(m).GetData()
}

// ofp_queue_prop_header from public import openflow_13.proto
type OfpQueuePropHeader openflow_13.OfpQueuePropHeader

func (m *OfpQueuePropHeader) Reset()         { (*openflow_13.OfpQueuePropHeader)(m).Reset() }
func (m *OfpQueuePropHeader) String() string { return (*openflow_13.OfpQueuePropHeader)(m).String() }
func (*OfpQueuePropHeader) ProtoMessage()    {}
func (m *OfpQueuePropHeader) GetProperty() uint32 {
	return (*openflow_13.OfpQueuePropHeader)(m).GetProperty()
}
func (m *OfpQueuePropHeader) GetLen() uint32 { return (*openflow_13.OfpQueuePropHeader)(m).GetLen() }

// ofp_queue_prop_min_rate from public import openflow_13.proto
type OfpQueuePropMinRate openflow_13.OfpQueuePropMinRate

func (m *OfpQueuePropMinRate) Reset()         { (*openflow_13.OfpQueuePropMinRate)(m).Reset() }
func (m *OfpQueuePropMinRate) String() string { return (*openflow_13.OfpQueuePropMinRate)(m).String() }
func (*OfpQueuePropMinRate) ProtoMessage()    {}
func (m *OfpQueuePropMinRate) GetPropHeader() *OfpQueuePropHeader {
	return (*OfpQueuePropHeader)((*openflow_13.OfpQueuePropMinRate)(m).GetPropHeader())
}
func (m *OfpQueuePropMinRate) GetRate() uint32 { return (*openflow_13.OfpQueuePropMinRate)(m).GetRate() }

// ofp_queue_prop_max_rate from public import openflow_13.proto
type OfpQueuePropMaxRate openflow_13.OfpQueuePropMaxRate

func (m *OfpQueuePropMaxRate) Reset()         { (*openflow_13.OfpQueuePropMaxRate)(m).Reset() }
func (m *OfpQueuePropMaxRate) String() string { return (*openflow_13.OfpQueuePropMaxRate)(m).String() }
func (*OfpQueuePropMaxRate) ProtoMessage()    {}
func (m *OfpQueuePropMaxRate) GetPropHeader() *OfpQueuePropHeader {
	return (*OfpQueuePropHeader)((*openflow_13.OfpQueuePropMaxRate)(m).GetPropHeader())
}
func (m *OfpQueuePropMaxRate) GetRate() uint32 { return (*openflow_13.OfpQueuePropMaxRate)(m).GetRate() }

// ofp_queue_prop_experimenter from public import openflow_13.proto
type OfpQueuePropExperimenter openflow_13.OfpQueuePropExperimenter

func (m *OfpQueuePropExperimenter) Reset() { (*openflow_13.OfpQueuePropExperimenter)(m).Reset() }
func (m *OfpQueuePropExperimenter) String() string {
	return (*openflow_13.OfpQueuePropExperimenter)(m).String()
}
func (*OfpQueuePropExperimenter) ProtoMessage() {}
func (m *OfpQueuePropExperimenter) GetPropHeader() *OfpQueuePropHeader {
	return (*OfpQueuePropHeader)((*openflow_13.OfpQueuePropExperimenter)(m).GetPropHeader())
}
func (m *OfpQueuePropExperimenter) GetExperimenter() uint32 {
	return (*openflow_13.OfpQueuePropExperimenter)(m).GetExperimenter()
}
func (m *OfpQueuePropExperimenter) GetData() []byte {
	return (*openflow_13.OfpQueuePropExperimenter)(m).GetData()
}

// ofp_packet_queue from public import openflow_13.proto
type OfpPacketQueue openflow_13.OfpPacketQueue

func (m *OfpPacketQueue) Reset()             { (*openflow_13.OfpPacketQueue)(m).Reset() }
func (m *OfpPacketQueue) String() string     { return (*openflow_13.OfpPacketQueue)(m).String() }
func (*OfpPacketQueue) ProtoMessage()        {}
func (m *OfpPacketQueue) GetQueueId() uint32 { return (*openflow_13.OfpPacketQueue)(m).GetQueueId() }
func (m *OfpPacketQueue) GetPort() uint32    { return (*openflow_13.OfpPacketQueue)(m).GetPort() }
func (m *OfpPacketQueue) GetProperties() []*OfpQueuePropHeader {
	o := (*openflow_13.OfpPacketQueue)(m).GetProperties()
	if o == nil {
		return nil
	}
	s := make([]*OfpQueuePropHeader, len(o))
	for i, x := range o {
		s[i] = (*OfpQueuePropHeader)(x)
	}
	return s
}

// ofp_queue_get_config_request from public import openflow_13.proto
type OfpQueueGetConfigRequest openflow_13.OfpQueueGetConfigRequest

func (m *OfpQueueGetConfigRequest) Reset() { (*openflow_13.OfpQueueGetConfigRequest)(m).Reset() }
func (m *OfpQueueGetConfigRequest) String() string {
	return (*openflow_13.OfpQueueGetConfigRequest)(m).String()
}
func (*OfpQueueGetConfigRequest) ProtoMessage() {}
func (m *OfpQueueGetConfigRequest) GetPort() uint32 {
	return (*openflow_13.OfpQueueGetConfigRequest)(m).GetPort()
}

// ofp_queue_get_config_reply from public import openflow_13.proto
type OfpQueueGetConfigReply openflow_13.OfpQueueGetConfigReply

func (m *OfpQueueGetConfigReply) Reset() { (*openflow_13.OfpQueueGetConfigReply)(m).Reset() }
func (m *OfpQueueGetConfigReply) String() string {
	return (*openflow_13.OfpQueueGetConfigReply)(m).String()
}
func (*OfpQueueGetConfigReply) ProtoMessage() {}
func (m *OfpQueueGetConfigReply) GetPort() uint32 {
	return (*openflow_13.OfpQueueGetConfigReply)(m).GetPort()
}
func (m *OfpQueueGetConfigReply) GetQueues() []*OfpPacketQueue {
	o := (*openflow_13.OfpQueueGetConfigReply)(m).GetQueues()
	if o == nil {
		return nil
	}
	s := make([]*OfpPacketQueue, len(o))
	for i, x := range o {
		s[i] = (*OfpPacketQueue)(x)
	}
	return s
}

// ofp_action_set_queue from public import openflow_13.proto
type OfpActionSetQueue openflow_13.OfpActionSetQueue

func (m *OfpActionSetQueue) Reset()          { (*openflow_13.OfpActionSetQueue)(m).Reset() }
func (m *OfpActionSetQueue) String() string  { return (*openflow_13.OfpActionSetQueue)(m).String() }
func (*OfpActionSetQueue) ProtoMessage()     {}
func (m *OfpActionSetQueue) GetType() uint32 { return (*openflow_13.OfpActionSetQueue)(m).GetType() }
func (m *OfpActionSetQueue) GetQueueId() uint32 {
	return (*openflow_13.OfpActionSetQueue)(m).GetQueueId()
}

// ofp_queue_stats_request from public import openflow_13.proto
type OfpQueueStatsRequest openflow_13.OfpQueueStatsRequest

func (m *OfpQueueStatsRequest) Reset()         { (*openflow_13.OfpQueueStatsRequest)(m).Reset() }
func (m *OfpQueueStatsRequest) String() string { return (*openflow_13.OfpQueueStatsRequest)(m).String() }
func (*OfpQueueStatsRequest) ProtoMessage()    {}
func (m *OfpQueueStatsRequest) GetPortNo() uint32 {
	return (*openflow_13.OfpQueueStatsRequest)(m).GetPortNo()
}
func (m *OfpQueueStatsRequest) GetQueueId() uint32 {
	return (*openflow_13.OfpQueueStatsRequest)(m).GetQueueId()
}

// ofp_queue_stats from public import openflow_13.proto
type OfpQueueStats openflow_13.OfpQueueStats

func (m *OfpQueueStats) Reset()               { (*openflow_13.OfpQueueStats)(m).Reset() }
func (m *OfpQueueStats) String() string       { return (*openflow_13.OfpQueueStats)(m).String() }
func (*OfpQueueStats) ProtoMessage()          {}
func (m *OfpQueueStats) GetPortNo() uint32    { return (*openflow_13.OfpQueueStats)(m).GetPortNo() }
func (m *OfpQueueStats) GetQueueId() uint32   { return (*openflow_13.OfpQueueStats)(m).GetQueueId() }
func (m *OfpQueueStats) GetTxBytes() uint64   { return (*openflow_13.OfpQueueStats)(m).GetTxBytes() }
func (m *OfpQueueStats) GetTxPackets() uint64 { return (*openflow_13.OfpQueueStats)(m).GetTxPackets() }
func (m *OfpQueueStats) GetTxErrors() uint64  { return (*openflow_13.OfpQueueStats)(m).GetTxErrors() }
func (m *OfpQueueStats) GetDurationSec() uint32 {
	return (*openflow_13.OfpQueueStats)(m).GetDurationSec()
}
func (m *OfpQueueStats) GetDurationNsec() uint32 {
	return (*openflow_13.OfpQueueStats)(m).GetDurationNsec()
}

// ofp_role_request from public import openflow_13.proto
type OfpRoleRequest openflow_13.OfpRoleRequest

func (m *OfpRoleRequest) Reset()         { (*openflow_13.OfpRoleRequest)(m).Reset() }
func (m *OfpRoleRequest) String() string { return (*openflow_13.OfpRoleRequest)(m).String() }
func (*OfpRoleRequest) ProtoMessage()    {}
func (m *OfpRoleRequest) GetRole() OfpControllerRole {
	return (OfpControllerRole)((*openflow_13.OfpRoleRequest)(m).GetRole())
}
func (m *OfpRoleRequest) GetGenerationId() uint64 {
	return (*openflow_13.OfpRoleRequest)(m).GetGenerationId()
}

// ofp_async_config from public import openflow_13.proto
type OfpAsyncConfig openflow_13.OfpAsyncConfig

func (m *OfpAsyncConfig) Reset()         { (*openflow_13.OfpAsyncConfig)(m).Reset() }
func (m *OfpAsyncConfig) String() string { return (*openflow_13.OfpAsyncConfig)(m).String() }
func (*OfpAsyncConfig) ProtoMessage()    {}
func (m *OfpAsyncConfig) GetPacketInMask() []uint32 {
	return (*openflow_13.OfpAsyncConfig)(m).GetPacketInMask()
}
func (m *OfpAsyncConfig) GetPortStatusMask() []uint32 {
	return (*openflow_13.OfpAsyncConfig)(m).GetPortStatusMask()
}
func (m *OfpAsyncConfig) GetFlowRemovedMask() []uint32 {
	return (*openflow_13.OfpAsyncConfig)(m).GetFlowRemovedMask()
}

// FlowTableUpdate from public import openflow_13.proto
type FlowTableUpdate openflow_13.FlowTableUpdate

func (m *FlowTableUpdate) Reset()         { (*openflow_13.FlowTableUpdate)(m).Reset() }
func (m *FlowTableUpdate) String() string { return (*openflow_13.FlowTableUpdate)(m).String() }
func (*FlowTableUpdate) ProtoMessage()    {}
func (m *FlowTableUpdate) GetId() string  { return (*openflow_13.FlowTableUpdate)(m).GetId() }
func (m *FlowTableUpdate) GetFlowMod() *OfpFlowMod {
	return (*OfpFlowMod)((*openflow_13.FlowTableUpdate)(m).GetFlowMod())
}

// FlowGroupTableUpdate from public import openflow_13.proto
type FlowGroupTableUpdate openflow_13.FlowGroupTableUpdate

func (m *FlowGroupTableUpdate) Reset()         { (*openflow_13.FlowGroupTableUpdate)(m).Reset() }
func (m *FlowGroupTableUpdate) String() string { return (*openflow_13.FlowGroupTableUpdate)(m).String() }
func (*FlowGroupTableUpdate) ProtoMessage()    {}
func (m *FlowGroupTableUpdate) GetId() string  { return (*openflow_13.FlowGroupTableUpdate)(m).GetId() }
func (m *FlowGroupTableUpdate) GetGroupMod() *OfpGroupMod {
	return (*OfpGroupMod)((*openflow_13.FlowGroupTableUpdate)(m).GetGroupMod())
}

// Flows from public import openflow_13.proto
type Flows openflow_13.Flows

func (m *Flows) Reset()         { (*openflow_13.Flows)(m).Reset() }
func (m *Flows) String() string { return (*openflow_13.Flows)(m).String() }
func (*Flows) ProtoMessage()    {}
func (m *Flows) GetItems() []*OfpFlowStats {
	o := (*openflow_13.Flows)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*OfpFlowStats, len(o))
	for i, x := range o {
		s[i] = (*OfpFlowStats)(x)
	}
	return s
}

// FlowGroups from public import openflow_13.proto
type FlowGroups openflow_13.FlowGroups

func (m *FlowGroups) Reset()         { (*openflow_13.FlowGroups)(m).Reset() }
func (m *FlowGroups) String() string { return (*openflow_13.FlowGroups)(m).String() }
func (*FlowGroups) ProtoMessage()    {}
func (m *FlowGroups) GetItems() []*OfpGroupEntry {
	o := (*openflow_13.FlowGroups)(m).GetItems()
	if o == nil {
		return nil
	}
	s := make([]*OfpGroupEntry, len(o))
	for i, x := range o {
		s[i] = (*OfpGroupEntry)(x)
	}
	return s
}

// PacketIn from public import openflow_13.proto
type PacketIn openflow_13.PacketIn

func (m *PacketIn) Reset()         { (*openflow_13.PacketIn)(m).Reset() }
func (m *PacketIn) String() string { return (*openflow_13.PacketIn)(m).String() }
func (*PacketIn) ProtoMessage()    {}
func (m *PacketIn) GetId() string  { return (*openflow_13.PacketIn)(m).GetId() }
func (m *PacketIn) GetPacketIn() *OfpPacketIn {
	return (*OfpPacketIn)((*openflow_13.PacketIn)(m).GetPacketIn())
}

// PacketOut from public import openflow_13.proto
type PacketOut openflow_13.PacketOut

func (m *PacketOut) Reset()         { (*openflow_13.PacketOut)(m).Reset() }
func (m *PacketOut) String() string { return (*openflow_13.PacketOut)(m).String() }
func (*PacketOut) ProtoMessage()    {}
func (m *PacketOut) GetId() string  { return (*openflow_13.PacketOut)(m).GetId() }
func (m *PacketOut) GetPacketOut() *OfpPacketOut {
	return (*OfpPacketOut)((*openflow_13.PacketOut)(m).GetPacketOut())
}

// ChangeEvent from public import openflow_13.proto
type ChangeEvent openflow_13.ChangeEvent

func (m *ChangeEvent) Reset()         { (*openflow_13.ChangeEvent)(m).Reset() }
func (m *ChangeEvent) String() string { return (*openflow_13.ChangeEvent)(m).String() }
func (*ChangeEvent) ProtoMessage()    {}
func (m *ChangeEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) int, []interface{}) {
	return _ChangeEvent_OneofMarshaler, _ChangeEvent_OneofUnmarshaler, _ChangeEvent_OneofSizer, nil
}
func _ChangeEvent_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*ChangeEvent)
	m0 := (*openflow_13.ChangeEvent)(m)
	enc, _, _, _ := m0.XXX_OneofFuncs()
	return enc(m0, b)
}
func _ChangeEvent_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*ChangeEvent)
	m0 := (*openflow_13.ChangeEvent)(m)
	_, dec, _, _ := m0.XXX_OneofFuncs()
	return dec(m0, tag, wire, b)
}
func _ChangeEvent_OneofSizer(msg proto.Message) int {
	m := msg.(*ChangeEvent)
	m0 := (*openflow_13.ChangeEvent)(m)
	_, _, size, _ := m0.XXX_OneofFuncs()
	return size(m0)
}
func (m *ChangeEvent) GetId() string { return (*openflow_13.ChangeEvent)(m).GetId() }
func (m *ChangeEvent) GetPortStatus() *OfpPortStatus {
	return (*OfpPortStatus)((*openflow_13.ChangeEvent)(m).GetPortStatus())
}

// ofp_port_no from public import openflow_13.proto
type OfpPortNo openflow_13.OfpPortNo

var OfpPortNo_name = openflow_13.OfpPortNo_name
var OfpPortNo_value = openflow_13.OfpPortNo_value

func (x OfpPortNo) String() string { return (openflow_13.OfpPortNo)(x).String() }

const OfpPortNo_OFPP_INVALID = OfpPortNo(openflow_13.OfpPortNo_OFPP_INVALID)
const OfpPortNo_OFPP_MAX = OfpPortNo(openflow_13.OfpPortNo_OFPP_MAX)
const OfpPortNo_OFPP_IN_PORT = OfpPortNo(openflow_13.OfpPortNo_OFPP_IN_PORT)
const OfpPortNo_OFPP_TABLE = OfpPortNo(openflow_13.OfpPortNo_OFPP_TABLE)
const OfpPortNo_OFPP_NORMAL = OfpPortNo(openflow_13.OfpPortNo_OFPP_NORMAL)
const OfpPortNo_OFPP_FLOOD = OfpPortNo(openflow_13.OfpPortNo_OFPP_FLOOD)
const OfpPortNo_OFPP_ALL = OfpPortNo(openflow_13.OfpPortNo_OFPP_ALL)
const OfpPortNo_OFPP_CONTROLLER = OfpPortNo(openflow_13.OfpPortNo_OFPP_CONTROLLER)
const OfpPortNo_OFPP_LOCAL = OfpPortNo(openflow_13.OfpPortNo_OFPP_LOCAL)
const OfpPortNo_OFPP_ANY = OfpPortNo(openflow_13.OfpPortNo_OFPP_ANY)

// ofp_type from public import openflow_13.proto
type OfpType openflow_13.OfpType

var OfpType_name = openflow_13.OfpType_name
var OfpType_value = openflow_13.OfpType_value

func (x OfpType) String() string { return (openflow_13.OfpType)(x).String() }

const OfpType_OFPT_HELLO = OfpType(openflow_13.OfpType_OFPT_HELLO)
const OfpType_OFPT_ERROR = OfpType(openflow_13.OfpType_OFPT_ERROR)
const OfpType_OFPT_ECHO_REQUEST = OfpType(openflow_13.OfpType_OFPT_ECHO_REQUEST)
const OfpType_OFPT_ECHO_REPLY = OfpType(openflow_13.OfpType_OFPT_ECHO_REPLY)
const OfpType_OFPT_EXPERIMENTER = OfpType(openflow_13.OfpType_OFPT_EXPERIMENTER)
const OfpType_OFPT_FEATURES_REQUEST = OfpType(openflow_13.OfpType_OFPT_FEATURES_REQUEST)
const OfpType_OFPT_FEATURES_REPLY = OfpType(openflow_13.OfpType_OFPT_FEATURES_REPLY)
const OfpType_OFPT_GET_CONFIG_REQUEST = OfpType(openflow_13.OfpType_OFPT_GET_CONFIG_REQUEST)
const OfpType_OFPT_GET_CONFIG_REPLY = OfpType(openflow_13.OfpType_OFPT_GET_CONFIG_REPLY)
const OfpType_OFPT_SET_CONFIG = OfpType(openflow_13.OfpType_OFPT_SET_CONFIG)
const OfpType_OFPT_PACKET_IN = OfpType(openflow_13.OfpType_OFPT_PACKET_IN)
const OfpType_OFPT_FLOW_REMOVED = OfpType(openflow_13.OfpType_OFPT_FLOW_REMOVED)
const OfpType_OFPT_PORT_STATUS = OfpType(openflow_13.OfpType_OFPT_PORT_STATUS)
const OfpType_OFPT_PACKET_OUT = OfpType(openflow_13.OfpType_OFPT_PACKET_OUT)
const OfpType_OFPT_FLOW_MOD = OfpType(openflow_13.OfpType_OFPT_FLOW_MOD)
const OfpType_OFPT_GROUP_MOD = OfpType(openflow_13.OfpType_OFPT_GROUP_MOD)
const OfpType_OFPT_PORT_MOD = OfpType(openflow_13.OfpType_OFPT_PORT_MOD)
const OfpType_OFPT_TABLE_MOD = OfpType(openflow_13.OfpType_OFPT_TABLE_MOD)
const OfpType_OFPT_MULTIPART_REQUEST = OfpType(openflow_13.OfpType_OFPT_MULTIPART_REQUEST)
const OfpType_OFPT_MULTIPART_REPLY = OfpType(openflow_13.OfpType_OFPT_MULTIPART_REPLY)
const OfpType_OFPT_BARRIER_REQUEST = OfpType(openflow_13.OfpType_OFPT_BARRIER_REQUEST)
const OfpType_OFPT_BARRIER_REPLY = OfpType(openflow_13.OfpType_OFPT_BARRIER_REPLY)
const OfpType_OFPT_QUEUE_GET_CONFIG_REQUEST = OfpType(openflow_13.OfpType_OFPT_QUEUE_GET_CONFIG_REQUEST)
const OfpType_OFPT_QUEUE_GET_CONFIG_REPLY = OfpType(openflow_13.OfpType_OFPT_QUEUE_GET_CONFIG_REPLY)
const OfpType_OFPT_ROLE_REQUEST = OfpType(openflow_13.OfpType_OFPT_ROLE_REQUEST)
const OfpType_OFPT_ROLE_REPLY = OfpType(openflow_13.OfpType_OFPT_ROLE_REPLY)
const OfpType_OFPT_GET_ASYNC_REQUEST = OfpType(openflow_13.OfpType_OFPT_GET_ASYNC_REQUEST)
const OfpType_OFPT_GET_ASYNC_REPLY = OfpType(openflow_13.OfpType_OFPT_GET_ASYNC_REPLY)
const OfpType_OFPT_SET_ASYNC = OfpType(openflow_13.OfpType_OFPT_SET_ASYNC)
const OfpType_OFPT_METER_MOD = OfpType(openflow_13.OfpType_OFPT_METER_MOD)

// ofp_hello_elem_type from public import openflow_13.proto
type OfpHelloElemType openflow_13.OfpHelloElemType

var OfpHelloElemType_name = openflow_13.OfpHelloElemType_name
var OfpHelloElemType_value = openflow_13.OfpHelloElemType_value

func (x OfpHelloElemType) String() string { return (openflow_13.OfpHelloElemType)(x).String() }

const OfpHelloElemType_OFPHET_INVALID = OfpHelloElemType(openflow_13.OfpHelloElemType_OFPHET_INVALID)
const OfpHelloElemType_OFPHET_VERSIONBITMAP = OfpHelloElemType(openflow_13.OfpHelloElemType_OFPHET_VERSIONBITMAP)

// ofp_config_flags from public import openflow_13.proto
type OfpConfigFlags openflow_13.OfpConfigFlags

var OfpConfigFlags_name = openflow_13.OfpConfigFlags_name
var OfpConfigFlags_value = openflow_13.OfpConfigFlags_value

func (x OfpConfigFlags) String() string { return (openflow_13.OfpConfigFlags)(x).String() }

const OfpConfigFlags_OFPC_FRAG_NORMAL = OfpConfigFlags(openflow_13.OfpConfigFlags_OFPC_FRAG_NORMAL)
const OfpConfigFlags_OFPC_FRAG_DROP = OfpConfigFlags(openflow_13.OfpConfigFlags_OFPC_FRAG_DROP)
const OfpConfigFlags_OFPC_FRAG_REASM = OfpConfigFlags(openflow_13.OfpConfigFlags_OFPC_FRAG_REASM)
const OfpConfigFlags_OFPC_FRAG_MASK = OfpConfigFlags(openflow_13.OfpConfigFlags_OFPC_FRAG_MASK)

// ofp_table_config from public import openflow_13.proto
type OfpTableConfig openflow_13.OfpTableConfig

var OfpTableConfig_name = openflow_13.OfpTableConfig_name
var OfpTableConfig_value = openflow_13.OfpTableConfig_value

func (x OfpTableConfig) String() string { return (openflow_13.OfpTableConfig)(x).String() }

const OfpTableConfig_OFPTC_INVALID = OfpTableConfig(openflow_13.OfpTableConfig_OFPTC_INVALID)
const OfpTableConfig_OFPTC_DEPRECATED_MASK = OfpTableConfig(openflow_13.OfpTableConfig_OFPTC_DEPRECATED_MASK)

// ofp_table from public import openflow_13.proto
type OfpTable openflow_13.OfpTable

var OfpTable_name = openflow_13.OfpTable_name
var OfpTable_value = openflow_13.OfpTable_value

func (x OfpTable) String() string { return (openflow_13.OfpTable)(x).String() }

const OfpTable_OFPTT_INVALID = OfpTable(openflow_13.OfpTable_OFPTT_INVALID)
const OfpTable_OFPTT_MAX = OfpTable(openflow_13.OfpTable_OFPTT_MAX)
const OfpTable_OFPTT_ALL = OfpTable(openflow_13.OfpTable_OFPTT_ALL)

// ofp_capabilities from public import openflow_13.proto
type OfpCapabilities openflow_13.OfpCapabilities

var OfpCapabilities_name = openflow_13.OfpCapabilities_name
var OfpCapabilities_value = openflow_13.OfpCapabilities_value

func (x OfpCapabilities) String() string { return (openflow_13.OfpCapabilities)(x).String() }

const OfpCapabilities_OFPC_INVALID = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_INVALID)
const OfpCapabilities_OFPC_FLOW_STATS = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_FLOW_STATS)
const OfpCapabilities_OFPC_TABLE_STATS = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_TABLE_STATS)
const OfpCapabilities_OFPC_PORT_STATS = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_PORT_STATS)
const OfpCapabilities_OFPC_GROUP_STATS = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_GROUP_STATS)
const OfpCapabilities_OFPC_IP_REASM = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_IP_REASM)
const OfpCapabilities_OFPC_QUEUE_STATS = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_QUEUE_STATS)
const OfpCapabilities_OFPC_PORT_BLOCKED = OfpCapabilities(openflow_13.OfpCapabilities_OFPC_PORT_BLOCKED)

// ofp_port_config from public import openflow_13.proto
type OfpPortConfig openflow_13.OfpPortConfig

var OfpPortConfig_name = openflow_13.OfpPortConfig_name
var OfpPortConfig_value = openflow_13.OfpPortConfig_value

func (x OfpPortConfig) String() string { return (openflow_13.OfpPortConfig)(x).String() }

const OfpPortConfig_OFPPC_INVALID = OfpPortConfig(openflow_13.OfpPortConfig_OFPPC_INVALID)
const OfpPortConfig_OFPPC_PORT_DOWN = OfpPortConfig(openflow_13.OfpPortConfig_OFPPC_PORT_DOWN)
const OfpPortConfig_OFPPC_NO_RECV = OfpPortConfig(openflow_13.OfpPortConfig_OFPPC_NO_RECV)
const OfpPortConfig_OFPPC_NO_FWD = OfpPortConfig(openflow_13.OfpPortConfig_OFPPC_NO_FWD)
const OfpPortConfig_OFPPC_NO_PACKET_IN = OfpPortConfig(openflow_13.OfpPortConfig_OFPPC_NO_PACKET_IN)

// ofp_port_state from public import openflow_13.proto
type OfpPortState openflow_13.OfpPortState

var OfpPortState_name = openflow_13.OfpPortState_name
var OfpPortState_value = openflow_13.OfpPortState_value

func (x OfpPortState) String() string { return (openflow_13.OfpPortState)(x).String() }

const OfpPortState_OFPPS_INVALID = OfpPortState(openflow_13.OfpPortState_OFPPS_INVALID)
const OfpPortState_OFPPS_LINK_DOWN = OfpPortState(openflow_13.OfpPortState_OFPPS_LINK_DOWN)
const OfpPortState_OFPPS_BLOCKED = OfpPortState(openflow_13.OfpPortState_OFPPS_BLOCKED)
const OfpPortState_OFPPS_LIVE = OfpPortState(openflow_13.OfpPortState_OFPPS_LIVE)

// ofp_port_features from public import openflow_13.proto
type OfpPortFeatures openflow_13.OfpPortFeatures

var OfpPortFeatures_name = openflow_13.OfpPortFeatures_name
var OfpPortFeatures_value = openflow_13.OfpPortFeatures_value

func (x OfpPortFeatures) String() string { return (openflow_13.OfpPortFeatures)(x).String() }

const OfpPortFeatures_OFPPF_INVALID = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_INVALID)
const OfpPortFeatures_OFPPF_10MB_HD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_10MB_HD)
const OfpPortFeatures_OFPPF_10MB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_10MB_FD)
const OfpPortFeatures_OFPPF_100MB_HD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_100MB_HD)
const OfpPortFeatures_OFPPF_100MB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_100MB_FD)
const OfpPortFeatures_OFPPF_1GB_HD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_1GB_HD)
const OfpPortFeatures_OFPPF_1GB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_1GB_FD)
const OfpPortFeatures_OFPPF_10GB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_10GB_FD)
const OfpPortFeatures_OFPPF_40GB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_40GB_FD)
const OfpPortFeatures_OFPPF_100GB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_100GB_FD)
const OfpPortFeatures_OFPPF_1TB_FD = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_1TB_FD)
const OfpPortFeatures_OFPPF_OTHER = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_OTHER)
const OfpPortFeatures_OFPPF_COPPER = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_COPPER)
const OfpPortFeatures_OFPPF_FIBER = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_FIBER)
const OfpPortFeatures_OFPPF_AUTONEG = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_AUTONEG)
const OfpPortFeatures_OFPPF_PAUSE = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_PAUSE)
const OfpPortFeatures_OFPPF_PAUSE_ASYM = OfpPortFeatures(openflow_13.OfpPortFeatures_OFPPF_PAUSE_ASYM)

// ofp_port_reason from public import openflow_13.proto
type OfpPortReason openflow_13.OfpPortReason

var OfpPortReason_name = openflow_13.OfpPortReason_name
var OfpPortReason_value = openflow_13.OfpPortReason_value

func (x OfpPortReason) String() string { return (openflow_13.OfpPortReason)(x).String() }

const OfpPortReason_OFPPR_ADD = OfpPortReason(openflow_13.OfpPortReason_OFPPR_ADD)
const OfpPortReason_OFPPR_DELETE = OfpPortReason(openflow_13.OfpPortReason_OFPPR_DELETE)
const OfpPortReason_OFPPR_MODIFY = OfpPortReason(openflow_13.OfpPortReason_OFPPR_MODIFY)

// ofp_match_type from public import openflow_13.proto
type OfpMatchType openflow_13.OfpMatchType

var OfpMatchType_name = openflow_13.OfpMatchType_name
var OfpMatchType_value = openflow_13.OfpMatchType_value

func (x OfpMatchType) String() string { return (openflow_13.OfpMatchType)(x).String() }

const OfpMatchType_OFPMT_STANDARD = OfpMatchType(openflow_13.OfpMatchType_OFPMT_STANDARD)
const OfpMatchType_OFPMT_OXM = OfpMatchType(openflow_13.OfpMatchType_OFPMT_OXM)

// ofp_oxm_class from public import openflow_13.proto
type OfpOxmClass openflow_13.OfpOxmClass

var OfpOxmClass_name = openflow_13.OfpOxmClass_name
var OfpOxmClass_value = openflow_13.OfpOxmClass_value

func (x OfpOxmClass) String() string { return (openflow_13.OfpOxmClass)(x).String() }

const OfpOxmClass_OFPXMC_NXM_0 = OfpOxmClass(openflow_13.OfpOxmClass_OFPXMC_NXM_0)
const OfpOxmClass_OFPXMC_NXM_1 = OfpOxmClass(openflow_13.OfpOxmClass_OFPXMC_NXM_1)
const OfpOxmClass_OFPXMC_OPENFLOW_BASIC = OfpOxmClass(openflow_13.OfpOxmClass_OFPXMC_OPENFLOW_BASIC)
const OfpOxmClass_OFPXMC_EXPERIMENTER = OfpOxmClass(openflow_13.OfpOxmClass_OFPXMC_EXPERIMENTER)

// oxm_ofb_field_types from public import openflow_13.proto
type OxmOfbFieldTypes openflow_13.OxmOfbFieldTypes

var OxmOfbFieldTypes_name = openflow_13.OxmOfbFieldTypes_name
var OxmOfbFieldTypes_value = openflow_13.OxmOfbFieldTypes_value

func (x OxmOfbFieldTypes) String() string { return (openflow_13.OxmOfbFieldTypes)(x).String() }

const OxmOfbFieldTypes_OFPXMT_OFB_IN_PORT = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IN_PORT)
const OxmOfbFieldTypes_OFPXMT_OFB_IN_PHY_PORT = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IN_PHY_PORT)
const OxmOfbFieldTypes_OFPXMT_OFB_METADATA = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_METADATA)
const OxmOfbFieldTypes_OFPXMT_OFB_ETH_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ETH_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_ETH_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ETH_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_ETH_TYPE = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ETH_TYPE)
const OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID)
const OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP)
const OxmOfbFieldTypes_OFPXMT_OFB_IP_DSCP = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IP_DSCP)
const OxmOfbFieldTypes_OFPXMT_OFB_IP_ECN = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IP_ECN)
const OxmOfbFieldTypes_OFPXMT_OFB_IP_PROTO = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IP_PROTO)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV4_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV4_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV4_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV4_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_TCP_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_TCP_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_TCP_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_TCP_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_UDP_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_UDP_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_UDP_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_UDP_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_SCTP_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_SCTP_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_SCTP_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_SCTP_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_ICMPV4_TYPE = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ICMPV4_TYPE)
const OxmOfbFieldTypes_OFPXMT_OFB_ICMPV4_CODE = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ICMPV4_CODE)
const OxmOfbFieldTypes_OFPXMT_OFB_ARP_OP = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ARP_OP)
const OxmOfbFieldTypes_OFPXMT_OFB_ARP_SPA = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ARP_SPA)
const OxmOfbFieldTypes_OFPXMT_OFB_ARP_TPA = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ARP_TPA)
const OxmOfbFieldTypes_OFPXMT_OFB_ARP_SHA = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ARP_SHA)
const OxmOfbFieldTypes_OFPXMT_OFB_ARP_THA = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ARP_THA)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_SRC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_SRC)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_DST = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_DST)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_FLABEL = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_FLABEL)
const OxmOfbFieldTypes_OFPXMT_OFB_ICMPV6_TYPE = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ICMPV6_TYPE)
const OxmOfbFieldTypes_OFPXMT_OFB_ICMPV6_CODE = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ICMPV6_CODE)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_TARGET = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_TARGET)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_SLL = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_SLL)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_TLL = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_ND_TLL)
const OxmOfbFieldTypes_OFPXMT_OFB_MPLS_LABEL = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_MPLS_LABEL)
const OxmOfbFieldTypes_OFPXMT_OFB_MPLS_TC = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_MPLS_TC)
const OxmOfbFieldTypes_OFPXMT_OFB_MPLS_BOS = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_MPLS_BOS)
const OxmOfbFieldTypes_OFPXMT_OFB_PBB_ISID = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_PBB_ISID)
const OxmOfbFieldTypes_OFPXMT_OFB_TUNNEL_ID = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_TUNNEL_ID)
const OxmOfbFieldTypes_OFPXMT_OFB_IPV6_EXTHDR = OxmOfbFieldTypes(openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_IPV6_EXTHDR)

// ofp_vlan_id from public import openflow_13.proto
type OfpVlanId openflow_13.OfpVlanId

var OfpVlanId_name = openflow_13.OfpVlanId_name
var OfpVlanId_value = openflow_13.OfpVlanId_value

func (x OfpVlanId) String() string { return (openflow_13.OfpVlanId)(x).String() }

const OfpVlanId_OFPVID_NONE = OfpVlanId(openflow_13.OfpVlanId_OFPVID_NONE)
const OfpVlanId_OFPVID_PRESENT = OfpVlanId(openflow_13.OfpVlanId_OFPVID_PRESENT)

// ofp_ipv6exthdr_flags from public import openflow_13.proto
type OfpIpv6ExthdrFlags openflow_13.OfpIpv6ExthdrFlags

var OfpIpv6ExthdrFlags_name = openflow_13.OfpIpv6ExthdrFlags_name
var OfpIpv6ExthdrFlags_value = openflow_13.OfpIpv6ExthdrFlags_value

func (x OfpIpv6ExthdrFlags) String() string { return (openflow_13.OfpIpv6ExthdrFlags)(x).String() }

const OfpIpv6ExthdrFlags_OFPIEH_INVALID = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_INVALID)
const OfpIpv6ExthdrFlags_OFPIEH_NONEXT = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_NONEXT)
const OfpIpv6ExthdrFlags_OFPIEH_ESP = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_ESP)
const OfpIpv6ExthdrFlags_OFPIEH_AUTH = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_AUTH)
const OfpIpv6ExthdrFlags_OFPIEH_DEST = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_DEST)
const OfpIpv6ExthdrFlags_OFPIEH_FRAG = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_FRAG)
const OfpIpv6ExthdrFlags_OFPIEH_ROUTER = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_ROUTER)
const OfpIpv6ExthdrFlags_OFPIEH_HOP = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_HOP)
const OfpIpv6ExthdrFlags_OFPIEH_UNREP = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_UNREP)
const OfpIpv6ExthdrFlags_OFPIEH_UNSEQ = OfpIpv6ExthdrFlags(openflow_13.OfpIpv6ExthdrFlags_OFPIEH_UNSEQ)

// ofp_action_type from public import openflow_13.proto
type OfpActionType openflow_13.OfpActionType

var OfpActionType_name = openflow_13.OfpActionType_name
var OfpActionType_value = openflow_13.OfpActionType_value

func (x OfpActionType) String() string { return (openflow_13.OfpActionType)(x).String() }

const OfpActionType_OFPAT_OUTPUT = OfpActionType(openflow_13.OfpActionType_OFPAT_OUTPUT)
const OfpActionType_OFPAT_COPY_TTL_OUT = OfpActionType(openflow_13.OfpActionType_OFPAT_COPY_TTL_OUT)
const OfpActionType_OFPAT_COPY_TTL_IN = OfpActionType(openflow_13.OfpActionType_OFPAT_COPY_TTL_IN)
const OfpActionType_OFPAT_SET_MPLS_TTL = OfpActionType(openflow_13.OfpActionType_OFPAT_SET_MPLS_TTL)
const OfpActionType_OFPAT_DEC_MPLS_TTL = OfpActionType(openflow_13.OfpActionType_OFPAT_DEC_MPLS_TTL)
const OfpActionType_OFPAT_PUSH_VLAN = OfpActionType(openflow_13.OfpActionType_OFPAT_PUSH_VLAN)
const OfpActionType_OFPAT_POP_VLAN = OfpActionType(openflow_13.OfpActionType_OFPAT_POP_VLAN)
const OfpActionType_OFPAT_PUSH_MPLS = OfpActionType(openflow_13.OfpActionType_OFPAT_PUSH_MPLS)
const OfpActionType_OFPAT_POP_MPLS = OfpActionType(openflow_13.OfpActionType_OFPAT_POP_MPLS)
const OfpActionType_OFPAT_SET_QUEUE = OfpActionType(openflow_13.OfpActionType_OFPAT_SET_QUEUE)
const OfpActionType_OFPAT_GROUP = OfpActionType(openflow_13.OfpActionType_OFPAT_GROUP)
const OfpActionType_OFPAT_SET_NW_TTL = OfpActionType(openflow_13.OfpActionType_OFPAT_SET_NW_TTL)
const OfpActionType_OFPAT_DEC_NW_TTL = OfpActionType(openflow_13.OfpActionType_OFPAT_DEC_NW_TTL)
const OfpActionType_OFPAT_SET_FIELD = OfpActionType(openflow_13.OfpActionType_OFPAT_SET_FIELD)
const OfpActionType_OFPAT_PUSH_PBB = OfpActionType(openflow_13.OfpActionType_OFPAT_PUSH_PBB)
const OfpActionType_OFPAT_POP_PBB = OfpActionType(openflow_13.OfpActionType_OFPAT_POP_PBB)
const OfpActionType_OFPAT_EXPERIMENTER = OfpActionType(openflow_13.OfpActionType_OFPAT_EXPERIMENTER)

// ofp_controller_max_len from public import openflow_13.proto
type OfpControllerMaxLen openflow_13.OfpControllerMaxLen

var OfpControllerMaxLen_name = openflow_13.OfpControllerMaxLen_name
var OfpControllerMaxLen_value = openflow_13.OfpControllerMaxLen_value

func (x OfpControllerMaxLen) String() string { return (openflow_13.OfpControllerMaxLen)(x).String() }

const OfpControllerMaxLen_OFPCML_INVALID = OfpControllerMaxLen(openflow_13.OfpControllerMaxLen_OFPCML_INVALID)
const OfpControllerMaxLen_OFPCML_MAX = OfpControllerMaxLen(openflow_13.OfpControllerMaxLen_OFPCML_MAX)
const OfpControllerMaxLen_OFPCML_NO_BUFFER = OfpControllerMaxLen(openflow_13.OfpControllerMaxLen_OFPCML_NO_BUFFER)

// ofp_instruction_type from public import openflow_13.proto
type OfpInstructionType openflow_13.OfpInstructionType

var OfpInstructionType_name = openflow_13.OfpInstructionType_name
var OfpInstructionType_value = openflow_13.OfpInstructionType_value

func (x OfpInstructionType) String() string { return (openflow_13.OfpInstructionType)(x).String() }

const OfpInstructionType_OFPIT_INVALID = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_INVALID)
const OfpInstructionType_OFPIT_GOTO_TABLE = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_GOTO_TABLE)
const OfpInstructionType_OFPIT_WRITE_METADATA = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_WRITE_METADATA)
const OfpInstructionType_OFPIT_WRITE_ACTIONS = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_WRITE_ACTIONS)
const OfpInstructionType_OFPIT_APPLY_ACTIONS = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_APPLY_ACTIONS)
const OfpInstructionType_OFPIT_CLEAR_ACTIONS = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_CLEAR_ACTIONS)
const OfpInstructionType_OFPIT_METER = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_METER)
const OfpInstructionType_OFPIT_EXPERIMENTER = OfpInstructionType(openflow_13.OfpInstructionType_OFPIT_EXPERIMENTER)

// ofp_flow_mod_command from public import openflow_13.proto
type OfpFlowModCommand openflow_13.OfpFlowModCommand

var OfpFlowModCommand_name = openflow_13.OfpFlowModCommand_name
var OfpFlowModCommand_value = openflow_13.OfpFlowModCommand_value

func (x OfpFlowModCommand) String() string { return (openflow_13.OfpFlowModCommand)(x).String() }

const OfpFlowModCommand_OFPFC_ADD = OfpFlowModCommand(openflow_13.OfpFlowModCommand_OFPFC_ADD)
const OfpFlowModCommand_OFPFC_MODIFY = OfpFlowModCommand(openflow_13.OfpFlowModCommand_OFPFC_MODIFY)
const OfpFlowModCommand_OFPFC_MODIFY_STRICT = OfpFlowModCommand(openflow_13.OfpFlowModCommand_OFPFC_MODIFY_STRICT)
const OfpFlowModCommand_OFPFC_DELETE = OfpFlowModCommand(openflow_13.OfpFlowModCommand_OFPFC_DELETE)
const OfpFlowModCommand_OFPFC_DELETE_STRICT = OfpFlowModCommand(openflow_13.OfpFlowModCommand_OFPFC_DELETE_STRICT)

// ofp_flow_mod_flags from public import openflow_13.proto
type OfpFlowModFlags openflow_13.OfpFlowModFlags

var OfpFlowModFlags_name = openflow_13.OfpFlowModFlags_name
var OfpFlowModFlags_value = openflow_13.OfpFlowModFlags_value

func (x OfpFlowModFlags) String() string { return (openflow_13.OfpFlowModFlags)(x).String() }

const OfpFlowModFlags_OFPFF_INVALID = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_INVALID)
const OfpFlowModFlags_OFPFF_SEND_FLOW_REM = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_SEND_FLOW_REM)
const OfpFlowModFlags_OFPFF_CHECK_OVERLAP = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_CHECK_OVERLAP)
const OfpFlowModFlags_OFPFF_RESET_COUNTS = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_RESET_COUNTS)
const OfpFlowModFlags_OFPFF_NO_PKT_COUNTS = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_NO_PKT_COUNTS)
const OfpFlowModFlags_OFPFF_NO_BYT_COUNTS = OfpFlowModFlags(openflow_13.OfpFlowModFlags_OFPFF_NO_BYT_COUNTS)

// ofp_group from public import openflow_13.proto
type OfpGroup openflow_13.OfpGroup

var OfpGroup_name = openflow_13.OfpGroup_name
var OfpGroup_value = openflow_13.OfpGroup_value

func (x OfpGroup) String() string { return (openflow_13.OfpGroup)(x).String() }

const OfpGroup_OFPG_INVALID = OfpGroup(openflow_13.OfpGroup_OFPG_INVALID)
const OfpGroup_OFPG_MAX = OfpGroup(openflow_13.OfpGroup_OFPG_MAX)
const OfpGroup_OFPG_ALL = OfpGroup(openflow_13.OfpGroup_OFPG_ALL)
const OfpGroup_OFPG_ANY = OfpGroup(openflow_13.OfpGroup_OFPG_ANY)

// ofp_group_mod_command from public import openflow_13.proto
type OfpGroupModCommand openflow_13.OfpGroupModCommand

var OfpGroupModCommand_name = openflow_13.OfpGroupModCommand_name
var OfpGroupModCommand_value = openflow_13.OfpGroupModCommand_value

func (x OfpGroupModCommand) String() string { return (openflow_13.OfpGroupModCommand)(x).String() }

const OfpGroupModCommand_OFPGC_ADD = OfpGroupModCommand(openflow_13.OfpGroupModCommand_OFPGC_ADD)
const OfpGroupModCommand_OFPGC_MODIFY = OfpGroupModCommand(openflow_13.OfpGroupModCommand_OFPGC_MODIFY)
const OfpGroupModCommand_OFPGC_DELETE = OfpGroupModCommand(openflow_13.OfpGroupModCommand_OFPGC_DELETE)

// ofp_group_type from public import openflow_13.proto
type OfpGroupType openflow_13.OfpGroupType

var OfpGroupType_name = openflow_13.OfpGroupType_name
var OfpGroupType_value = openflow_13.OfpGroupType_value

func (x OfpGroupType) String() string { return (openflow_13.OfpGroupType)(x).String() }

const OfpGroupType_OFPGT_ALL = OfpGroupType(openflow_13.OfpGroupType_OFPGT_ALL)
const OfpGroupType_OFPGT_SELECT = OfpGroupType(openflow_13.OfpGroupType_OFPGT_SELECT)
const OfpGroupType_OFPGT_INDIRECT = OfpGroupType(openflow_13.OfpGroupType_OFPGT_INDIRECT)
const OfpGroupType_OFPGT_FF = OfpGroupType(openflow_13.OfpGroupType_OFPGT_FF)

// ofp_packet_in_reason from public import openflow_13.proto
type OfpPacketInReason openflow_13.OfpPacketInReason

var OfpPacketInReason_name = openflow_13.OfpPacketInReason_name
var OfpPacketInReason_value = openflow_13.OfpPacketInReason_value

func (x OfpPacketInReason) String() string { return (openflow_13.OfpPacketInReason)(x).String() }

const OfpPacketInReason_OFPR_NO_MATCH = OfpPacketInReason(openflow_13.OfpPacketInReason_OFPR_NO_MATCH)
const OfpPacketInReason_OFPR_ACTION = OfpPacketInReason(openflow_13.OfpPacketInReason_OFPR_ACTION)
const OfpPacketInReason_OFPR_INVALID_TTL = OfpPacketInReason(openflow_13.OfpPacketInReason_OFPR_INVALID_TTL)

// ofp_flow_removed_reason from public import openflow_13.proto
type OfpFlowRemovedReason openflow_13.OfpFlowRemovedReason

var OfpFlowRemovedReason_name = openflow_13.OfpFlowRemovedReason_name
var OfpFlowRemovedReason_value = openflow_13.OfpFlowRemovedReason_value

func (x OfpFlowRemovedReason) String() string { return (openflow_13.OfpFlowRemovedReason)(x).String() }

const OfpFlowRemovedReason_OFPRR_IDLE_TIMEOUT = OfpFlowRemovedReason(openflow_13.OfpFlowRemovedReason_OFPRR_IDLE_TIMEOUT)
const OfpFlowRemovedReason_OFPRR_HARD_TIMEOUT = OfpFlowRemovedReason(openflow_13.OfpFlowRemovedReason_OFPRR_HARD_TIMEOUT)
const OfpFlowRemovedReason_OFPRR_DELETE = OfpFlowRemovedReason(openflow_13.OfpFlowRemovedReason_OFPRR_DELETE)
const OfpFlowRemovedReason_OFPRR_GROUP_DELETE = OfpFlowRemovedReason(openflow_13.OfpFlowRemovedReason_OFPRR_GROUP_DELETE)
const OfpFlowRemovedReason_OFPRR_METER_DELETE = OfpFlowRemovedReason(openflow_13.OfpFlowRemovedReason_OFPRR_METER_DELETE)

// ofp_meter from public import openflow_13.proto
type OfpMeter openflow_13.OfpMeter

var OfpMeter_name = openflow_13.OfpMeter_name
var OfpMeter_value = openflow_13.OfpMeter_value

func (x OfpMeter) String() string { return (openflow_13.OfpMeter)(x).String() }

const OfpMeter_OFPM_ZERO = OfpMeter(openflow_13.OfpMeter_OFPM_ZERO)
const OfpMeter_OFPM_MAX = OfpMeter(openflow_13.OfpMeter_OFPM_MAX)
const OfpMeter_OFPM_SLOWPATH = OfpMeter(openflow_13.OfpMeter_OFPM_SLOWPATH)
const OfpMeter_OFPM_CONTROLLER = OfpMeter(openflow_13.OfpMeter_OFPM_CONTROLLER)
const OfpMeter_OFPM_ALL = OfpMeter(openflow_13.OfpMeter_OFPM_ALL)

// ofp_meter_band_type from public import openflow_13.proto
type OfpMeterBandType openflow_13.OfpMeterBandType

var OfpMeterBandType_name = openflow_13.OfpMeterBandType_name
var OfpMeterBandType_value = openflow_13.OfpMeterBandType_value

func (x OfpMeterBandType) String() string { return (openflow_13.OfpMeterBandType)(x).String() }

const OfpMeterBandType_OFPMBT_INVALID = OfpMeterBandType(openflow_13.OfpMeterBandType_OFPMBT_INVALID)
const OfpMeterBandType_OFPMBT_DROP = OfpMeterBandType(openflow_13.OfpMeterBandType_OFPMBT_DROP)
const OfpMeterBandType_OFPMBT_DSCP_REMARK = OfpMeterBandType(openflow_13.OfpMeterBandType_OFPMBT_DSCP_REMARK)
const OfpMeterBandType_OFPMBT_EXPERIMENTER = OfpMeterBandType(openflow_13.OfpMeterBandType_OFPMBT_EXPERIMENTER)

// ofp_meter_mod_command from public import openflow_13.proto
type OfpMeterModCommand openflow_13.OfpMeterModCommand

var OfpMeterModCommand_name = openflow_13.OfpMeterModCommand_name
var OfpMeterModCommand_value = openflow_13.OfpMeterModCommand_value

func (x OfpMeterModCommand) String() string { return (openflow_13.OfpMeterModCommand)(x).String() }

const OfpMeterModCommand_OFPMC_ADD = OfpMeterModCommand(openflow_13.OfpMeterModCommand_OFPMC_ADD)
const OfpMeterModCommand_OFPMC_MODIFY = OfpMeterModCommand(openflow_13.OfpMeterModCommand_OFPMC_MODIFY)
const OfpMeterModCommand_OFPMC_DELETE = OfpMeterModCommand(openflow_13.OfpMeterModCommand_OFPMC_DELETE)

// ofp_meter_flags from public import openflow_13.proto
type OfpMeterFlags openflow_13.OfpMeterFlags

var OfpMeterFlags_name = openflow_13.OfpMeterFlags_name
var OfpMeterFlags_value = openflow_13.OfpMeterFlags_value

func (x OfpMeterFlags) String() string { return (openflow_13.OfpMeterFlags)(x).String() }

const OfpMeterFlags_OFPMF_INVALID = OfpMeterFlags(openflow_13.OfpMeterFlags_OFPMF_INVALID)
const OfpMeterFlags_OFPMF_KBPS = OfpMeterFlags(openflow_13.OfpMeterFlags_OFPMF_KBPS)
const OfpMeterFlags_OFPMF_PKTPS = OfpMeterFlags(openflow_13.OfpMeterFlags_OFPMF_PKTPS)
const OfpMeterFlags_OFPMF_BURST = OfpMeterFlags(openflow_13.OfpMeterFlags_OFPMF_BURST)
const OfpMeterFlags_OFPMF_STATS = OfpMeterFlags(openflow_13.OfpMeterFlags_OFPMF_STATS)

// ofp_error_type from public import openflow_13.proto
type OfpErrorType openflow_13.OfpErrorType

var OfpErrorType_name = openflow_13.OfpErrorType_name
var OfpErrorType_value = openflow_13.OfpErrorType_value

func (x OfpErrorType) String() string { return (openflow_13.OfpErrorType)(x).String() }

const OfpErrorType_OFPET_HELLO_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_HELLO_FAILED)
const OfpErrorType_OFPET_BAD_REQUEST = OfpErrorType(openflow_13.OfpErrorType_OFPET_BAD_REQUEST)
const OfpErrorType_OFPET_BAD_ACTION = OfpErrorType(openflow_13.OfpErrorType_OFPET_BAD_ACTION)
const OfpErrorType_OFPET_BAD_INSTRUCTION = OfpErrorType(openflow_13.OfpErrorType_OFPET_BAD_INSTRUCTION)
const OfpErrorType_OFPET_BAD_MATCH = OfpErrorType(openflow_13.OfpErrorType_OFPET_BAD_MATCH)
const OfpErrorType_OFPET_FLOW_MOD_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_FLOW_MOD_FAILED)
const OfpErrorType_OFPET_GROUP_MOD_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_GROUP_MOD_FAILED)
const OfpErrorType_OFPET_PORT_MOD_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_PORT_MOD_FAILED)
const OfpErrorType_OFPET_TABLE_MOD_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_TABLE_MOD_FAILED)
const OfpErrorType_OFPET_QUEUE_OP_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_QUEUE_OP_FAILED)
const OfpErrorType_OFPET_SWITCH_CONFIG_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_SWITCH_CONFIG_FAILED)
const OfpErrorType_OFPET_ROLE_REQUEST_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_ROLE_REQUEST_FAILED)
const OfpErrorType_OFPET_METER_MOD_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_METER_MOD_FAILED)
const OfpErrorType_OFPET_TABLE_FEATURES_FAILED = OfpErrorType(openflow_13.OfpErrorType_OFPET_TABLE_FEATURES_FAILED)
const OfpErrorType_OFPET_EXPERIMENTER = OfpErrorType(openflow_13.OfpErrorType_OFPET_EXPERIMENTER)

// ofp_hello_failed_code from public import openflow_13.proto
type OfpHelloFailedCode openflow_13.OfpHelloFailedCode

var OfpHelloFailedCode_name = openflow_13.OfpHelloFailedCode_name
var OfpHelloFailedCode_value = openflow_13.OfpHelloFailedCode_value

func (x OfpHelloFailedCode) String() string { return (openflow_13.OfpHelloFailedCode)(x).String() }

const OfpHelloFailedCode_OFPHFC_INCOMPATIBLE = OfpHelloFailedCode(openflow_13.OfpHelloFailedCode_OFPHFC_INCOMPATIBLE)
const OfpHelloFailedCode_OFPHFC_EPERM = OfpHelloFailedCode(openflow_13.OfpHelloFailedCode_OFPHFC_EPERM)

// ofp_bad_request_code from public import openflow_13.proto
type OfpBadRequestCode openflow_13.OfpBadRequestCode

var OfpBadRequestCode_name = openflow_13.OfpBadRequestCode_name
var OfpBadRequestCode_value = openflow_13.OfpBadRequestCode_value

func (x OfpBadRequestCode) String() string { return (openflow_13.OfpBadRequestCode)(x).String() }

const OfpBadRequestCode_OFPBRC_BAD_VERSION = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_VERSION)
const OfpBadRequestCode_OFPBRC_BAD_TYPE = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_TYPE)
const OfpBadRequestCode_OFPBRC_BAD_MULTIPART = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_MULTIPART)
const OfpBadRequestCode_OFPBRC_BAD_EXPERIMENTER = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_EXPERIMENTER)
const OfpBadRequestCode_OFPBRC_BAD_EXP_TYPE = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_EXP_TYPE)
const OfpBadRequestCode_OFPBRC_EPERM = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_EPERM)
const OfpBadRequestCode_OFPBRC_BAD_LEN = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_LEN)
const OfpBadRequestCode_OFPBRC_BUFFER_EMPTY = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BUFFER_EMPTY)
const OfpBadRequestCode_OFPBRC_BUFFER_UNKNOWN = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BUFFER_UNKNOWN)
const OfpBadRequestCode_OFPBRC_BAD_TABLE_ID = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_TABLE_ID)
const OfpBadRequestCode_OFPBRC_IS_SLAVE = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_IS_SLAVE)
const OfpBadRequestCode_OFPBRC_BAD_PORT = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_PORT)
const OfpBadRequestCode_OFPBRC_BAD_PACKET = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_BAD_PACKET)
const OfpBadRequestCode_OFPBRC_MULTIPART_BUFFER_OVERFLOW = OfpBadRequestCode(openflow_13.OfpBadRequestCode_OFPBRC_MULTIPART_BUFFER_OVERFLOW)

// ofp_bad_action_code from public import openflow_13.proto
type OfpBadActionCode openflow_13.OfpBadActionCode

var OfpBadActionCode_name = openflow_13.OfpBadActionCode_name
var OfpBadActionCode_value = openflow_13.OfpBadActionCode_value

func (x OfpBadActionCode) String() string { return (openflow_13.OfpBadActionCode)(x).String() }

const OfpBadActionCode_OFPBAC_BAD_TYPE = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_TYPE)
const OfpBadActionCode_OFPBAC_BAD_LEN = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_LEN)
const OfpBadActionCode_OFPBAC_BAD_EXPERIMENTER = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_EXPERIMENTER)
const OfpBadActionCode_OFPBAC_BAD_EXP_TYPE = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_EXP_TYPE)
const OfpBadActionCode_OFPBAC_BAD_OUT_PORT = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_OUT_PORT)
const OfpBadActionCode_OFPBAC_BAD_ARGUMENT = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_ARGUMENT)
const OfpBadActionCode_OFPBAC_EPERM = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_EPERM)
const OfpBadActionCode_OFPBAC_TOO_MANY = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_TOO_MANY)
const OfpBadActionCode_OFPBAC_BAD_QUEUE = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_QUEUE)
const OfpBadActionCode_OFPBAC_BAD_OUT_GROUP = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_OUT_GROUP)
const OfpBadActionCode_OFPBAC_MATCH_INCONSISTENT = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_MATCH_INCONSISTENT)
const OfpBadActionCode_OFPBAC_UNSUPPORTED_ORDER = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_UNSUPPORTED_ORDER)
const OfpBadActionCode_OFPBAC_BAD_TAG = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_TAG)
const OfpBadActionCode_OFPBAC_BAD_SET_TYPE = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_SET_TYPE)
const OfpBadActionCode_OFPBAC_BAD_SET_LEN = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_SET_LEN)
const OfpBadActionCode_OFPBAC_BAD_SET_ARGUMENT = OfpBadActionCode(openflow_13.OfpBadActionCode_OFPBAC_BAD_SET_ARGUMENT)

// ofp_bad_instruction_code from public import openflow_13.proto
type OfpBadInstructionCode openflow_13.OfpBadInstructionCode

var OfpBadInstructionCode_name = openflow_13.OfpBadInstructionCode_name
var OfpBadInstructionCode_value = openflow_13.OfpBadInstructionCode_value

func (x OfpBadInstructionCode) String() string { return (openflow_13.OfpBadInstructionCode)(x).String() }

const OfpBadInstructionCode_OFPBIC_UNKNOWN_INST = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_UNKNOWN_INST)
const OfpBadInstructionCode_OFPBIC_UNSUP_INST = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_UNSUP_INST)
const OfpBadInstructionCode_OFPBIC_BAD_TABLE_ID = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_BAD_TABLE_ID)
const OfpBadInstructionCode_OFPBIC_UNSUP_METADATA = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_UNSUP_METADATA)
const OfpBadInstructionCode_OFPBIC_UNSUP_METADATA_MASK = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_UNSUP_METADATA_MASK)
const OfpBadInstructionCode_OFPBIC_BAD_EXPERIMENTER = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_BAD_EXPERIMENTER)
const OfpBadInstructionCode_OFPBIC_BAD_EXP_TYPE = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_BAD_EXP_TYPE)
const OfpBadInstructionCode_OFPBIC_BAD_LEN = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_BAD_LEN)
const OfpBadInstructionCode_OFPBIC_EPERM = OfpBadInstructionCode(openflow_13.OfpBadInstructionCode_OFPBIC_EPERM)

// ofp_bad_match_code from public import openflow_13.proto
type OfpBadMatchCode openflow_13.OfpBadMatchCode

var OfpBadMatchCode_name = openflow_13.OfpBadMatchCode_name
var OfpBadMatchCode_value = openflow_13.OfpBadMatchCode_value

func (x OfpBadMatchCode) String() string { return (openflow_13.OfpBadMatchCode)(x).String() }

const OfpBadMatchCode_OFPBMC_BAD_TYPE = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_TYPE)
const OfpBadMatchCode_OFPBMC_BAD_LEN = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_LEN)
const OfpBadMatchCode_OFPBMC_BAD_TAG = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_TAG)
const OfpBadMatchCode_OFPBMC_BAD_DL_ADDR_MASK = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_DL_ADDR_MASK)
const OfpBadMatchCode_OFPBMC_BAD_NW_ADDR_MASK = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_NW_ADDR_MASK)
const OfpBadMatchCode_OFPBMC_BAD_WILDCARDS = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_WILDCARDS)
const OfpBadMatchCode_OFPBMC_BAD_FIELD = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_FIELD)
const OfpBadMatchCode_OFPBMC_BAD_VALUE = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_VALUE)
const OfpBadMatchCode_OFPBMC_BAD_MASK = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_MASK)
const OfpBadMatchCode_OFPBMC_BAD_PREREQ = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_BAD_PREREQ)
const OfpBadMatchCode_OFPBMC_DUP_FIELD = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_DUP_FIELD)
const OfpBadMatchCode_OFPBMC_EPERM = OfpBadMatchCode(openflow_13.OfpBadMatchCode_OFPBMC_EPERM)

// ofp_flow_mod_failed_code from public import openflow_13.proto
type OfpFlowModFailedCode openflow_13.OfpFlowModFailedCode

var OfpFlowModFailedCode_name = openflow_13.OfpFlowModFailedCode_name
var OfpFlowModFailedCode_value = openflow_13.OfpFlowModFailedCode_value

func (x OfpFlowModFailedCode) String() string { return (openflow_13.OfpFlowModFailedCode)(x).String() }

const OfpFlowModFailedCode_OFPFMFC_UNKNOWN = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_UNKNOWN)
const OfpFlowModFailedCode_OFPFMFC_TABLE_FULL = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_TABLE_FULL)
const OfpFlowModFailedCode_OFPFMFC_BAD_TABLE_ID = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_BAD_TABLE_ID)
const OfpFlowModFailedCode_OFPFMFC_OVERLAP = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_OVERLAP)
const OfpFlowModFailedCode_OFPFMFC_EPERM = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_EPERM)
const OfpFlowModFailedCode_OFPFMFC_BAD_TIMEOUT = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_BAD_TIMEOUT)
const OfpFlowModFailedCode_OFPFMFC_BAD_COMMAND = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_BAD_COMMAND)
const OfpFlowModFailedCode_OFPFMFC_BAD_FLAGS = OfpFlowModFailedCode(openflow_13.OfpFlowModFailedCode_OFPFMFC_BAD_FLAGS)

// ofp_group_mod_failed_code from public import openflow_13.proto
type OfpGroupModFailedCode openflow_13.OfpGroupModFailedCode

var OfpGroupModFailedCode_name = openflow_13.OfpGroupModFailedCode_name
var OfpGroupModFailedCode_value = openflow_13.OfpGroupModFailedCode_value

func (x OfpGroupModFailedCode) String() string { return (openflow_13.OfpGroupModFailedCode)(x).String() }

const OfpGroupModFailedCode_OFPGMFC_GROUP_EXISTS = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_GROUP_EXISTS)
const OfpGroupModFailedCode_OFPGMFC_INVALID_GROUP = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_INVALID_GROUP)
const OfpGroupModFailedCode_OFPGMFC_WEIGHT_UNSUPPORTED = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_WEIGHT_UNSUPPORTED)
const OfpGroupModFailedCode_OFPGMFC_OUT_OF_GROUPS = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_OUT_OF_GROUPS)
const OfpGroupModFailedCode_OFPGMFC_OUT_OF_BUCKETS = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_OUT_OF_BUCKETS)
const OfpGroupModFailedCode_OFPGMFC_CHAINING_UNSUPPORTED = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_CHAINING_UNSUPPORTED)
const OfpGroupModFailedCode_OFPGMFC_WATCH_UNSUPPORTED = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_WATCH_UNSUPPORTED)
const OfpGroupModFailedCode_OFPGMFC_LOOP = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_LOOP)
const OfpGroupModFailedCode_OFPGMFC_UNKNOWN_GROUP = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_UNKNOWN_GROUP)
const OfpGroupModFailedCode_OFPGMFC_CHAINED_GROUP = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_CHAINED_GROUP)
const OfpGroupModFailedCode_OFPGMFC_BAD_TYPE = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_BAD_TYPE)
const OfpGroupModFailedCode_OFPGMFC_BAD_COMMAND = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_BAD_COMMAND)
const OfpGroupModFailedCode_OFPGMFC_BAD_BUCKET = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_BAD_BUCKET)
const OfpGroupModFailedCode_OFPGMFC_BAD_WATCH = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_BAD_WATCH)
const OfpGroupModFailedCode_OFPGMFC_EPERM = OfpGroupModFailedCode(openflow_13.OfpGroupModFailedCode_OFPGMFC_EPERM)

// ofp_port_mod_failed_code from public import openflow_13.proto
type OfpPortModFailedCode openflow_13.OfpPortModFailedCode

var OfpPortModFailedCode_name = openflow_13.OfpPortModFailedCode_name
var OfpPortModFailedCode_value = openflow_13.OfpPortModFailedCode_value

func (x OfpPortModFailedCode) String() string { return (openflow_13.OfpPortModFailedCode)(x).String() }

const OfpPortModFailedCode_OFPPMFC_BAD_PORT = OfpPortModFailedCode(openflow_13.OfpPortModFailedCode_OFPPMFC_BAD_PORT)
const OfpPortModFailedCode_OFPPMFC_BAD_HW_ADDR = OfpPortModFailedCode(openflow_13.OfpPortModFailedCode_OFPPMFC_BAD_HW_ADDR)
const OfpPortModFailedCode_OFPPMFC_BAD_CONFIG = OfpPortModFailedCode(openflow_13.OfpPortModFailedCode_OFPPMFC_BAD_CONFIG)
const OfpPortModFailedCode_OFPPMFC_BAD_ADVERTISE = OfpPortModFailedCode(openflow_13.OfpPortModFailedCode_OFPPMFC_BAD_ADVERTISE)
const OfpPortModFailedCode_OFPPMFC_EPERM = OfpPortModFailedCode(openflow_13.OfpPortModFailedCode_OFPPMFC_EPERM)

// ofp_table_mod_failed_code from public import openflow_13.proto
type OfpTableModFailedCode openflow_13.OfpTableModFailedCode

var OfpTableModFailedCode_name = openflow_13.OfpTableModFailedCode_name
var OfpTableModFailedCode_value = openflow_13.OfpTableModFailedCode_value

func (x OfpTableModFailedCode) String() string { return (openflow_13.OfpTableModFailedCode)(x).String() }

const OfpTableModFailedCode_OFPTMFC_BAD_TABLE = OfpTableModFailedCode(openflow_13.OfpTableModFailedCode_OFPTMFC_BAD_TABLE)
const OfpTableModFailedCode_OFPTMFC_BAD_CONFIG = OfpTableModFailedCode(openflow_13.OfpTableModFailedCode_OFPTMFC_BAD_CONFIG)
const OfpTableModFailedCode_OFPTMFC_EPERM = OfpTableModFailedCode(openflow_13.OfpTableModFailedCode_OFPTMFC_EPERM)

// ofp_queue_op_failed_code from public import openflow_13.proto
type OfpQueueOpFailedCode openflow_13.OfpQueueOpFailedCode

var OfpQueueOpFailedCode_name = openflow_13.OfpQueueOpFailedCode_name
var OfpQueueOpFailedCode_value = openflow_13.OfpQueueOpFailedCode_value

func (x OfpQueueOpFailedCode) String() string { return (openflow_13.OfpQueueOpFailedCode)(x).String() }

const OfpQueueOpFailedCode_OFPQOFC_BAD_PORT = OfpQueueOpFailedCode(openflow_13.OfpQueueOpFailedCode_OFPQOFC_BAD_PORT)
const OfpQueueOpFailedCode_OFPQOFC_BAD_QUEUE = OfpQueueOpFailedCode(openflow_13.OfpQueueOpFailedCode_OFPQOFC_BAD_QUEUE)
const OfpQueueOpFailedCode_OFPQOFC_EPERM = OfpQueueOpFailedCode(openflow_13.OfpQueueOpFailedCode_OFPQOFC_EPERM)

// ofp_switch_config_failed_code from public import openflow_13.proto
type OfpSwitchConfigFailedCode openflow_13.OfpSwitchConfigFailedCode

var OfpSwitchConfigFailedCode_name = openflow_13.OfpSwitchConfigFailedCode_name
var OfpSwitchConfigFailedCode_value = openflow_13.OfpSwitchConfigFailedCode_value

func (x OfpSwitchConfigFailedCode) String() string {
	return (openflow_13.OfpSwitchConfigFailedCode)(x).String()
}

const OfpSwitchConfigFailedCode_OFPSCFC_BAD_FLAGS = OfpSwitchConfigFailedCode(openflow_13.OfpSwitchConfigFailedCode_OFPSCFC_BAD_FLAGS)
const OfpSwitchConfigFailedCode_OFPSCFC_BAD_LEN = OfpSwitchConfigFailedCode(openflow_13.OfpSwitchConfigFailedCode_OFPSCFC_BAD_LEN)
const OfpSwitchConfigFailedCode_OFPSCFC_EPERM = OfpSwitchConfigFailedCode(openflow_13.OfpSwitchConfigFailedCode_OFPSCFC_EPERM)

// ofp_role_request_failed_code from public import openflow_13.proto
type OfpRoleRequestFailedCode openflow_13.OfpRoleRequestFailedCode

var OfpRoleRequestFailedCode_name = openflow_13.OfpRoleRequestFailedCode_name
var OfpRoleRequestFailedCode_value = openflow_13.OfpRoleRequestFailedCode_value

func (x OfpRoleRequestFailedCode) String() string {
	return (openflow_13.OfpRoleRequestFailedCode)(x).String()
}

const OfpRoleRequestFailedCode_OFPRRFC_STALE = OfpRoleRequestFailedCode(openflow_13.OfpRoleRequestFailedCode_OFPRRFC_STALE)
const OfpRoleRequestFailedCode_OFPRRFC_UNSUP = OfpRoleRequestFailedCode(openflow_13.OfpRoleRequestFailedCode_OFPRRFC_UNSUP)
const OfpRoleRequestFailedCode_OFPRRFC_BAD_ROLE = OfpRoleRequestFailedCode(openflow_13.OfpRoleRequestFailedCode_OFPRRFC_BAD_ROLE)

// ofp_meter_mod_failed_code from public import openflow_13.proto
type OfpMeterModFailedCode openflow_13.OfpMeterModFailedCode

var OfpMeterModFailedCode_name = openflow_13.OfpMeterModFailedCode_name
var OfpMeterModFailedCode_value = openflow_13.OfpMeterModFailedCode_value

func (x OfpMeterModFailedCode) String() string { return (openflow_13.OfpMeterModFailedCode)(x).String() }

const OfpMeterModFailedCode_OFPMMFC_UNKNOWN = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_UNKNOWN)
const OfpMeterModFailedCode_OFPMMFC_METER_EXISTS = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_METER_EXISTS)
const OfpMeterModFailedCode_OFPMMFC_INVALID_METER = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_INVALID_METER)
const OfpMeterModFailedCode_OFPMMFC_UNKNOWN_METER = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_UNKNOWN_METER)
const OfpMeterModFailedCode_OFPMMFC_BAD_COMMAND = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_COMMAND)
const OfpMeterModFailedCode_OFPMMFC_BAD_FLAGS = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_FLAGS)
const OfpMeterModFailedCode_OFPMMFC_BAD_RATE = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_RATE)
const OfpMeterModFailedCode_OFPMMFC_BAD_BURST = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_BURST)
const OfpMeterModFailedCode_OFPMMFC_BAD_BAND = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_BAND)
const OfpMeterModFailedCode_OFPMMFC_BAD_BAND_VALUE = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_BAD_BAND_VALUE)
const OfpMeterModFailedCode_OFPMMFC_OUT_OF_METERS = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_OUT_OF_METERS)
const OfpMeterModFailedCode_OFPMMFC_OUT_OF_BANDS = OfpMeterModFailedCode(openflow_13.OfpMeterModFailedCode_OFPMMFC_OUT_OF_BANDS)

// ofp_table_features_failed_code from public import openflow_13.proto
type OfpTableFeaturesFailedCode openflow_13.OfpTableFeaturesFailedCode

var OfpTableFeaturesFailedCode_name = openflow_13.OfpTableFeaturesFailedCode_name
var OfpTableFeaturesFailedCode_value = openflow_13.OfpTableFeaturesFailedCode_value

func (x OfpTableFeaturesFailedCode) String() string {
	return (openflow_13.OfpTableFeaturesFailedCode)(x).String()
}

const OfpTableFeaturesFailedCode_OFPTFFC_BAD_TABLE = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_BAD_TABLE)
const OfpTableFeaturesFailedCode_OFPTFFC_BAD_METADATA = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_BAD_METADATA)
const OfpTableFeaturesFailedCode_OFPTFFC_BAD_TYPE = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_BAD_TYPE)
const OfpTableFeaturesFailedCode_OFPTFFC_BAD_LEN = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_BAD_LEN)
const OfpTableFeaturesFailedCode_OFPTFFC_BAD_ARGUMENT = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_BAD_ARGUMENT)
const OfpTableFeaturesFailedCode_OFPTFFC_EPERM = OfpTableFeaturesFailedCode(openflow_13.OfpTableFeaturesFailedCode_OFPTFFC_EPERM)

// ofp_multipart_type from public import openflow_13.proto
type OfpMultipartType openflow_13.OfpMultipartType

var OfpMultipartType_name = openflow_13.OfpMultipartType_name
var OfpMultipartType_value = openflow_13.OfpMultipartType_value

func (x OfpMultipartType) String() string { return (openflow_13.OfpMultipartType)(x).String() }

const OfpMultipartType_OFPMP_DESC = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_DESC)
const OfpMultipartType_OFPMP_FLOW = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_FLOW)
const OfpMultipartType_OFPMP_AGGREGATE = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_AGGREGATE)
const OfpMultipartType_OFPMP_TABLE = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_TABLE)
const OfpMultipartType_OFPMP_PORT_STATS = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_PORT_STATS)
const OfpMultipartType_OFPMP_QUEUE = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_QUEUE)
const OfpMultipartType_OFPMP_GROUP = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_GROUP)
const OfpMultipartType_OFPMP_GROUP_DESC = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_GROUP_DESC)
const OfpMultipartType_OFPMP_GROUP_FEATURES = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_GROUP_FEATURES)
const OfpMultipartType_OFPMP_METER = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_METER)
const OfpMultipartType_OFPMP_METER_CONFIG = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_METER_CONFIG)
const OfpMultipartType_OFPMP_METER_FEATURES = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_METER_FEATURES)
const OfpMultipartType_OFPMP_TABLE_FEATURES = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_TABLE_FEATURES)
const OfpMultipartType_OFPMP_PORT_DESC = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_PORT_DESC)
const OfpMultipartType_OFPMP_EXPERIMENTER = OfpMultipartType(openflow_13.OfpMultipartType_OFPMP_EXPERIMENTER)

// ofp_multipart_request_flags from public import openflow_13.proto
type OfpMultipartRequestFlags openflow_13.OfpMultipartRequestFlags

var OfpMultipartRequestFlags_name = openflow_13.OfpMultipartRequestFlags_name
var OfpMultipartRequestFlags_value = openflow_13.OfpMultipartRequestFlags_value

func (x OfpMultipartRequestFlags) String() string {
	return (openflow_13.OfpMultipartRequestFlags)(x).String()
}

const OfpMultipartRequestFlags_OFPMPF_REQ_INVALID = OfpMultipartRequestFlags(openflow_13.OfpMultipartRequestFlags_OFPMPF_REQ_INVALID)
const OfpMultipartRequestFlags_OFPMPF_REQ_MORE = OfpMultipartRequestFlags(openflow_13.OfpMultipartRequestFlags_OFPMPF_REQ_MORE)

// ofp_multipart_reply_flags from public import openflow_13.proto
type OfpMultipartReplyFlags openflow_13.OfpMultipartReplyFlags

var OfpMultipartReplyFlags_name = openflow_13.OfpMultipartReplyFlags_name
var OfpMultipartReplyFlags_value = openflow_13.OfpMultipartReplyFlags_value

func (x OfpMultipartReplyFlags) String() string {
	return (openflow_13.OfpMultipartReplyFlags)(x).String()
}

const OfpMultipartReplyFlags_OFPMPF_REPLY_INVALID = OfpMultipartReplyFlags(openflow_13.OfpMultipartReplyFlags_OFPMPF_REPLY_INVALID)
const OfpMultipartReplyFlags_OFPMPF_REPLY_MORE = OfpMultipartReplyFlags(openflow_13.OfpMultipartReplyFlags_OFPMPF_REPLY_MORE)

// ofp_table_feature_prop_type from public import openflow_13.proto
type OfpTableFeaturePropType openflow_13.OfpTableFeaturePropType

var OfpTableFeaturePropType_name = openflow_13.OfpTableFeaturePropType_name
var OfpTableFeaturePropType_value = openflow_13.OfpTableFeaturePropType_value

func (x OfpTableFeaturePropType) String() string {
	return (openflow_13.OfpTableFeaturePropType)(x).String()
}

const OfpTableFeaturePropType_OFPTFPT_INSTRUCTIONS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_INSTRUCTIONS)
const OfpTableFeaturePropType_OFPTFPT_INSTRUCTIONS_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_INSTRUCTIONS_MISS)
const OfpTableFeaturePropType_OFPTFPT_NEXT_TABLES = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_NEXT_TABLES)
const OfpTableFeaturePropType_OFPTFPT_NEXT_TABLES_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_NEXT_TABLES_MISS)
const OfpTableFeaturePropType_OFPTFPT_WRITE_ACTIONS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_WRITE_ACTIONS)
const OfpTableFeaturePropType_OFPTFPT_WRITE_ACTIONS_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_WRITE_ACTIONS_MISS)
const OfpTableFeaturePropType_OFPTFPT_APPLY_ACTIONS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_APPLY_ACTIONS)
const OfpTableFeaturePropType_OFPTFPT_APPLY_ACTIONS_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_APPLY_ACTIONS_MISS)
const OfpTableFeaturePropType_OFPTFPT_MATCH = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_MATCH)
const OfpTableFeaturePropType_OFPTFPT_WILDCARDS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_WILDCARDS)
const OfpTableFeaturePropType_OFPTFPT_WRITE_SETFIELD = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_WRITE_SETFIELD)
const OfpTableFeaturePropType_OFPTFPT_WRITE_SETFIELD_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_WRITE_SETFIELD_MISS)
const OfpTableFeaturePropType_OFPTFPT_APPLY_SETFIELD = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_APPLY_SETFIELD)
const OfpTableFeaturePropType_OFPTFPT_APPLY_SETFIELD_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_APPLY_SETFIELD_MISS)
const OfpTableFeaturePropType_OFPTFPT_EXPERIMENTER = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_EXPERIMENTER)
const OfpTableFeaturePropType_OFPTFPT_EXPERIMENTER_MISS = OfpTableFeaturePropType(openflow_13.OfpTableFeaturePropType_OFPTFPT_EXPERIMENTER_MISS)

// ofp_group_capabilities from public import openflow_13.proto
type OfpGroupCapabilities openflow_13.OfpGroupCapabilities

var OfpGroupCapabilities_name = openflow_13.OfpGroupCapabilities_name
var OfpGroupCapabilities_value = openflow_13.OfpGroupCapabilities_value

func (x OfpGroupCapabilities) String() string { return (openflow_13.OfpGroupCapabilities)(x).String() }

const OfpGroupCapabilities_OFPGFC_INVALID = OfpGroupCapabilities(openflow_13.OfpGroupCapabilities_OFPGFC_INVALID)
const OfpGroupCapabilities_OFPGFC_SELECT_WEIGHT = OfpGroupCapabilities(openflow_13.OfpGroupCapabilities_OFPGFC_SELECT_WEIGHT)
const OfpGroupCapabilities_OFPGFC_SELECT_LIVENESS = OfpGroupCapabilities(openflow_13.OfpGroupCapabilities_OFPGFC_SELECT_LIVENESS)
const OfpGroupCapabilities_OFPGFC_CHAINING = OfpGroupCapabilities(openflow_13.OfpGroupCapabilities_OFPGFC_CHAINING)
const OfpGroupCapabilities_OFPGFC_CHAINING_CHECKS = OfpGroupCapabilities(openflow_13.OfpGroupCapabilities_OFPGFC_CHAINING_CHECKS)

// ofp_queue_properties from public import openflow_13.proto
type OfpQueueProperties openflow_13.OfpQueueProperties

var OfpQueueProperties_name = openflow_13.OfpQueueProperties_name
var OfpQueueProperties_value = openflow_13.OfpQueueProperties_value

func (x OfpQueueProperties) String() string { return (openflow_13.OfpQueueProperties)(x).String() }

const OfpQueueProperties_OFPQT_INVALID = OfpQueueProperties(openflow_13.OfpQueueProperties_OFPQT_INVALID)
const OfpQueueProperties_OFPQT_MIN_RATE = OfpQueueProperties(openflow_13.OfpQueueProperties_OFPQT_MIN_RATE)
const OfpQueueProperties_OFPQT_MAX_RATE = OfpQueueProperties(openflow_13.OfpQueueProperties_OFPQT_MAX_RATE)
const OfpQueueProperties_OFPQT_EXPERIMENTER = OfpQueueProperties(openflow_13.OfpQueueProperties_OFPQT_EXPERIMENTER)

// ofp_controller_role from public import openflow_13.proto
type OfpControllerRole openflow_13.OfpControllerRole

var OfpControllerRole_name = openflow_13.OfpControllerRole_name
var OfpControllerRole_value = openflow_13.OfpControllerRole_value

func (x OfpControllerRole) String() string { return (openflow_13.OfpControllerRole)(x).String() }

const OfpControllerRole_OFPCR_ROLE_NOCHANGE = OfpControllerRole(openflow_13.OfpControllerRole_OFPCR_ROLE_NOCHANGE)
const OfpControllerRole_OFPCR_ROLE_EQUAL = OfpControllerRole(openflow_13.OfpControllerRole_OFPCR_ROLE_EQUAL)
const OfpControllerRole_OFPCR_ROLE_MASTER = OfpControllerRole(openflow_13.OfpControllerRole_OFPCR_ROLE_MASTER)
const OfpControllerRole_OFPCR_ROLE_SLAVE = OfpControllerRole(openflow_13.OfpControllerRole_OFPCR_ROLE_SLAVE)

type AlarmFilterRuleKey_AlarmFilterRuleKey int32

const (
	AlarmFilterRuleKey_id          AlarmFilterRuleKey_AlarmFilterRuleKey = 0
	AlarmFilterRuleKey_type        AlarmFilterRuleKey_AlarmFilterRuleKey = 1
	AlarmFilterRuleKey_severity    AlarmFilterRuleKey_AlarmFilterRuleKey = 2
	AlarmFilterRuleKey_resource_id AlarmFilterRuleKey_AlarmFilterRuleKey = 3
	AlarmFilterRuleKey_category    AlarmFilterRuleKey_AlarmFilterRuleKey = 4
	AlarmFilterRuleKey_device_id   AlarmFilterRuleKey_AlarmFilterRuleKey = 5
)

var AlarmFilterRuleKey_AlarmFilterRuleKey_name = map[int32]string{
	0: "id",
	1: "type",
	2: "severity",
	3: "resource_id",
	4: "category",
	5: "device_id",
}
var AlarmFilterRuleKey_AlarmFilterRuleKey_value = map[string]int32{
	"id":          0,
	"type":        1,
	"severity":    2,
	"resource_id": 3,
	"category":    4,
	"device_id":   5,
}

func (x AlarmFilterRuleKey_AlarmFilterRuleKey) String() string {
	return proto.EnumName(AlarmFilterRuleKey_AlarmFilterRuleKey_name, int32(x))
}
func (AlarmFilterRuleKey_AlarmFilterRuleKey) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor0, []int{2, 0}
}

type DeviceGroup struct {
	Id             string                   `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	LogicalDevices []*voltha5.LogicalDevice `protobuf:"bytes,2,rep,name=logical_devices,json=logicalDevices" json:"logical_devices,omitempty"`
	Devices        []*voltha6.Device        `protobuf:"bytes,3,rep,name=devices" json:"devices,omitempty"`
}

func (m *DeviceGroup) Reset()                    { *m = DeviceGroup{} }
func (m *DeviceGroup) String() string            { return proto.CompactTextString(m) }
func (*DeviceGroup) ProtoMessage()               {}
func (*DeviceGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }

func (m *DeviceGroup) GetId() string {
	if m != nil {
		return m.Id
	}
	return ""
}

func (m *DeviceGroup) GetLogicalDevices() []*voltha5.LogicalDevice {
	if m != nil {
		return m.LogicalDevices
	}
	return nil
}

func (m *DeviceGroup) GetDevices() []*voltha6.Device {
	if m != nil {
		return m.Devices
	}
	return nil
}

type DeviceGroups struct {
	Items []*DeviceGroup `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"`
}

func (m *DeviceGroups) Reset()                    { *m = DeviceGroups{} }
func (m *DeviceGroups) String() string            { return proto.CompactTextString(m) }
func (*DeviceGroups) ProtoMessage()               {}
func (*DeviceGroups) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }

func (m *DeviceGroups) GetItems() []*DeviceGroup {
	if m != nil {
		return m.Items
	}
	return nil
}

type AlarmFilterRuleKey struct {
}

func (m *AlarmFilterRuleKey) Reset()                    { *m = AlarmFilterRuleKey{} }
func (m *AlarmFilterRuleKey) String() string            { return proto.CompactTextString(m) }
func (*AlarmFilterRuleKey) ProtoMessage()               {}
func (*AlarmFilterRuleKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }

type AlarmFilterRule struct {
	Key   AlarmFilterRuleKey_AlarmFilterRuleKey `protobuf:"varint,1,opt,name=key,enum=voltha.AlarmFilterRuleKey_AlarmFilterRuleKey" json:"key,omitempty"`
	Value string                                `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

func (m *AlarmFilterRule) Reset()                    { *m = AlarmFilterRule{} }
func (m *AlarmFilterRule) String() string            { return proto.CompactTextString(m) }
func (*AlarmFilterRule) ProtoMessage()               {}
func (*AlarmFilterRule) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }

func (m *AlarmFilterRule) GetKey() AlarmFilterRuleKey_AlarmFilterRuleKey {
	if m != nil {
		return m.Key
	}
	return AlarmFilterRuleKey_id
}

func (m *AlarmFilterRule) GetValue() string {
	if m != nil {
		return m.Value
	}
	return ""
}

type AlarmFilter struct {
	Id    string             `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Rules []*AlarmFilterRule `protobuf:"bytes,2,rep,name=rules" json:"rules,omitempty"`
}

func (m *AlarmFilter) Reset()                    { *m = AlarmFilter{} }
func (m *AlarmFilter) String() string            { return proto.CompactTextString(m) }
func (*AlarmFilter) ProtoMessage()               {}
func (*AlarmFilter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }

func (m *AlarmFilter) GetId() string {
	if m != nil {
		return m.Id
	}
	return ""
}

func (m *AlarmFilter) GetRules() []*AlarmFilterRule {
	if m != nil {
		return m.Rules
	}
	return nil
}

type AlarmFilters struct {
	Filters []*AlarmFilter `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"`
}

func (m *AlarmFilters) Reset()                    { *m = AlarmFilters{} }
func (m *AlarmFilters) String() string            { return proto.CompactTextString(m) }
func (*AlarmFilters) ProtoMessage()               {}
func (*AlarmFilters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }

func (m *AlarmFilters) GetFilters() []*AlarmFilter {
	if m != nil {
		return m.Filters
	}
	return nil
}

// Top-level (root) node for a Voltha Instance
type VolthaInstance struct {
	InstanceId     string                    `protobuf:"bytes,1,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
	Version        string                    `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
	LogLevel       voltha3.LogLevel_LogLevel `protobuf:"varint,3,opt,name=log_level,json=logLevel,enum=voltha.LogLevel_LogLevel" json:"log_level,omitempty"`
	Health         *voltha4.HealthStatus     `protobuf:"bytes,10,opt,name=health" json:"health,omitempty"`
	Adapters       []*voltha7.Adapter        `protobuf:"bytes,11,rep,name=adapters" json:"adapters,omitempty"`
	LogicalDevices []*voltha5.LogicalDevice  `protobuf:"bytes,12,rep,name=logical_devices,json=logicalDevices" json:"logical_devices,omitempty"`
	Devices        []*voltha6.Device         `protobuf:"bytes,13,rep,name=devices" json:"devices,omitempty"`
	DeviceTypes    []*voltha6.DeviceType     `protobuf:"bytes,14,rep,name=device_types,json=deviceTypes" json:"device_types,omitempty"`
	DeviceGroups   []*DeviceGroup            `protobuf:"bytes,15,rep,name=device_groups,json=deviceGroups" json:"device_groups,omitempty"`
	AlarmFilters   []*AlarmFilter            `protobuf:"bytes,16,rep,name=alarm_filters,json=alarmFilters" json:"alarm_filters,omitempty"`
}

func (m *VolthaInstance) Reset()                    { *m = VolthaInstance{} }
func (m *VolthaInstance) String() string            { return proto.CompactTextString(m) }
func (*VolthaInstance) ProtoMessage()               {}
func (*VolthaInstance) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }

func (m *VolthaInstance) GetInstanceId() string {
	if m != nil {
		return m.InstanceId
	}
	return ""
}

func (m *VolthaInstance) GetVersion() string {
	if m != nil {
		return m.Version
	}
	return ""
}

func (m *VolthaInstance) GetLogLevel() voltha3.LogLevel_LogLevel {
	if m != nil {
		return m.LogLevel
	}
	return voltha3.LogLevel_DEBUG
}

func (m *VolthaInstance) GetHealth() *voltha4.HealthStatus {
	if m != nil {
		return m.Health
	}
	return nil
}

func (m *VolthaInstance) GetAdapters() []*voltha7.Adapter {
	if m != nil {
		return m.Adapters
	}
	return nil
}

func (m *VolthaInstance) GetLogicalDevices() []*voltha5.LogicalDevice {
	if m != nil {
		return m.LogicalDevices
	}
	return nil
}

func (m *VolthaInstance) GetDevices() []*voltha6.Device {
	if m != nil {
		return m.Devices
	}
	return nil
}

func (m *VolthaInstance) GetDeviceTypes() []*voltha6.DeviceType {
	if m != nil {
		return m.DeviceTypes
	}
	return nil
}

func (m *VolthaInstance) GetDeviceGroups() []*DeviceGroup {
	if m != nil {
		return m.DeviceGroups
	}
	return nil
}

func (m *VolthaInstance) GetAlarmFilters() []*AlarmFilter {
	if m != nil {
		return m.AlarmFilters
	}
	return nil
}

type VolthaInstances struct {
	Items []string `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"`
}

func (m *VolthaInstances) Reset()                    { *m = VolthaInstances{} }
func (m *VolthaInstances) String() string            { return proto.CompactTextString(m) }
func (*VolthaInstances) ProtoMessage()               {}
func (*VolthaInstances) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }

func (m *VolthaInstances) GetItems() []string {
	if m != nil {
		return m.Items
	}
	return nil
}

// Voltha representing the entire Voltha cluster
type Voltha struct {
	Version        string                    `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"`
	LogLevel       voltha3.LogLevel_LogLevel `protobuf:"varint,2,opt,name=log_level,json=logLevel,enum=voltha.LogLevel_LogLevel" json:"log_level,omitempty"`
	Instances      []*VolthaInstance         `protobuf:"bytes,3,rep,name=instances" json:"instances,omitempty"`
	Adapters       []*voltha7.Adapter        `protobuf:"bytes,11,rep,name=adapters" json:"adapters,omitempty"`
	LogicalDevices []*voltha5.LogicalDevice  `protobuf:"bytes,12,rep,name=logical_devices,json=logicalDevices" json:"logical_devices,omitempty"`
	Devices        []*voltha6.Device         `protobuf:"bytes,13,rep,name=devices" json:"devices,omitempty"`
	DeviceGroups   []*DeviceGroup            `protobuf:"bytes,15,rep,name=device_groups,json=deviceGroups" json:"device_groups,omitempty"`
}

func (m *Voltha) Reset()                    { *m = Voltha{} }
func (m *Voltha) String() string            { return proto.CompactTextString(m) }
func (*Voltha) ProtoMessage()               {}
func (*Voltha) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }

func (m *Voltha) GetVersion() string {
	if m != nil {
		return m.Version
	}
	return ""
}

func (m *Voltha) GetLogLevel() voltha3.LogLevel_LogLevel {
	if m != nil {
		return m.LogLevel
	}
	return voltha3.LogLevel_DEBUG
}

func (m *Voltha) GetInstances() []*VolthaInstance {
	if m != nil {
		return m.Instances
	}
	return nil
}

func (m *Voltha) GetAdapters() []*voltha7.Adapter {
	if m != nil {
		return m.Adapters
	}
	return nil
}

func (m *Voltha) GetLogicalDevices() []*voltha5.LogicalDevice {
	if m != nil {
		return m.LogicalDevices
	}
	return nil
}

func (m *Voltha) GetDevices() []*voltha6.Device {
	if m != nil {
		return m.Devices
	}
	return nil
}

func (m *Voltha) GetDeviceGroups() []*DeviceGroup {
	if m != nil {
		return m.DeviceGroups
	}
	return nil
}

func init() {
	proto.RegisterType((*DeviceGroup)(nil), "voltha.DeviceGroup")
	proto.RegisterType((*DeviceGroups)(nil), "voltha.DeviceGroups")
	proto.RegisterType((*AlarmFilterRuleKey)(nil), "voltha.AlarmFilterRuleKey")
	proto.RegisterType((*AlarmFilterRule)(nil), "voltha.AlarmFilterRule")
	proto.RegisterType((*AlarmFilter)(nil), "voltha.AlarmFilter")
	proto.RegisterType((*AlarmFilters)(nil), "voltha.AlarmFilters")
	proto.RegisterType((*VolthaInstance)(nil), "voltha.VolthaInstance")
	proto.RegisterType((*VolthaInstances)(nil), "voltha.VolthaInstances")
	proto.RegisterType((*Voltha)(nil), "voltha.Voltha")
	proto.RegisterEnum("voltha.AlarmFilterRuleKey_AlarmFilterRuleKey", AlarmFilterRuleKey_AlarmFilterRuleKey_name, AlarmFilterRuleKey_AlarmFilterRuleKey_value)
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// Client API for VolthaGlobalService service

type VolthaGlobalServiceClient interface {
	// Get high level information on the Voltha cluster
	GetVoltha(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*Voltha, error)
	// List all Voltha cluster instances
	ListVolthaInstances(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VolthaInstances, error)
	// Get details on a Voltha cluster instance
	GetVolthaInstance(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*VolthaInstance, error)
	// List all logical devices managed by the Voltha cluster
	ListLogicalDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha5.LogicalDevices, error)
	// Get additional information on a given logical device
	GetLogicalDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalDevice, error)
	// List ports of a logical device
	ListLogicalDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalPorts, error)
	// List all flows of a logical device
	ListLogicalDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error)
	// Update flow table for logical device
	UpdateLogicalDeviceFlowTable(ctx context.Context, in *openflow_13.FlowTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all flow groups of a logical device
	ListLogicalDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error)
	// Update group table for device
	UpdateLogicalDeviceFlowGroupTable(ctx context.Context, in *openflow_13.FlowGroupTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all physical devices controlled by the Voltha cluster
	ListDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.Devices, error)
	// Get more information on a given physical device
	GetDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Device, error)
	// Pre-provision a new physical device
	CreateDevice(ctx context.Context, in *voltha6.Device, opts ...grpc.CallOption) (*voltha6.Device, error)
	// Enable a device.  If the device was in pre-provisioned state then it
	// will tansition to ENABLED state.  If it was is DISABLED state then it
	// will tansition to ENABLED state as well.
	EnableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Disable a device
	DisableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Reboot a device
	RebootDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Delete a device
	DeleteDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List ports of a device
	ListDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Ports, error)
	// List pm config of a device
	ListDevicePmConfigs(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.PmConfigs, error)
	// Update the pm config of a device
	UpdateDevicePmConfigs(ctx context.Context, in *voltha6.PmConfigs, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all flows of a device
	ListDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error)
	// List all flow groups of a device
	ListDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error)
	// List device types known to Voltha
	ListDeviceTypes(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.DeviceTypes, error)
	// Get additional information on a device type
	GetDeviceType(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.DeviceType, error)
	// List all device sharding groups
	ListDeviceGroups(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*DeviceGroups, error)
	// Get additional information on a device group
	GetDeviceGroup(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*DeviceGroup, error)
	CreateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error)
	GetAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*AlarmFilter, error)
	UpdateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error)
	DeleteAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	ListAlarmFilters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*AlarmFilters, error)
}

type volthaGlobalServiceClient struct {
	cc *grpc.ClientConn
}

func NewVolthaGlobalServiceClient(cc *grpc.ClientConn) VolthaGlobalServiceClient {
	return &volthaGlobalServiceClient{cc}
}

func (c *volthaGlobalServiceClient) GetVoltha(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*Voltha, error) {
	out := new(Voltha)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetVoltha", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListVolthaInstances(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VolthaInstances, error) {
	out := new(VolthaInstances)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListVolthaInstances", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetVolthaInstance(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*VolthaInstance, error) {
	out := new(VolthaInstance)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetVolthaInstance", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListLogicalDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha5.LogicalDevices, error) {
	out := new(voltha5.LogicalDevices)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListLogicalDevices", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetLogicalDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalDevice, error) {
	out := new(voltha5.LogicalDevice)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetLogicalDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListLogicalDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalPorts, error) {
	out := new(voltha5.LogicalPorts)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListLogicalDevicePorts", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListLogicalDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error) {
	out := new(openflow_13.Flows)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListLogicalDeviceFlows", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) UpdateLogicalDeviceFlowTable(ctx context.Context, in *openflow_13.FlowTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/UpdateLogicalDeviceFlowTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListLogicalDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error) {
	out := new(openflow_13.FlowGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListLogicalDeviceFlowGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, in *openflow_13.FlowGroupTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/UpdateLogicalDeviceFlowGroupTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.Devices, error) {
	out := new(voltha6.Devices)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDevices", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Device, error) {
	out := new(voltha6.Device)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) CreateDevice(ctx context.Context, in *voltha6.Device, opts ...grpc.CallOption) (*voltha6.Device, error) {
	out := new(voltha6.Device)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/CreateDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) EnableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/EnableDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) DisableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/DisableDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) RebootDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/RebootDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) DeleteDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/DeleteDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Ports, error) {
	out := new(voltha6.Ports)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDevicePorts", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDevicePmConfigs(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.PmConfigs, error) {
	out := new(voltha6.PmConfigs)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDevicePmConfigs", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) UpdateDevicePmConfigs(ctx context.Context, in *voltha6.PmConfigs, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/UpdateDevicePmConfigs", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error) {
	out := new(openflow_13.Flows)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDeviceFlows", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error) {
	out := new(openflow_13.FlowGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDeviceFlowGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDeviceTypes(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.DeviceTypes, error) {
	out := new(voltha6.DeviceTypes)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDeviceTypes", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetDeviceType(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.DeviceType, error) {
	out := new(voltha6.DeviceType)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetDeviceType", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListDeviceGroups(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*DeviceGroups, error) {
	out := new(DeviceGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListDeviceGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetDeviceGroup(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*DeviceGroup, error) {
	out := new(DeviceGroup)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetDeviceGroup", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) CreateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/CreateAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) GetAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/GetAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) UpdateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/UpdateAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) DeleteAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/DeleteAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaGlobalServiceClient) ListAlarmFilters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*AlarmFilters, error) {
	out := new(AlarmFilters)
	err := grpc.Invoke(ctx, "/voltha.VolthaGlobalService/ListAlarmFilters", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for VolthaGlobalService service

type VolthaGlobalServiceServer interface {
	// Get high level information on the Voltha cluster
	GetVoltha(context.Context, *google_protobuf.Empty) (*Voltha, error)
	// List all Voltha cluster instances
	ListVolthaInstances(context.Context, *google_protobuf.Empty) (*VolthaInstances, error)
	// Get details on a Voltha cluster instance
	GetVolthaInstance(context.Context, *voltha3.ID) (*VolthaInstance, error)
	// List all logical devices managed by the Voltha cluster
	ListLogicalDevices(context.Context, *google_protobuf.Empty) (*voltha5.LogicalDevices, error)
	// Get additional information on a given logical device
	GetLogicalDevice(context.Context, *voltha3.ID) (*voltha5.LogicalDevice, error)
	// List ports of a logical device
	ListLogicalDevicePorts(context.Context, *voltha3.ID) (*voltha5.LogicalPorts, error)
	// List all flows of a logical device
	ListLogicalDeviceFlows(context.Context, *voltha3.ID) (*openflow_13.Flows, error)
	// Update flow table for logical device
	UpdateLogicalDeviceFlowTable(context.Context, *openflow_13.FlowTableUpdate) (*google_protobuf.Empty, error)
	// List all flow groups of a logical device
	ListLogicalDeviceFlowGroups(context.Context, *voltha3.ID) (*openflow_13.FlowGroups, error)
	// Update group table for device
	UpdateLogicalDeviceFlowGroupTable(context.Context, *openflow_13.FlowGroupTableUpdate) (*google_protobuf.Empty, error)
	// List all physical devices controlled by the Voltha cluster
	ListDevices(context.Context, *google_protobuf.Empty) (*voltha6.Devices, error)
	// Get more information on a given physical device
	GetDevice(context.Context, *voltha3.ID) (*voltha6.Device, error)
	// Pre-provision a new physical device
	CreateDevice(context.Context, *voltha6.Device) (*voltha6.Device, error)
	// Enable a device.  If the device was in pre-provisioned state then it
	// will tansition to ENABLED state.  If it was is DISABLED state then it
	// will tansition to ENABLED state as well.
	EnableDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Disable a device
	DisableDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Reboot a device
	RebootDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Delete a device
	DeleteDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// List ports of a device
	ListDevicePorts(context.Context, *voltha3.ID) (*voltha6.Ports, error)
	// List pm config of a device
	ListDevicePmConfigs(context.Context, *voltha3.ID) (*voltha6.PmConfigs, error)
	// Update the pm config of a device
	UpdateDevicePmConfigs(context.Context, *voltha6.PmConfigs) (*google_protobuf.Empty, error)
	// List all flows of a device
	ListDeviceFlows(context.Context, *voltha3.ID) (*openflow_13.Flows, error)
	// List all flow groups of a device
	ListDeviceFlowGroups(context.Context, *voltha3.ID) (*openflow_13.FlowGroups, error)
	// List device types known to Voltha
	ListDeviceTypes(context.Context, *google_protobuf.Empty) (*voltha6.DeviceTypes, error)
	// Get additional information on a device type
	GetDeviceType(context.Context, *voltha3.ID) (*voltha6.DeviceType, error)
	// List all device sharding groups
	ListDeviceGroups(context.Context, *google_protobuf.Empty) (*DeviceGroups, error)
	// Get additional information on a device group
	GetDeviceGroup(context.Context, *voltha3.ID) (*DeviceGroup, error)
	CreateAlarmFilter(context.Context, *AlarmFilter) (*AlarmFilter, error)
	GetAlarmFilter(context.Context, *voltha3.ID) (*AlarmFilter, error)
	UpdateAlarmFilter(context.Context, *AlarmFilter) (*AlarmFilter, error)
	DeleteAlarmFilter(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	ListAlarmFilters(context.Context, *google_protobuf.Empty) (*AlarmFilters, error)
}

func RegisterVolthaGlobalServiceServer(s *grpc.Server, srv VolthaGlobalServiceServer) {
	s.RegisterService(&_VolthaGlobalService_serviceDesc, srv)
}

func _VolthaGlobalService_GetVoltha_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetVoltha(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetVoltha",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetVoltha(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListVolthaInstances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListVolthaInstances(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListVolthaInstances",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListVolthaInstances(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetVolthaInstance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetVolthaInstance(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetVolthaInstance",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetVolthaInstance(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListLogicalDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListLogicalDevices(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListLogicalDevices",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListLogicalDevices(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetLogicalDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetLogicalDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetLogicalDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetLogicalDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListLogicalDevicePorts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListLogicalDevicePorts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListLogicalDevicePorts",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListLogicalDevicePorts(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListLogicalDeviceFlows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListLogicalDeviceFlows(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListLogicalDeviceFlows",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListLogicalDeviceFlows(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_UpdateLogicalDeviceFlowTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(openflow_13.FlowTableUpdate)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).UpdateLogicalDeviceFlowTable(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/UpdateLogicalDeviceFlowTable",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).UpdateLogicalDeviceFlowTable(ctx, req.(*openflow_13.FlowTableUpdate))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListLogicalDeviceFlowGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListLogicalDeviceFlowGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListLogicalDeviceFlowGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListLogicalDeviceFlowGroups(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_UpdateLogicalDeviceFlowGroupTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(openflow_13.FlowGroupTableUpdate)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).UpdateLogicalDeviceFlowGroupTable(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/UpdateLogicalDeviceFlowGroupTable",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).UpdateLogicalDeviceFlowGroupTable(ctx, req.(*openflow_13.FlowGroupTableUpdate))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDevices(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDevices",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDevices(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_CreateDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha6.Device)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).CreateDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/CreateDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).CreateDevice(ctx, req.(*voltha6.Device))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_EnableDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).EnableDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/EnableDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).EnableDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_DisableDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).DisableDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/DisableDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).DisableDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_RebootDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).RebootDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/RebootDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).RebootDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_DeleteDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).DeleteDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/DeleteDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).DeleteDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDevicePorts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDevicePorts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDevicePorts",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDevicePorts(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDevicePmConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDevicePmConfigs(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDevicePmConfigs",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDevicePmConfigs(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_UpdateDevicePmConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha6.PmConfigs)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).UpdateDevicePmConfigs(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/UpdateDevicePmConfigs",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).UpdateDevicePmConfigs(ctx, req.(*voltha6.PmConfigs))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDeviceFlows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDeviceFlows(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDeviceFlows",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDeviceFlows(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDeviceFlowGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDeviceFlowGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDeviceFlowGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDeviceFlowGroups(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDeviceTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDeviceTypes(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDeviceTypes",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDeviceTypes(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetDeviceType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetDeviceType(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetDeviceType",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetDeviceType(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListDeviceGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListDeviceGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListDeviceGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListDeviceGroups(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetDeviceGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetDeviceGroup(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetDeviceGroup",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetDeviceGroup(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_CreateAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AlarmFilter)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).CreateAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/CreateAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).CreateAlarmFilter(ctx, req.(*AlarmFilter))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_GetAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).GetAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/GetAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).GetAlarmFilter(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_UpdateAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AlarmFilter)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).UpdateAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/UpdateAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).UpdateAlarmFilter(ctx, req.(*AlarmFilter))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_DeleteAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).DeleteAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/DeleteAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).DeleteAlarmFilter(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaGlobalService_ListAlarmFilters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaGlobalServiceServer).ListAlarmFilters(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaGlobalService/ListAlarmFilters",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaGlobalServiceServer).ListAlarmFilters(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

var _VolthaGlobalService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "voltha.VolthaGlobalService",
	HandlerType: (*VolthaGlobalServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetVoltha",
			Handler:    _VolthaGlobalService_GetVoltha_Handler,
		},
		{
			MethodName: "ListVolthaInstances",
			Handler:    _VolthaGlobalService_ListVolthaInstances_Handler,
		},
		{
			MethodName: "GetVolthaInstance",
			Handler:    _VolthaGlobalService_GetVolthaInstance_Handler,
		},
		{
			MethodName: "ListLogicalDevices",
			Handler:    _VolthaGlobalService_ListLogicalDevices_Handler,
		},
		{
			MethodName: "GetLogicalDevice",
			Handler:    _VolthaGlobalService_GetLogicalDevice_Handler,
		},
		{
			MethodName: "ListLogicalDevicePorts",
			Handler:    _VolthaGlobalService_ListLogicalDevicePorts_Handler,
		},
		{
			MethodName: "ListLogicalDeviceFlows",
			Handler:    _VolthaGlobalService_ListLogicalDeviceFlows_Handler,
		},
		{
			MethodName: "UpdateLogicalDeviceFlowTable",
			Handler:    _VolthaGlobalService_UpdateLogicalDeviceFlowTable_Handler,
		},
		{
			MethodName: "ListLogicalDeviceFlowGroups",
			Handler:    _VolthaGlobalService_ListLogicalDeviceFlowGroups_Handler,
		},
		{
			MethodName: "UpdateLogicalDeviceFlowGroupTable",
			Handler:    _VolthaGlobalService_UpdateLogicalDeviceFlowGroupTable_Handler,
		},
		{
			MethodName: "ListDevices",
			Handler:    _VolthaGlobalService_ListDevices_Handler,
		},
		{
			MethodName: "GetDevice",
			Handler:    _VolthaGlobalService_GetDevice_Handler,
		},
		{
			MethodName: "CreateDevice",
			Handler:    _VolthaGlobalService_CreateDevice_Handler,
		},
		{
			MethodName: "EnableDevice",
			Handler:    _VolthaGlobalService_EnableDevice_Handler,
		},
		{
			MethodName: "DisableDevice",
			Handler:    _VolthaGlobalService_DisableDevice_Handler,
		},
		{
			MethodName: "RebootDevice",
			Handler:    _VolthaGlobalService_RebootDevice_Handler,
		},
		{
			MethodName: "DeleteDevice",
			Handler:    _VolthaGlobalService_DeleteDevice_Handler,
		},
		{
			MethodName: "ListDevicePorts",
			Handler:    _VolthaGlobalService_ListDevicePorts_Handler,
		},
		{
			MethodName: "ListDevicePmConfigs",
			Handler:    _VolthaGlobalService_ListDevicePmConfigs_Handler,
		},
		{
			MethodName: "UpdateDevicePmConfigs",
			Handler:    _VolthaGlobalService_UpdateDevicePmConfigs_Handler,
		},
		{
			MethodName: "ListDeviceFlows",
			Handler:    _VolthaGlobalService_ListDeviceFlows_Handler,
		},
		{
			MethodName: "ListDeviceFlowGroups",
			Handler:    _VolthaGlobalService_ListDeviceFlowGroups_Handler,
		},
		{
			MethodName: "ListDeviceTypes",
			Handler:    _VolthaGlobalService_ListDeviceTypes_Handler,
		},
		{
			MethodName: "GetDeviceType",
			Handler:    _VolthaGlobalService_GetDeviceType_Handler,
		},
		{
			MethodName: "ListDeviceGroups",
			Handler:    _VolthaGlobalService_ListDeviceGroups_Handler,
		},
		{
			MethodName: "GetDeviceGroup",
			Handler:    _VolthaGlobalService_GetDeviceGroup_Handler,
		},
		{
			MethodName: "CreateAlarmFilter",
			Handler:    _VolthaGlobalService_CreateAlarmFilter_Handler,
		},
		{
			MethodName: "GetAlarmFilter",
			Handler:    _VolthaGlobalService_GetAlarmFilter_Handler,
		},
		{
			MethodName: "UpdateAlarmFilter",
			Handler:    _VolthaGlobalService_UpdateAlarmFilter_Handler,
		},
		{
			MethodName: "DeleteAlarmFilter",
			Handler:    _VolthaGlobalService_DeleteAlarmFilter_Handler,
		},
		{
			MethodName: "ListAlarmFilters",
			Handler:    _VolthaGlobalService_ListAlarmFilters_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "voltha.proto",
}

// Client API for VolthaLocalService service

type VolthaLocalServiceClient interface {
	// Get information on this Voltha instance
	GetVolthaInstance(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VolthaInstance, error)
	// Get the health state of the Voltha instance
	GetHealth(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha4.HealthStatus, error)
	// List all active adapters (plugins) in this Voltha instance
	ListAdapters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha7.Adapters, error)
	// List all logical devices managed by this Voltha instance
	ListLogicalDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha5.LogicalDevices, error)
	// Get additional information on given logical device
	GetLogicalDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalDevice, error)
	// List ports of a logical device
	ListLogicalDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalPorts, error)
	// List all flows of a logical device
	ListLogicalDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error)
	// Update flow table for logical device
	UpdateLogicalDeviceFlowTable(ctx context.Context, in *openflow_13.FlowTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all flow groups of a logical device
	ListLogicalDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error)
	// Update group table for logical device
	UpdateLogicalDeviceFlowGroupTable(ctx context.Context, in *openflow_13.FlowGroupTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all physical devices managed by this Voltha instance
	ListDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.Devices, error)
	// Get additional information on this device
	GetDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Device, error)
	// Pre-provision a new physical device
	CreateDevice(ctx context.Context, in *voltha6.Device, opts ...grpc.CallOption) (*voltha6.Device, error)
	// Enable a device.  If the device was in pre-provisioned state then it
	// will tansition to ENABLED state.  If it was is DISABLED state then it
	// will tansition to ENABLED state as well.
	EnableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Disable a device
	DisableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Reboot a device
	RebootDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// Delete a device
	DeleteDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List ports of a device
	ListDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Ports, error)
	// List pm config of a device
	ListDevicePmConfigs(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.PmConfigs, error)
	// Update the pm config of a device
	UpdateDevicePmConfigs(ctx context.Context, in *voltha6.PmConfigs, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	// List all flows of a device
	ListDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error)
	// List all flow groups of a device
	ListDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error)
	// List device types know to Voltha instance
	ListDeviceTypes(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.DeviceTypes, error)
	// Get additional information on given device type
	GetDeviceType(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.DeviceType, error)
	// List device sharding groups managed by this Voltha instance
	ListDeviceGroups(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*DeviceGroups, error)
	// Get more information on given device shard
	GetDeviceGroup(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*DeviceGroup, error)
	// Stream control packets to the dataplane
	StreamPacketsOut(ctx context.Context, opts ...grpc.CallOption) (VolthaLocalService_StreamPacketsOutClient, error)
	// Receive control packet stream
	ReceivePacketsIn(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (VolthaLocalService_ReceivePacketsInClient, error)
	ReceiveChangeEvents(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (VolthaLocalService_ReceiveChangeEventsClient, error)
	CreateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error)
	GetAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*AlarmFilter, error)
	UpdateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error)
	DeleteAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
	ListAlarmFilters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*AlarmFilters, error)
}

type volthaLocalServiceClient struct {
	cc *grpc.ClientConn
}

func NewVolthaLocalServiceClient(cc *grpc.ClientConn) VolthaLocalServiceClient {
	return &volthaLocalServiceClient{cc}
}

func (c *volthaLocalServiceClient) GetVolthaInstance(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VolthaInstance, error) {
	out := new(VolthaInstance)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetVolthaInstance", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetHealth(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha4.HealthStatus, error) {
	out := new(voltha4.HealthStatus)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetHealth", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListAdapters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha7.Adapters, error) {
	out := new(voltha7.Adapters)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListAdapters", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListLogicalDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha5.LogicalDevices, error) {
	out := new(voltha5.LogicalDevices)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListLogicalDevices", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetLogicalDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalDevice, error) {
	out := new(voltha5.LogicalDevice)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetLogicalDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListLogicalDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha5.LogicalPorts, error) {
	out := new(voltha5.LogicalPorts)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListLogicalDevicePorts", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListLogicalDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error) {
	out := new(openflow_13.Flows)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListLogicalDeviceFlows", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) UpdateLogicalDeviceFlowTable(ctx context.Context, in *openflow_13.FlowTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/UpdateLogicalDeviceFlowTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListLogicalDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error) {
	out := new(openflow_13.FlowGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListLogicalDeviceFlowGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, in *openflow_13.FlowGroupTableUpdate, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/UpdateLogicalDeviceFlowGroupTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDevices(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.Devices, error) {
	out := new(voltha6.Devices)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDevices", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Device, error) {
	out := new(voltha6.Device)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) CreateDevice(ctx context.Context, in *voltha6.Device, opts ...grpc.CallOption) (*voltha6.Device, error) {
	out := new(voltha6.Device)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/CreateDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) EnableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/EnableDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) DisableDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/DisableDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) RebootDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/RebootDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) DeleteDevice(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/DeleteDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDevicePorts(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.Ports, error) {
	out := new(voltha6.Ports)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDevicePorts", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDevicePmConfigs(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.PmConfigs, error) {
	out := new(voltha6.PmConfigs)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDevicePmConfigs", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) UpdateDevicePmConfigs(ctx context.Context, in *voltha6.PmConfigs, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/UpdateDevicePmConfigs", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDeviceFlows(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.Flows, error) {
	out := new(openflow_13.Flows)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDeviceFlows", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDeviceFlowGroups(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*openflow_13.FlowGroups, error) {
	out := new(openflow_13.FlowGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDeviceFlowGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDeviceTypes(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*voltha6.DeviceTypes, error) {
	out := new(voltha6.DeviceTypes)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDeviceTypes", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetDeviceType(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*voltha6.DeviceType, error) {
	out := new(voltha6.DeviceType)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetDeviceType", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListDeviceGroups(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*DeviceGroups, error) {
	out := new(DeviceGroups)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListDeviceGroups", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetDeviceGroup(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*DeviceGroup, error) {
	out := new(DeviceGroup)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetDeviceGroup", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) StreamPacketsOut(ctx context.Context, opts ...grpc.CallOption) (VolthaLocalService_StreamPacketsOutClient, error) {
	stream, err := grpc.NewClientStream(ctx, &_VolthaLocalService_serviceDesc.Streams[0], c.cc, "/voltha.VolthaLocalService/StreamPacketsOut", opts...)
	if err != nil {
		return nil, err
	}
	x := &volthaLocalServiceStreamPacketsOutClient{stream}
	return x, nil
}

type VolthaLocalService_StreamPacketsOutClient interface {
	Send(*openflow_13.PacketOut) error
	CloseAndRecv() (*google_protobuf.Empty, error)
	grpc.ClientStream
}

type volthaLocalServiceStreamPacketsOutClient struct {
	grpc.ClientStream
}

func (x *volthaLocalServiceStreamPacketsOutClient) Send(m *openflow_13.PacketOut) error {
	return x.ClientStream.SendMsg(m)
}

func (x *volthaLocalServiceStreamPacketsOutClient) CloseAndRecv() (*google_protobuf.Empty, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(google_protobuf.Empty)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *volthaLocalServiceClient) ReceivePacketsIn(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (VolthaLocalService_ReceivePacketsInClient, error) {
	stream, err := grpc.NewClientStream(ctx, &_VolthaLocalService_serviceDesc.Streams[1], c.cc, "/voltha.VolthaLocalService/ReceivePacketsIn", opts...)
	if err != nil {
		return nil, err
	}
	x := &volthaLocalServiceReceivePacketsInClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type VolthaLocalService_ReceivePacketsInClient interface {
	Recv() (*openflow_13.PacketIn, error)
	grpc.ClientStream
}

type volthaLocalServiceReceivePacketsInClient struct {
	grpc.ClientStream
}

func (x *volthaLocalServiceReceivePacketsInClient) Recv() (*openflow_13.PacketIn, error) {
	m := new(openflow_13.PacketIn)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *volthaLocalServiceClient) ReceiveChangeEvents(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (VolthaLocalService_ReceiveChangeEventsClient, error) {
	stream, err := grpc.NewClientStream(ctx, &_VolthaLocalService_serviceDesc.Streams[2], c.cc, "/voltha.VolthaLocalService/ReceiveChangeEvents", opts...)
	if err != nil {
		return nil, err
	}
	x := &volthaLocalServiceReceiveChangeEventsClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type VolthaLocalService_ReceiveChangeEventsClient interface {
	Recv() (*openflow_13.ChangeEvent, error)
	grpc.ClientStream
}

type volthaLocalServiceReceiveChangeEventsClient struct {
	grpc.ClientStream
}

func (x *volthaLocalServiceReceiveChangeEventsClient) Recv() (*openflow_13.ChangeEvent, error) {
	m := new(openflow_13.ChangeEvent)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *volthaLocalServiceClient) CreateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/CreateAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) GetAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/GetAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) UpdateAlarmFilter(ctx context.Context, in *AlarmFilter, opts ...grpc.CallOption) (*AlarmFilter, error) {
	out := new(AlarmFilter)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/UpdateAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) DeleteAlarmFilter(ctx context.Context, in *voltha3.ID, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/DeleteAlarmFilter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *volthaLocalServiceClient) ListAlarmFilters(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*AlarmFilters, error) {
	out := new(AlarmFilters)
	err := grpc.Invoke(ctx, "/voltha.VolthaLocalService/ListAlarmFilters", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for VolthaLocalService service

type VolthaLocalServiceServer interface {
	// Get information on this Voltha instance
	GetVolthaInstance(context.Context, *google_protobuf.Empty) (*VolthaInstance, error)
	// Get the health state of the Voltha instance
	GetHealth(context.Context, *google_protobuf.Empty) (*voltha4.HealthStatus, error)
	// List all active adapters (plugins) in this Voltha instance
	ListAdapters(context.Context, *google_protobuf.Empty) (*voltha7.Adapters, error)
	// List all logical devices managed by this Voltha instance
	ListLogicalDevices(context.Context, *google_protobuf.Empty) (*voltha5.LogicalDevices, error)
	// Get additional information on given logical device
	GetLogicalDevice(context.Context, *voltha3.ID) (*voltha5.LogicalDevice, error)
	// List ports of a logical device
	ListLogicalDevicePorts(context.Context, *voltha3.ID) (*voltha5.LogicalPorts, error)
	// List all flows of a logical device
	ListLogicalDeviceFlows(context.Context, *voltha3.ID) (*openflow_13.Flows, error)
	// Update flow table for logical device
	UpdateLogicalDeviceFlowTable(context.Context, *openflow_13.FlowTableUpdate) (*google_protobuf.Empty, error)
	// List all flow groups of a logical device
	ListLogicalDeviceFlowGroups(context.Context, *voltha3.ID) (*openflow_13.FlowGroups, error)
	// Update group table for logical device
	UpdateLogicalDeviceFlowGroupTable(context.Context, *openflow_13.FlowGroupTableUpdate) (*google_protobuf.Empty, error)
	// List all physical devices managed by this Voltha instance
	ListDevices(context.Context, *google_protobuf.Empty) (*voltha6.Devices, error)
	// Get additional information on this device
	GetDevice(context.Context, *voltha3.ID) (*voltha6.Device, error)
	// Pre-provision a new physical device
	CreateDevice(context.Context, *voltha6.Device) (*voltha6.Device, error)
	// Enable a device.  If the device was in pre-provisioned state then it
	// will tansition to ENABLED state.  If it was is DISABLED state then it
	// will tansition to ENABLED state as well.
	EnableDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Disable a device
	DisableDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Reboot a device
	RebootDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// Delete a device
	DeleteDevice(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	// List ports of a device
	ListDevicePorts(context.Context, *voltha3.ID) (*voltha6.Ports, error)
	// List pm config of a device
	ListDevicePmConfigs(context.Context, *voltha3.ID) (*voltha6.PmConfigs, error)
	// Update the pm config of a device
	UpdateDevicePmConfigs(context.Context, *voltha6.PmConfigs) (*google_protobuf.Empty, error)
	// List all flows of a device
	ListDeviceFlows(context.Context, *voltha3.ID) (*openflow_13.Flows, error)
	// List all flow groups of a device
	ListDeviceFlowGroups(context.Context, *voltha3.ID) (*openflow_13.FlowGroups, error)
	// List device types know to Voltha instance
	ListDeviceTypes(context.Context, *google_protobuf.Empty) (*voltha6.DeviceTypes, error)
	// Get additional information on given device type
	GetDeviceType(context.Context, *voltha3.ID) (*voltha6.DeviceType, error)
	// List device sharding groups managed by this Voltha instance
	ListDeviceGroups(context.Context, *google_protobuf.Empty) (*DeviceGroups, error)
	// Get more information on given device shard
	GetDeviceGroup(context.Context, *voltha3.ID) (*DeviceGroup, error)
	// Stream control packets to the dataplane
	StreamPacketsOut(VolthaLocalService_StreamPacketsOutServer) error
	// Receive control packet stream
	ReceivePacketsIn(*google_protobuf.Empty, VolthaLocalService_ReceivePacketsInServer) error
	ReceiveChangeEvents(*google_protobuf.Empty, VolthaLocalService_ReceiveChangeEventsServer) error
	CreateAlarmFilter(context.Context, *AlarmFilter) (*AlarmFilter, error)
	GetAlarmFilter(context.Context, *voltha3.ID) (*AlarmFilter, error)
	UpdateAlarmFilter(context.Context, *AlarmFilter) (*AlarmFilter, error)
	DeleteAlarmFilter(context.Context, *voltha3.ID) (*google_protobuf.Empty, error)
	ListAlarmFilters(context.Context, *google_protobuf.Empty) (*AlarmFilters, error)
}

func RegisterVolthaLocalServiceServer(s *grpc.Server, srv VolthaLocalServiceServer) {
	s.RegisterService(&_VolthaLocalService_serviceDesc, srv)
}

func _VolthaLocalService_GetVolthaInstance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetVolthaInstance(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetVolthaInstance",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetVolthaInstance(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetHealth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetHealth(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetHealth",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetHealth(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListAdapters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListAdapters(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListAdapters",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListAdapters(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListLogicalDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListLogicalDevices(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListLogicalDevices",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListLogicalDevices(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetLogicalDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetLogicalDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetLogicalDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetLogicalDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListLogicalDevicePorts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListLogicalDevicePorts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListLogicalDevicePorts",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListLogicalDevicePorts(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListLogicalDeviceFlows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListLogicalDeviceFlows(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListLogicalDeviceFlows",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListLogicalDeviceFlows(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_UpdateLogicalDeviceFlowTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(openflow_13.FlowTableUpdate)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).UpdateLogicalDeviceFlowTable(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/UpdateLogicalDeviceFlowTable",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).UpdateLogicalDeviceFlowTable(ctx, req.(*openflow_13.FlowTableUpdate))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListLogicalDeviceFlowGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListLogicalDeviceFlowGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListLogicalDeviceFlowGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListLogicalDeviceFlowGroups(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_UpdateLogicalDeviceFlowGroupTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(openflow_13.FlowGroupTableUpdate)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).UpdateLogicalDeviceFlowGroupTable(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/UpdateLogicalDeviceFlowGroupTable",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).UpdateLogicalDeviceFlowGroupTable(ctx, req.(*openflow_13.FlowGroupTableUpdate))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDevices(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDevices",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDevices(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_CreateDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha6.Device)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).CreateDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/CreateDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).CreateDevice(ctx, req.(*voltha6.Device))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_EnableDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).EnableDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/EnableDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).EnableDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_DisableDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).DisableDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/DisableDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).DisableDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_RebootDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).RebootDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/RebootDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).RebootDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_DeleteDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).DeleteDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/DeleteDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).DeleteDevice(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDevicePorts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDevicePorts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDevicePorts",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDevicePorts(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDevicePmConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDevicePmConfigs(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDevicePmConfigs",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDevicePmConfigs(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_UpdateDevicePmConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha6.PmConfigs)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).UpdateDevicePmConfigs(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/UpdateDevicePmConfigs",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).UpdateDevicePmConfigs(ctx, req.(*voltha6.PmConfigs))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDeviceFlows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDeviceFlows(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDeviceFlows",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDeviceFlows(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDeviceFlowGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDeviceFlowGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDeviceFlowGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDeviceFlowGroups(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDeviceTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDeviceTypes(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDeviceTypes",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDeviceTypes(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetDeviceType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetDeviceType(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetDeviceType",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetDeviceType(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListDeviceGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListDeviceGroups(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListDeviceGroups",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListDeviceGroups(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetDeviceGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetDeviceGroup(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetDeviceGroup",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetDeviceGroup(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_StreamPacketsOut_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(VolthaLocalServiceServer).StreamPacketsOut(&volthaLocalServiceStreamPacketsOutServer{stream})
}

type VolthaLocalService_StreamPacketsOutServer interface {
	SendAndClose(*google_protobuf.Empty) error
	Recv() (*openflow_13.PacketOut, error)
	grpc.ServerStream
}

type volthaLocalServiceStreamPacketsOutServer struct {
	grpc.ServerStream
}

func (x *volthaLocalServiceStreamPacketsOutServer) SendAndClose(m *google_protobuf.Empty) error {
	return x.ServerStream.SendMsg(m)
}

func (x *volthaLocalServiceStreamPacketsOutServer) Recv() (*openflow_13.PacketOut, error) {
	m := new(openflow_13.PacketOut)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _VolthaLocalService_ReceivePacketsIn_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(google_protobuf.Empty)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(VolthaLocalServiceServer).ReceivePacketsIn(m, &volthaLocalServiceReceivePacketsInServer{stream})
}

type VolthaLocalService_ReceivePacketsInServer interface {
	Send(*openflow_13.PacketIn) error
	grpc.ServerStream
}

type volthaLocalServiceReceivePacketsInServer struct {
	grpc.ServerStream
}

func (x *volthaLocalServiceReceivePacketsInServer) Send(m *openflow_13.PacketIn) error {
	return x.ServerStream.SendMsg(m)
}

func _VolthaLocalService_ReceiveChangeEvents_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(google_protobuf.Empty)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(VolthaLocalServiceServer).ReceiveChangeEvents(m, &volthaLocalServiceReceiveChangeEventsServer{stream})
}

type VolthaLocalService_ReceiveChangeEventsServer interface {
	Send(*openflow_13.ChangeEvent) error
	grpc.ServerStream
}

type volthaLocalServiceReceiveChangeEventsServer struct {
	grpc.ServerStream
}

func (x *volthaLocalServiceReceiveChangeEventsServer) Send(m *openflow_13.ChangeEvent) error {
	return x.ServerStream.SendMsg(m)
}

func _VolthaLocalService_CreateAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AlarmFilter)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).CreateAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/CreateAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).CreateAlarmFilter(ctx, req.(*AlarmFilter))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_GetAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).GetAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/GetAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).GetAlarmFilter(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_UpdateAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AlarmFilter)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).UpdateAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/UpdateAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).UpdateAlarmFilter(ctx, req.(*AlarmFilter))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_DeleteAlarmFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(voltha3.ID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).DeleteAlarmFilter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/DeleteAlarmFilter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).DeleteAlarmFilter(ctx, req.(*voltha3.ID))
	}
	return interceptor(ctx, in, info, handler)
}

func _VolthaLocalService_ListAlarmFilters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(google_protobuf.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(VolthaLocalServiceServer).ListAlarmFilters(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/voltha.VolthaLocalService/ListAlarmFilters",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(VolthaLocalServiceServer).ListAlarmFilters(ctx, req.(*google_protobuf.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

var _VolthaLocalService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "voltha.VolthaLocalService",
	HandlerType: (*VolthaLocalServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetVolthaInstance",
			Handler:    _VolthaLocalService_GetVolthaInstance_Handler,
		},
		{
			MethodName: "GetHealth",
			Handler:    _VolthaLocalService_GetHealth_Handler,
		},
		{
			MethodName: "ListAdapters",
			Handler:    _VolthaLocalService_ListAdapters_Handler,
		},
		{
			MethodName: "ListLogicalDevices",
			Handler:    _VolthaLocalService_ListLogicalDevices_Handler,
		},
		{
			MethodName: "GetLogicalDevice",
			Handler:    _VolthaLocalService_GetLogicalDevice_Handler,
		},
		{
			MethodName: "ListLogicalDevicePorts",
			Handler:    _VolthaLocalService_ListLogicalDevicePorts_Handler,
		},
		{
			MethodName: "ListLogicalDeviceFlows",
			Handler:    _VolthaLocalService_ListLogicalDeviceFlows_Handler,
		},
		{
			MethodName: "UpdateLogicalDeviceFlowTable",
			Handler:    _VolthaLocalService_UpdateLogicalDeviceFlowTable_Handler,
		},
		{
			MethodName: "ListLogicalDeviceFlowGroups",
			Handler:    _VolthaLocalService_ListLogicalDeviceFlowGroups_Handler,
		},
		{
			MethodName: "UpdateLogicalDeviceFlowGroupTable",
			Handler:    _VolthaLocalService_UpdateLogicalDeviceFlowGroupTable_Handler,
		},
		{
			MethodName: "ListDevices",
			Handler:    _VolthaLocalService_ListDevices_Handler,
		},
		{
			MethodName: "GetDevice",
			Handler:    _VolthaLocalService_GetDevice_Handler,
		},
		{
			MethodName: "CreateDevice",
			Handler:    _VolthaLocalService_CreateDevice_Handler,
		},
		{
			MethodName: "EnableDevice",
			Handler:    _VolthaLocalService_EnableDevice_Handler,
		},
		{
			MethodName: "DisableDevice",
			Handler:    _VolthaLocalService_DisableDevice_Handler,
		},
		{
			MethodName: "RebootDevice",
			Handler:    _VolthaLocalService_RebootDevice_Handler,
		},
		{
			MethodName: "DeleteDevice",
			Handler:    _VolthaLocalService_DeleteDevice_Handler,
		},
		{
			MethodName: "ListDevicePorts",
			Handler:    _VolthaLocalService_ListDevicePorts_Handler,
		},
		{
			MethodName: "ListDevicePmConfigs",
			Handler:    _VolthaLocalService_ListDevicePmConfigs_Handler,
		},
		{
			MethodName: "UpdateDevicePmConfigs",
			Handler:    _VolthaLocalService_UpdateDevicePmConfigs_Handler,
		},
		{
			MethodName: "ListDeviceFlows",
			Handler:    _VolthaLocalService_ListDeviceFlows_Handler,
		},
		{
			MethodName: "ListDeviceFlowGroups",
			Handler:    _VolthaLocalService_ListDeviceFlowGroups_Handler,
		},
		{
			MethodName: "ListDeviceTypes",
			Handler:    _VolthaLocalService_ListDeviceTypes_Handler,
		},
		{
			MethodName: "GetDeviceType",
			Handler:    _VolthaLocalService_GetDeviceType_Handler,
		},
		{
			MethodName: "ListDeviceGroups",
			Handler:    _VolthaLocalService_ListDeviceGroups_Handler,
		},
		{
			MethodName: "GetDeviceGroup",
			Handler:    _VolthaLocalService_GetDeviceGroup_Handler,
		},
		{
			MethodName: "CreateAlarmFilter",
			Handler:    _VolthaLocalService_CreateAlarmFilter_Handler,
		},
		{
			MethodName: "GetAlarmFilter",
			Handler:    _VolthaLocalService_GetAlarmFilter_Handler,
		},
		{
			MethodName: "UpdateAlarmFilter",
			Handler:    _VolthaLocalService_UpdateAlarmFilter_Handler,
		},
		{
			MethodName: "DeleteAlarmFilter",
			Handler:    _VolthaLocalService_DeleteAlarmFilter_Handler,
		},
		{
			MethodName: "ListAlarmFilters",
			Handler:    _VolthaLocalService_ListAlarmFilters_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamPacketsOut",
			Handler:       _VolthaLocalService_StreamPacketsOut_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "ReceivePacketsIn",
			Handler:       _VolthaLocalService_ReceivePacketsIn_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ReceiveChangeEvents",
			Handler:       _VolthaLocalService_ReceiveChangeEvents_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "voltha.proto",
}

func init() { proto.RegisterFile("voltha.proto", fileDescriptor0) }

var fileDescriptor0 = []byte{
	// 2029 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4b, 0x73, 0x1b, 0x59,
	0x15, 0x4e, 0xfb, 0xad, 0x23, 0xc9, 0x92, 0xae, 0x5f, 0xb2, 0x6c, 0x4f, 0xec, 0x9b, 0x49, 0xc6,
	0xf1, 0x94, 0xa5, 0xc4, 0x66, 0x42, 0x4d, 0x18, 0x8a, 0xc1, 0x8f, 0x24, 0x26, 0x2e, 0xa2, 0x52,
	0x32, 0x33, 0x40, 0x48, 0xa9, 0xda, 0xd2, 0x8d, 0xdc, 0x4c, 0xab, 0x5b, 0xd5, 0xdd, 0xd2, 0x8c,
	0x6a, 0x60, 0xc1, 0xb0, 0x82, 0x25, 0xd9, 0xc0, 0x9e, 0x0d, 0x6c, 0xf8, 0x25, 0x59, 0x50, 0xfc,
	0x03, 0x8a, 0x05, 0xbf, 0x60, 0x60, 0x49, 0xdd, 0x97, 0xd4, 0x8f, 0xdb, 0x7a, 0xd9, 0xb3, 0x98,
	0x5d, 0xf7, 0x7d, 0x7c, 0xdf, 0x39, 0xa7, 0xcf, 0x39, 0xf7, 0x7e, 0x0d, 0xa9, 0x8e, 0x6d, 0x7a,
	0x97, 0x7a, 0xb1, 0xe5, 0xd8, 0x9e, 0x8d, 0xe6, 0xf8, 0x5b, 0x61, 0xa3, 0x61, 0xdb, 0x0d, 0x93,
	0x94, 0xd8, 0xe8, 0x45, 0xfb, 0x75, 0x89, 0x34, 0x5b, 0x5e, 0x97, 0x2f, 0x2a, 0xac, 0x87, 0x27,
	0x75, 0x4b, 0x4e, 0x6d, 0x8a, 0x29, 0xbd, 0x65, 0x94, 0x74, 0xcb, 0xb2, 0x3d, 0xdd, 0x33, 0x6c,
	0xcb, 0x15, 0xb3, 0xa8, 0xab, 0x5b, 0x8d, 0xaa, 0xdd, 0xf2, 0x8f, 0x41, 0x93, 0x78, 0x82, 0xbd,
	0x90, 0xaa, 0xd9, 0xcd, 0xa6, 0x6d, 0xc9, 0xb7, 0x4b, 0xa2, 0x9b, 0xde, 0xa5, 0x78, 0x5b, 0x36,
	0xed, 0x86, 0x51, 0xd3, 0xcd, 0x6a, 0x9d, 0x74, 0x8c, 0x1a, 0x91, 0x6b, 0x02, 0x6f, 0x69, 0xbd,
	0xae, 0xb7, 0x3c, 0xe2, 0x88, 0xd7, 0x9c, 0xdd, 0x22, 0xd6, 0x6b, 0xd3, 0xfe, 0xa2, 0x7a, 0xff,
	0x90, 0x0f, 0xe1, 0xbf, 0x68, 0x90, 0x3c, 0x61, 0x5b, 0x1e, 0x3b, 0x76, 0xbb, 0x85, 0x56, 0x60,
	0xca, 0xa8, 0xe7, 0xb5, 0x6d, 0x6d, 0x37, 0x71, 0x34, 0xfb, 0x9f, 0x6f, 0xde, 0x6e, 0x69, 0x95,
	0x29, 0xa3, 0x8e, 0xce, 0x20, 0x13, 0xa4, 0x73, 0xf3, 0x53, 0xdb, 0xd3, 0xbb, 0xc9, 0x83, 0x95,
	0xa2, 0x08, 0xd7, 0x39, 0x9f, 0xe6, 0x58, 0x47, 0x89, 0x7f, 0x7d, 0xf3, 0x76, 0x6b, 0x86, 0x62,
	0x55, 0x16, 0x4d, 0xff, 0x8c, 0x8b, 0x0e, 0x61, 0x5e, 0x42, 0x4c, 0x33, 0x88, 0x45, 0x09, 0x11,
	0xdd, 0x2b, 0x57, 0xe2, 0x0f, 0x21, 0xe5, 0xb3, 0xd2, 0x45, 0x77, 0x61, 0xd6, 0xf0, 0x48, 0xd3,
	0xcd, 0x6b, 0x0c, 0x62, 0x29, 0x08, 0xc1, 0x16, 0x55, 0xf8, 0x0a, 0xfc, 0x25, 0xa0, 0x1f, 0x9b,
	0xba, 0xd3, 0x7c, 0x64, 0x98, 0x1e, 0x71, 0x2a, 0x6d, 0x93, 0x3c, 0x25, 0x5d, 0x7c, 0xa1, 0x1a,
	0x45, 0x73, 0x94, 0x35, 0x7b, 0x03, 0x2d, 0xc0, 0x8c, 0xd7, 0x6d, 0x91, 0xac, 0x86, 0x52, 0xb0,
	0xe0, 0x92, 0x0e, 0x71, 0x0c, 0xaf, 0x9b, 0x9d, 0x42, 0x19, 0x48, 0x3a, 0xc4, 0xb5, 0xdb, 0x4e,
	0x8d, 0x54, 0x8d, 0x7a, 0x76, 0x9a, 0x4e, 0xd7, 0x74, 0x8f, 0x34, 0x6c, 0xa7, 0x9b, 0x9d, 0x41,
	0x69, 0x48, 0x70, 0x83, 0xe9, 0xe4, 0x2c, 0xbe, 0x84, 0x4c, 0x88, 0x03, 0xfd, 0x08, 0xa6, 0x3f,
	0x27, 0x5d, 0x16, 0xdf, 0xc5, 0x83, 0x7d, 0x69, 0x75, 0xd4, 0x12, 0xc5, 0x50, 0x85, 0xee, 0x44,
	0xcb, 0x30, 0xdb, 0xd1, 0xcd, 0x36, 0xc9, 0x4f, 0xd1, 0x4f, 0x54, 0xe1, 0x2f, 0xf8, 0x39, 0x24,
	0x7d, 0x1b, 0xe2, 0x3e, 0xe2, 0x3e, 0xcc, 0x3a, 0x6d, 0xb3, 0xf7, 0xe9, 0xd6, 0x62, 0xe8, 0x2b,
	0x7c, 0x15, 0xfe, 0x21, 0xa4, 0x7c, 0x33, 0x2e, 0xda, 0x87, 0xf9, 0xd7, 0xfc, 0x31, 0x1c, 0x75,
	0x3f, 0x80, 0x5c, 0x83, 0xff, 0x31, 0x03, 0x8b, 0x9f, 0xb2, 0xf9, 0x33, 0xcb, 0xf5, 0x74, 0xab,
	0x46, 0xd0, 0x1d, 0x48, 0x1a, 0xe2, 0xb9, 0x1a, 0x36, 0x10, 0xe4, 0xcc, 0x59, 0x1d, 0xdd, 0x84,
	0xf9, 0x0e, 0x71, 0x5c, 0xc3, 0xb6, 0xb8, 0x9b, 0x72, 0x8d, 0x1c, 0x45, 0x0f, 0x20, 0x61, 0xda,
	0x8d, 0xaa, 0x49, 0x3a, 0xc4, 0xcc, 0x4f, 0xb3, 0x60, 0xae, 0xfb, 0x12, 0xf1, 0x9c, 0x8e, 0xf7,
	0x1e, 0x2a, 0x0b, 0xa6, 0x78, 0x42, 0x87, 0x30, 0xc7, 0x6b, 0x28, 0x0f, 0xdb, 0xda, 0x6e, 0xf2,
	0x60, 0x59, 0x6e, 0x7a, 0xc2, 0x46, 0x9f, 0x7b, 0xba, 0xd7, 0x76, 0x8f, 0x66, 0x69, 0x02, 0xde,
	0xa8, 0x88, 0xa5, 0xe8, 0x01, 0x2c, 0x88, 0x32, 0x72, 0xf3, 0x49, 0xe6, 0x78, 0xa6, 0xe7, 0x38,
	0x1f, 0xf7, 0xa7, 0x6c, 0x6f, 0xad, 0xaa, 0x66, 0x52, 0x57, 0xaf, 0x99, 0xf4, 0xa8, 0x35, 0x83,
	0x3e, 0x06, 0xd1, 0x0c, 0xaa, 0x34, 0x97, 0xdd, 0xfc, 0x22, 0xdb, 0x89, 0x82, 0x3b, 0x5f, 0x74,
	0x5b, 0x81, 0xdd, 0xc9, 0x7a, 0x6f, 0xd8, 0x45, 0xc7, 0x90, 0x16, 0x08, 0x0d, 0x56, 0x76, 0xf9,
	0x4c, 0x6c, 0xb5, 0xf9, 0x31, 0x04, 0xad, 0x28, 0xd5, 0x63, 0x48, 0xeb, 0x34, 0x3f, 0xaa, 0x32,
	0x79, 0xb2, 0xb1, 0xc9, 0x13, 0x00, 0xd1, 0x7d, 0xb9, 0xf7, 0x70, 0xf6, 0x7f, 0x34, 0x01, 0x70,
	0x11, 0x32, 0xc1, 0x94, 0x72, 0x69, 0x41, 0xf4, 0x3b, 0x41, 0x42, 0x14, 0xbd, 0x5c, 0xff, 0xf7,
	0x69, 0x98, 0xe3, 0x1b, 0xfc, 0x39, 0xa5, 0x0d, 0xcf, 0xa9, 0xa9, 0xd1, 0x73, 0xea, 0x09, 0x24,
	0x64, 0xea, 0xca, 0x8e, 0xb6, 0x2a, 0xf7, 0x05, 0x8d, 0x3d, 0x42, 0xd4, 0xbd, 0x74, 0xa0, 0x08,
	0x2a, 0xfd, 0xcd, 0xdf, 0xd9, 0x44, 0xbb, 0x8e, 0x34, 0x11, 0x5f, 0xec, 0xe0, 0xcd, 0x3a, 0x2c,
	0xf1, 0xa8, 0x3d, 0x36, 0xed, 0x0b, 0xdd, 0x7c, 0x4e, 0x1c, 0xba, 0x08, 0x9d, 0x40, 0xe2, 0x31,
	0xf1, 0xc4, 0xb7, 0x5c, 0x2d, 0xf2, 0x53, 0xb5, 0x28, 0x0f, 0xdc, 0xe2, 0x29, 0x3d, 0x8d, 0x0b,
	0x8b, 0xc1, 0xb8, 0xe3, 0xcc, 0xd7, 0xff, 0xfc, 0xf7, 0x9b, 0xa9, 0x04, 0x9a, 0x67, 0xc7, 0x6f,
	0xe7, 0x3e, 0xea, 0xc2, 0xd2, 0xb9, 0xe1, 0x7a, 0xe1, 0x1c, 0x8a, 0xc3, 0x5b, 0x53, 0x7f, 0x47,
	0x17, 0xdf, 0xff, 0xc3, 0x7f, 0xdf, 0x6e, 0xcd, 0x8b, 0xcc, 0x63, 0xcf, 0x88, 0x3f, 0x33, 0xc2,
	0x25, 0x94, 0x13, 0x84, 0xa5, 0xfe, 0xc7, 0xfd, 0x0c, 0x72, 0x3d, 0x07, 0x7a, 0x0d, 0x11, 0x24,
	0xc1, 0xd9, 0x49, 0x21, 0x26, 0x69, 0xf0, 0x3b, 0x0c, 0x33, 0x8f, 0x56, 0x23, 0x98, 0xa5, 0xaf,
	0x8c, 0xfa, 0x6f, 0xd0, 0x57, 0x80, 0xa8, 0x4f, 0xe7, 0xc1, 0x0f, 0x19, 0xe7, 0xd2, 0xaa, 0x32,
	0x25, 0x5c, 0xfc, 0x01, 0xf5, 0x22, 0x17, 0x49, 0x24, 0xc6, 0xbd, 0x8e, 0xd6, 0x24, 0x77, 0x68,
	0x1a, 0xbd, 0x84, 0xec, 0x63, 0x12, 0xe4, 0x0e, 0x38, 0xa5, 0xce, 0x40, 0xfc, 0x2e, 0xc3, 0x7d,
	0x07, 0x6d, 0xc6, 0xe0, 0x72, 0xcf, 0x1c, 0x58, 0x8d, 0x78, 0x56, 0xb6, 0x1d, 0xcf, 0x0d, 0x50,
	0x2c, 0x87, 0x28, 0xd8, 0x0a, 0xfc, 0x40, 0x7c, 0xa1, 0x16, 0x7d, 0x63, 0x6c, 0xef, 0x22, 0x3c,
	0x88, 0xad, 0xc4, 0x56, 0xa2, 0x5f, 0x2b, 0x38, 0x1f, 0x99, 0xf6, 0x17, 0x41, 0x4e, 0x54, 0xf4,
	0xdf, 0xa4, 0xd8, 0x3c, 0x3e, 0x12, 0x8c, 0x74, 0x34, 0x9a, 0x13, 0xc3, 0xd8, 0xd9, 0x2e, 0xf4,
	0x3b, 0x0d, 0x36, 0x3f, 0x69, 0xd5, 0x75, 0x8f, 0x44, 0x0c, 0x78, 0xa1, 0x5f, 0x98, 0x04, 0x6d,
	0x46, 0x88, 0xd9, 0x38, 0xdf, 0x53, 0x88, 0xf9, 0xe8, 0x78, 0x9f, 0x99, 0xf0, 0x1e, 0x1e, 0xc1,
	0x84, 0x87, 0xda, 0x1e, 0xfa, 0xa3, 0x06, 0x1b, 0xca, 0x20, 0x88, 0x8e, 0xee, 0x8f, 0xc4, 0x5a,
	0xc4, 0x20, 0xbe, 0x08, 0xff, 0x94, 0x86, 0x20, 0x0d, 0x49, 0x36, 0xc5, 0xfb, 0x42, 0x24, 0x28,
	0x7b, 0x68, 0x77, 0xa8, 0x45, 0x62, 0x2f, 0x7a, 0xa3, 0xc1, 0x4e, 0x4c, 0x68, 0x18, 0x23, 0x8f,
	0xcf, 0x8e, 0xda, 0x9c, 0x51, 0x82, 0x74, 0xc8, 0x4c, 0xda, 0xc7, 0x23, 0x9b, 0x44, 0x43, 0xf5,
	0x0a, 0x92, 0x34, 0x52, 0xc3, 0xaa, 0x2e, 0x13, 0x6c, 0x85, 0x2e, 0xbe, 0x4d, 0x63, 0x91, 0xe8,
	0x35, 0x5b, 0x46, 0x9d, 0x43, 0x19, 0x49, 0x2d, 0xcb, 0xeb, 0x94, 0x75, 0x3d, 0x45, 0x5d, 0x85,
	0xda, 0x32, 0xde, 0x64, 0x08, 0xab, 0x68, 0x39, 0x84, 0xc0, 0x0b, 0xe9, 0x27, 0x90, 0x3a, 0x76,
	0x88, 0xee, 0x11, 0x81, 0x14, 0xda, 0x1d, 0x41, 0x2b, 0x30, 0xb4, 0x65, 0x1c, 0xb6, 0x87, 0x7a,
	0xfc, 0x19, 0xa4, 0x4e, 0x2d, 0x1a, 0x4e, 0x85, 0x55, 0x71, 0xa1, 0xbd, 0xc5, 0xf0, 0xb6, 0xf0,
	0x86, 0xca, 0xba, 0x12, 0x61, 0x70, 0xe8, 0xe7, 0x90, 0x3e, 0x31, 0xdc, 0x31, 0x91, 0x45, 0x23,
	0xc1, 0x9b, 0x4a, 0xe4, 0x3a, 0xc7, 0xa3, 0x36, 0x57, 0xc8, 0x85, 0x6d, 0x7b, 0xd7, 0x66, 0xb3,
	0xc3, 0xe0, 0x28, 0xf0, 0x09, 0x31, 0x89, 0x37, 0x41, 0x30, 0xf6, 0xd4, 0xc0, 0x75, 0x06, 0x87,
	0x7e, 0x09, 0x99, 0x7e, 0x5e, 0x45, 0x7b, 0x5e, 0x5a, 0x3e, 0xf3, 0x66, 0x57, 0x8c, 0x34, 0xbb,
	0x4d, 0x54, 0x50, 0xc2, 0xf3, 0x26, 0xf7, 0x8a, 0x1f, 0x83, 0x02, 0xbd, 0x79, 0x6c, 0x5b, 0xaf,
	0x8d, 0x46, 0x90, 0x21, 0xd7, 0x63, 0x90, 0xd3, 0xf8, 0x3d, 0x86, 0xbc, 0x83, 0x6e, 0xaa, 0x91,
	0x9b, 0xd5, 0x9a, 0xc0, 0xb1, 0x60, 0x85, 0xd7, 0x5a, 0x98, 0x20, 0x0a, 0x1a, 0x1b, 0xa5, 0x3d,
	0xde, 0x35, 0xf1, 0x30, 0x32, 0x9a, 0x92, 0x4d, 0x7f, 0xb0, 0x46, 0x6b, 0xd6, 0x0f, 0x07, 0x36,
	0xeb, 0xb8, 0xe8, 0xf5, 0x9a, 0xf4, 0x72, 0x90, 0x6f, 0x9c, 0xbe, 0xf8, 0x68, 0x84, 0xbe, 0x88,
	0xd1, 0x76, 0x2c, 0xbf, 0xec, 0x87, 0xb6, 0xdf, 0x69, 0x7e, 0x5d, 0x8f, 0xeb, 0x3e, 0x4b, 0xd1,
	0x2b, 0xbf, 0x8b, 0x4b, 0x94, 0x75, 0x31, 0x28, 0x11, 0xd4, 0x4d, 0x84, 0xcf, 0xa1, 0x0a, 0xa4,
	0x7b, 0xbd, 0x88, 0x42, 0x84, 0x62, 0x1c, 0xa1, 0xc0, 0x3b, 0x0c, 0x6e, 0x03, 0xad, 0xab, 0xe0,
	0x78, 0x63, 0x72, 0x21, 0xdb, 0x77, 0x42, 0x44, 0x31, 0xce, 0x8b, 0x65, 0xc5, 0x75, 0x52, 0xdc,
	0xc4, 0x32, 0xa1, 0x0b, 0x28, 0x23, 0x5e, 0x43, 0x2b, 0x21, 0x62, 0x11, 0xb9, 0x4f, 0x60, 0xb1,
	0xe7, 0x08, 0xff, 0xe9, 0xe1, 0xf7, 0x44, 0x75, 0x6b, 0xc5, 0x58, 0x9d, 0x16, 0x02, 0x91, 0xfb,
	0x52, 0x85, 0x1c, 0x6f, 0xb2, 0x7e, 0x25, 0xae, 0x52, 0x39, 0x05, 0xd5, 0x20, 0xde, 0x66, 0x14,
	0x05, 0xdc, 0x33, 0x3a, 0x20, 0x9a, 0x68, 0x9a, 0x73, 0xbb, 0xfd, 0xe8, 0x4a, 0xbb, 0xfd, 0xa0,
	0x11, 0xbb, 0x03, 0xa0, 0xdc, 0xee, 0x3a, 0xe4, 0x78, 0xb5, 0x4e, 0x66, 0xf7, 0x6d, 0x46, 0x71,
	0xb3, 0x30, 0x80, 0x82, 0x1a, 0xff, 0x12, 0x72, 0xbc, 0x53, 0xc6, 0xd9, 0x1f, 0xd7, 0x08, 0x84,
	0x0b, 0x7b, 0x83, 0x5c, 0xa8, 0xf2, 0x34, 0x0a, 0xfc, 0xad, 0x18, 0x9a, 0x46, 0xfe, 0xd5, 0x78,
	0x2b, 0x9c, 0x32, 0x01, 0x96, 0x83, 0xbf, 0x6e, 0x02, 0xe2, 0xd7, 0xf2, 0x73, 0xbb, 0xd6, 0x17,
	0x25, 0xbf, 0x50, 0xdd, 0xe9, 0x87, 0xde, 0xbc, 0x43, 0xf7, 0xfb, 0x15, 0x46, 0x9d, 0x41, 0xe9,
	0xfe, 0xbd, 0xa3, 0xa6, 0x9b, 0xa8, 0xce, 0x8e, 0x7e, 0xfe, 0x5f, 0x62, 0xb8, 0x33, 0xfe, 0xff,
	0x17, 0xf8, 0x2e, 0xad, 0x89, 0x05, 0xf9, 0xab, 0x23, 0x5c, 0xd4, 0x0c, 0xbe, 0x24, 0xfe, 0x6d,
	0x34, 0x20, 0xc5, 0x22, 0x27, 0xa5, 0x64, 0x1c, 0x51, 0x36, 0x24, 0x44, 0x5d, 0xbc, 0x4f, 0x49,
	0xa0, 0xaf, 0x58, 0xc3, 0x2a, 0x85, 0xd3, 0xf4, 0x34, 0xea, 0x6f, 0xb5, 0x6b, 0x91, 0x29, 0x3f,
	0x18, 0x20, 0x53, 0x6e, 0xa2, 0xad, 0x20, 0x79, 0x58, 0xac, 0xe8, 0x93, 0x89, 0x95, 0xbd, 0xe8,
	0x05, 0x5e, 0x81, 0xce, 0x33, 0xf1, 0xcb, 0x2b, 0x48, 0x96, 0x8f, 0x22, 0xa7, 0x78, 0xe0, 0x7e,
	0x1c, 0xc7, 0x29, 0xce, 0xf4, 0xaf, 0xb5, 0x89, 0x95, 0xcb, 0x93, 0x81, 0x87, 0xe1, 0x68, 0x46,
	0xf0, 0xa3, 0xf1, 0xf7, 0xdf, 0x8e, 0x7e, 0x51, 0x5c, 0xcd, 0x07, 0x1b, 0x42, 0x3b, 0xce, 0x9f,
	0xae, 0x43, 0xc5, 0xbc, 0x18, 0xe1, 0xb4, 0xbe, 0x87, 0x8a, 0x23, 0xda, 0x25, 0x4f, 0xa0, 0x3f,
	0x7f, 0xdb, 0x5a, 0xe6, 0x43, 0x66, 0xd8, 0x21, 0x1e, 0xd3, 0x30, 0x1a, 0xb6, 0xda, 0x84, 0x8a,
	0xe6, 0x7d, 0x85, 0xa2, 0xf1, 0xf5, 0x53, 0x6e, 0x80, 0xac, 0xc4, 0xa7, 0xa3, 0xea, 0x9a, 0xc8,
	0x01, 0x16, 0xc0, 0xe1, 0x35, 0x57, 0x1e, 0x53, 0xdd, 0x44, 0x4e, 0xda, 0x00, 0x26, 0x57, 0x75,
	0xe3, 0x6b, 0x9c, 0xbb, 0x0c, 0xf5, 0x16, 0xde, 0x89, 0xb7, 0x54, 0x2a, 0x9d, 0xea, 0x24, 0x4a,
	0x47, 0x5e, 0x88, 0xf1, 0x00, 0x7c, 0xa9, 0x77, 0x5e, 0x4d, 0xa0, 0x77, 0x46, 0xb1, 0x5f, 0xa8,
	0x9e, 0x57, 0x13, 0xa8, 0x1e, 0x01, 0xbf, 0x37, 0x08, 0x5e, 0x68, 0x9f, 0x8b, 0xb1, 0xb4, 0xcf,
	0xf7, 0x22, 0x5d, 0xd3, 0x77, 0x7b, 0x56, 0x90, 0xf0, 0x6e, 0x59, 0x9b, 0x48, 0x01, 0x89, 0xff,
	0x28, 0xe8, 0xf6, 0x20, 0xfc, 0xbe, 0x0e, 0xf2, 0xae, 0x41, 0x07, 0xdd, 0xe3, 0x3d, 0x18, 0x8f,
	0x46, 0x49, 0x93, 0xd7, 0x1d, 0x5f, 0x0d, 0x7d, 0x3c, 0xf0, 0x00, 0x18, 0x1c, 0xcf, 0x5e, 0xe3,
	0xbf, 0x82, 0x26, 0x3a, 0x1f, 0xa1, 0xcb, 0xee, 0xa2, 0x3b, 0x43, 0xac, 0x90, 0xdd, 0xb5, 0x7d,
	0x45, 0x65, 0xf4, 0x41, 0x9c, 0x32, 0x8a, 0x69, 0x43, 0x42, 0x1f, 0xfd, 0x6c, 0x5c, 0x7d, 0x14,
	0xd1, 0xd3, 0x51, 0x50, 0xde, 0xe0, 0xba, 0x57, 0x56, 0x49, 0xdf, 0x8f, 0x55, 0x49, 0x5b, 0x68,
	0x43, 0x49, 0x2f, 0x62, 0xf9, 0x72, 0x7c, 0xad, 0xb4, 0x3b, 0x28, 0x69, 0x02, 0x8a, 0xe9, 0x11,
	0x64, 0x9f, 0x7b, 0x0e, 0xd1, 0x9b, 0x65, 0xbd, 0xf6, 0x39, 0xf1, 0xdc, 0x67, 0x6d, 0x0f, 0xad,
	0x06, 0x72, 0x84, 0x4f, 0x3c, 0x6b, 0x7b, 0xb1, 0xf5, 0x71, 0x63, 0x57, 0x43, 0xa7, 0x90, 0xad,
	0x90, 0x1a, 0x31, 0x3a, 0x44, 0x00, 0x9d, 0x59, 0xb1, 0xf1, 0x59, 0x51, 0xe0, 0x9f, 0x59, 0xf8,
	0xc6, 0x3d, 0x0d, 0x3d, 0x85, 0x25, 0x01, 0x73, 0x7c, 0xa9, 0x5b, 0x0d, 0x72, 0xda, 0x21, 0x96,
	0x17, 0x1f, 0xe9, 0x7c, 0x00, 0xc9, 0xb7, 0x85, 0x81, 0x91, 0xab, 0xa9, 0xc1, 0x3b, 0x2c, 0x88,
	0xdb, 0x38, 0xf4, 0x71, 0x22, 0x9a, 0xf0, 0xe5, 0xf8, 0x9a, 0x30, 0xe6, 0xfb, 0x28, 0x64, 0xd5,
	0xaf, 0xae, 0xa6, 0x0c, 0xdf, 0x67, 0x44, 0xb7, 0x0b, 0x43, 0x89, 0xa8, 0x23, 0xfa, 0xa4, 0xfa,
	0x50, 0xb8, 0xb3, 0x37, 0xdc, 0x1d, 0x72, 0x65, 0x95, 0x78, 0x4b, 0x5d, 0x32, 0x01, 0xae, 0xa3,
	0x8f, 0x60, 0xc9, 0x76, 0x1a, 0x2c, 0x39, 0x6a, 0xb6, 0x53, 0x17, 0x40, 0x47, 0x29, 0x2e, 0xfb,
	0xca, 0x94, 0xc7, 0xfd, 0xdb, 0xd4, 0xea, 0x33, 0x39, 0xff, 0xa9, 0x5f, 0x15, 0x96, 0x67, 0xca,
	0xb3, 0xe5, 0xb9, 0xf2, 0x7c, 0x79, 0xa1, 0x9c, 0x28, 0xc3, 0xc5, 0x1c, 0x33, 0xeb, 0xf0, 0xff,
	0x01, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x33, 0xad, 0xd7, 0x94, 0x22, 0x00, 0x00,
}
