Skip to content

Support for UMF Interfaces Model -CPU model - #231

Draft
ksravani-hcl wants to merge 1 commit into
sonic-net:masterfrom
ksravani-hcl:pr_intfmodel_cpu
Draft

ksravani-hcl wants to merge 1 commit into
sonic-net:masterfrom
ksravani-hcl:pr_intfmodel_cpu

Conversation

@ksravani-hcl

@ksravani-hcl ksravani-hcl commented Jul 8, 2026

Copy link
Copy Markdown

Support for UMF Interfaces Model -CPU model

counters (general, ethernet,subinterface)
management/cpu
mac-address
description
oper-status
port-speed
enabled
mtu
id

Component Testing PR - sonic-net/sonic-gnmi#737

Unit Testing Result

=== RUN TestCPU_DbToYang_intf_cpu_xfmr
=== RUN TestCPU_DbToYang_intf_cpu_xfmr/Success_-CPU
=== RUN TestCPU_DbToYang_intf_cpu_xfmr/Success
-Non_CPU
=== RUN TestCPU_DbToYang_intf_cpu_xfmr/Failure
-No_Key
--- PASS: TestCPU_DbToYang_intf_cpu_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_intf_cpu_xfmr/Success
-CPU (0.00s)
--- PASS: TestCPU_DbToYang_intf_cpu_xfmr/Success
-Non_CPU (0.00s)
--- PASS: TestCPU_DbToYang_intf_cpu_xfmr/Failure
-No_Key (0.00s)
=== RUN TestCPU_DbToYang_intf_description_xfmr
=== RUN TestCPU_DbToYang_intf_description_xfmr/Successful_Retrieval
=== RUN TestCPU_DbToYang_intf_description_xfmr/Missing_Description_Field
=== RUN TestCPU_DbToYang_intf_description_xfmr/Invalid_Interface_Name
--- PASS: TestCPU_DbToYang_intf_description_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_intf_description_xfmr/Successful_Retrieval (0.00s)
--- PASS: TestCPU_DbToYang_intf_description_xfmr/Missing_Description_Field (0.00s)
--- PASS: TestCPU_DbToYang_intf_description_xfmr/Invalid_Interface_Name (0.00s)
=== RUN TestCPU_DbToYang_pins_ifindex_xfmr
=== RUN TestCPU_DbToYang_pins_ifindex_xfmr/Successful_ID_Parsing
=== RUN TestCPU_DbToYang_pins_ifindex_xfmr/Non-numeric_ID
=== RUN TestCPU_DbToYang_pins_ifindex_xfmr/Missing_Entry
--- PASS: TestCPU_DbToYang_pins_ifindex_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_pins_ifindex_xfmr/Successful_ID_Parsing (0.00s)
--- PASS: TestCPU_DbToYang_pins_ifindex_xfmr/Non-numeric_ID (0.00s)
--- PASS: TestCPU_DbToYang_pins_ifindex_xfmr/Missing_Entry (0.00s)
=== RUN TestCPU_DbToYang_intf_ipv4_counters_xfmr_PortChannel
--- PASS: TestCPU_DbToYang_intf_ipv4_counters_xfmr_PortChannel (0.00s)
=== RUN TestCPU_DbToYang_intf_ipv6_counters_xfmr_Ethernet
--- PASS: TestCPU_DbToYang_intf_ipv6_counters_xfmr_Ethernet (0.00s)
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr/CPU_Interface
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr/Management_Interface
-eth_prefix
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr/Management_Interface
-mgmt_prefix
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr/Standard_Interface
=== RUN TestCPU_DbToYang_intf_mgmt_xfmr/Missing_Name_Key
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr/CPU_Interface (0.00s)
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr/Management_Interface
-eth_prefix (0.00s)
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr/Management_Interface
-mgmt_prefix (0.00s)
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr/Standard_Interface (0.00s)
--- PASS: TestCPU_DbToYang_intf_mgmt_xfmr/Missing_Name_Key (0.00s)
=== RUN TestCPU_DbToYang_intf_eth_mac_address_xfmr
=== RUN TestCPU_DbToYang_intf_eth_mac_address_xfmr/Explicit
=== RUN TestCPU_DbToYang_intf_eth_mac_address_xfmr/Fallback
--- PASS: TestCPU_DbToYang_intf_eth_mac_address_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_intf_eth_mac_address_xfmr/Explicit (0.00s)
--- PASS: TestCPU_DbToYang_intf_eth_mac_address_xfmr/Fallback (0.00s)
=== RUN TestCPU_SumV4Counters_AllFields
--- PASS: TestCPU_SumV4Counters_AllFields (0.00s)
=== RUN TestCPU_SumV6Counters_AllFields
--- PASS: TestCPU_SumV6Counters_AllFields (0.00s)
=== RUN TestCPU_GetSpecificCounterAttr_Subinterface
--- PASS: TestCPU_GetSpecificCounterAttr_Subinterface (0.00s)
=== RUN TestCPU_DbToYang_intf_oper_status_xfmr
=== RUN TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Up
=== RUN TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Down_Branch
=== RUN TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Unknown_Default_Branch
=== RUN TestCPU_DbToYang_intf_oper_status_xfmr/CPU_Interface_Always_Up
--- PASS: TestCPU_DbToYang_intf_oper_status_xfmr (0.00s)
--- PASS: TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Up (0.00s)
--- PASS: TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Down_Branch (0.00s)
--- PASS: TestCPU_DbToYang_intf_oper_status_xfmr/Oper_Status_Unknown_Default_Branch (0.00s)
--- PASS: TestCPU_DbToYang_intf_oper_status_xfmr/CPU_Interface_Always_Up (0.00s)
=== RUN TestCPU_PopulatePortCounters
=== RUN TestCPU_PopulatePortCounters/Success
-IPv4_Subinterface_Counters_with_Explicit_ifName
=== RUN TestCPU_PopulatePortCounters/Success
-IPv6_Subinterface_Counters_with_URI_Fallback_ifName
--- PASS: TestCPU_PopulatePortCounters (0.00s)
--- PASS: TestCPU_PopulatePortCounters/Success
-IPv4_Subinterface_Counters_with_Explicit_ifName (0.00s)
--- PASS: TestCPU_PopulatePortCounters/Success
-_IPv6_Subinterface_Counters_with_URI_Fallback_ifName (0.00s)
PASS

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 8, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: aliyahhoda / name: Aliyah Hoda (d07be1c57a66b2bf4c1cec9942453d6f690391b4)
  • ✅ login: ksravani-hcl / name: ksravani-hcl (29f57fdcbbb8a2f62dce0f0d8da2003c6a1a0789)

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@ksravani-hcl
ksravani-hcl force-pushed the pr_intfmodel_cpu branch 2 times, most recently from cfb0b97 to 8515334 Compare August 21, 2026 14:19
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@ksravani-hcl

ksravani-hcl commented Sep 3, 2026

Copy link
Copy Markdown
Author

@ndas7, @rlucus Could you please review the PR.

@ksravani-hcl

Copy link
Copy Markdown
Author

@kwangsuk, @Verma-Anukul Can you please review the PR.

Signed-off-by: SRAVANI KANASANI <ksravani-hcl>
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

return fmt.Errorf("%w; getMembers() for %s failed", err, ifName)
}

for _, member := range members {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both IPv4 and IPv6 transformers call populatePortCounters but ignore its returned error. If the OID mapping or COUNTERS entry is missing, the transformer can return success with incomplete or empty counters, making backend failures appear as valid telemetry. Please propagate the error, or explicitly distinguish “counter not supported” from a failed DB lookup.

	for _, member := range members {
		var mcounters ...Counters
-		populatePortCounters(inParams, member, &mcounters)
+		if err := populatePortCounters(inParams, member, &mcounters); err != nil {
+			return err
+		}
		sumV4Counters(v4_counters, &mcounters)
	}

}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-eth:ethernet/oc-eth:state/oc-eth:port-speed {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already defined above, and will cause duplicate updates

}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-eth:ethernet/oc-eth:state/oc-eth:port-speed {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants