VOL-3675: Fix for invalid attribute definitions in Multicast Operations Profile ME
Change-Id: Ie0e606e54d4e3574c717badbcdd48a9fa3f45bfd
diff --git a/VERSION b/VERSION
index 288adf5..dffa40e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.13.3
+0.13.4
diff --git a/generated/multicastoperationsprofileframe.go b/generated/multicastoperationsprofileframe.go
index 61f36fb..6204894 100644
--- a/generated/multicastoperationsprofileframe.go
+++ b/generated/multicastoperationsprofileframe.go
@@ -1,5 +1,4 @@
/*
- * 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");
@@ -15,11 +14,9 @@
* 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
-*/
+* NOTE: This file was hand coded (not generated by omci-parser) due to complexity
+* of the ME's entry in the G.988 (11/2017) specification.
+ */
package generated
import "github.com/deckarep/golang-set"
@@ -28,14 +25,14 @@
var multicastoperationsprofileME *ManagedEntityDefinition
-type MulticastOperationsProfile struct{
+type MulticastOperationsProfile struct {
ManagedEntityDefinition
Attributes AttributeValueMap
}
-func init(){
+func init() {
multicastoperationsprofileME = &ManagedEntityDefinition{
- Name: "MulticastOperationsProfile",
+ Name: "MulticastOperationsProfile",
ClassID: 309,
MessageTypes: mapset.NewSetWith(
Create,
@@ -43,28 +40,28 @@
Get,
Set,
GetNext,
- ),
+ ),
AllowedAttributeMask: 0xffff,
AttributeDefinitions: AttributeDefinitionMap{
- 0: Uint16Field("ManagedEntityId", PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read, SetByCreate), false,false,false,0),
- 1: ByteField("IgmpVersion", EnumerationAttributeType, 0x8000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 1),
- 2: ByteField("IgmpFunction", EnumerationAttributeType, 0x4000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 2),
- 3: ByteField("ImmediateLeave", EnumerationAttributeType, 0x2000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 3),
- 4: Uint16Field("USIgmpTci", PointerAttributeType, 0x1000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 4),
- 5: ByteField("USIgmpTagCtrl", EnumerationAttributeType, 0x0800, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 5),
- 6: Uint32Field("USIgmpRate", CounterAttributeType, 0x0400, 0, mapset.NewSetWith(Read), false, true, false, 6),
- 7: MultiByteField("DynamicAccessControlListTable", StringAttributeType, 0x0200, 24, toOctets("AAAAAAAAAAAAAAAAAAAAAAAAAAA="), mapset.NewSetWith(Read), false, false, false, 7),
- 8: MultiByteField("StaticAccessControlListTable", StringAttributeType, 0x0100, 24, toOctets("AAAAAAAAAAAAAAAAAAAAAAAAAAA="), mapset.NewSetWith(Read), false, true, false, 8),
- 9: MultiByteField("LostGroupsListTable", StringAttributeType, 0x0080, 10, toOctets("AAAAAAAAAAAAAAAAAAAAAAAAAAA="), mapset.NewSetWith(Read), false, true, false, 9),
- 10: ByteField("Robustness", EnumerationAttributeType, 0x0040, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 10),
- 11: Uint32Field("QuerierIp", CounterAttributeType, 0x0020, 0, mapset.NewSetWith(Read), false, false, false, 11),
- 12: Uint32Field("QueryInterval", CounterAttributeType, 0x0010, 0, mapset.NewSetWith(Read), false, false, false, 12),
- 13: Uint32Field("QuerierMaxResponseTime", CounterAttributeType, 0x0008, 0, mapset.NewSetWith(Read), false, false, false, 13),
- 14: Uint32Field("LastMemberResponseTime", CounterAttributeType, 0x0004, 0, mapset.NewSetWith(Read), false, false, false, 14),
- 15: ByteField("UnauthorizedJoinBehaviour", EnumerationAttributeType, 0x0002, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 15),
- 16: MultiByteField("DSIgmpMcastTci", StringAttributeType, 0x0001, 10, toOctets("AAAAAAAAAAAAAAAAAAAAAAAAAAA="), mapset.NewSetWith(Read), false, true, false, 16),
+ 0: Uint16Field("ManagedEntityId", PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read, SetByCreate), false, false, false, 0),
+ 1: ByteField("IgmpVersion", EnumerationAttributeType, 0x8000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 1),
+ 2: ByteField("IgmpFunction", EnumerationAttributeType, 0x4000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 2),
+ 3: ByteField("ImmediateLeave", EnumerationAttributeType, 0x2000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, false, false, 3),
+ 4: Uint16Field("USIgmpTci", UnsignedIntegerAttributeType, 0x1000, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 4),
+ 5: ByteField("USIgmpTagCtrl", EnumerationAttributeType, 0x0800, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 5),
+ 6: Uint32Field("USIgmpRate", UnsignedIntegerAttributeType, 0x0400, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 6),
+ 7: TableField("DynamicAccessControlListTable", TableAttributeType, 0x0200, TableInfo{nil, 24}, mapset.NewSetWith(Read, Write), false, false, false, 7),
+ 8: TableField("StaticAccessControlListTable", TableAttributeType, 0x0100, TableInfo{nil, 24}, mapset.NewSetWith(Read, Write), false, true, false, 8),
+ 9: TableField("LostGroupsListTable", TableAttributeType, 0x0080, TableInfo{nil, 10}, mapset.NewSetWith(Read), false, true, false, 9),
+ 10: ByteField("Robustness", UnsignedIntegerAttributeType, 0x0040, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 10),
+ 11: Uint32Field("QuerierIp", UnsignedIntegerAttributeType, 0x0020, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 11),
+ 12: Uint32Field("QueryInterval", UnsignedIntegerAttributeType, 0x0010, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 12),
+ 13: Uint32Field("QuerierMaxResponseTime", UnsignedIntegerAttributeType, 0x0008, 0, mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 13),
+ 14: Uint32Field("LastMemberResponseTime", UnsignedIntegerAttributeType, 0x0004, 0, mapset.NewSetWith(Read, Write), false, true, false, 14),
+ 15: ByteField("UnauthorizedJoinBehaviour", UnsignedIntegerAttributeType, 0x0002, 0, mapset.NewSetWith(Read, Write), false, true, false, 15),
+ 16: MultiByteField("DSIgmpMcastTci", OctetsAttributeType, 0x0001, 3, toOctets("AAAA"), mapset.NewSetWith(Read, SetByCreate, Write), false, true, false, 16),
},
- Access: CreatedByOlt,
+ Access: CreatedByOlt,
Support: UnknownSupport,
}
}
@@ -72,6 +69,6 @@
// NewMulticastOperationsProfilePoint (class ID 309) 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 NewMulticastOperationsProfile(params ...ParamData) (*ManagedEntity, OmciErrors){
+func NewMulticastOperationsProfile(params ...ParamData) (*ManagedEntity, OmciErrors) {
return NewManagedEntity(*multicastoperationsprofileME, params...)
-}
\ No newline at end of file
+}
diff --git a/omci_test.go b/omci_test.go
index 12575d7..d49f3cd 100644
--- a/omci_test.go
+++ b/omci_test.go
@@ -20,9 +20,9 @@
import (
"encoding/hex"
"fmt"
+ "github.com/google/gopacket"
. "github.com/opencord/omci-lib-go"
. "github.com/opencord/omci-lib-go/generated"
- "github.com/google/gopacket"
"github.com/stretchr/testify/assert"
"strings"
"testing"
@@ -1133,7 +1133,6 @@
assert.NotNil(t, byteValue)
}
-
func TestUnsupportedG988ClassIDMibUploadNextResponseAttributes(t *testing.T) {
// Same as previous, but try different attribute mask combinations
tid := 3
@@ -1245,4 +1244,61 @@
assert.True(t, ok3)
assert.NotNil(t, byteValue)
}
-}
\ No newline at end of file
+}
+
+func TestCreateMulticastOperationsProfileMe(t *testing.T) {
+ // Test various create request for this ME
+ meParams := ParamData{
+ EntityID: uint16(0x501),
+ Attributes: AttributeValueMap{
+ "IgmpVersion": 2,
+ "IgmpFunction": 0,
+ "ImmediateLeave": 0,
+ "USIgmpTci": 0,
+ "Robustness": 2,
+ "QuerierIp": 0,
+ "QueryInterval": 125,
+ "QuerierMaxResponseTime": 100,
+ "LastMemberResponseTime": 10,
+ "UnauthorizedJoinBehaviour": 0,
+ "USIgmpRate": 0,
+ "USIgmpTagCtrl": 0,
+ "DSIgmpMcastTci": []byte{0, 0, 0},
+ },
+ }
+ meInstance, newErr := NewMulticastOperationsProfile(meParams)
+ assert.NotNil(t, meInstance)
+ assert.Equal(t, newErr.StatusCode(), Success)
+
+ tid := uint16(123)
+ frame, omciErr := GenFrame(meInstance, CreateRequestType, TransactionID(tid))
+ assert.NotNil(t, frame)
+ assert.NotZero(t, len(frame))
+ assert.Nil(t, omciErr)
+
+ ///////////////////////////////////////////////////////////////////
+ // Now decode
+ packet := gopacket.NewPacket(frame, LayerTypeOMCI, gopacket.NoCopy)
+ assert.NotNil(t, packet)
+
+ omciLayer := packet.Layer(LayerTypeOMCI)
+ assert.NotNil(t, omciLayer)
+
+ omciObj, omciOk := omciLayer.(*OMCI)
+ assert.NotNil(t, omciObj)
+ assert.True(t, omciOk)
+ assert.Equal(t, tid, omciObj.TransactionID)
+ assert.Equal(t, CreateRequestType, omciObj.MessageType)
+ assert.Equal(t, BaselineIdent, omciObj.DeviceIdentifier)
+
+ msgLayer := packet.Layer(LayerTypeCreateRequest)
+ assert.NotNil(t, msgLayer)
+
+ msgObj, msgOk := msgLayer.(*CreateRequest)
+ assert.NotNil(t, msgObj)
+ assert.True(t, msgOk)
+
+ assert.Equal(t, meInstance.GetClassID(), msgObj.EntityClass)
+ assert.Equal(t, meInstance.GetEntityID(), msgObj.EntityInstance)
+ //assert.Equal(t, meInstance.GetAttributeValueMap(), msgObj.Attributes)
+}