@@ -76,6 +76,10 @@ var specInterfaceEnforcer = &DefaultValueEnforcer[string, *dozer.SpecInterface]{
7676 return errors .Wrap (err , "failed to handle interface base" )
7777 }
7878
79+ if err := specInterfaceVLANProxyARPEnforcer .Handle (basePath , name , actual , desired , actions ); err != nil {
80+ return errors .Wrap (err , "failed to handle interface VLAN Proxy ARP" )
81+ }
82+
7983 actualIPs , desiredIPs := ValueOrNil (actual , desired ,
8084 func (value * dozer.SpecInterface ) map [string ]* dozer.SpecInterfaceIP { return value .VLANIPs })
8185 if err := specInterfaceVLANIPsEnforcer .Handle (basePath , actualIPs , desiredIPs , actions ); err != nil {
@@ -224,6 +228,56 @@ var specInterfaceVLANIPEnforcer = &DefaultValueEnforcer[string, *dozer.SpecInter
224228 },
225229}
226230
231+ var specInterfaceVLANProxyARPEnforcer = & DefaultValueEnforcer [string , * dozer.SpecInterface ]{
232+ Summary : "Interface VLAN Proxy-ARP" ,
233+ Path : "/routed-vlan/ipv4/proxy-arp/config" ,
234+ UpdateWeight : ActionWeightProxyARPUpdate ,
235+ DeleteWeight : ActionWeightProxyARPDelete ,
236+ RecreateOnUpdate : true ,
237+ Getter : func (key string , value * dozer.SpecInterface ) any { return value .ProxyARP },
238+ Marshal : func (_ string , value * dozer.SpecInterface ) (ygot.ValidatedGoStruct , error ) {
239+ mode := oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_DISABLE
240+ if value != nil && value .ProxyARP != nil {
241+ if value .ProxyARP .All {
242+ mode = oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_ALL
243+ } else {
244+ mode = oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_REMOTE_ONLY
245+ }
246+ }
247+
248+ return & oc.OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp {
249+ Config : & oc.OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config {
250+ Mode : mode ,
251+ },
252+ }, nil
253+ },
254+ }
255+
256+ var specInterfaceSubinterfaceProxyARPEnforcer = & DefaultValueEnforcer [uint32 , * dozer.SpecSubinterface ]{
257+ Summary : "Subinterface %d Proxy-ARP" ,
258+ Path : "/ipv4/proxy-arp/config" ,
259+ UpdateWeight : ActionWeightProxyARPUpdate ,
260+ DeleteWeight : ActionWeightProxyARPDelete ,
261+ RecreateOnUpdate : true ,
262+ Getter : func (idx uint32 , value * dozer.SpecSubinterface ) any { return value .ProxyARP },
263+ Marshal : func (_ uint32 , value * dozer.SpecSubinterface ) (ygot.ValidatedGoStruct , error ) {
264+ mode := oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_DISABLE
265+ if value != nil && value .ProxyARP != nil {
266+ if value .ProxyARP .All {
267+ mode = oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_ALL
268+ } else {
269+ mode = oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_REMOTE_ONLY
270+ }
271+ }
272+
273+ return & oc.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_ProxyArp {
274+ Config : & oc.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_ProxyArp_Config {
275+ Mode : mode ,
276+ },
277+ }, nil
278+ },
279+ }
280+
227281var specInterfaceSubinterfacesEnforcer = & DefaultMapEnforcer [uint32 , * dozer.SpecSubinterface ]{
228282 Summary : "Subinterface %s" ,
229283 ValueHandler : specInterfaceSubinterfaceEnforcer ,
@@ -238,6 +292,10 @@ var specInterfaceSubinterfaceEnforcer = &DefaultValueEnforcer[uint32, *dozer.Spe
238292 return errors .Wrap (err , "failed to handle subinterface base" )
239293 }
240294
295+ if err := specInterfaceSubinterfaceProxyARPEnforcer .Handle (basePath , idx , actual , desired , actions ); err != nil {
296+ return errors .Wrap (err , "failed to handle subinterface Proxy ARP" )
297+ }
298+
241299 actualIPs , desiredIPs := ValueOrNil (actual , desired ,
242300 func (value * dozer.SpecSubinterface ) map [string ]* dozer.SpecInterfaceIP { return value .IPs })
243301 if err := specInterfaceSubinterfaceIPsEnforcer .Handle (basePath , actualIPs , desiredIPs , actions ); err != nil {
@@ -255,7 +313,6 @@ var specInterfaceSubinterfaceBaseEnforcer = &DefaultValueEnforcer[uint32, *dozer
255313 DeleteWeight : ActionWeightInterfaceSubinterfaceDelete ,
256314 Marshal : func (idx uint32 , value * dozer.SpecSubinterface ) (ygot.ValidatedGoStruct , error ) {
257315 var vlan * oc.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Vlan
258-
259316 if value .VLAN != nil {
260317 vlan = & oc.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Vlan {
261318 Config : & oc.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Vlan_Config {
@@ -510,6 +567,22 @@ func loadActualInterfaces(ctx context.Context, agent *agentapi.Agent, client *gn
510567 return nil
511568}
512569
570+ func unmarshalProxyARP (ocVal oc.E_OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode ) (* dozer.SpecProxyARP , error ) {
571+ var pa * dozer.SpecProxyARP
572+ switch ocVal {
573+ case oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_UNSET :
574+ case oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_DISABLE :
575+ case oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_REMOTE_ONLY :
576+ pa = & dozer.SpecProxyARP {All : false }
577+ case oc .OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_ProxyArp_Config_Mode_ALL :
578+ pa = & dozer.SpecProxyARP {All : true }
579+ default :
580+ return nil , errors .Errorf ("unknown Proxy ARP mode %v" , ocVal )
581+ }
582+
583+ return pa , nil
584+ }
585+
513586func unmarshalOCInterfaces (agent * agentapi.Agent , ocVal * oc.OpenconfigInterfaces_Interfaces ) (map [string ]* dozer.SpecInterface , error ) {
514587 interfaces := map [string ]* dozer.SpecInterface {}
515588
@@ -596,6 +669,14 @@ func unmarshalOCInterfaces(agent *agentapi.Agent, ocVal *oc.OpenconfigInterfaces
596669 subIface .AnycastGateways = sub .Ipv4 .SagIpv4 .Config .StaticAnycastGateway
597670 }
598671
672+ if sub .Ipv4 != nil && sub .Ipv4 .ProxyArp != nil && sub .Ipv4 .ProxyArp .Config != nil {
673+ pa , err := unmarshalProxyARP (sub .Ipv4 .ProxyArp .Config .Mode )
674+ if err != nil {
675+ return nil , errors .Wrapf (err , "failed to unmarshal proxy-arp for %s.%d" , name , id )
676+ }
677+ subIface .ProxyARP = pa
678+ }
679+
599680 if sub .Vlan != nil {
600681 if sub .Vlan .Config != nil {
601682 subIface .VLAN , err = unmarshalVLAN (sub .Vlan .Config .VlanId )
@@ -638,6 +719,13 @@ func unmarshalOCInterfaces(agent *agentapi.Agent, ocVal *oc.OpenconfigInterfaces
638719 if ocIface .RoutedVlan .Ipv4 .SagIpv4 != nil && ocIface .RoutedVlan .Ipv4 .SagIpv4 .Config != nil {
639720 iface .VLANAnycastGateway = ocIface .RoutedVlan .Ipv4 .SagIpv4 .Config .StaticAnycastGateway
640721 }
722+ if ocIface .RoutedVlan .Ipv4 .ProxyArp != nil && ocIface .RoutedVlan .Ipv4 .ProxyArp .Config != nil {
723+ pa , err := unmarshalProxyARP (ocIface .RoutedVlan .Ipv4 .ProxyArp .Config .Mode )
724+ if err != nil {
725+ return nil , errors .Wrapf (err , "failed to unmarshal proxy-arp for VLAN interface %s" , name )
726+ }
727+ iface .ProxyARP = pa
728+ }
641729 }
642730 }
643731 if vlan && ! isVLAN (name ) {
0 commit comments