go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/ipfixplugin/vppcalls/vpp2202/vppcalls_handlers.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_fp "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2202/flowprobe"
    23  	vpp_ipfix "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2202/ipfix_export"
    24  	"go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/ifaceidx"
    25  	"go.ligato.io/vpp-agent/v3/plugins/vpp/ipfixplugin/vppcalls"
    26  )
    27  
    28  func init() {
    29  	var msgs []govppapi.Message
    30  	msgs = append(msgs, vpp_ipfix.AllMessages()...)
    31  	msgs = append(msgs, vpp_fp.AllMessages()...)
    32  
    33  	vppcalls.AddIpfixHandlerVersion(vpp2202.Version, msgs, NewIpfixVppHandler)
    34  }
    35  
    36  // IpfixVppHandler is accessor for IPFIX-related vppcalls methods.
    37  type IpfixVppHandler struct {
    38  	callsChannel govppapi.Channel
    39  	ifIndexes    ifaceidx.IfaceMetadataIndex
    40  	log          logging.Logger
    41  }
    42  
    43  // NewIpfixVppHandler creates new instance of IPFIX vppcalls handler.
    44  func NewIpfixVppHandler(callsChan govppapi.Channel,
    45  	ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger,
    46  ) vppcalls.IpfixVppAPI {
    47  	return &IpfixVppHandler{
    48  		callsChannel: callsChan,
    49  		ifIndexes:    ifIndexes,
    50  		log:          log,
    51  	}
    52  }