diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-02-22 13:29:52 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-02-22 15:19:08 +0900 |
commit | 89f40dfa4a015d000489a1ffa70824722e7eafed (patch) | |
tree | 347c403a2b4020c926fc162d009dfab42452d00a /packet/bgp/helper.go | |
parent | 07275fba28e3c33530d0a4c96dab61e66c3df46f (diff) |
packet/bgp: Flatten structure of OpaqueExtended
Currently, to instantiate sub types of the Opaque Extended Community,
it is required to instantiate "OpaqueExtended" and its value type (e.g.,
"ValidationExtended" or "EncapExtended") and also specify its sub type.
This can cause the confusion of the outer and inner (value) structures
and the unmatch of the value structure and its sub type.
This patch makes the "OpaqueExtended" into more flat structure and
introduces "NewXxxExtended()" function to improve usability.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'packet/bgp/helper.go')
-rw-r--r-- | packet/bgp/helper.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/packet/bgp/helper.go b/packet/bgp/helper.go index 79229d92..851332fd 100644 --- a/packet/bgp/helper.go +++ b/packet/bgp/helper.go @@ -65,12 +65,8 @@ func NewTestBGPUpdateMessage() *BGPMessage { NewTwoOctetAsSpecificExtended(EC_SUBTYPE_ROUTE_TARGET, 10003, 3<<20, isTransitive), NewFourOctetAsSpecificExtended(EC_SUBTYPE_ROUTE_TARGET, 1<<20, 300, isTransitive), NewIPv4AddressSpecificExtended(EC_SUBTYPE_ROUTE_TARGET, "192.2.1.2", 3000, isTransitive), - &OpaqueExtended{ - Value: &DefaultOpaqueExtendedValue{[]byte{255, 1, 2, 3, 4, 5, 6, 7}}, - }, - &OpaqueExtended{ - Value: &ValidationExtended{Value: VALIDATION_STATE_INVALID}, - }, + NewOpaqueExtended(false, []byte{1, 2, 3, 4, 5, 6, 7}), + NewValidationExtended(VALIDATION_STATE_INVALID), &UnknownExtended{Type: 99, Value: []byte{0, 1, 2, 3, 4, 5, 6, 7}}, NewESILabelExtended(1000, true), NewESImportRouteTarget("11:22:33:44:55:66"), |