go.ligato.io/vpp-agent/v3@v3.5.0/clientv2/vpp/data_change_api.go (about)

     1  // Copyright (c) 2017 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 vppclient
    16  
    17  import (
    18  	abf "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/abf"
    19  	acl "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/acl"
    20  	interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces"
    21  	ipfix "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/ipfix"
    22  	ipsec "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/ipsec"
    23  	l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2"
    24  	l3 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l3"
    25  	nat "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/nat"
    26  	punt "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/punt"
    27  	stn "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/stn"
    28  )
    29  
    30  // DataChangeDSL defines Domain Specific Language (DSL) for data change.
    31  // of the VPP configuration.
    32  // Use this interface to make your implementation independent of the local
    33  // and any remote client.
    34  // Every DSL statement (apart from Send) returns the receiver (possibly wrapped
    35  // to change the scope of DSL), allowing the calls to be chained together
    36  // conveniently in a single statement.
    37  type DataChangeDSL interface {
    38  	// Put initiates a chained sequence of data change DSL statements, declaring
    39  	// new or changing existing configurable objects, e.g.:
    40  	//     Put().Interface(&memif).XConnect(&xconnect).BD(&BD) ... Send()
    41  	// The set of available objects to be created or changed is defined by PutDSL.
    42  	Put() PutDSL
    43  
    44  	// Delete initiates a chained sequence of data change DSL statements,
    45  	// removing existing configurable objects (by name), e.g.:
    46  	//     Delete().Interface(memifName).XConnect(xconnectName).BD(BDName) ... Send()
    47  	// The set of available objects to be removed is defined by DeleteDSL.
    48  	Delete() DeleteDSL
    49  
    50  	// Send propagates requested changes to the plugins.
    51  	Send() Reply
    52  }
    53  
    54  // PutDSL is a subset of data change DSL statements, used to declare new
    55  // VPP configuration or to change an existing one.
    56  type PutDSL interface {
    57  	// Interface adds a request to create or update VPP network interface.
    58  	Interface(val *interfaces.Interface) PutDSL
    59  	// Span adds VPP span to the Put request.
    60  	Span(span *interfaces.Span) PutDSL
    61  	// ACL adds a request to create or update VPP Access Control List.
    62  	ACL(acl *acl.ACL) PutDSL
    63  	// ABF adds a request to create or update VPP ACL-based forwarding.
    64  	ABF(abf *abf.ABF) PutDSL
    65  	// BD adds a request to create or update VPP Bridge Domain.
    66  	BD(val *l2.BridgeDomain) PutDSL
    67  	// BDFIB adds a request to create or update VPP L2 Forwarding Information Base.
    68  	BDFIB(fib *l2.FIBEntry) PutDSL
    69  	// XConnect adds a request to create or update VPP Cross Connect.
    70  	XConnect(val *l2.XConnectPair) PutDSL
    71  	// VrfTable adds a request to create or update VPP VRF table.
    72  	VrfTable(val *l3.VrfTable) PutDSL
    73  	// StaticRoute adds a request to create or update VPP L3 Static Route.
    74  	StaticRoute(val *l3.Route) PutDSL
    75  	// Arp adds a request to create or update VPP L3 ARP.
    76  	Arp(arp *l3.ARPEntry) PutDSL
    77  	// ProxyArpInterfaces adds a request to create or update VPP L3 proxy ARP interfaces
    78  	ProxyArp(proxyArp *l3.ProxyARP) PutDSL
    79  	// IPScanNeighbor adds L3 IP Scan Neighbor to the RESYNC request.
    80  	IPScanNeighbor(ipScanNeigh *l3.IPScanNeighbor) PutDSL
    81  	// StnRule adds a request to create or update Stn rule.
    82  	StnRule(stn *stn.Rule) PutDSL
    83  	// NAT44Global adds a request to set global configuration for NAT44
    84  	NAT44Global(nat *nat.Nat44Global) PutDSL
    85  	// DNAT44 adds a request to create or update DNAT44 configuration
    86  	DNAT44(dnat *nat.DNat44) PutDSL
    87  	// NAT44Interface adds a request to create or update NAT44 interface configuration.
    88  	NAT44Interface(natIf *nat.Nat44Interface) PutDSL
    89  	// NAT44AddressPool adds a request to create or update NAT44 address pool.
    90  	NAT44AddressPool(pool *nat.Nat44AddressPool) PutDSL
    91  	// IPSecSA adds request to create a new Security Association
    92  	IPSecSA(sa *ipsec.SecurityAssociation) PutDSL
    93  	// IPSecSPD adds request to create a new Security Policy Database
    94  	IPSecSPD(spd *ipsec.SecurityPolicyDatabase) PutDSL
    95  	// IPSecSP adds request to add a new Security Policy
    96  	IPSecSP(sp *ipsec.SecurityPolicy) PutDSL
    97  	// IPSecTunnelProtection adds request to create a new IPSec tunnel protection
    98  	IPSecTunnelProtection(tp *ipsec.TunnelProtection) PutDSL
    99  	// PuntIPRedirect adds request to create or update rule to punt L3 traffic via interface.
   100  	PuntIPRedirect(val *punt.IPRedirect) PutDSL
   101  	// PuntToHost adds request to create or update rule to punt L4 traffic to a host.
   102  	PuntToHost(val *punt.ToHost) PutDSL
   103  	// PuntException adds request to create or update exception to punt specific packets.
   104  	PuntException(val *punt.Exception) PutDSL
   105  	// IPFIX adds a request to update VPP IP Flow Information eXport configuration.
   106  	IPFIX(val *ipfix.IPFIX) PutDSL
   107  	// FlowprobeParams adds a request to update VPP Flowprobe Params.
   108  	FlowprobeParams(val *ipfix.FlowProbeParams) PutDSL
   109  	// FlowprobeFeature adds a request to enable Flowprobe Feature on interface.
   110  	FlowprobeFeature(val *ipfix.FlowProbeFeature) PutDSL
   111  	// VRRP adds a request to create or update VPP L3 VRRP.
   112  	VRRP(val *l3.VRRPEntry) PutDSL
   113  
   114  	// Delete changes the DSL mode to allow removal of an existing configuration.
   115  	// See documentation for DataChangeDSL.Delete().
   116  	Delete() DeleteDSL
   117  
   118  	// Send propagates requested changes to the plugins.
   119  	Send() Reply
   120  }
   121  
   122  // DeleteDSL is a subset of data change DSL statements, used to remove
   123  // an existing VPP configuration.
   124  type DeleteDSL interface {
   125  	// Interface adds a request to delete an existing VPP network interface.
   126  	Interface(ifaceName string) DeleteDSL
   127  	// Span adds VPP span to the Delete request.
   128  	Span(span *interfaces.Span) DeleteDSL
   129  	// ACL adds a request to delete an existing VPP Access Control List.
   130  	ACL(aclName string) DeleteDSL
   131  	// ABF adds a request to delete and existing VPP Access Control List.
   132  	ABF(abfIndex uint32) DeleteDSL
   133  	// BD adds a request to delete an existing VPP Bridge Domain.
   134  	BD(bdName string) DeleteDSL
   135  	// BDFIB adds a request to delete an existing VPP L2 Forwarding Information
   136  	// Base.
   137  	BDFIB(bdName string, mac string) DeleteDSL
   138  	// XConnect adds a request to delete an existing VPP Cross Connect.
   139  	XConnect(rxIfaceName string) DeleteDSL
   140  	// VrfTable adds a request to delete existing VPP VRF table.
   141  	VrfTable(id uint32, proto l3.VrfTable_Protocol) DeleteDSL
   142  	// StaticRoute adds a request to delete an existing VPP L3 Static Route.
   143  	StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL
   144  	// Arp adds a request to delete an existing VPP L3 ARP.
   145  	Arp(ifaceName string, ipAddr string) DeleteDSL
   146  	// ProxyArpInterfaces adds a request to delete an existing VPP L3 proxy ARP interfaces
   147  	ProxyArp() DeleteDSL
   148  	// IPScanNeighbor adds a request to delete an existing VPP L3 IP Scan Neighbor.
   149  	IPScanNeighbor() DeleteDSL
   150  	// StnRule adds a request to delete an existing Stn rule.
   151  	StnRule(iface, addr string) DeleteDSL
   152  	// NAT44Global adds a request to remove global configuration for NAT44
   153  	NAT44Global() DeleteDSL
   154  	// DNAT44 adds a request to delete an existing DNAT44 configuration
   155  	DNAT44(label string) DeleteDSL
   156  	// NAT44Interface adds a request to delete NAT44 interface configuration.
   157  	NAT44Interface(natIf *nat.Nat44Interface) DeleteDSL
   158  	// NAT44AddressPool adds a request to delete NAT44 address pool.
   159  	NAT44AddressPool(pool *nat.Nat44AddressPool) DeleteDSL
   160  	// IPSecSA adds request to delete a Security Association
   161  	IPSecSA(saIndex uint32) DeleteDSL
   162  	// IPSecSPD adds request to delete a Security Policy Database
   163  	IPSecSPD(spdIndex uint32) DeleteDSL
   164  	// IPSecSP adds request to delete a Security Policy
   165  	IPSecSP(sp *ipsec.SecurityPolicy) DeleteDSL
   166  	// IPSecTunnelProtection adds request to delete an IPSec tunnel protection from an interface
   167  	IPSecTunnelProtection(tp *ipsec.TunnelProtection) DeleteDSL
   168  	// PuntIPRedirect adds request to delete a rule used to punt L3 traffic via interface.
   169  	PuntIPRedirect(l3Proto punt.L3Protocol, txInterface string) DeleteDSL
   170  	// PuntToHost adds request to delete a rule used to punt L4 traffic to a host.
   171  	PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protocol, port uint32) DeleteDSL
   172  	// PuntException adds request to delete exception to punt specific packets.
   173  	PuntException(reason string) DeleteDSL
   174  	// FlowprobeFeature adds a request to disable Flowprobe Feature on interface.
   175  	FlowprobeFeature(val *ipfix.FlowProbeFeature) DeleteDSL
   176  	// VRRP adds a request to delete VPP L3 VRRP.
   177  	VRRP(val *l3.VRRPEntry) DeleteDSL
   178  
   179  	// Put changes the DSL mode to allow configuration editing.
   180  	// See documentation for DataChangeDSL.Put().
   181  	Put() PutDSL
   182  
   183  	// Send propagates requested changes to the plugins.
   184  	Send() Reply
   185  }
   186  
   187  // Reply interface allows to wait for a reply to previously called Send() and
   188  // extract the result from it (success/error).
   189  type Reply interface {
   190  	// ReceiveReply waits for a reply to previously called Send() and returns
   191  	// the result (error or nil).
   192  	ReceiveReply() error
   193  }