diff options
author | Eiichiro Watanabe <a16tochjp@gmail.com> | 2015-10-28 18:01:49 +0900 |
---|---|---|
committer | Eiichiro Watanabe <a16tochjp@gmail.com> | 2015-10-28 18:01:49 +0900 |
commit | 645ce47b986cf7296d217bc98af7b4a8446833a9 (patch) | |
tree | 2956783393fe296fd393e96760df9b2d2ee8aa7c /server | |
parent | d6360e2b32932354b300db2c7e7f28b584fb39a2 (diff) |
Add examples for rpki
Diffstat (limited to 'server')
-rw-r--r-- | server/rpki_test.go | 31 |
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) +} |