blob: 2bd03ce75c0c03e8d8e80af35305742fa3e36666 [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):
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