summaryrefslogtreecommitdiffhomepage
path: root/config/bgp_configs.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-21 08:48:24 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-21 08:57:21 +0000
commita34d8d2651877998fe01d35350259c979a49d295 (patch)
tree220802d9c7b596c8636a80d116b9b9a38518c825 /config/bgp_configs.go
parentc6ddfb1d8ecc5944a775a458fbce648713ae3b02 (diff)
config: simplify config structures
stop generating self-contained leafref fields in openconfig model. (e.g. bgp:neighbor/bgp:neighbor-address ) Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r--config/bgp_configs.go51
1 files changed, 14 insertions, 37 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index 1b3d2a73..e6a3dbad 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -937,8 +937,6 @@ func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool {
//struct for container gobgp:bmp-server
type BmpServer struct {
// original -> gobgp:address
- //gobgp:address's original type is inet:ip-address
- Address string `mapstructure:"address"`
// original -> gobgp:bmp-server-config
Config BmpServerConfig `mapstructure:"config"`
// original -> gobgp:bmp-server-state
@@ -949,9 +947,6 @@ func (lhs *BmpServer) Equal(rhs *BmpServer) bool {
if lhs == nil || rhs == nil {
return false
}
- if lhs.Address != rhs.Address {
- return false
- }
if !lhs.Config.Equal(&(rhs.Config)) {
return false
}
@@ -1130,8 +1125,6 @@ func (lhs *RpkiServerConfig) Equal(rhs *RpkiServerConfig) bool {
//struct for container gobgp:rpki-server
type RpkiServer struct {
// original -> gobgp:address
- //gobgp:address's original type is inet:ip-address
- Address string `mapstructure:"address"`
// original -> gobgp:rpki-server-config
Config RpkiServerConfig `mapstructure:"config"`
// original -> gobgp:rpki-server-state
@@ -1142,9 +1135,6 @@ func (lhs *RpkiServer) Equal(rhs *RpkiServer) bool {
if lhs == nil || rhs == nil {
return false
}
- if lhs.Address != rhs.Address {
- return false
- }
if !lhs.Config.Equal(&(rhs.Config)) {
return false
}
@@ -1285,7 +1275,6 @@ func (lhs *PeerGroupConfig) Equal(rhs *PeerGroupConfig) bool {
//struct for container bgp:peer-group
type PeerGroup struct {
// original -> bgp:peer-group-name
- PeerGroupName string `mapstructure:"peer-group-name"`
// original -> bgp:peer-group-config
Config PeerGroupConfig `mapstructure:"config"`
// original -> bgp:peer-group-state
@@ -1322,9 +1311,6 @@ func (lhs *PeerGroup) Equal(rhs *PeerGroup) bool {
if lhs == nil || rhs == nil {
return false
}
- if lhs.PeerGroupName != rhs.PeerGroupName {
- return false
- }
if !lhs.Config.Equal(&(rhs.Config)) {
return false
}
@@ -1361,10 +1347,10 @@ func (lhs *PeerGroup) Equal(rhs *PeerGroup) bool {
{
lmap := make(map[string]*AfiSafi)
for _, l := range lhs.AfiSafis {
- lmap[string(l.AfiSafiName)] = &l
+ lmap[string(l.Config.AfiSafiName)] = &l
}
for _, r := range rhs.AfiSafis {
- if l, y := lmap[string(r.AfiSafiName)]; !y {
+ if l, y := lmap[string(r.Config.AfiSafiName)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -2399,8 +2385,6 @@ func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool {
//struct for container bgp:neighbor
type Neighbor struct {
// original -> bgp:neighbor-address
- //bgp:neighbor-address's original type is inet:ip-address
- NeighborAddress string `mapstructure:"neighbor-address"`
// original -> bgp:neighbor-config
Config NeighborConfig `mapstructure:"config"`
// original -> bgp:neighbor-state
@@ -2437,9 +2421,6 @@ func (lhs *Neighbor) Equal(rhs *Neighbor) bool {
if lhs == nil || rhs == nil {
return false
}
- if lhs.NeighborAddress != rhs.NeighborAddress {
- return false
- }
if !lhs.Config.Equal(&(rhs.Config)) {
return false
}
@@ -2476,10 +2457,10 @@ func (lhs *Neighbor) Equal(rhs *Neighbor) bool {
{
lmap := make(map[string]*AfiSafi)
for _, l := range lhs.AfiSafis {
- lmap[string(l.AfiSafiName)] = &l
+ lmap[string(l.Config.AfiSafiName)] = &l
}
for _, r := range rhs.AfiSafis {
- if l, y := lmap[string(r.AfiSafiName)]; !y {
+ if l, y := lmap[string(r.Config.AfiSafiName)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -3205,7 +3186,6 @@ func (lhs *MpGracefulRestart) Equal(rhs *MpGracefulRestart) bool {
//struct for container bgp-mp:afi-safi
type AfiSafi struct {
// original -> bgp-mp:afi-safi-name
- AfiSafiName AfiSafiType `mapstructure:"afi-safi-name"`
// original -> bgp-mp:mp-graceful-restart
MpGracefulRestart MpGracefulRestart `mapstructure:"mp-graceful-restart"`
// original -> bgp-mp:afi-safi-config
@@ -3248,9 +3228,6 @@ func (lhs *AfiSafi) Equal(rhs *AfiSafi) bool {
if lhs == nil || rhs == nil {
return false
}
- if lhs.AfiSafiName != rhs.AfiSafiName {
- return false
- }
if !lhs.MpGracefulRestart.Equal(&(rhs.MpGracefulRestart)) {
return false
}
@@ -3996,10 +3973,10 @@ func (lhs *Global) Equal(rhs *Global) bool {
{
lmap := make(map[string]*AfiSafi)
for _, l := range lhs.AfiSafis {
- lmap[string(l.AfiSafiName)] = &l
+ lmap[string(l.Config.AfiSafiName)] = &l
}
for _, r := range rhs.AfiSafis {
- if l, y := lmap[string(r.AfiSafiName)]; !y {
+ if l, y := lmap[string(r.Config.AfiSafiName)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -4053,10 +4030,10 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool {
{
lmap := make(map[string]*Neighbor)
for _, l := range lhs.Neighbors {
- lmap[string(l.NeighborAddress)] = &l
+ lmap[string(l.Config.NeighborAddress)] = &l
}
for _, r := range rhs.Neighbors {
- if l, y := lmap[string(r.NeighborAddress)]; !y {
+ if l, y := lmap[string(r.Config.NeighborAddress)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -4069,10 +4046,10 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool {
{
lmap := make(map[string]*PeerGroup)
for _, l := range lhs.PeerGroups {
- lmap[string(l.PeerGroupName)] = &l
+ lmap[string(l.Config.PeerGroupName)] = &l
}
for _, r := range rhs.PeerGroups {
- if l, y := lmap[string(r.PeerGroupName)]; !y {
+ if l, y := lmap[string(r.Config.PeerGroupName)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -4085,10 +4062,10 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool {
{
lmap := make(map[string]*RpkiServer)
for _, l := range lhs.RpkiServers {
- lmap[string(l.Address)] = &l
+ lmap[string(l.Config.Address)] = &l
}
for _, r := range rhs.RpkiServers {
- if l, y := lmap[string(r.Address)]; !y {
+ if l, y := lmap[string(r.Config.Address)]; !y {
return false
} else if !r.Equal(l) {
return false
@@ -4101,10 +4078,10 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool {
{
lmap := make(map[string]*BmpServer)
for _, l := range lhs.BmpServers {
- lmap[string(l.Address)] = &l
+ lmap[string(l.Config.Address)] = &l
}
for _, r := range rhs.BmpServers {
- if l, y := lmap[string(r.Address)]; !y {
+ if l, y := lmap[string(r.Config.Address)]; !y {
return false
} else if !r.Equal(l) {
return false