summaryrefslogtreecommitdiffhomepage
path: root/server/rpki_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/rpki_test.go')
-rw-r--r--server/rpki_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/rpki_test.go b/server/rpki_test.go
index 590a6a72..3de06963 100644
--- a/server/rpki_test.go
+++ b/server/rpki_test.go
@@ -84,6 +84,21 @@ func TestValidate0(t *testing.T) {
assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_INVALID)
}
+func TestValidate1(t *testing.T) {
+ assert := assert.New(t)
+
+ tree := radix.New()
+ addROA(tree, 65000, net.ParseIP("10.0.0.0"), 16, 16)
+
+ var r config.RpkiValidationResultType
+
+ r = validateOne(tree, "10.0.0.0/16", "65000")
+ assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_VALID)
+
+ r = validateOne(tree, "10.0.0.0/16", "65001")
+ assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_INVALID)
+}
+
func TestValidate2(t *testing.T) {
assert := assert.New(t)
@@ -183,3 +198,19 @@ func TestValidate7(t *testing.T) {
r = validateOne(tree, "10.0.0.0/24", "{65000,65001}")
assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND)
}
+
+func TestValidate8(t *testing.T) {
+ assert := assert.New(t)
+
+ tree := radix.New()
+ addROA(tree, 0, net.ParseIP("10.0.0.0"), 16, 24)
+ addROA(tree, 65000, net.ParseIP("10.0.0.0"), 16, 24)
+
+ var r config.RpkiValidationResultType
+
+ r = validateOne(tree, "10.0.0.0/24", "65000")
+ assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_VALID)
+
+ r = validateOne(tree, "10.0.0.0/24", "65001")
+ assert.Equal(r, config.RPKI_VALIDATION_RESULT_TYPE_INVALID)
+}