summaryrefslogtreecommitdiffstats
path: root/src/plugins/flowprobe/flowprobe.api
blob: 55dd51d3c30c7ba47a50ec4842ad5e1e6ece2357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Define a simple enable-disable binary API to control the feature */

/** \file
    This file defines the vpp control-plane API messages
    used to control the flowprobe plugin
*/

option version = "1.0.0";

import "vnet/interface_types.api";

enum flowprobe_which_flags : u8
{
  FLOWPROBE_WHICH_FLAG_IP4 = 0x1,
  FLOWPROBE_WHICH_FLAG_L2  = 0x2,
  FLOWPROBE_WHICH_FLAG_IP6 = 0x4,
};

enum flowprobe_record_flags : u8
{
  FLOWPROBE_RECORD_FLAG_L2 = 0x1,
  FLOWPROBE_RECORD_FLAG_L3 = 0x2,
  FLOWPROBE_RECORD_FLAG_L4 = 0x4,
};

/** \brief Enable / disable per-packet IPFIX recording on an interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param which - flags indicating forwarding path
    @param sw_if_index - index of the interface
*/
autoreply define flowprobe_tx_interface_add_del
{
  /* Client identifier, set from api_main.my_client_index */
  u32 client_index;

  /* Arbitrary context, so client can match reply to request */
  u32 context;

  /* Enable / disable the feature */
  bool is_add;
  vl_api_flowprobe_which_flags_t which;

  /* Interface handle */
  vl_api_interface_index_t sw_if_index;
  option vat_help = "<intfc> [disable]";
};

autoreply define flowprobe_params
{
  u32 client_index;
  u32 context;
  vl_api_flowprobe_record_flags_t record_flags;
  u32 active_timer;  /* ~0 is off, 0 is default */
  u32 passive_timer; /* ~0 is off, 0 is default */
  option vat_help = "record <[l2] [l3] [l4]> [active <timer> passive <timer>]";
};
S config VPP """ from vpp_object import VppObject class VppQosRecord(VppObject): """ QoS Record(ing) configuration """ def __init__(self, test, intf, source): self._test = test self.intf = intf self.source = source def add_vpp_config(self): self._test.vapi.qos_record_enable_disable( enable=1, record={'sw_if_index': self.intf.sw_if_index, 'input_source': self.source}) self._test.registry.register(self, self._test.logger) return self def remove_vpp_config(self): self._test.vapi.qos_record_enable_disable( enable=0, record={'sw_if_index': self.intf.sw_if_index, 'input_source': self.source}) def query_vpp_config(self): rs = self._test.vapi.qos_record_dump() for r in rs: if self.intf.sw_if_index == r.record.sw_if_index and \ self.source == r.record.input_source: return True return False def object_id(self): return ("qos-record-%s-%d" % (self.intf, self.source)) class VppQosStore(VppObject): """ QoS Store(ing) configuration """ def __init__(self, test, intf, source, value): self._test = test self.intf = intf self.source = source self.value = value def add_vpp_config(self): self._test.vapi.qos_store_enable_disable( enable=1, store={'sw_if_index': self.intf.sw_if_index, 'input_source': self.source, 'value': self.value}) self._test.registry.register(self, self._test.logger) return self def remove_vpp_config(self): self._test.vapi.qos_store_enable_disable( enable=0, store={'sw_if_index': self.intf.sw_if_index, 'input_source': self.source}) def query_vpp_config(self): rs = self._test.vapi.qos_store_dump() for r in rs: if self.intf.sw_if_index == r.store.sw_if_index and \ self.source == r.store.input_source and \ self.value == r.store.value: return True return False def object_id(self): return ("qos-store-%s-%d" % (self.intf, self.source)) class VppQosEgressMap(VppObject): """ QoS Egress Map(ping) configuration """ def __init__(self, test, id, rows): self._test = test self.id = id self.rows = rows def add_vpp_config(self): self._test.vapi.qos_egress_map_update( map={'id': self.id, 'rows': self.rows}) self._test.registry.register(self, self._test.logger) return self def remove_vpp_config(self): self._test.vapi.qos_egress_map_delete(id=self.id) def query_vpp_config(self): rs = self._test.vapi.qos_egress_map_dump() for r in rs: if self.id == r.map.id: return True return False def object_id(self): return ("qos-map-%d" % (self.id)) class VppQosMark(VppObject): """ QoS Mark(ing) configuration """ def __init__(self, test, intf, map, source): self._test = test self.intf = intf self.source = source self.map = map def add_vpp_config(self): self._test.vapi.qos_mark_enable_disable( enable=1, mark={'sw_if_index': self.intf.sw_if_index, 'map_id': self.map.id, 'output_source': self.source}) self._test.registry.register(self, self._test.logger) return self def remove_vpp_config(self): self._test.vapi.qos_mark_enable_disable( enable=0, mark={'sw_if_index': self.intf.sw_if_index, 'output_source': self.source}) def query_vpp_config(self): ms = self._test.vapi.qos_mark_dump() for m in ms: if self.intf.sw_if_index == m.mark.sw_if_index and \ self.source == m.mark.output_source and \ self.map.id == m.mark.map_id: return True return False def object_id(self): return ("qos-mark-%s-%d" % (self.intf, self.source))