func (h *InterfaceMockHandler) ApplyTxn(txn *localclient.Txn, latestRevs *syncbase.PrevRevisions) error {
	h.log.Debug("Started retrieving Interface data from localclient transaction that is currently applied")
	if txn == nil {
		return errors.New("txn is nil")
	}
	values := make(map[string]proto.Message)
	if txn.VPPDataResyncTxn != nil {
		h.reset()
		values = mapAppend(values, txn.VPPDataResyncTxn.CommonMockDSL.Values)
	}
	if txn.LinuxDataResyncTxn != nil {
		h.reset()
		values = mapAppend(values, txn.LinuxDataResyncTxn.CommonMockDSL.Values)
	}
	if txn.VPPDataChangeTxn != nil {
		values = mapAppend(values, txn.VPPDataChangeTxn.CommonMockDSL.Values)
	}
	if txn.LinuxDataChangeTxn != nil {
		values = mapAppend(values, txn.LinuxDataChangeTxn.CommonMockDSL.Values)
	}
	for key, value := range values {
		if name, isValid := linux_interfaces.ModelInterface.ParseKey(key); isValid {
			if value != nil {
				h.Interfaces[name] = value.(*linux_interfaces.Interface)
			} else {
				delete(h.Interfaces, name)
			}
		}
	}
	return nil
}
ApplyTxn is called when applying transaction created by Contiv code for VPP-Agent to set up VPP. Interface data from transaction
are further stored (mocking VPP-Agent) and later exposed by other methods/fields to i.e. unit tests for verification purposes.
package handler
import (
	"errors"
	"github.com/contiv/vpp/mock/localclient"
	"github.com/golang/protobuf/proto"
	"go.ligato.io/cn-infra/v2/datasync/syncbase"
	"go.ligato.io/cn-infra/v2/logging"
	linux_interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/linux/interfaces"
)
type InterfaceMockHandler struct {
	log        logging.Logger
	Interfaces map[string]*linux_interfaces.Interface
}
func NewInterfaceMock(log logging.Logger) *InterfaceMockHandler {
	return &InterfaceMockHandler{
		log:        log,
		Interfaces: make(map[string]*linux_interfaces.Interface),
	}
}