bgpwtf/cccampix: add IRR daemon
We add a small IRR service for getting a parsed RPSL from IRRs. For now,
we only support RIPE and ARIN, and only the following attributes:
- remarks
- import
- export
Since RPSL/RFC2622 is fucking insane, there is no guarantee that the
parser, especially the import/export parser, is correct. But it should
be good enough for our use. We even throw in some tests for good
measure.
$ grpcurl -format text -plaintext -d 'as: "26625"' 127.0.0.1:4200 ix.IRR.Query
source: SOURCE_ARIN
attributes: <
import: <
expressions: <
peering: "AS6083"
actions: "pref=10"
>
filter: "ANY"
>
>
attributes: <
import: <
expressions: <
peering: "AS12491"
actions: "pref=10"
>
filter: "ANY"
>
>
Change-Id: I8b240ffe2cd3553a25ce33dbd3917c0aef64e804
diff --git a/bgpwtf/cccampix/proto/ix.proto b/bgpwtf/cccampix/proto/ix.proto
index c938386..01ddc4f 100644
--- a/bgpwtf/cccampix/proto/ix.proto
+++ b/bgpwtf/cccampix/proto/ix.proto
@@ -39,3 +39,45 @@
// GetIXMembers returns information about membership of a given PeeringDB IX.
rpc GetIXMembers(GetIXMembersRequest) returns (GetIXMembersResponse);
}
+
+message IRRQueryRequest {
+ // AS to query for. This needs be the AS number of the AS, possibly
+ // prefixed with 'as'/'AS'.
+ string as = 1;
+}
+
+message IRRAttribute {
+ message ImportExport {
+ message Expression {
+ string peering = 1;
+ string router_us = 2;
+ string router_them = 3;
+ repeated string actions = 4;
+ }
+ string protocol_from = 1;
+ string protocol_into = 2;
+ repeated Expression expressions = 3;
+ string filter = 4;
+ }
+
+ oneof value {
+ string remarks = 1;
+ ImportExport import = 2;
+ ImportExport export = 3;
+ }
+}
+
+message IRRQueryResponse {
+ enum Source {
+ SOURCE_INVALID = 0;
+ SOURCE_RIPE = 1;
+ SOURCE_ARIN = 2;
+ }
+ Source source = 1;
+ repeated IRRAttribute attributes = 2;
+}
+
+service IRR {
+ // Query returns parsed RPSL data from supported IRRs for a given aut-num.
+ rpc Query(IRRQueryRequest) returns (IRRQueryResponse);
+}