blob: 3231826f31b1f799c46ee7ab2cc43b7a22bb45ae [file] [log] [blame]
Arthur de Kerhor8a6f5d32021-05-20 11:48:00 +02001#!/usr/bin/env python3
2"""
3 UDP decap objects
4"""
5
6from vpp_object import VppObject
7from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
8
9
10class VppUdpDecap(VppObject):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020011 def __init__(self, test, is_ip4, dst_port, next_proto):
Arthur de Kerhor8a6f5d32021-05-20 11:48:00 +020012 self._test = test
13 self.active = False
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020014 self.udp_decap = {"is_ip4": is_ip4, "port": dst_port, "next_proto": next_proto}
Arthur de Kerhor8a6f5d32021-05-20 11:48:00 +020015
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