@@ -248,5 +248,41 @@ def test_rpki_verify_preference(self):
248
248
with self .assertRaises (ConfigSessionError ):
249
249
self .cli_commit ()
250
250
251
+ def test_rpki_source_address (self ):
252
+ peer = '192.0.2.1'
253
+ port = '8080'
254
+ preference = '1'
255
+ username = 'foo'
256
+ source_address = '100.10.10.1'
257
+
258
+ self .cli_set (['interfaces' , 'ethernet' , 'eth0' , 'address' , f'{ source_address } /24' ])
259
+
260
+ # Configure a TCP cache server
261
+ self .cli_set (base_path + ['cache' , peer , 'port' , port ])
262
+ self .cli_set (base_path + ['cache' , peer , 'preference' , preference ])
263
+ self .cli_set (base_path + ['cache' , peer , 'source-address' , source_address ])
264
+ self .cli_commit ()
265
+
266
+ # Verify FRR configuration
267
+ frrconfig = self .getFRRconfig ('rpki' )
268
+ self .assertIn (f'rpki cache tcp { peer } { port } source { source_address } preference { preference } ' , frrconfig )
269
+
270
+ self .cli_set (['pki' , 'openssh' , rpki_key_name , 'private' , 'key' , rpki_ssh_key .replace ('\n ' , '' )])
271
+ self .cli_set (['pki' , 'openssh' , rpki_key_name , 'public' , 'key' , rpki_ssh_pub .replace ('\n ' , '' )])
272
+ self .cli_set (['pki' , 'openssh' , rpki_key_name , 'public' , 'type' , rpki_key_type ])
273
+
274
+ # Configure a SSH cache server
275
+ self .cli_set (base_path + ['cache' , peer , 'ssh' , 'username' , username ])
276
+ self .cli_set (base_path + ['cache' , peer , 'ssh' , 'key' , rpki_key_name ])
277
+ self .cli_commit ()
278
+
279
+ # Verify FRR configuration
280
+ frrconfig = self .getFRRconfig ('rpki' )
281
+ self .assertIn (
282
+ f'rpki cache ssh { peer } { port } { username } /run/frr/id_rpki_{ peer } /run/frr/id_rpki_{ peer } .pub source { source_address } preference { preference } ' ,
283
+ frrconfig ,
284
+ )
285
+
286
+
251
287
if __name__ == '__main__' :
252
288
unittest .main (verbosity = 2 )
0 commit comments