go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/vpp.go (about) 1 // Copyright (c) 2019 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 vpp 16 17 import ( 18 "errors" 19 20 govppapi "go.fd.io/govpp/api" 21 22 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi" 23 ) 24 25 var ( 26 // ErrIncompatible is an error returned when no compatible handler is found. 27 ErrIncompatible = errors.New("incompatible handler") 28 // ErrNoVersions is an error returned when no handler versions are found. 29 ErrNoVersions = errors.New("no handler versions") 30 // ErrPluginDisabled is an error returned when disabled plugin is detected. 31 ErrPluginDisabled = errors.New("plugin not available") 32 ) 33 34 type Version = binapi.Version 35 36 // Client provides methods for managing VPP. 37 type Client interface { 38 govppapi.Connection 39 binapi.CompatibilityChecker 40 41 // NewAPIChannel returns new channel for sending binapi requests. 42 NewAPIChannel() (govppapi.Channel, error) 43 // Stats provides access to VPP stats API. 44 Stats() govppapi.StatsProvider 45 // IsPluginLoaded returns true if the given plugin is currently loaded. 46 IsPluginLoaded(plugin string) bool 47 // BinapiVersion returns preferred binapi version. 48 BinapiVersion() Version 49 // OnReconnect registers handler function to be executed on reconnect. 50 OnReconnect(h func()) 51 }