vpp-agent icon indicating copy to clipboard operation
vpp-agent copied to clipboard

Can not delete the wg peer for the metadata is nil

Open mulspace opened this issue 4 years ago • 0 comments

Hi,

When I configure the wg and wg peer by vpp-agent, it works.

And when restart vpp-agent, it will try to delete the wg peer. And it is failed for the Metadata is nil.

The log is: Oct 29 15:30:10 pop vpp-agent[489658]: 87. DELETE [DISCOVERED]: Oct 29 15:30:10 pop vpp-agent[489658]: - key: config/vpp/wg/v1/peer/wg0/endpoint/172.20.60.80/54321 Oct 29 15:30:10 pop vpp-agent[489658]: - value: { public_key:"HF/PyzhqvfoXWeM7hRhhNBlVEG7OvltAZxKT5lyT4RU=" port:54321 endpoint:"172.20.60.80" wg_if_name:"wg0" allowed_ips:"10.0.0.2/32" } Oct 29 15:30:10 pop vpp-agent[489658]: - error: failed to delete peer - metadata is nil

From the code, the WithMetadata is True for PeerDescriptor. And there is no MetadataFactory for it. At as result of it, the WgMetadata may be not saved when create wg peer.

@@ -89,21 +92,32 @@ func NewWgPeerDescriptor(wgHandler vppcalls.WgVppAPI, log logging.PluginLogger)
 // the KVScheduler.
 func (d *WgPeerDescriptor) GetDescriptor() *adapter.PeerDescriptor {
        return &adapter.PeerDescriptor{
               WithMetadata:         true,
+               MetadataMapFactory: d.MetadataFactory
        }
 }

Is there any fix/workaround for it.

Thanks.

mulspace avatar Oct 29 '21 16:10 mulspace