gnl2go.go
func DeserializeSerDes(serdesType string, list []byte) (SerDes, error) {
	switch serdesType {
	case "U8Type":
		attr := new(U8Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U16Type":
		attr := new(U16Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U32Type":
		attr := new(U32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U64Type":
		attr := new(U64Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "I32Type":
		attr := new(I32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "Net16Type":
		attr := new(Net16Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "Net32Type":
		attr := new(Net32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "NulStringType":
		attr := new(NulStringType)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "IgnoreType":
		attr := new(IgnoreType)
		return attr, nil
	case "BinaryType":
		attr := new(BinaryType)
		//binary always return nil, no point to check err != nil
		attr.Deserialize(list)
		return attr, nil
	/*
		XXX(tehnerd): dangerous assumption that we either have basic types (above) or it's
		a nested attribute's list. havent tested in prod yet
	*/
	default:
		atl, exists := ATLName2ATL[serdesType]
		if !exists {
			return nil, fmt.Errorf("serdes doesnt exists. type: %v\n", serdesType)
		}
		attr := CreateAttrListType(atl)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return &attr, nil
	}
	return nil, nil
}
func DeserializeSerDes(serdesType string, list []byte) (SerDes, error) {
	switch serdesType {
	case "U8Type":
		attr := new(U8Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U16Type":
		attr := new(U16Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U32Type":
		attr := new(U32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "U64Type":
		attr := new(U64Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "I32Type":
		attr := new(I32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "Net16Type":
		attr := new(Net16Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "Net32Type":
		attr := new(Net32Type)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "NulStringType":
		attr := new(NulStringType)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return attr, nil
	case "IgnoreType":
		attr := new(IgnoreType)
		return attr, nil
	case "BinaryType":
		attr := new(BinaryType)
		//binary always return nil, no point to check err != nil
		attr.Deserialize(list)
		return attr, nil
	/*
		XXX(tehnerd): dangerous assumption that we either have basic types (above) or it's
		a nested attribute's list. havent tested in prod yet
	*/
	default:
		atl, exists := ATLName2ATL[serdesType]
		if !exists {
			return nil, fmt.Errorf("serdes doesnt exists. type: %v\n", serdesType)
		}
		attr := CreateAttrListType(atl)
		err := attr.Deserialize(list)
		if err != nil {
			return nil, err
		}
		return &attr, nil
	}
	return nil, nil
}
/*
Routine which helps to deserialize. used in AttrList Deserialize()
*/