X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fbfd.py;h=d99bbf6165c3de7fe5811e708f23c6cdb878a850;hb=13a08cc;hp=b467cc79eead2f846f4551393a5f1c7ba97e88b7;hpb=239790fd91b3f62e5eda1042a97f9216fe59856e;p=vpp.git diff --git a/test/bfd.py b/test/bfd.py index b467cc79eea..d99bbf6165c 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) @@ -198,6 +191,10 @@ class VppBFDAuthKey(VppObject): """ key data """ return self._key + @key.setter + def key(self, value): + self._key = value + @property def conf_key_id(self): """ configuration key ID """ @@ -233,7 +230,7 @@ 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=100000, required_min_rx=100000, detect_mult=3, + desired_min_tx=300000, required_min_rx=300000, detect_mult=3, sha1_key=None, bfd_key_id=None): self._test = test self._interface = interface @@ -249,7 +246,10 @@ class VppBFDUDPSession(VppObject): self._required_min_rx = required_min_rx self._detect_mult = detect_mult self._sha1_key = sha1_key - self._bfd_key_id = bfd_key_id if bfd_key_id else randint(0, 255) + if bfd_key_id is not None: + self._bfd_key_id = bfd_key_id + else: + self._bfd_key_id = randint(0, 255) @property def test(self):