def validate(self):
        assert self.af_ in [socket.AF_INET, socket.AF_INET6]
        if self.vip_ or self.port_ or self.proto_:
            assert self.proto_.lower() in ['tcp', 'udp']
            assert _validate_ip(self.vip_)
            assert isinstance(self.port_, int)
            assert self.port_ > 0 and self.port_ < (2 ** 16)
            assert self.fwmark_ is None
        else:
            assert isinstance(self.fwmark_, int)
            assert self.proto_ is None
            assert self.port_ is None
            assert self.vip_ is None
            assert self.fwmark_ > 0 and self.fwmark_ < (2 ** 32)
dataset/ETHPy150Open facebook/gnlpy/ipvs.py/Service.validate/original