4 object abstractions for representing QoS config VPP
7 from vpp_object import VppObject
10 class VppQosRecord(VppObject):
11 """ QoS Record(ing) configuration """
13 def __init__(self, test, intf, source):
18 def add_vpp_config(self):
19 self._test.vapi.qos_record_enable_disable(
21 record={'sw_if_index': self.intf.sw_if_index,
22 'input_source': self.source})
23 self._test.registry.register(self, self._test.logger)
26 def remove_vpp_config(self):
27 self._test.vapi.qos_record_enable_disable(
29 record={'sw_if_index': self.intf.sw_if_index,
30 'input_source': self.source})
32 def query_vpp_config(self):
33 rs = self._test.vapi.qos_record_dump()
36 if self.intf.sw_if_index == r.record.sw_if_index and \
37 self.source == r.record.input_source:
42 return ("qos-record-%s-%d" % (self.intf, self.source))
45 class VppQosStore(VppObject):
46 """ QoS Store(ing) configuration """
48 def __init__(self, test, intf, source, value):
54 def add_vpp_config(self):
55 self._test.vapi.qos_store_enable_disable(
57 store={'sw_if_index': self.intf.sw_if_index,
58 'input_source': self.source,
60 self._test.registry.register(self, self._test.logger)
63 def remove_vpp_config(self):
64 self._test.vapi.qos_store_enable_disable(
66 store={'sw_if_index': self.intf.sw_if_index,
67 'input_source': self.source})
69 def query_vpp_config(self):
70 rs = self._test.vapi.qos_store_dump()
73 if self.intf.sw_if_index == r.store.sw_if_index and \
74 self.source == r.store.input_source and \
75 self.value == r.store.value:
80 return ("qos-store-%s-%d" % (self.intf, self.source))
83 class VppQosEgressMap(VppObject):
84 """ QoS Egress Map(ping) configuration """
86 def __init__(self, test, id, rows):
91 def add_vpp_config(self):
92 self._test.vapi.qos_egress_map_update(
95 self._test.registry.register(self, self._test.logger)
98 def remove_vpp_config(self):
99 self._test.vapi.qos_egress_map_delete(id=self.id)
101 def query_vpp_config(self):
102 rs = self._test.vapi.qos_egress_map_dump()
105 if self.id == r.map.id:
110 return ("qos-map-%d" % (self.id))
113 class VppQosMark(VppObject):
114 """ QoS Mark(ing) configuration """
116 def __init__(self, test, intf, map, source):
122 def add_vpp_config(self):
123 self._test.vapi.qos_mark_enable_disable(
125 mark={'sw_if_index': self.intf.sw_if_index,
126 'map_id': self.map.id,
127 'output_source': self.source})
128 self._test.registry.register(self, self._test.logger)
131 def remove_vpp_config(self):
132 self._test.vapi.qos_mark_enable_disable(
134 mark={'sw_if_index': self.intf.sw_if_index,
135 'output_source': self.source})
137 def query_vpp_config(self):
138 ms = self._test.vapi.qos_mark_dump()
141 if self.intf.sw_if_index == m.mark.sw_if_index and \
142 self.source == m.mark.output_source and \
143 self.map.id == m.mark.map_id:
148 return ("qos-mark-%s-%d" % (self.intf, self.source))