kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 22 | import "C" |
| 23 | |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 24 | import ( |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 25 | "errors" |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 26 | rtmgrclient "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/rtmgr_client" |
| 27 | rtmgrhandle "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/rtmgr_client/handle" |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 29 | httptransport "github.com/go-openapi/runtime/client" |
| 30 | "github.com/go-openapi/strfmt" |
| 31 | "github.com/spf13/viper" |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 32 | "math/rand" |
| 33 | "strconv" |
| 34 | "time" |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 35 | ) |
| 36 | |
| 37 | type Control struct { |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 38 | e2ap *E2ap |
| 39 | registry *Registry |
| 40 | rtmgrClient *RtmgrClient |
| 41 | tracker *Tracker |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 42 | rcChan chan *xapp.RMRParams |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | type RMRMeid struct { |
| 46 | PlmnID string |
| 47 | EnbID string |
| 48 | } |
| 49 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 50 | var seedSN uint16 |
| 51 | var SubscriptionReqChan = make(chan SubRouteInfo, 10) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 52 | |
| 53 | const ( |
| 54 | CREATE Action = 0 |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 55 | MERGE Action = 1 |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 56 | DELETE Action = 3 |
| 57 | ) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 58 | |
| 59 | func init() { |
| 60 | viper.AutomaticEnv() |
| 61 | viper.SetEnvPrefix("submgr") |
| 62 | viper.AllowEmptyEnv(true) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 63 | seedSN = uint16(viper.GetInt("seed_sn")) |
| 64 | if seedSN == 0 { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 65 | rand.Seed(time.Now().UnixNano()) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 66 | seedSN = uint16(rand.Intn(65535)) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 67 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 68 | if seedSN > 65535 { |
| 69 | seedSN = 0 |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 70 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 71 | xapp.Logger.Info("SUBMGR: Initial Sequence Number: %v", seedSN) |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | func NewControl() Control { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 75 | registry := new(Registry) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 76 | registry.Initialize(seedSN) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 77 | |
Balint Uveges | e9608cd | 2019-09-20 18:00:32 +0000 | [diff] [blame] | 78 | tracker := new(Tracker) |
| 79 | tracker.Init() |
| 80 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 81 | transport := httptransport.New(viper.GetString("rtmgr.HostAddr")+":"+viper.GetString("rtmgr.port"), viper.GetString("rtmgr.baseUrl"), []string{"http"}) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 82 | client := rtmgrclient.New(transport, strfmt.Default) |
| 83 | handle := rtmgrhandle.NewProvideXappSubscriptionHandleParamsWithTimeout(10 * time.Second) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 84 | deleteHandle := rtmgrhandle.NewDeleteXappSubscriptionHandleParamsWithTimeout(10 * time.Second) |
| 85 | rtmgrClient := RtmgrClient{client, handle, deleteHandle} |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 86 | |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 87 | return Control{new(E2ap), registry, &rtmgrClient, tracker, make(chan *xapp.RMRParams)} |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | func (c *Control) Run() { |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 91 | go c.controlLoop() |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 92 | xapp.Run(c) |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 93 | } |
| 94 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 95 | func (c *Control) Consume(rp *xapp.RMRParams) (err error) { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 96 | c.rcChan <- rp |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 97 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 98 | } |
| 99 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 100 | func (c *Control) rmrSend(params *xapp.RMRParams) (err error) { |
| 101 | if !xapp.Rmr.Send(params, false) { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 102 | err = errors.New("rmr.Send() failed") |
| 103 | } |
| 104 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 105 | } |
| 106 | |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 107 | func (c *Control) rmrReplyToSender(params *xapp.RMRParams) (err error) { |
| 108 | if !xapp.Rmr.Send(params, true) { |
| 109 | err = errors.New("rmr.Send() failed") |
| 110 | } |
| 111 | return |
| 112 | } |
| 113 | |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 114 | func (c *Control) controlLoop() { |
| 115 | for { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 116 | msg := <-c.rcChan |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 117 | switch msg.Mtype { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 118 | case xapp.RICMessageTypes["RIC_SUB_REQ"]: |
| 119 | c.handleSubscriptionRequest(msg) |
| 120 | case xapp.RICMessageTypes["RIC_SUB_RESP"]: |
| 121 | c.handleSubscriptionResponse(msg) |
| 122 | case xapp.RICMessageTypes["RIC_SUB_DEL_REQ"]: |
| 123 | c.handleSubscriptionDeleteRequest(msg) |
| 124 | case xapp.RICMessageTypes["RIC_SUB_DEL_RESP"]: |
| 125 | c.handleSubscriptionDeleteResponse(msg) |
| 126 | default: |
| 127 | err := errors.New("Message Type " + strconv.Itoa(msg.Mtype) + " is discarded") |
| 128 | xapp.Logger.Error("Unknown message type: %v", err) |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 133 | func (c *Control) handleSubscriptionRequest(params *xapp.RMRParams) (err error) { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 134 | payloadSeqNum, err := c.e2ap.GetSubscriptionRequestSequenceNumber(params.Payload) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 135 | if err != nil { |
| 136 | err = errors.New("Unable to get Subscription Sequence Number from Payload due to: " + err.Error()) |
| 137 | return |
| 138 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 139 | xapp.Logger.Info("Subscription Request Received. RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 140 | |
| 141 | /* Reserve a sequence number and set it in the payload */ |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 142 | newSubId := c.registry.ReserveSequenceNumber() |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 143 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 144 | _, err = c.e2ap.SetSubscriptionRequestSequenceNumber(params.Payload, newSubId) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 145 | if err != nil { |
| 146 | err = errors.New("Unable to set Subscription Sequence Number in Payload due to: " + err.Error()) |
| 147 | return |
| 148 | } |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 149 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 150 | srcAddr, srcPort, err := c.rtmgrClient.SplitSource(params.Src) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 151 | if err != nil { |
| 152 | xapp.Logger.Error("Failed to update routing-manager about the subscription request with reason: %s", err) |
| 153 | return |
| 154 | } |
| 155 | |
| 156 | /* Create transatcion records for every subscription request */ |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 157 | xactKey := TransactionKey{newSubId, CREATE} |
| 158 | xactValue := Transaction{*srcAddr, *srcPort, params} |
| 159 | err = c.tracker.TrackTransaction(xactKey, xactValue) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 160 | if err != nil { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 161 | xapp.Logger.Error("Failed to create a Subscription Request transaction record due to %v", err) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 162 | return |
| 163 | } |
| 164 | |
| 165 | /* Update routing manager about the new subscription*/ |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 166 | subRouteAction := SubRouteInfo{CREATE, *srcAddr, *srcPort, newSubId} |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 167 | go c.rtmgrClient.SubscriptionRequestUpdate() |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 168 | SubscriptionReqChan <- subRouteAction |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 169 | |
| 170 | // Setting new subscription ID in the RMR header |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 171 | params.SubId = int(newSubId) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 172 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 173 | xapp.Logger.Info("Generated ID: %v. Forwarding to E2 Termination...", int(newSubId)) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 174 | c.rmrSend(params) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 175 | xapp.Logger.Debug("--- Debugging transaction table = %v", c.tracker.transactionTable) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 176 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 177 | } |
| 178 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 179 | func (c *Control) handleSubscriptionResponse(params *xapp.RMRParams) (err error) { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 180 | payloadSeqNum, err := c.e2ap.GetSubscriptionResponseSequenceNumber(params.Payload) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 181 | if err != nil { |
| 182 | err = errors.New("Unable to get Subscription Sequence Number from Payload due to: " + err.Error()) |
| 183 | return |
| 184 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 185 | xapp.Logger.Info("Subscription Response Received. RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum) |
| 186 | if !c.registry.IsValidSequenceNumber(payloadSeqNum) { |
| 187 | err = errors.New("Unknown Subscription ID: " + strconv.Itoa(int(payloadSeqNum)) + " in Subscritpion Response. Message discarded.") |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 188 | return |
| 189 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 190 | c.registry.setSubscriptionToConfirmed(payloadSeqNum) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 191 | xapp.Logger.Info("Subscription Response Registered. Forwarding to Requestor...") |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 192 | transaction, err := c.tracker.completeTransaction(payloadSeqNum, CREATE) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 193 | if err != nil { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 194 | xapp.Logger.Error("Failed to delete a Subscription Request transaction record due to %v", err) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 195 | return |
| 196 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 197 | xapp.Logger.Info("Subscription ID: %v, from address: %v:%v. Forwarding to E2 Termination...", int(payloadSeqNum), transaction.XappInstanceAddress, transaction.XappPort) |
| 198 | params.Mbuf = transaction.OrigParams.Mbuf |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 199 | c.rmrReplyToSender(params) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 200 | return |
| 201 | } |
| 202 | |
| 203 | func (act Action) String() string { |
| 204 | actions := [...]string{ |
| 205 | "CREATE", |
| 206 | "MERGE", |
| 207 | "DELETE", |
| 208 | } |
| 209 | |
| 210 | if act < CREATE || act > DELETE { |
| 211 | return "Unknown" |
| 212 | } |
| 213 | return actions[act] |
| 214 | } |
| 215 | |
| 216 | func (act Action) valid() bool { |
| 217 | switch act { |
| 218 | case CREATE, MERGE, DELETE: |
| 219 | return true |
| 220 | default: |
| 221 | return false |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func (c *Control) handleSubscriptionDeleteRequest(params *xapp.RMRParams) (err error) { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 226 | payloadSeqNum, err := c.e2ap.GetSubscriptionDeleteRequestSequenceNumber(params.Payload) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 227 | if err != nil { |
| 228 | err = errors.New("Unable to get Subscription Sequence Number from Payload due to: " + err.Error()) |
| 229 | return |
| 230 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 231 | xapp.Logger.Info("Subscription Delete Request Received. RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum) |
| 232 | if c.registry.IsValidSequenceNumber(payloadSeqNum) { |
| 233 | c.registry.deleteSubscription(payloadSeqNum) |
| 234 | trackErr := c.trackDeleteTransaction(params, payloadSeqNum) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 235 | if trackErr != nil { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 236 | xapp.Logger.Error("Failed to create a Subscription Delete Request transaction record due to %v", trackErr) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 237 | return trackErr |
| 238 | } |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 239 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 240 | xapp.Logger.Info("Subscription ID: %v. Forwarding to E2 Termination...", int(payloadSeqNum)) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 241 | c.rmrSend(params) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 242 | return |
| 243 | } |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 244 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 245 | func (c *Control) trackDeleteTransaction(params *xapp.RMRParams, payloadSeqNum uint16) (err error) { |
| 246 | srcAddr, srcPort, err := c.rtmgrClient.SplitSource(params.Src) |
| 247 | if err != nil { |
| 248 | xapp.Logger.Error("Failed to update routing-manager about the subscription delete request with reason: %s", err) |
| 249 | } |
| 250 | xactKey := TransactionKey{payloadSeqNum, DELETE} |
| 251 | xactValue := Transaction{*srcAddr, *srcPort, params} |
| 252 | err = c.tracker.TrackTransaction(xactKey, xactValue) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 253 | return |
| 254 | } |
| 255 | |
| 256 | func (c *Control) handleSubscriptionDeleteResponse(params *xapp.RMRParams) (err error) { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 257 | payloadSeqNum, err := c.e2ap.GetSubscriptionDeleteResponseSequenceNumber(params.Payload) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 258 | if err != nil { |
| 259 | err = errors.New("Unable to get Subscription Sequence Number from Payload due to: " + err.Error()) |
| 260 | return |
| 261 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 262 | var transaction, _ = c.tracker.RetriveTransaction(payloadSeqNum, DELETE) |
| 263 | subRouteAction := SubRouteInfo{DELETE, transaction.XappInstanceAddress, transaction.XappPort, payloadSeqNum} |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 264 | go c.rtmgrClient.SubscriptionRequestUpdate() |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 265 | SubscriptionReqChan <- subRouteAction |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 266 | |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 267 | xapp.Logger.Info("Subscription Delete Response Received. RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum) |
| 268 | if c.registry.releaseSequenceNumber(payloadSeqNum) { |
| 269 | transaction, err = c.tracker.completeTransaction(payloadSeqNum, DELETE) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 270 | if err != nil { |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 271 | xapp.Logger.Error("Failed to delete a Subscription Delete Request transaction record due to %v", err) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 272 | return |
| 273 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 274 | xapp.Logger.Info("Subscription ID: %v, from address: %v:%v. Forwarding to E2 Termination...", int(payloadSeqNum), transaction.XappInstanceAddress, transaction.XappPort) |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 275 | //params.Src = xAddress + ":" + strconv.Itoa(int(xPort)) |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame^] | 276 | params.Mbuf = transaction.OrigParams.Mbuf |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 277 | c.rmrReplyToSender(params) |
| 278 | } |
| 279 | return |
| 280 | } |