/*
 * Copyright (c) 2018 - present.  Boling Consulting Solutions (bcsw.net)
 * Copyright 2020-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.
 */
/*
 * NOTE: This file was generated, manual edits will be overwritten!
 *
 * Generated by 'goCodeGenerator.py':
 *              https://github.com/cboling/OMCI-parser/README.md
 */

package generated

import "github.com/deckarep/golang-set"

// PseudowireMaintenanceProfileClassID is the 16-bit ID for the OMCI
// Managed entity Pseudowire maintenance profile
const PseudowireMaintenanceProfileClassID = ClassID(284) // 0x011c

var pseudowiremaintenanceprofileBME *ManagedEntityDefinition

// PseudowireMaintenanceProfile (Class ID: #284 / 0x011c)
//	The pseudowire maintenance profile permits the configuration of pseudowire service exception
//	handling. It is created and deleted by the OLT.
//
//	The settings, and indeed existence, of a pseudowire maintenance profile affect the behaviour of
//	the pseudowire PM history data ME only in establishing criteria for counting SESs, but in no
//	other way. The pseudowire maintenance profile primarily affects the alarms declared by the
//	subscribing pseudowire TP.
//
//	Relationships
//		One or more instances of the pseudowire TP may point to an instance of the pseudowire
//		maintenance profile. If the pseudowire TP does not refer to a pseudowire maintenance profile,
//		the ONU's default exception handling is implied.
//
//	Attributes
//		Managed Entity Id
//			This attribute uniquely identifies each instance of this ME. The value 0 is reserved. (R,
//			setbycreate) (mandatory) (2-bytes)
//
//		Jitter Buffer Maximum Depth
//			This attribute specifies the desired maximum depth of the playout buffer in the PSN to the TDM
//			direction. The value is expressed as a multiple of the 125-vs frame rate. The default value 0
//			selects the ONU's internal policy. (R,-W, setbycreate) (optional) (2-bytes)
//
//		Jitter Buffer Desired Depth
//			This attribute specifies the desired nominal fill depth of the playout buffer in the PSN to the
//			TDM direction. The value is expressed as a multiple of the 125-vs frame rate. The default value
//			0 selects the ONU's internal policy. (R,-W, setbycreate) (optional) (2-bytes)
//
//		Fill Policy
//			This attribute defines the payload bit pattern to be applied towards the TDM service if no
//			payload packet is available to play out. The default value 0 specifies that the ONU apply its
//			internal policy.
//
//			0	ONU default, vendor-specific (recommended: AIS for unstructured service, all 1s for structured
//			service)
//
//			1	Play out AIS according to the service definition (for example, DS3 AIS)
//
//			2	Play out all 1s
//
//			3	Play out all 0s
//
//			4	Repeat the previous data
//
//			5	Play out DS1 idle (Appendix C of [b-ATIS-0600403])
//
//			6..15	Reserved for future standardization
//
//			16..255	Vendor-specific, not to be standardized
//
//			(R,-W, setbycreate) (optional) (1-byte)
//
//			Four pairs of alarm-related policy attributes, defined in the following, share common behaviour.
//
//			The alarm declaration policy attribute defines the anomaly rate that causes the corresponding
//			alarm to be declared. It is an integer percentage between 1..100. If this density of anomalies
//			occurs during the alarm onset soak interval, the alarm is declared. The default value 0 selects
//			the ONU's internal policy.
//
//			The alarm clear policy attribute defines the anomaly rate that causes the corresponding alarm to
//			be cleared. It is an integer percentage between 0..99. If no more than this density of anomalies
//			occurs during the alarm clear soak interval, the alarm is cleared. The default value 255 selects
//			the ONU's internal policy.
//
//		Misconnected Packets Declaration Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Misconnected Packets Clear Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Loss Of Packets Declaration Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Loss Of Packets Clear Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Buffer Overrun_Underrun Declaration Policy
//			Buffer overrun/underrun declaration policy: (R,-W, setbycreate) (optional) (1-byte)
//
//		Buffer Overrun_Underrun Clear Policy
//			Buffer overrun/underrun clear policy: (R,-W, setbycreate) (optional) (1-byte)
//
//		Malformed Packets Declaration Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Malformed Packets Clear Policy
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		R_Bit Transmit Set Policy
//			R-bit transmit set policy: This attribute defines the number of consecutive lost packets that
//			causes the transmitted R bit to be set in the TDM to the PSN direction, indicating lost packets
//			to the far end. The default value 0 selects the ONU's internal policy. (R,-W, setbycreate)
//			(optional) (1-byte)
//
//		R_Bit Transmit Clear Policy
//			R-bit transmit clear policy: This attribute defines the number of consecutive valid packets that
//			causes the transmitted R bit to be cleared in the TDM to the PSN direction, removing the remote
//			failure indication to the far end. The default value 0 selects the ONU's internal policy. (R,-W,
//			setbycreate) (optional) (1-byte)
//
//		R_Bit Receive Policy
//			R-bit receive policy: This attribute defines the action towards the N-*-64 TDM interface when
//			remote failure is indicated on packets received from the PSN (either Rbit set or M-=-0b10 while
//			the L bit is cleared).
//
//			0	Do nothing (recommended to be the default)
//
//			1	Play out service-specific RAI/REI/RDI code
//
//			2	Send channel idle signalling and idle channel payload to all DS0s comprising the service
//
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		L Bit Receive Policy
//			This attribute defines the action towards the TDM interface when farend TDM failure is indicated
//			on packets received from the PSN (L bit set).
//
//			0	Play out service-specific AIS (recommended to be the default)
//
//			1	Repeat last received packet
//
//			2	Send channel idle signalling and idle channel payload to all DS0s comprising the service
//
//			(R,-W, setbycreate) (optional) (1-byte)
//
//		Ses Threshold
//			Number of lost, malformed or otherwise unusable packets expected in the PSN to the TDM direction
//			within a 1-s interval that causes an SES to be counted. Stray packets do not count towards an
//			SES, nor do packets whose L bit is set at the far end. The value 0 specifies that the ONU uses
//			its internal default, which is not necessarily the same as the recommended default value 3. (R,
//			W, set-by-create) (optional) (2 bytes)
//
type PseudowireMaintenanceProfile struct {
	ManagedEntityDefinition
	Attributes AttributeValueMap
}

// Attribute name constants

const PseudowireMaintenanceProfile_JitterBufferMaximumDepth = "JitterBufferMaximumDepth"
const PseudowireMaintenanceProfile_JitterBufferDesiredDepth = "JitterBufferDesiredDepth"
const PseudowireMaintenanceProfile_FillPolicy = "FillPolicy"
const PseudowireMaintenanceProfile_MisconnectedPacketsDeclarationPolicy = "MisconnectedPacketsDeclarationPolicy"
const PseudowireMaintenanceProfile_MisconnectedPacketsClearPolicy = "MisconnectedPacketsClearPolicy"
const PseudowireMaintenanceProfile_LossOfPacketsDeclarationPolicy = "LossOfPacketsDeclarationPolicy"
const PseudowireMaintenanceProfile_LossOfPacketsClearPolicy = "LossOfPacketsClearPolicy"
const PseudowireMaintenanceProfile_BufferOverrunUnderrunDeclarationPolicy = "BufferOverrunUnderrunDeclarationPolicy"
const PseudowireMaintenanceProfile_BufferOverrunUnderrunClearPolicy = "BufferOverrunUnderrunClearPolicy"
const PseudowireMaintenanceProfile_MalformedPacketsDeclarationPolicy = "MalformedPacketsDeclarationPolicy"
const PseudowireMaintenanceProfile_MalformedPacketsClearPolicy = "MalformedPacketsClearPolicy"
const PseudowireMaintenanceProfile_RBitTransmitSetPolicy = "RBitTransmitSetPolicy"
const PseudowireMaintenanceProfile_RBitTransmitClearPolicy = "RBitTransmitClearPolicy"
const PseudowireMaintenanceProfile_RBitReceivePolicy = "RBitReceivePolicy"
const PseudowireMaintenanceProfile_LBitReceivePolicy = "LBitReceivePolicy"
const PseudowireMaintenanceProfile_SesThreshold = "SesThreshold"

func init() {
	pseudowiremaintenanceprofileBME = &ManagedEntityDefinition{
		Name:    "PseudowireMaintenanceProfile",
		ClassID: PseudowireMaintenanceProfileClassID,
		MessageTypes: mapset.NewSetWith(
			Create,
			Delete,
			Get,
			Set,
		),
		AllowedAttributeMask: 0xffff,
		AttributeDefinitions: AttributeDefinitionMap{
			0:  Uint16Field(ManagedEntityID, PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read, SetByCreate), false, false, false, 0),
			1:  Uint16Field(PseudowireMaintenanceProfile_JitterBufferMaximumDepth, UnsignedIntegerAttributeType, 0x8000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 1),
			2:  Uint16Field(PseudowireMaintenanceProfile_JitterBufferDesiredDepth, UnsignedIntegerAttributeType, 0x4000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 2),
			3:  ByteField(PseudowireMaintenanceProfile_FillPolicy, UnsignedIntegerAttributeType, 0x2000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 3),
			4:  ByteField(PseudowireMaintenanceProfile_MisconnectedPacketsDeclarationPolicy, UnsignedIntegerAttributeType, 0x1000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 4),
			5:  ByteField(PseudowireMaintenanceProfile_MisconnectedPacketsClearPolicy, UnsignedIntegerAttributeType, 0x0800, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 5),
			6:  ByteField(PseudowireMaintenanceProfile_LossOfPacketsDeclarationPolicy, UnsignedIntegerAttributeType, 0x0400, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 6),
			7:  ByteField(PseudowireMaintenanceProfile_LossOfPacketsClearPolicy, UnsignedIntegerAttributeType, 0x0200, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 7),
			8:  ByteField(PseudowireMaintenanceProfile_BufferOverrunUnderrunDeclarationPolicy, UnsignedIntegerAttributeType, 0x0100, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 8),
			9:  ByteField(PseudowireMaintenanceProfile_BufferOverrunUnderrunClearPolicy, UnsignedIntegerAttributeType, 0x0080, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 9),
			10: ByteField(PseudowireMaintenanceProfile_MalformedPacketsDeclarationPolicy, UnsignedIntegerAttributeType, 0x0040, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 10),
			11: ByteField(PseudowireMaintenanceProfile_MalformedPacketsClearPolicy, UnsignedIntegerAttributeType, 0x0020, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 11),
			12: ByteField(PseudowireMaintenanceProfile_RBitTransmitSetPolicy, UnsignedIntegerAttributeType, 0x0010, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 12),
			13: ByteField(PseudowireMaintenanceProfile_RBitTransmitClearPolicy, UnsignedIntegerAttributeType, 0x0008, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 13),
			14: ByteField(PseudowireMaintenanceProfile_RBitReceivePolicy, UnsignedIntegerAttributeType, 0x0004, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 14),
			15: ByteField(PseudowireMaintenanceProfile_LBitReceivePolicy, UnsignedIntegerAttributeType, 0x0002, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 15),
			16: Uint16Field(PseudowireMaintenanceProfile_SesThreshold, UnsignedIntegerAttributeType, 0x0001, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 16),
		},
		Access:  CreatedByOlt,
		Support: UnknownSupport,
	}
}

// NewPseudowireMaintenanceProfile (class ID 284) creates the basic
// Managed Entity definition that is used to validate an ME of this type that
// is received from or transmitted to the OMCC.
func NewPseudowireMaintenanceProfile(params ...ParamData) (*ManagedEntity, OmciErrors) {
	return NewManagedEntity(*pseudowiremaintenanceprofileBME, params...)
}
