def start_ping(user = None, target = None, threadlock = None): """ Web UI calls start_ping() return (True, str) (False, list) """ if target is None: return (False, ["invalid target"]) if ml_check.validate_ipv4(target): e = ml_func.sudo(["ping -W 3 -c 10", target], block=True) elif ml_check.validate_ipv6(target): e = ml_func.sudo(["ping6 -W 3 -c 10", target], block=True) else: return (False, ["invalid target"]) return e
def test_validate_ipv4_b06(self): """ validate_ipv4_b06 """ self.maxDiff = None self.assertFalse(ml_check.validate_ipv4("-1.0.1.2"))
def test_validate_ipv4_b05(self): """ validate_ipv4_b05 """ self.maxDiff = None self.assertFalse(ml_check.validate_ipv4("1.2.3.256"))
def test_validate_ipv4_b04(self): """ validate_ipv4_b04 """ self.maxDiff = None self.assertFalse(ml_check.validate_ipv4("a.b.c.d"))
def test_validate_ipv4_g03(self): """ validate_ipv4_g03 """ self.maxDiff = None self.assertTrue(ml_check.validate_ipv4("255.255.255.255"))
def test_validate_ipv4_g02(self): """ validate_ipv4_g02 """ self.maxDiff = None self.assertTrue(ml_check.validate_ipv4("0.0.0.0"))
def test_validate_ipv4_g01(self): """ validate_ipv4_g01 """ self.maxDiff = None self.assertTrue(ml_check.validate_ipv4("10.12.97.100"))