summaryrefslogtreecommitdiffstats
path: root/test/test_util.py
AgeCommit message (Expand)AuthorFilesLines
2022-05-10tests: replace pycodestyle with blackKlement Sekera1-7/+7
2021-11-02build: remove unnecessary executable bitsRay Kinsella1-0/+0
2021-04-16tests: cpus awarenessKlement Sekera1-2/+6
2021-02-08tests: allow for externally supplied VPP workers config for testsAndrew Yourtchenko1-0/+9
2021-01-22tests: add generalized tags for tests, use them for run-solo testsAndrew Yourtchenko1-1/+1
2020-08-27tests: "force solo" testcase supportAndrew Yourtchenko1-1/+8
2019-11-05misc: Fix python scripts shebang lineRenato Botelho do Couto1-1/+1
2019-01-14VTL: Allow running simple unittest.TestCases.Paul Vinciguerra1-3/+4
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan1-3/+3
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-0/+19
d } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
from vpp_object import VppObject


class IgmpSG():
    def __init__(self, saddr, gaddr):
        self.saddr = saddr
        self.gaddr = gaddr


class VppIgmpConfig(VppObject):
    def __init__(self, test, sw_if_index, sg=None):
        self._test = test
        self.sw_if_index = sw_if_index
        if isinstance(sg, list):
            self.sg_list = sg
        else:
            self.sg_list = []
            self.sg_list.append(sg)

    def add_sg(self, sg):
        self.sg.append(sg)

    def add_vpp_config(self):
        for e in self.sg_list:
            self._test.vapi.igmp_listen(
                1, self.sw_if_index, e.saddr, e.gaddr)

    def remove_vpp_config(self):
        self._test.vapi.igmp_clear_interface(self.sw_if_index)

    def __str__(self):
        return self.object_id()

    def object_id(self):
        return "%s:%d" % (self.sg_list, self.sw_if_index)

    def query_vpp_config(self):
        return self._test.vapi.igmp_dump()