blob: d1a308878c561a6070e439eccedcf3c04dc8cbff [file] [log] [blame]
Jakub Grajciar7b867a82017-12-08 16:28:42 +01001
2from vpp_object import VppObject
3
4
5class IgmpSG():
6 def __init__(self, saddr, gaddr):
7 self.saddr = saddr
8 self.gaddr = gaddr
9
10
11class VppIgmpConfig(VppObject):
12 def __init__(self, test, sw_if_index, sg=None):
13 self._test = test
14 self.sw_if_index = sw_if_index
15 if isinstance(sg, list):
16 self.sg_list = sg
17 else:
18 self.sg_list = []
19 self.sg_list.append(sg)
20
21 def add_sg(self, sg):
22 self.sg.append(sg)
23
24 def add_vpp_config(self):
25 for e in self.sg_list:
26 self._test.vapi.igmp_listen(
27 1, self.sw_if_index, e.saddr, e.gaddr)
28
29 def remove_vpp_config(self):
30 self._test.vapi.igmp_clear_interface(self.sw_if_index)
31
32 def __str__(self):
33 return self.object_id()
34
35 def object_id(self):
36 return "%s:%d" % (self.sg_list, self.sw_if_index)
37
38 def query_vpp_config(self):
39 return self._test.vapi.igmp_dump()