go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/stnplugin/vppcalls/vpp2202/vppcalls_handler.go (about)

     1  //  Copyright (c) 2022 Cisco and/or its affiliates.
     2  //
     3  //  Licensed under the Apache License, Version 2.0 (the "License");
     4  //  you may not use this file except in compliance with the License.
     5  //  You may obtain a copy of the License at:
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  //  Unless required by applicable law or agreed to in writing, software
    10  //  distributed under the License is distributed on an "AS IS" BASIS,
    11  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //  See the License for the specific language governing permissions and
    13  //  limitations under the License.
    14  
    15  package vpp2202
    16  
    17  import (
    18  	govppapi "go.fd.io/govpp/api"
    19  	"go.ligato.io/cn-infra/v2/logging"
    20  
    21  	vpp2202 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2202"
    22  	vpp_stn "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2202/stn"
    23  	"go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/ifaceidx"
    24  	"go.ligato.io/vpp-agent/v3/plugins/vpp/stnplugin/vppcalls"
    25  )
    26  
    27  func init() {
    28  	var msgs []govppapi.Message
    29  	msgs = append(msgs, vpp_stn.AllMessages()...)
    30  
    31  	vppcalls.AddStnHandlerVersion(vpp2202.Version, msgs, NewStnVppHandler)
    32  }
    33  
    34  // StnVppHandler is accessor for STN-related vppcalls methods
    35  type StnVppHandler struct {
    36  	callsChannel govppapi.Channel
    37  	ifIndexes    ifaceidx.IfaceMetadataIndex
    38  	log          logging.Logger
    39  }
    40  
    41  // NewStnVppHandler creates new instance of STN vppcalls handler
    42  func NewStnVppHandler(
    43  	callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger,
    44  ) vppcalls.StnVppAPI {
    45  	return &StnVppHandler{
    46  		callsChannel: callsChan,
    47  		ifIndexes:    ifIndexes,
    48  		log:          log,
    49  	}
    50  }