MCPcopy Create free account
hub / github.com/FDio/vpp / AuthKeyFactory

Class AuthKeyFactory

test/test_bfd.py:112–129  ·  view source on GitHub ↗

Factory class for creating auth keys with unique conf key ID

Source from the content-addressed store, hash-verified

110
111
112class AuthKeyFactory(object):
113 """Factory class for creating auth keys with unique conf key ID"""
114
115 def __init__(self):
116 self._conf_key_ids = {}
117
118 def create_random_key(self, test, auth_type=BFDAuthType.keyed_sha1):
119 """create a random key with unique conf key id"""
120 conf_key_id = randint(0, 0xFFFFFFFF)
121 while conf_key_id in self._conf_key_ids:
122 conf_key_id = randint(0, 0xFFFFFFFF)
123 self._conf_key_ids[conf_key_id] = 1
124 key = scapy.compat.raw(
125 bytearray([randint(0, 255) for _ in range(randint(1, 20))])
126 )
127 return VppBFDAuthKey(
128 test=test, auth_type=auth_type, conf_key_id=conf_key_id, key=key
129 )
130
131
132@parameterized_class(

Callers 6

setUpMethod · 0.85
setUpMethod · 0.85
setUpMethod · 0.85
setUpMethod · 0.85
setUpMethod · 0.85
setUpMethod · 0.85

Calls

no outgoing calls

Tested by 6

setUpMethod · 0.68
setUpMethod · 0.68
setUpMethod · 0.68
setUpMethod · 0.68
setUpMethod · 0.68
setUpMethod · 0.68