go.ligato.io/vpp-agent/v3@v3.5.0/clientv2/linux/data_change_api.go (about) 1 // Copyright (c) 2018 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 linuxclient 16 17 import ( 18 vpp_clientv2 "go.ligato.io/vpp-agent/v3/clientv2/vpp" 19 linux_interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/linux/interfaces" 20 linux_iptables "go.ligato.io/vpp-agent/v3/proto/ligato/linux/iptables" 21 linux_l3 "go.ligato.io/vpp-agent/v3/proto/ligato/linux/l3" 22 vpp_abf "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/abf" 23 vpp_acl "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/acl" 24 vpp_interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces" 25 ipfix "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/ipfix" 26 ipsec "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/ipsec" 27 vpp_l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2" 28 vpp_l3 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l3" 29 nat "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/nat" 30 punt "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/punt" 31 vpp_stn "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/stn" 32 ) 33 34 // DataChangeDSL defines the Domain Specific Language (DSL) for data change 35 // of both Linux and VPP configuration. 36 // Use this interface to make your implementation independent of the local 37 // and any remote client. 38 // Every DSL statement (apart from Send) returns the receiver (possibly wrapped 39 // to change the scope of DSL), allowing the calls to be chained together 40 // conveniently in a single statement. 41 type DataChangeDSL interface { 42 // Put initiates a chained sequence of data change DSL statements, declaring 43 // new configurable objects or changing existing ones, e.g.: 44 // Put().LinuxInterface(&veth).VppInterface(&afpacket).BD(&BD) ... Send() 45 // The set of available objects to be created or changed is defined by PutDSL. 46 Put() PutDSL 47 48 // Delete initiates a chained sequence of data change DSL statements, 49 // removing existing configurable objects (by name), e.g: 50 // Delete().LinuxInterface(vethName).VppInterface(afpacketName).BD(BDName) ... Send() 51 // The set of available objects to be removed is defined by DeleteDSL. 52 Delete() DeleteDSL 53 54 // Send propagates requested changes to the plugins. 55 Send() vpp_clientv2.Reply 56 } 57 58 // PutDSL is a subset of data change DSL statements, used to declare new 59 // Linux or VPP configuration or change existing one. 60 type PutDSL interface { 61 // LinuxInterface adds a request to create or update Linux network interface. 62 LinuxInterface(val *linux_interfaces.Interface) PutDSL 63 // LinuxArpEntry adds a request to crete or update Linux ARP entry 64 LinuxArpEntry(val *linux_l3.ARPEntry) PutDSL 65 // LinuxRoute adds a request to crete or update Linux route 66 LinuxRoute(val *linux_l3.Route) PutDSL 67 // IptablesRuleChain adds request to create or update iptables rule chain. 68 IptablesRuleChain(val *linux_iptables.RuleChain) PutDSL 69 70 // VppInterface adds a request to create or update VPP network interface. 71 VppInterface(val *vpp_interfaces.Interface) PutDSL 72 // Span adds VPP span to the Put request. 73 Span(span *vpp_interfaces.Span) PutDSL 74 // ACL adds a request to create or update VPP Access Control List. 75 ACL(acl *vpp_acl.ACL) PutDSL 76 // ABF adds a request to create or update VPP ACL-based forwarding. 77 ABF(abf *vpp_abf.ABF) PutDSL 78 /*// BfdSession adds a request to create or update VPP bidirectional 79 // forwarding detection session. 80 BfdSession(val *vpp_bfd.SingleHopBFD_Session) PutDSL 81 // BfdAuthKeys adds a request to create or update VPP bidirectional 82 // forwarding detection key. 83 BfdAuthKeys(val *vpp_bfd.SingleHopBFD_Key) PutDSL 84 // BfdEchoFunction adds a request to create or update VPP bidirectional 85 // forwarding detection echo function. 86 BfdEchoFunction(val *vpp_bfd.SingleHopBFD_EchoFunction) PutDSL*/ 87 // BD adds a request to create or update VPP Bridge Domain. 88 BD(val *vpp_l2.BridgeDomain) PutDSL 89 // BDFIB adds a request to create or update VPP L2 Forwarding Information Base. 90 BDFIB(fib *vpp_l2.FIBEntry) PutDSL 91 // VrfTable adds a request to create or update VPP VRF table. 92 VrfTable(val *vpp_l3.VrfTable) PutDSL 93 // XConnect adds a request to create or update VPP Cross Connect. 94 XConnect(val *vpp_l2.XConnectPair) PutDSL 95 // StaticRoute adds a request to create or update VPP L3 Static Route. 96 StaticRoute(val *vpp_l3.Route) PutDSL 97 // Arp adds a request to create or update VPP L3 ARP. 98 Arp(arp *vpp_l3.ARPEntry) PutDSL 99 // ProxyArp adds a request to create or update VPP L3 proxy ARP. 100 ProxyArp(proxyArp *vpp_l3.ProxyARP) PutDSL 101 // IPScanNeighbor adds L3 IP Scan Neighbor to the RESYNC request. 102 IPScanNeighbor(ipScanNeigh *vpp_l3.IPScanNeighbor) PutDSL 103 /*// L4Features adds a request to enable or disable L4 features 104 L4Features(val *vpp_l4.L4Features) PutDSL 105 // AppNamespace adds a request to create or update VPP Application namespace 106 AppNamespace(appNs *vpp_l4.AppNamespaces_AppNamespace) PutDSL*/ 107 // StnRule adds a request to create or update VPP Stn rule. 108 StnRule(stn *vpp_stn.Rule) PutDSL 109 // NAT44Global adds a request to set global configuration for NAT44 110 NAT44Global(nat *nat.Nat44Global) PutDSL 111 // DNAT44 adds a request to create or update DNAT44 configuration 112 DNAT44(dnat *nat.DNat44) PutDSL 113 // NAT44Interface adds a request to create or update NAT44 interface configuration. 114 NAT44Interface(natIf *nat.Nat44Interface) PutDSL 115 // NAT44AddressPool adds a request to create or update NAT44 address pool. 116 NAT44AddressPool(pool *nat.Nat44AddressPool) PutDSL 117 // IPSecSA adds request to create a new Security Association 118 IPSecSA(sa *ipsec.SecurityAssociation) PutDSL 119 // IPSecSPD adds request to create a new Security Policy Database 120 IPSecSPD(spd *ipsec.SecurityPolicyDatabase) PutDSL 121 // IPSecSP adds request to create a new Security Policy 122 IPSecSP(sp *ipsec.SecurityPolicy) PutDSL 123 // IPSecTunnelProtection adds request to create a new IPSec tunnel protection 124 IPSecTunnelProtection(tp *ipsec.TunnelProtection) PutDSL 125 // PuntIPRedirect adds request to create or update rule to punt L3 traffic via interface. 126 PuntIPRedirect(val *punt.IPRedirect) PutDSL 127 // PuntToHost adds request to create or update rule to punt L4 traffic to a host. 128 PuntToHost(val *punt.ToHost) PutDSL 129 // PuntException adds request to create or update exception to punt specific packets. 130 PuntException(val *punt.Exception) PutDSL 131 // IPFIX adds a request to update VPP IP Flow Information eXport configuration. 132 IPFIX(val *ipfix.IPFIX) PutDSL 133 // FlowprobeParams adds a request to update VPP Flowprobe Params. 134 FlowprobeParams(val *ipfix.FlowProbeParams) PutDSL 135 // FlowprobeFeature adds a request to enable Flowprobe Feature on interface. 136 FlowprobeFeature(val *ipfix.FlowProbeFeature) PutDSL 137 // VRRP adds a request to create or update VPP L3 VRRP. 138 VRRP(val *vpp_l3.VRRPEntry) PutDSL 139 140 // Delete changes the DSL mode to allow removing an existing configuration. 141 // See documentation for DataChangeDSL.Delete(). 142 Delete() DeleteDSL 143 144 // Send propagates requested changes to the plugins. 145 Send() vpp_clientv2.Reply 146 } 147 148 // DeleteDSL is a subset of data change DSL statements, used to remove 149 // existing Linux or VPP configuration. 150 type DeleteDSL interface { 151 // LinuxInterface adds a request to delete an existing Linux network 152 // interface. 153 LinuxInterface(ifaceName string) DeleteDSL 154 // LinuxArpEntry adds a request to delete Linux ARP entry 155 LinuxArpEntry(ifaceName string, ipAddr string) DeleteDSL 156 // LinuxRoute adds a request to delete Linux route 157 LinuxRoute(dstAddr, outIfaceName string) DeleteDSL 158 // IptablesRuleChain adds request to delete iptables rule chain. 159 IptablesRuleChain(name string) DeleteDSL 160 161 // VppInterface adds a request to delete an existing VPP network interface. 162 VppInterface(ifaceName string) DeleteDSL 163 // Span adds VPP span to the Delete request. 164 Span(span *vpp_interfaces.Span) DeleteDSL 165 // ACL adds a request to delete an existing VPP Access Control List. 166 ACL(aclName string) DeleteDSL 167 // ABF adds a request to delete an existing VPP ACL-based forwarding. 168 ABF(abfIndex uint32) DeleteDSL 169 /*// BfdSession adds a request to delete an existing VPP bidirectional 170 // forwarding detection session. 171 BfdSession(bfdSessionIfaceName string) DeleteDSL 172 // BfdAuthKeys adds a request to delete an existing VPP bidirectional 173 // forwarding detection key. 174 BfdAuthKeys(bfdKey string) DeleteDSL 175 // BfdEchoFunction adds a request to delete an existing VPP bidirectional 176 // forwarding detection echo function. 177 BfdEchoFunction(bfdEchoName string) DeleteDSL*/ 178 // BD adds a request to delete an existing VPP Bridge Domain. 179 BD(bdName string) DeleteDSL 180 // FIB adds a request to delete an existing VPP L2 Forwarding Information 181 // Base. 182 BDFIB(bdName string, mac string) DeleteDSL 183 // VrfTable adds a request to delete existing VPP VRF table. 184 VrfTable(id uint32, proto vpp_l3.VrfTable_Protocol) DeleteDSL 185 // XConnect adds a request to delete an existing VPP Cross Connect. 186 XConnect(rxIfaceName string) DeleteDSL 187 // StaticRoute adds a request to delete an existing VPP L3 Static Route. 188 StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL 189 /*// L4Features adds a request to enable or disable L4 features 190 L4Features() DeleteDSL 191 // AppNamespace adds a request to delete VPP Application namespace 192 // Note: current version does not support application namespace deletion 193 AppNamespace(id string) DeleteDSL*/ 194 // Arp adds a request to delete an existing VPP L3 ARP. 195 Arp(ifaceName string, ipAddr string) DeleteDSL 196 // ProxyArp adds a request to delete an existing VPP L3 proxy ARP 197 ProxyArp() DeleteDSL 198 // IPScanNeighbor adds a request to delete an existing VPP L3 IP Scan Neighbor. 199 IPScanNeighbor() DeleteDSL 200 // StnRule adds a request to delete an existing VPP Stn rule. 201 StnRule(iface, addr string) DeleteDSL 202 // NAT44Global adds a request to remove global configuration for NAT44 203 NAT44Global() DeleteDSL 204 // DNAT44 adds a request to delete an existing DNAT-44 configuration 205 DNAT44(label string) DeleteDSL 206 // NAT44Interface adds a request to delete NAT44 interface configuration. 207 NAT44Interface(natIf *nat.Nat44Interface) DeleteDSL 208 // NAT44AddressPool adds a request to delete NAT44 address pool. 209 NAT44AddressPool(pool *nat.Nat44AddressPool) DeleteDSL 210 // IPSecSA adds request to delete a Security Association 211 IPSecSA(saIndex uint32) DeleteDSL 212 // IPSecSPD adds request to delete a Security Policy Database 213 IPSecSPD(spdIndex uint32) DeleteDSL 214 // IPSecSP adds request to delete a Security Policy 215 IPSecSP(sp *ipsec.SecurityPolicy) DeleteDSL 216 // IPSecTunnelProtection adds request to delete an IPSec tunnel protection from an interface 217 IPSecTunnelProtection(tp *ipsec.TunnelProtection) DeleteDSL 218 // PuntIPRedirect adds request to delete a rule used to punt L3 traffic via interface. 219 PuntIPRedirect(l3Proto punt.L3Protocol, txInterface string) DeleteDSL 220 // PuntToHost adds request to delete a rule used to punt L4 traffic to a host. 221 PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protocol, port uint32) DeleteDSL 222 // PuntException adds request to delete exception to punt specific packets. 223 PuntException(reason string) DeleteDSL 224 // FlowprobeFeature adds a request to disable Flowprobe Feature on interface. 225 FlowprobeFeature(val *ipfix.FlowProbeFeature) DeleteDSL 226 // VRRP adds a request to delete VPP L3 VRRP. 227 VRRP(val *vpp_l3.VRRPEntry) DeleteDSL 228 229 // Put changes the DSL mode to allow configuration editing. 230 // See documentation for DataChangeDSL.Put(). 231 Put() PutDSL 232 233 // Send propagates requested changes to the plugins. 234 Send() vpp_clientv2.Reply 235 }