Arthur de Kerhor | 8a6f5d3 | 2021-05-20 11:48:00 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | """ |
| 3 | UDP decap objects |
| 4 | """ |
| 5 | |
| 6 | from vpp_object import VppObject |
| 7 | from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 |
| 8 | |
| 9 | |
| 10 | class VppUdpDecap(VppObject): |
| 11 | |
| 12 | def __init__(self, |
| 13 | test, |
| 14 | is_ip4, |
| 15 | dst_port, |
| 16 | next_proto): |
| 17 | self._test = test |
| 18 | self.active = False |
| 19 | self.udp_decap = { |
| 20 | 'is_ip4': is_ip4, |
| 21 | 'port': dst_port, |
| 22 | 'next_proto': next_proto |
| 23 | } |
| 24 | |
| 25 | def add_vpp_config(self): |
| 26 | self._test.vapi.udp_decap_add_del(True, self.udp_decap) |
| 27 | self._test.registry.register(self, self._test.logger) |
| 28 | self.active = True |
| 29 | |
| 30 | def query_vpp_config(self): |
| 31 | return self.active |
| 32 | |
| 33 | def remove_vpp_config(self): |
| 34 | self._test.vapi.udp_decap_add_del(False, self.udp_decap) |
| 35 | self.active = False |