@@ -106,7 +106,7 @@ func (db *Database) InsertRule(ctx context.Context, r jsonapi.Rule) (*uuid.UUID,
106106
107107 if stmt , ok := db .stmt ["insert_uplink_rule" ]; ok {
108108 var id uuid.UUID
109- err := stmt .QueryRowContext (ctx , r .Enabled , inneripsrc , outeripsrc , r .Match .Header .Teid , inneripdst , r . Action . NextHop . String (), pq .Array (srh )).Scan (& id )
109+ err := stmt .QueryRowContext (ctx , r .Enabled , inneripsrc , outeripsrc , r .Match .Header .Teid , inneripdst , pq .Array (srh )).Scan (& id )
110110 return & id , err
111111 } else {
112112 return nil , fmt .Errorf ("Procedure not registered" )
@@ -120,7 +120,7 @@ func (db *Database) InsertRule(ctx context.Context, r jsonapi.Rule) (*uuid.UUID,
120120 } else {
121121 dst = r .Match .Payload .Dst .String () + "/32"
122122 }
123- err := stmt .QueryRowContext (ctx , r .Enabled , dst , r . Action . NextHop . String (), pq .Array (srh )).Scan (& id )
123+ err := stmt .QueryRowContext (ctx , r .Enabled , dst , pq .Array (srh )).Scan (& id )
124124 return & id , err
125125 } else {
126126 return nil , fmt .Errorf ("Procedure not registered" )
@@ -133,14 +133,13 @@ func (db *Database) InsertRule(ctx context.Context, r jsonapi.Rule) (*uuid.UUID,
133133func (db * Database ) GetRule (ctx context.Context , uuid uuid.UUID ) (jsonapi.Rule , error ) {
134134 var type_uplink bool
135135 var enabled bool
136- var action_next_hop string
137136 var action_srh []string
138137 var match_ue_ip string
139138 var match_gnb_ip * string
140139 var match_service_ip * string
141140 var match_uplink_teid * uint32
142141 if stmt , ok := db .stmt ["get_rule" ]; ok {
143- err := stmt .QueryRowContext (ctx , uuid .String ()).Scan (& type_uplink , & enabled , & action_next_hop , pq .Array (& action_srh ), & match_ue_ip , & match_gnb_ip , & match_uplink_teid , & match_service_ip )
142+ err := stmt .QueryRowContext (ctx , uuid .String ()).Scan (& type_uplink , & enabled , pq .Array (& action_srh ), & match_ue_ip , & match_gnb_ip , & match_uplink_teid , & match_service_ip )
144143 if err != nil {
145144 return jsonapi.Rule {}, err
146145 }
@@ -186,14 +185,9 @@ func (db *Database) GetRule(ctx context.Context, uuid uuid.UUID) (jsonapi.Rule,
186185 if err != nil {
187186 return jsonapi.Rule {}, err
188187 }
189- nh , err := jsonapi .NewNextHop (action_next_hop )
190- if err != nil {
191- return jsonapi.Rule {}, err
192- }
193188
194189 rule .Action = jsonapi.Action {
195- NextHop : * nh ,
196- SRH : * srh ,
190+ SRH : * srh ,
197191 }
198192
199193 return rule , err
@@ -206,7 +200,6 @@ func (db *Database) GetRules(ctx context.Context) (jsonapi.RuleMap, error) {
206200 var uuid uuid.UUID
207201 var type_uplink bool
208202 var enabled bool
209- var action_next_hop string
210203 var action_srh []string
211204 var match_ue_ip string
212205 var match_gnb_ip * string
@@ -224,7 +217,7 @@ func (db *Database) GetRules(ctx context.Context) (jsonapi.RuleMap, error) {
224217 // avoid looping if no longer necessary
225218 return jsonapi.RuleMap {}, ctx .Err ()
226219 default :
227- err := rows .Scan (& uuid , & type_uplink , & enabled , & action_next_hop , pq .Array (& action_srh ), & match_ue_ip , & match_gnb_ip , & match_uplink_teid , & match_service_ip )
220+ err := rows .Scan (& uuid , & type_uplink , & enabled , pq .Array (& action_srh ), & match_ue_ip , & match_gnb_ip , & match_uplink_teid , & match_service_ip )
228221 if err != nil {
229222 return m , err
230223 }
@@ -271,14 +264,9 @@ func (db *Database) GetRules(ctx context.Context) (jsonapi.RuleMap, error) {
271264 if err != nil {
272265 return jsonapi.RuleMap {}, err
273266 }
274- nh , err := jsonapi .NewNextHop (action_next_hop )
275- if err != nil {
276- return jsonapi.RuleMap {}, err
277- }
278267
279268 rule .Action = jsonapi.Action {
280- NextHop : * nh ,
281- SRH : * srh ,
269+ SRH : * srh ,
282270 }
283271 m [uuid ] = rule
284272 }
@@ -327,44 +315,34 @@ func (db *Database) DeleteRule(ctx context.Context, uuid uuid.UUID) error {
327315}
328316
329317func (db * Database ) GetUplinkAction (ctx context.Context , uplinkTeid uint32 , gnbIp netip.Addr , ueIp netip.Addr , serviceIp netip.Addr ) (jsonapi.Action , error ) {
330- var action_next_hop string
331318 var action_srh []string
332319 if stmt , ok := db .stmt ["get_uplink_action" ]; ok {
333- err := stmt .QueryRowContext (ctx , uplinkTeid , gnbIp .String (), ueIp .String (), serviceIp .String ()).Scan (& action_next_hop , pq .Array (& action_srh ))
320+ err := stmt .QueryRowContext (ctx , uplinkTeid , gnbIp .String (), ueIp .String (), serviceIp .String ()).Scan (pq .Array (& action_srh ))
334321 if err != nil {
335322 return jsonapi.Action {}, err
336323 }
337324 srh , err := jsonapi .NewSRH (action_srh )
338325 if err != nil {
339326 return jsonapi.Action {}, err
340327 }
341- nh , err := jsonapi .NewNextHop (action_next_hop )
342- if err != nil {
343- return jsonapi.Action {}, err
344- }
345- return jsonapi.Action {NextHop : * nh , SRH : * srh }, err
328+ return jsonapi.Action {SRH : * srh }, err
346329 } else {
347330 return jsonapi.Action {}, fmt .Errorf ("Procedure not registered" )
348331 }
349332}
350333
351334func (db * Database ) GetDownlinkAction (ctx context.Context , ueIp netip.Addr ) (jsonapi.Action , error ) {
352- var action_next_hop string
353335 var action_srh []string
354336 if stmt , ok := db .stmt ["get_downlink_action" ]; ok {
355- err := stmt .QueryRowContext (ctx , ueIp .String ()).Scan (& action_next_hop , pq .Array (& action_srh ))
337+ err := stmt .QueryRowContext (ctx , ueIp .String ()).Scan (pq .Array (& action_srh ))
356338 if err != nil {
357339 return jsonapi.Action {}, err
358340 }
359341 srh , err := jsonapi .NewSRH (action_srh )
360342 if err != nil {
361343 return jsonapi.Action {}, err
362344 }
363- nh , err := jsonapi .NewNextHop (action_next_hop )
364- if err != nil {
365- return jsonapi.Action {}, err
366- }
367- return jsonapi.Action {NextHop : * nh , SRH : * srh }, err
345+ return jsonapi.Action {SRH : * srh }, err
368346 } else {
369347 return jsonapi.Action {}, fmt .Errorf ("Procedure not registered" )
370348 }
0 commit comments