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): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 11 | def __init__(self, test, is_ip4, dst_port, next_proto): |
Arthur de Kerhor | 8a6f5d3 | 2021-05-20 11:48:00 +0200 | [diff] [blame] | 12 | self._test = test |
| 13 | self.active = False |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 14 | self.udp_decap = {"is_ip4": is_ip4, "port": dst_port, "next_proto": next_proto} |
Arthur de Kerhor | 8a6f5d3 | 2021-05-20 11:48:00 +0200 | [diff] [blame] | 15 | |
| 16 | def add_vpp_config(self): |
| 17 | self._test.vapi.udp_decap_add_del(True, self.udp_decap) |
| 18 | self._test.registry.register(self, self._test.logger) |
| 19 | self.active = True |
| 20 | |
| 21 | def query_vpp_config(self): |
| 22 | return self.active |
| 23 | |
| 24 | def remove_vpp_config(self): |
| 25 | self._test.vapi.udp_decap_add_del(False, self.udp_decap) |
| 26 | self.active = False |