aboutsummaryrefslogtreecommitdiff
path: root/ca
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-06-20 19:54:18 +0000
committerRob Austein <sra@hactrn.net>2014-06-20 19:54:18 +0000
commit126345e6829c24a83c779a8cc568044bb667df78 (patch)
tree3e34ee522b2d44653bbcbf1499fd86d3756511a3 /ca
parent9f6d2cc173e3749f619ccb5cca6f0b920a648cbd (diff)
Preliminary BGPSEC test configuration generator.
svn path=/trunk/; revision=5869
Diffstat (limited to 'ca')
-rwxr-xr-xca/tests/bgpsec-yaml.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/ca/tests/bgpsec-yaml.py b/ca/tests/bgpsec-yaml.py
new file mode 100755
index 00000000..16fc8b17
--- /dev/null
+++ b/ca/tests/bgpsec-yaml.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# $Id$
+#
+# Copyright (C) 2014 Dragon Research Labs ("DRL")
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND DRL DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL DRL BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+"""
+Script to generate YAML to feed to test scripts. A bit circular, but less work this way.
+
+This is a quick hack to generate some test data using BGPSEC router certificates.
+It does not (yet?) correspond to any router configurations here or anywhere. At some
+point it may evolve into a proper test program.
+"""
+
+import yaml
+
+root = "Root"
+
+def kid(n):
+ name = "ISP-%03d" % n
+ ipv4 = "10.%d.0.0/16" % n
+ asn = n
+ router_id = n * 10000
+
+ return dict(name = name,
+ ipv4 = ipv4,
+ asn = asn,
+ hosted_by = root,
+ roa_request = [dict(asn = asn, ipv4 = ipv4)],
+ router_cert = [dict(asn = asn, router_id = router_id)])
+
+print '''\
+# This configuration was generated by a script. Edit at your own risk.
+'''
+
+print yaml.dump(dict(name = root,
+ crl_interval = "5m",
+ regen_margin = "2m",
+ valid_for = "2d",
+ kids = [kid(n + 1) for n in xrange(200)]))
+