diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 02:52:59 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 02:52:59 +0900 |
commit | b6e606a99480cffd47e73e7b74aa3a10df5ad47d (patch) | |
tree | ad34613d89ea3316271ff6c2f82caff804ff9c81 /config/bgp_configs.go | |
parent | 49e45d4e0c0a81dc8f9ec4b3a39433b22af04f16 (diff) |
remove gRPC dependency from peer.go
move gRPC dependency from peer.go to grpc_server.go
Preparation for the removal of gRPC dependency from packages except
for api package.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r-- | config/bgp_configs.go | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index db9d2054..36a51da5 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -1,7 +1,7 @@ // DO NOT EDIT // generated by pyang using OpenConfig https://github.com/openconfig/public // -// Copyright (C) 2014,2015 Nippon Telegraph and Telephone Corporation. +// Copyright (C) 2014-2016 Nippon Telegraph and Telephone Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,7 +18,10 @@ package config -import "fmt" +import ( + "bytes" + "fmt" +) func mapkey(index int, name string) string { if name != "" { @@ -2190,6 +2193,65 @@ 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 + Advertised uint32 `mapstructure:"advertised"` + // original -> gobgp:RECEIVED + Received uint32 `mapstructure:"received"` + // original -> gobgp:ACCEPTED + Accepted uint32 `mapstructure:"accepted"` +} + +func (lhs *AdjTable) Equal(rhs *AdjTable) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Advertised != rhs.Advertised { + return false + } + if lhs.Received != rhs.Received { + return false + } + if lhs.Accepted != rhs.Accepted { + return false + } + return true +} + //struct for container bgp:queues type Queues struct { // original -> bgp-op:input @@ -2368,9 +2430,18 @@ type NeighborState struct { Messages Messages `mapstructure:"messages"` // original -> bgp:queues Queues Queues `mapstructure:"queues"` + // original -> gobgp:adj-table + AdjTable AdjTable `mapstructure:"adj-table"` + // original -> gobgp:Capabilities + Capabilities Capabilities `mapstructure:"capabilities"` + // original -> gobgp:received-open-message + //gobgp:received-open-message's original type is binary + ReceivedOpenMessage []byte `mapstructure:"received-open-message"` // original -> gobgp:admin-down //gobgp:admin-down's original type is boolean AdminDown bool `mapstructure:"admin-down"` + // original -> gobgp:admin-state + AdminState string `mapstructure:"admin-state"` // original -> gobgp:established-count EstablishedCount uint32 `mapstructure:"established-count"` // original -> gobgp:flops @@ -2428,9 +2499,21 @@ func (lhs *NeighborState) Equal(rhs *NeighborState) bool { if !lhs.Queues.Equal(&(rhs.Queues)) { return false } + if !lhs.AdjTable.Equal(&(rhs.AdjTable)) { + return false + } + if !lhs.Capabilities.Equal(&(rhs.Capabilities)) { + return false + } + if bytes.Compare(lhs.ReceivedOpenMessage, rhs.ReceivedOpenMessage) != 0 { + return false + } if lhs.AdminDown != rhs.AdminDown { return false } + if lhs.AdminState != rhs.AdminState { + return false + } if lhs.EstablishedCount != rhs.EstablishedCount { return false } |