From 3e94e74b6becd106386b0c9c4da5a47eeabe6ad8 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Mon, 15 Jun 2026 06:56:31 -0700 Subject: [PATCH 1/3] fix: switch_id on route + neighbor entries Signed-off-by: Nicholas Ching --- test/sai_test/config/route_configer.py | 32 +++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/test/sai_test/config/route_configer.py b/test/sai_test/config/route_configer.py index a7aa20946..54f742f0f 100644 --- a/test/sai_test/config/route_configer.py +++ b/test/sai_test/config/route_configer.py @@ -290,7 +290,8 @@ def create_default_v4_v6_route_entry(self): addr=sai_thrift_ip_addr_t( ip6=DEFAULT_IP_V6_PREFIX), mask=sai_thrift_ip_addr_t(ip6=DEFAULT_IP_V6_PREFIX)) - self.test_obj.dut.default_ipv6_route_entry = sai_thrift_route_entry_t(vr_id=self.test_obj.dut.default_vrf, + self.test_obj.dut.default_ipv6_route_entry = sai_thrift_route_entry_t(switch_id=self.test_obj.dut.switch_id, + vr_id=self.test_obj.dut.default_vrf, destination=v6_default) status = sai_thrift_create_route_entry( self.client, @@ -298,7 +299,8 @@ def create_default_v4_v6_route_entry(self): packet_action=SAI_PACKET_ACTION_DROP) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) - self.test_obj.dut.default_ipv4_route_entry = sai_thrift_route_entry_t(vr_id=self.test_obj.dut.default_vrf, + self.test_obj.dut.default_ipv4_route_entry = sai_thrift_route_entry_t(switch_id=self.test_obj.dut.switch_id, + vr_id=self.test_obj.dut.default_vrf, destination=sai_ipprefix(DEFAULT_IP_V4_PREFIX)) status = sai_thrift_create_route_entry( self.client, @@ -323,22 +325,22 @@ def create_route_by_rif( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=rif) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=rif) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -366,22 +368,22 @@ def create_route_by_nexthop( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=nexthopv4.oid) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=nexthopv6.oid) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -406,22 +408,22 @@ def create_route_by_nexthop_group( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=nexthop_groupv4.nhp_grp_id) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=nexthop_groupv6.nhp_grp_id) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -447,6 +449,7 @@ def create_neighbor_by_rif(self, nexthop_device: Device, rif, no_host=True): """ if nexthop_device.ipv4: nbr_entry_v4 = sai_thrift_neighbor_entry_t( + switch_id=self.test_obj.dut.switch_id, rif_id=rif, ip_address=sai_ipaddress(nexthop_device.ipv4)) status = sai_thrift_create_neighbor_entry( @@ -460,6 +463,7 @@ def create_neighbor_by_rif(self, nexthop_device: Device, rif, no_host=True): if nexthop_device.ipv6: nbr_entry_v6 = sai_thrift_neighbor_entry_t( + switch_id=self.test_obj.dut.switch_id, rif_id=rif, ip_address=sai_ipaddress(nexthop_device.ipv6)) status = sai_thrift_create_neighbor_entry( From 51d2647bd66f490ceba90a114514191a8c58c4f8 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Fri, 19 Jun 2026 11:27:23 -0700 Subject: [PATCH 2/3] fix: -5 error, switch-id-NULL on neighbor/route create test Signed-off-by: Nicholas Ching --- .../sai_rpc_server_helper_functions.tt | 52 ++++++++++++++++++- test/saithrift/src/switch_sai.thrift | 5 +- test/saithrift/src/switch_sai_rpc_server.cpp | 8 ++- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/meta/templates/sai_rpc_server_helper_functions.tt b/meta/templates/sai_rpc_server_helper_functions.tt index 1ca1ad545..ca1f7ab5d 100644 --- a/meta/templates/sai_rpc_server_helper_functions.tt +++ b/meta/templates/sai_rpc_server_helper_functions.tt @@ -31,7 +31,8 @@ } [%- END -%] [%- FOREACH struct IN apis.$api.structs %] - + [%- NEXT IF struct.short_name == 'neighbor_entry' %] + [%- NEXT IF struct.short_name == 'route_entry' %] [%- PROCESS struct_helper_function_header %] { @@ -135,8 +136,57 @@ void sai_thrift_parse_[% struct.short_name %](const [% struct.thrift_name %] &th [%- ######################################################################## -%] [%- BLOCK special_helper_functions -%] +extern sai_object_id_t gSwitchId; +extern sai_object_id_t switch_id; + void sai_thrift_parse_buffer(const std::string &thrift_buffer, void *buffer) { /* not supported yet */ } + +void sai_thrift_parse_neighbor_entry(const sai_thrift_neighbor_entry_t &thrift_neighbor_entry, + sai_neighbor_entry_t *neighbor_entry) +{ + if (neighbor_entry == NULL) { + return; + } + + // OCP sai_test often omits switch_id on neighbor_entry; fall back to the + // RPC-global switch_id (set by sai_thrift_create_switch) then gSwitchId. + if (thrift_neighbor_entry.switch_id != 0) { + neighbor_entry->switch_id = (sai_object_id_t)thrift_neighbor_entry.switch_id; + } else if (switch_id != SAI_NULL_OBJECT_ID) { + neighbor_entry->switch_id = switch_id; + } else if (gSwitchId != SAI_NULL_OBJECT_ID) { + neighbor_entry->switch_id = gSwitchId; + } else { + neighbor_entry->switch_id = SAI_NULL_OBJECT_ID; + } + + neighbor_entry->rif_id = (sai_object_id_t)thrift_neighbor_entry.rif_id; + sai_thrift_ip_address_t_parse(thrift_neighbor_entry.ip_address, + &neighbor_entry->ip_address); +} + +void sai_thrift_parse_route_entry(const sai_thrift_route_entry_t &thrift_route_entry, + sai_route_entry_t *route_entry) +{ + if (route_entry == NULL) { + return; + } + + if (thrift_route_entry.switch_id != 0) { + route_entry->switch_id = (sai_object_id_t)thrift_route_entry.switch_id; + } else if (switch_id != SAI_NULL_OBJECT_ID) { + route_entry->switch_id = switch_id; + } else if (gSwitchId != SAI_NULL_OBJECT_ID) { + route_entry->switch_id = gSwitchId; + } else { + route_entry->switch_id = SAI_NULL_OBJECT_ID; + } + + route_entry->vr_id = (sai_object_id_t)thrift_route_entry.vr_id; + sai_thrift_ip_prefix_t_parse(thrift_route_entry.destination, + &route_entry->destination); +} [% END -%] diff --git a/test/saithrift/src/switch_sai.thrift b/test/saithrift/src/switch_sai.thrift index 7f465749d..e46af31bf 100644 --- a/test/saithrift/src/switch_sai.thrift +++ b/test/saithrift/src/switch_sai.thrift @@ -198,8 +198,9 @@ struct sai_thrift_route_entry_t { } struct sai_thrift_neighbor_entry_t { - 1: sai_thrift_object_id_t rif_id; - 2: sai_thrift_ip_address_t ip_address; + 1: sai_thrift_object_id_t switch_id; + 2: sai_thrift_object_id_t rif_id; + 3: sai_thrift_ip_address_t ip_address; } struct sai_thrift_attribute_list_t { diff --git a/test/saithrift/src/switch_sai_rpc_server.cpp b/test/saithrift/src/switch_sai_rpc_server.cpp index 3a487de8a..41346e40c 100644 --- a/test/saithrift/src/switch_sai_rpc_server.cpp +++ b/test/saithrift/src/switch_sai_rpc_server.cpp @@ -241,7 +241,13 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf { } void sai_thrift_parse_neighbor_entry(const sai_thrift_neighbor_entry_t &thrift_neighbor_entry, sai_neighbor_entry_t *neighbor_entry) { - neighbor_entry->switch_id = gSwitchId; + // Python saithrift sends switch_id as field 1 (optional). Always fall back to + // gSwitchId when the client omits it (OCP sai_test often only passes rif_id). + if (thrift_neighbor_entry.switch_id != 0) { + neighbor_entry->switch_id = (sai_object_id_t) thrift_neighbor_entry.switch_id; + } else { + neighbor_entry->switch_id = gSwitchId; + } neighbor_entry->rif_id = (sai_object_id_t) thrift_neighbor_entry.rif_id; sai_thrift_parse_ip_address(thrift_neighbor_entry.ip_address, &neighbor_entry->ip_address); } From 1c9832a3fb9915d77c7961c03f1efbfdb633ffe9 Mon Sep 17 00:00:00 2001 From: Nicholas Ching Date: Fri, 26 Jun 2026 08:36:54 -0700 Subject: [PATCH 3/3] fix: fall back only to RPC-scoped switch_id Signed-off-by: Nicholas Ching Co-authored-by: Cursor --- .../sai_rpc_server_helper_functions.tt | 7 +--- test/sai_test/config/route_configer.py | 32 ++++++++----------- test/saithrift/src/switch_sai.thrift | 5 ++- test/saithrift/src/switch_sai_rpc_server.cpp | 8 +---- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/meta/templates/sai_rpc_server_helper_functions.tt b/meta/templates/sai_rpc_server_helper_functions.tt index ca1f7ab5d..f5f9f729e 100644 --- a/meta/templates/sai_rpc_server_helper_functions.tt +++ b/meta/templates/sai_rpc_server_helper_functions.tt @@ -136,7 +136,6 @@ void sai_thrift_parse_[% struct.short_name %](const [% struct.thrift_name %] &th [%- ######################################################################## -%] [%- BLOCK special_helper_functions -%] -extern sai_object_id_t gSwitchId; extern sai_object_id_t switch_id; void sai_thrift_parse_buffer(const std::string &thrift_buffer, @@ -152,13 +151,11 @@ void sai_thrift_parse_neighbor_entry(const sai_thrift_neighbor_entry_t &thrift_n } // OCP sai_test often omits switch_id on neighbor_entry; fall back to the - // RPC-global switch_id (set by sai_thrift_create_switch) then gSwitchId. + // RPC-global switch_id set by sai_thrift_create_switch. if (thrift_neighbor_entry.switch_id != 0) { neighbor_entry->switch_id = (sai_object_id_t)thrift_neighbor_entry.switch_id; } else if (switch_id != SAI_NULL_OBJECT_ID) { neighbor_entry->switch_id = switch_id; - } else if (gSwitchId != SAI_NULL_OBJECT_ID) { - neighbor_entry->switch_id = gSwitchId; } else { neighbor_entry->switch_id = SAI_NULL_OBJECT_ID; } @@ -179,8 +176,6 @@ void sai_thrift_parse_route_entry(const sai_thrift_route_entry_t &thrift_route_e route_entry->switch_id = (sai_object_id_t)thrift_route_entry.switch_id; } else if (switch_id != SAI_NULL_OBJECT_ID) { route_entry->switch_id = switch_id; - } else if (gSwitchId != SAI_NULL_OBJECT_ID) { - route_entry->switch_id = gSwitchId; } else { route_entry->switch_id = SAI_NULL_OBJECT_ID; } diff --git a/test/sai_test/config/route_configer.py b/test/sai_test/config/route_configer.py index 54f742f0f..a7aa20946 100644 --- a/test/sai_test/config/route_configer.py +++ b/test/sai_test/config/route_configer.py @@ -290,8 +290,7 @@ def create_default_v4_v6_route_entry(self): addr=sai_thrift_ip_addr_t( ip6=DEFAULT_IP_V6_PREFIX), mask=sai_thrift_ip_addr_t(ip6=DEFAULT_IP_V6_PREFIX)) - self.test_obj.dut.default_ipv6_route_entry = sai_thrift_route_entry_t(switch_id=self.test_obj.dut.switch_id, - vr_id=self.test_obj.dut.default_vrf, + self.test_obj.dut.default_ipv6_route_entry = sai_thrift_route_entry_t(vr_id=self.test_obj.dut.default_vrf, destination=v6_default) status = sai_thrift_create_route_entry( self.client, @@ -299,8 +298,7 @@ def create_default_v4_v6_route_entry(self): packet_action=SAI_PACKET_ACTION_DROP) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) - self.test_obj.dut.default_ipv4_route_entry = sai_thrift_route_entry_t(switch_id=self.test_obj.dut.switch_id, - vr_id=self.test_obj.dut.default_vrf, + self.test_obj.dut.default_ipv4_route_entry = sai_thrift_route_entry_t(vr_id=self.test_obj.dut.default_vrf, destination=sai_ipprefix(DEFAULT_IP_V4_PREFIX)) status = sai_thrift_create_route_entry( self.client, @@ -325,22 +323,22 @@ def create_route_by_rif( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=rif) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=rif) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -368,22 +366,22 @@ def create_route_by_nexthop( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=nexthopv4.oid) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=nexthopv6.oid) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -408,22 +406,22 @@ def create_route_by_nexthop_group( vr_id = self.choice_virtual_route(virtual_router) if dest_device.ip_prefix: net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/'+dest_device.ip_prefix)) else: # destination cannot use sai_ipaddress net_routev4 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv4+'/32')) status = sai_thrift_create_route_entry( self.client, net_routev4, next_hop_id=nexthop_groupv4.nhp_grp_id) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) if dest_device.ip_prefix_v6: net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/'+dest_device.ip_prefix_v6)) else: # destination cannot use sai_ipaddress net_routev6 = sai_thrift_route_entry_t( - switch_id=self.test_obj.dut.switch_id, vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) + vr_id=vr_id, destination=sai_ipprefix(dest_device.ipv6+'/128')) status = sai_thrift_create_route_entry( self.client, net_routev6, next_hop_id=nexthop_groupv6.nhp_grp_id) self.test_obj.assertEqual(status, SAI_STATUS_SUCCESS) @@ -449,7 +447,6 @@ def create_neighbor_by_rif(self, nexthop_device: Device, rif, no_host=True): """ if nexthop_device.ipv4: nbr_entry_v4 = sai_thrift_neighbor_entry_t( - switch_id=self.test_obj.dut.switch_id, rif_id=rif, ip_address=sai_ipaddress(nexthop_device.ipv4)) status = sai_thrift_create_neighbor_entry( @@ -463,7 +460,6 @@ def create_neighbor_by_rif(self, nexthop_device: Device, rif, no_host=True): if nexthop_device.ipv6: nbr_entry_v6 = sai_thrift_neighbor_entry_t( - switch_id=self.test_obj.dut.switch_id, rif_id=rif, ip_address=sai_ipaddress(nexthop_device.ipv6)) status = sai_thrift_create_neighbor_entry( diff --git a/test/saithrift/src/switch_sai.thrift b/test/saithrift/src/switch_sai.thrift index e46af31bf..7f465749d 100644 --- a/test/saithrift/src/switch_sai.thrift +++ b/test/saithrift/src/switch_sai.thrift @@ -198,9 +198,8 @@ struct sai_thrift_route_entry_t { } struct sai_thrift_neighbor_entry_t { - 1: sai_thrift_object_id_t switch_id; - 2: sai_thrift_object_id_t rif_id; - 3: sai_thrift_ip_address_t ip_address; + 1: sai_thrift_object_id_t rif_id; + 2: sai_thrift_ip_address_t ip_address; } struct sai_thrift_attribute_list_t { diff --git a/test/saithrift/src/switch_sai_rpc_server.cpp b/test/saithrift/src/switch_sai_rpc_server.cpp index 41346e40c..3a487de8a 100644 --- a/test/saithrift/src/switch_sai_rpc_server.cpp +++ b/test/saithrift/src/switch_sai_rpc_server.cpp @@ -241,13 +241,7 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf { } void sai_thrift_parse_neighbor_entry(const sai_thrift_neighbor_entry_t &thrift_neighbor_entry, sai_neighbor_entry_t *neighbor_entry) { - // Python saithrift sends switch_id as field 1 (optional). Always fall back to - // gSwitchId when the client omits it (OCP sai_test often only passes rif_id). - if (thrift_neighbor_entry.switch_id != 0) { - neighbor_entry->switch_id = (sai_object_id_t) thrift_neighbor_entry.switch_id; - } else { - neighbor_entry->switch_id = gSwitchId; - } + neighbor_entry->switch_id = gSwitchId; neighbor_entry->rif_id = (sai_object_id_t) thrift_neighbor_entry.rif_id; sai_thrift_parse_ip_address(thrift_neighbor_entry.ip_address, &neighbor_entry->ip_address); }