diff options
20 files changed, 129 insertions, 93 deletions
diff --git a/rpkid/Makefile b/rpkid/Makefile index a4b74936..1276b248 100644 --- a/rpkid/Makefile +++ b/rpkid/Makefile @@ -3,6 +3,7 @@ all:: left-right-protocol-samples/.stamp left-right-protocol-samples/.stamp: left-right-protocol-samples.xml split-protocol-samples.xsl + rm -f left-right-protocol-samples/*.xml xsltproc --stringparam dir left-right-protocol-samples split-protocol-samples.xsl left-right-protocol-samples.xml touch $@ @@ -23,6 +24,7 @@ up-down-schema.rng: up-down-schema.rnc all:: publication-protocol-samples/.stamp publication-protocol-samples/.stamp: publication-protocol-samples.xml split-protocol-samples.xsl + rm -f publication-protocol-samples/*.xml xsltproc --stringparam dir publication-protocol-samples split-protocol-samples.xsl publication-protocol-samples.xml touch $@ diff --git a/rpkid/left-right-protocol-samples.xml b/rpkid/left-right-protocol-samples.xml index b43c9bcb..3f250638 100644 --- a/rpkid/left-right-protocol-samples.xml +++ b/rpkid/left-right-protocol-samples.xml @@ -1186,61 +1186,34 @@ <!-- ==== --> <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="create" self_handle="42" route_origin_handle="88"/> - </msg> - - <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="create" self_handle="42" route_origin_handle="88"/> - </msg> - - <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="set" self_handle="42" route_origin_handle="88" - suppress_publication="yes" - as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48-56"/> - </msg> - - <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="set" self_handle="42" route_origin_handle="88"/> - </msg> - - <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="get" self_handle="42" route_origin_handle="88"/> - </msg> - - <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="get" self_handle="42" route_origin_handle="88" - as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48-56"/> - </msg> - - <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="list" self_handle="42"/> - </msg> - - <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="list" self_handle="42" route_origin_handle="88" - as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48"/> - </msg> - - <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="destroy" self_handle="42" route_origin_handle="88"/> + <list_resources self_handle="42" child_handle="289"/> </msg> <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <route_origin action="destroy" self_handle="42" route_origin_handle="88"/> + <list_resources self_handle="42" child_handle="289" + valid_until="2008-04-01T00:00:00Z" + ipv4="10.0.0.44/32,10.3.0.44/32" + ipv6="fe80:deed:f00d::/48,fe80:dead:beef:2::-fe80:dead:beef:2::49" + asn="666"/> </msg> - <!-- ==== --> + <!-- === --> <msg version="1" type="query" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <list_resources self_handle="42" child_handle="289"/> + <list_roa_requests self_handle="42"/> </msg> <msg version="1" type="reply" xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/"> - <list_resources self_handle="42" child_handle="289" - valid_until="2008-04-01T00:00:00Z" + <list_roa_requests self_handle="42" + asn="666" ipv4="10.0.0.44/32,10.3.0.44/32" - ipv6="fe80:deed:f00d::/48,fe80:dead:beef:2::-fe80:dead:beef:2::49" - asn="666"/> + ipv6="fe80:deed:f00d::/48,fe80:dead:beef::/48-56" + /> + <list_roa_requests self_handle="42" + asn="12345" + ipv4="10.0.0.44/32" + ipv6="2002:a00::/48-56" + /> </msg> <!-- === --> diff --git a/rpkid/left-right-protocol-samples/pdu.051.xml b/rpkid/left-right-protocol-samples/pdu.051.xml index 32c083c8..70bd52e4 100644 --- a/rpkid/left-right-protocol-samples/pdu.051.xml +++ b/rpkid/left-right-protocol-samples/pdu.051.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> <msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <route_origin action="create" self_handle="42" route_origin_handle="88"/> + <list_resources self_handle="42" child_handle="289"/> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.052.xml b/rpkid/left-right-protocol-samples/pdu.052.xml index b8b470b1..3cefe413 100644 --- a/rpkid/left-right-protocol-samples/pdu.052.xml +++ b/rpkid/left-right-protocol-samples/pdu.052.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> <msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <route_origin action="create" self_handle="42" route_origin_handle="88"/> + <list_resources self_handle="42" child_handle="289" valid_until="2008-04-01T00:00:00Z" ipv4="10.0.0.44/32,10.3.0.44/32" ipv6="fe80:deed:f00d::/48,fe80:dead:beef:2::-fe80:dead:beef:2::49" asn="666"/> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.053.xml b/rpkid/left-right-protocol-samples/pdu.053.xml index f8be8b6c..dc850831 100644 --- a/rpkid/left-right-protocol-samples/pdu.053.xml +++ b/rpkid/left-right-protocol-samples/pdu.053.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> <msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <route_origin action="set" self_handle="42" route_origin_handle="88" suppress_publication="yes" as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48-56"/> + <list_roa_requests self_handle="42"/> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.054.xml b/rpkid/left-right-protocol-samples/pdu.054.xml index 9247188f..621ad9e6 100644 --- a/rpkid/left-right-protocol-samples/pdu.054.xml +++ b/rpkid/left-right-protocol-samples/pdu.054.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> <msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <route_origin action="set" self_handle="42" route_origin_handle="88"/> + <list_roa_requests self_handle="42" asn="666" ipv4="10.0.0.44/32,10.3.0.44/32" ipv6="fe80:deed:f00d::/48,fe80:dead:beef::/48-56"/> + <list_roa_requests self_handle="42" asn="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48-56"/> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.055.xml b/rpkid/left-right-protocol-samples/pdu.055.xml index 30de8287..b6cb58e4 100644 --- a/rpkid/left-right-protocol-samples/pdu.055.xml +++ b/rpkid/left-right-protocol-samples/pdu.055.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <route_origin action="get" self_handle="42" route_origin_handle="88"/> +<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> + <report_error self_handle="42" error_code="your_hair_is_on_fire">text string</report_error> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.056.xml b/rpkid/left-right-protocol-samples/pdu.056.xml index ac134468..9778fd94 100644 --- a/rpkid/left-right-protocol-samples/pdu.056.xml +++ b/rpkid/left-right-protocol-samples/pdu.056.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="US-ASCII"?> <!--Automatically generated, do not edit.--> <msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <route_origin action="get" self_handle="42" route_origin_handle="88" as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48-56"/> + <report_error self_handle="42" error_code="your_hair_is_on_fire"/> </msg> diff --git a/rpkid/left-right-protocol-samples/pdu.057.xml b/rpkid/left-right-protocol-samples/pdu.057.xml deleted file mode 100644 index 2602858d..00000000 --- a/rpkid/left-right-protocol-samples/pdu.057.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <route_origin action="list" self_handle="42"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.058.xml b/rpkid/left-right-protocol-samples/pdu.058.xml deleted file mode 100644 index 9958973d..00000000 --- a/rpkid/left-right-protocol-samples/pdu.058.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <route_origin action="list" self_handle="42" route_origin_handle="88" as_number="12345" ipv4="10.0.0.44/32" ipv6="2002:a00::/48"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.059.xml b/rpkid/left-right-protocol-samples/pdu.059.xml deleted file mode 100644 index 94d874ba..00000000 --- a/rpkid/left-right-protocol-samples/pdu.059.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <route_origin action="destroy" self_handle="42" route_origin_handle="88"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.060.xml b/rpkid/left-right-protocol-samples/pdu.060.xml deleted file mode 100644 index f761d909..00000000 --- a/rpkid/left-right-protocol-samples/pdu.060.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <route_origin action="destroy" self_handle="42" route_origin_handle="88"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.061.xml b/rpkid/left-right-protocol-samples/pdu.061.xml deleted file mode 100644 index 70bd52e4..00000000 --- a/rpkid/left-right-protocol-samples/pdu.061.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="query"> - <list_resources self_handle="42" child_handle="289"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.062.xml b/rpkid/left-right-protocol-samples/pdu.062.xml deleted file mode 100644 index 3cefe413..00000000 --- a/rpkid/left-right-protocol-samples/pdu.062.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <list_resources self_handle="42" child_handle="289" valid_until="2008-04-01T00:00:00Z" ipv4="10.0.0.44/32,10.3.0.44/32" ipv6="fe80:deed:f00d::/48,fe80:dead:beef:2::-fe80:dead:beef:2::49" asn="666"/> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.063.xml b/rpkid/left-right-protocol-samples/pdu.063.xml deleted file mode 100644 index b6cb58e4..00000000 --- a/rpkid/left-right-protocol-samples/pdu.063.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <report_error self_handle="42" error_code="your_hair_is_on_fire">text string</report_error> -</msg> diff --git a/rpkid/left-right-protocol-samples/pdu.064.xml b/rpkid/left-right-protocol-samples/pdu.064.xml deleted file mode 100644 index 9778fd94..00000000 --- a/rpkid/left-right-protocol-samples/pdu.064.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII"?> -<!--Automatically generated, do not edit.--> -<msg xmlns="http://www.hactrn.net/uris/rpki/left-right-spec/" version="1" type="reply"> - <report_error self_handle="42" error_code="your_hair_is_on_fire"/> -</msg> diff --git a/rpkid/left-right-schema.rnc b/rpkid/left-right-schema.rnc index bdf00dfb..116eb0f4 100644 --- a/rpkid/left-right-schema.rnc +++ b/rpkid/left-right-schema.rnc @@ -22,6 +22,7 @@ query_elt |= parent_query query_elt |= child_query query_elt |= repository_query query_elt |= route_origin_query +query_elt |= list_roa_requests_query query_elt |= list_resources_query # PDUs allowed in a reply @@ -32,6 +33,7 @@ reply_elt |= child_reply reply_elt |= repository_reply reply_elt |= route_origin_reply reply_elt |= list_resources_reply +reply_elt |= list_roa_requests_reply reply_elt |= report_error_reply # Tag attributes for bulk operations @@ -228,6 +230,19 @@ list_resources_reply = element list_resources { attribute ipv6 { ipv6_list }? } +# <list_roa_requests/> element + +list_roa_requests_query = element list_roa_requests { + tag, self_handle +} + +list_roa_requests_reply = element list_roa_requests { + tag, self_handle, + attribute asn { xsd:positiveInteger }, + attribute ipv4 { ipv4_list }?, + attribute ipv6 { ipv6_list }? +} + # <report_error/> element error = xsd:token { maxLength="1024" } diff --git a/rpkid/left-right-schema.rng b/rpkid/left-right-schema.rng index c3d4f53f..78e949dc 100644 --- a/rpkid/left-right-schema.rng +++ b/rpkid/left-right-schema.rng @@ -56,6 +56,9 @@ <ref name="route_origin_query"/> </define> <define name="query_elt" combine="choice"> + <ref name="list_roa_requests_query"/> + </define> + <define name="query_elt" combine="choice"> <ref name="list_resources_query"/> </define> <!-- PDUs allowed in a reply --> @@ -81,6 +84,9 @@ <ref name="list_resources_reply"/> </define> <define name="reply_elt" combine="choice"> + <ref name="list_roa_requests_reply"/> + </define> + <define name="reply_elt" combine="choice"> <ref name="report_error_reply"/> </define> <!-- Tag attributes for bulk operations --> @@ -932,6 +938,32 @@ </optional> </element> </define> + <!-- <list_roa_requests/> element --> + <define name="list_roa_requests_query"> + <element name="list_roa_requests"> + <ref name="tag"/> + <ref name="self_handle"/> + </element> + </define> + <define name="list_roa_requests_reply"> + <element name="list_roa_requests"> + <ref name="tag"/> + <ref name="self_handle"/> + <attribute name="asn"> + <data type="positiveInteger"/> + </attribute> + <optional> + <attribute name="ipv4"> + <ref name="ipv4_list"/> + </attribute> + </optional> + <optional> + <attribute name="ipv6"> + <ref name="ipv6_list"/> + </attribute> + </optional> + </element> + </define> <!-- <report_error/> element --> <define name="error"> <data type="token"> diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py index 3fc20f07..67f266a2 100644 --- a/rpkid/rpki/left_right.py +++ b/rpkid/rpki/left_right.py @@ -1035,6 +1035,26 @@ class list_resources_elt(rpki.xml_utils.base_elt, left_right_namespace): elt.set("valid_until", self.valid_until.toXMLtime()) return elt +class list_roa_requests_elt(rpki.xml_utils.base_elt, left_right_namespace): + """ + <list_roa_requests/> element. + """ + + element_name = "list_roa_requests" + attributes = ("self_handle", "tag", "asn", "ipv4", "ipv6") + + def startElement(self, stack, name, attrs): + """ + Handle <list_roa_requests/> element. This requires special handling + due to the data types of some of the attributes. + """ + assert name == "list_roa_requests", "Unexpected name %s, stack %s" % (name, stack) + self.read_attrs(attrs) + if self.ipv4 is not None: + self.ipv4 = rpki.resource_set.roa_prefix_set_ipv4(self.ipv4) + if self.ipv6 is not None: + self.ipv6 = rpki.resource_set.roa_prefix_set_ipv6(self.ipv6) + class report_error_elt(rpki.xml_utils.base_elt, left_right_namespace): """ <report_error/> element. @@ -1066,8 +1086,9 @@ class msg(rpki.xml_utils.msg, left_right_namespace): ## @var pdus # Dispatch table of PDUs for this protocol. pdus = dict((x.element_name, x) - for x in (self_elt, child_elt, parent_elt, bsc_elt, repository_elt, - route_origin_elt, list_resources_elt, report_error_elt)) + for x in (self_elt, child_elt, parent_elt, bsc_elt, + repository_elt, route_origin_elt, list_resources_elt, + list_roa_requests_elt, report_error_elt)) def serve_top_level(self, gctx, cb): """ diff --git a/rpkid/rpki/relaxng.py b/rpkid/rpki/relaxng.py index 086b43be..fa981b97 100644 --- a/rpkid/rpki/relaxng.py +++ b/rpkid/rpki/relaxng.py @@ -62,6 +62,9 @@ left_right = lxml.etree.RelaxNG(lxml.etree.fromstring('''<?xml version="1.0" enc <ref name="route_origin_query"/> </define> <define name="query_elt" combine="choice"> + <ref name="list_roa_requests_query"/> + </define> + <define name="query_elt" combine="choice"> <ref name="list_resources_query"/> </define> <!-- PDUs allowed in a reply --> @@ -87,6 +90,9 @@ left_right = lxml.etree.RelaxNG(lxml.etree.fromstring('''<?xml version="1.0" enc <ref name="list_resources_reply"/> </define> <define name="reply_elt" combine="choice"> + <ref name="list_roa_requests_reply"/> + </define> + <define name="reply_elt" combine="choice"> <ref name="report_error_reply"/> </define> <!-- Tag attributes for bulk operations --> @@ -938,6 +944,32 @@ left_right = lxml.etree.RelaxNG(lxml.etree.fromstring('''<?xml version="1.0" enc </optional> </element> </define> + <!-- <list_roa_requests/> element --> + <define name="list_roa_requests_query"> + <element name="list_roa_requests"> + <ref name="tag"/> + <ref name="self_handle"/> + </element> + </define> + <define name="list_roa_requests_reply"> + <element name="list_roa_requests"> + <ref name="tag"/> + <ref name="self_handle"/> + <attribute name="asn"> + <data type="positiveInteger"/> + </attribute> + <optional> + <attribute name="ipv4"> + <ref name="ipv4_list"/> + </attribute> + </optional> + <optional> + <attribute name="ipv6"> + <ref name="ipv6_list"/> + </attribute> + </optional> + </element> + </define> <!-- <report_error/> element --> <define name="error"> <data type="token"> |