summaryrefslogtreecommitdiffhomepage
path: root/config/bgp_configs.go
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-11-10 05:08:24 +0000
committerWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-11-14 02:15:35 +0000
commit926ab34220431de2561c17269d473f8fc8f33217 (patch)
tree1b3caab92f0a59adc3c8acebe4b8a31626ec8152 /config/bgp_configs.go
parentd23cea2d7c95b0d6683fbd80abcdb65e303816a4 (diff)
config: use struct type instead of []byte for capability and open msg
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r--config/bgp_configs.go48
1 files changed, 10 insertions, 38 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index c9e2a9c0..ea0e6549 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -19,8 +19,9 @@
package config
import (
- "bytes"
"fmt"
+
+ "github.com/osrg/gobgp/packet/bgp"
)
func mapkey(index int, name string) string {
@@ -1996,39 +1997,6 @@ func (lhs *Timers) Equal(rhs *Timers) bool {
return true
}
-//struct for container gobgp:Capabilities
-type Capabilities struct {
- // original -> gobgp:remote
- // original type is list of binary
- RemoteList [][]byte `mapstructure:"remote-list"`
- // original -> gobgp:local
- // original type is list of binary
- LocalList [][]byte `mapstructure:"local-list"`
-}
-
-func (lhs *Capabilities) Equal(rhs *Capabilities) bool {
- if lhs == nil || rhs == nil {
- return false
- }
- if len(lhs.RemoteList) != len(rhs.RemoteList) {
- return false
- }
- for idx, l := range lhs.RemoteList {
- if bytes.Compare(l, rhs.RemoteList[idx]) != 0 {
- return false
- }
- }
- if len(lhs.LocalList) != len(rhs.LocalList) {
- return false
- }
- for idx, l := range lhs.LocalList {
- if bytes.Compare(l, rhs.LocalList[idx]) != 0 {
- return false
- }
- }
- return true
-}
-
//struct for container gobgp:adj-table
type AdjTable struct {
// original -> gobgp:ADVERTISED
@@ -2235,11 +2203,15 @@ type NeighborState struct {
Queues Queues `mapstructure:"queues"`
// original -> gobgp:adj-table
AdjTable AdjTable `mapstructure:"adj-table"`
- // original -> gobgp:Capabilities
- Capabilities Capabilities `mapstructure:"capabilities"`
+ // original -> gobgp:remote-capability
+ // original type is list of bgp-capability
+ RemoteCapabilityList []bgp.ParameterCapabilityInterface `mapstructure:"remote-capability-list"`
+ // original -> gobgp:local-capability
+ // original type is list of bgp-capability
+ LocalCapabilityList []bgp.ParameterCapabilityInterface `mapstructure:"local-capability-list"`
// original -> gobgp:received-open-message
- //gobgp:received-open-message's original type is binary
- ReceivedOpenMessage []byte `mapstructure:"received-open-message"`
+ //gobgp:received-open-message's original type is bgp-open-message
+ ReceivedOpenMessage *bgp.BGPMessage `mapstructure:"received-open-message"`
// original -> gobgp:admin-down
//gobgp:admin-down's original type is boolean
AdminDown bool `mapstructure:"admin-down"`