X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fbfd.py;h=a297dab25273b8ce876d05af4b7bf8557972ef84;hb=053204ab039d34a990ff0e14c32ce3b294fcce0e;hp=452a18049883d07f01028056091ed3c0a0ebab71;hpb=e0d2bd6bd7fc59c0c6ac48195d7f825dc99bfd91;p=vpp.git diff --git a/test/bfd.py b/test/bfd.py index 452a1804988..a297dab2527 100644 --- a/test/bfd.py +++ b/test/bfd.py @@ -35,9 +35,6 @@ class BFDDiagCode(NumericConstant): reverse_concatenated_path_down: "Reverse Concatenated Path Down", } - def __init__(self, value): - NumericConstant.__init__(self, value) - class BFDState(NumericConstant): """ BFD State """ @@ -53,9 +50,6 @@ class BFDState(NumericConstant): up: "Up", } - def __init__(self, value): - NumericConstant.__init__(self, value) - class BFDAuthType(NumericConstant): """ BFD Authentication Type """ @@ -75,9 +69,6 @@ class BFDAuthType(NumericConstant): meticulous_keyed_sha1: "Meticulous Keyed SHA1", } - def __init__(self, value): - NumericConstant.__init__(self, value) - def bfd_is_auth_used(pkt): """ is packet authenticated? """ @@ -148,6 +139,7 @@ class BFD(Packet): return self.sprintf("BFD(my_disc=%BFD.my_discriminator%," "your_disc=%BFD.your_discriminator%)") + # glue the BFD packet class to scapy parser bind_layers(UDP, BFD, dport=BFD.udp_dport) @@ -169,6 +161,7 @@ class BFD_vpp_echo(Packet): "BFD_VPP_ECHO(disc=%BFD_VPP_ECHO.discriminator%," "expire_time_clocks=%BFD_VPP_ECHO.expire_time_clocks%)") + # glue the BFD echo packet class to scapy parser bind_layers(UDP, BFD_vpp_echo, dport=BFD_vpp_echo.udp_dport) @@ -229,16 +222,13 @@ class VppBFDAuthKey(VppObject): def object_id(self): return "bfd-auth-key-%s" % self._conf_key_id - def __str__(self): - return self.object_id() - class VppBFDUDPSession(VppObject): """ Represents BFD UDP session in VPP """ def __init__(self, test, interface, peer_addr, local_addr=None, af=AF_INET, desired_min_tx=300000, required_min_rx=300000, detect_mult=3, - sha1_key=None, bfd_key_id=None): + sha1_key=None, bfd_key_id=None, is_tunnel=False): self._test = test self._interface = interface self._af = af @@ -257,6 +247,7 @@ class VppBFDUDPSession(VppObject): self._bfd_key_id = bfd_key_id else: self._bfd_key_id = randint(0, 255) + self._is_tunnel = is_tunnel @property def test(self): @@ -358,6 +349,10 @@ class VppBFDUDPSession(VppObject): """ bfd key id in use """ return self._bfd_key_id + @property + def is_tunnel(self): + return self._is_tunnel + def activate_auth(self, key, bfd_key_id=None, delayed=False): """ activate authentication for this session """ self._bfd_key_id = bfd_key_id if bfd_key_id else randint(0, 255) @@ -437,9 +432,6 @@ class VppBFDUDPSession(VppObject): self.peer_addr, self.af) - def __str__(self): - return self.object_id() - def admin_up(self): """ set bfd session admin-up """ is_ipv6 = 1 if AF_INET6 == self._af else 0