openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
285 stars 107 forks source link

inconsistent proto tag been generated by proto_generator for the same path #767

Closed dliu2223 closed 1 year ago

dliu2223 commented 1 year ago

I am using gribi and gnmi to control and manage our devices, for gribi, I am using gribi-aft.proto and for gnmi, I am using aft.proto generated in the gnmi part of the project, per the transformation spec, for same path, the tag should be the same, but I just noticed that the tags (e.g., decapsulate_header) are different, see below: 1) gribi-aft.proto: syntax = "proto3";

package gribi_aft;

import "github.com/openconfig/ygot/proto/ywrapper/ywrapper.proto"; import "github.com/openconfig/ygot/proto/yext/yext.proto"; import "v1/proto/gribi_aft/enums/enums.proto";

option go_package = "github.com/openconfig/gribi/v1/proto/gribi_aft";

message Device { Afts afts = 35982132 [(yext.schemapath) = "/afts"]; }

message Afts { message Ipv4Entry { gribi_aft.enums.OpenconfigAftTypesEncapsulationHeaderType decapsulate_header = 383809427 [(yext.schemapath) = "/afts/ipv4-unicast/ipv4-entry/state/decapsulate-header"];

2) aft.proto syntax = "proto3";

package aft;

import "github.com/openconfig/ygot/proto/ywrapper/ywrapper.proto"; import "github.com/openconfig/ygot/proto/yext/yext.proto"; import "aft/enums/enums.proto";

option go_package = "github.com/openconfig/public/release/models/aft";

message Device { Afts afts = 230660683 [(yext.schemapath) = "/afts"]; }

message Afts { message Ipv4Entry { aft.enums.OpenconfigAftTypesEncapsulationHeaderType decapsulate_header = 198291690 [(yext.schemapath) = "/afts/ipv4-unicast/ipv4-entry/state/decapsulate-header"];

I am using the latest proto_generator. Is this an expected behavior? gribi-aft.yang has deviations and augmentations compared to openconfig-aft.yang, but I expect the tag should be the same since the paths are the same from root.

Please advise.

Thanks

David

robshakir commented 1 year ago

The base module name is included in the hash that calculates the fields, so two modules that define the same thing are not expected to create the same tag unless they actually are the same module.

dliu2223 commented 1 year ago

OK, that explains it, let me rework the model structure and try it again. will close the ticket. Thanks

On Tue, Jan 31, 2023 at 3:34 PM Rob Shakir @.***> wrote:

The base module name is included in the hash that calculates the fields, so two modules that define the same thing are not expected to create the same tag unless they actually are the same module.

— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openconfig_ygot_issues_767-23issuecomment-2D1411218091&d=DwMCaQ&c=udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=muzbAtqPojeg0y31fUcbZA_FaWC9exft3yCCrqM_26s&m=e1M0rhdBlgWbpTrq65dqt0yfVRk0HLphZoUIf788e_gPNJgPp8_L1EVTe0ya9f78&s=5SJ0NrvE8FHDOBdXp-KH3SSsYp2cQcN2KIwx1MrJgwc&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AEN56CNOD7LVUS3T43PWQJ3WVGOQ3ANCNFSM6AAAAAAUNAKROA&d=DwMCaQ&c=udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=muzbAtqPojeg0y31fUcbZA_FaWC9exft3yCCrqM_26s&m=e1M0rhdBlgWbpTrq65dqt0yfVRk0HLphZoUIf788e_gPNJgPp8_L1EVTe0ya9f78&s=7D8FhOPW8xQ0QTVTzd4_jXPXlsK-DG61BunxtqtO4PU&e= . You are receiving this because you authored the thread.Message ID: @.***>

-- David Liu