summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/bgp_configs.go6
-rw-r--r--config/default.go1
-rw-r--r--config/serve.go2
-rw-r--r--server/fsm.go4
-rw-r--r--tools/pyang_plugins/gobgp.yang10
5 files changed, 22 insertions, 1 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index c259d426..57866339 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -2307,6 +2307,9 @@ type NeighborConfig struct {
// original -> bgp:neighbor-address
//bgp:neighbor-address's original type is inet:ip-address
NeighborAddress string `mapstructure:"neighbor-address"`
+ // original -> gobgp:admin-down
+ //gobgp:admin-down's original type is boolean
+ AdminDown bool `mapstructure:"admin-down"`
}
func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool {
@@ -2343,6 +2346,9 @@ func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool {
if lhs.NeighborAddress != rhs.NeighborAddress {
return false
}
+ if lhs.AdminDown != rhs.AdminDown {
+ return false
+ }
return true
}
diff --git a/config/default.go b/config/default.go
index 102621eb..24dc08c7 100644
--- a/config/default.go
+++ b/config/default.go
@@ -141,6 +141,7 @@ func SetDefaultConfigValues(v *viper.Viper, b *BgpConfigSet) error {
n.State.Description = n.Config.Description
n.Config.Description = ""
+ n.State.AdminDown = n.Config.AdminDown
if !vv.IsSet("neighbor.config.local-as") {
n.Config.LocalAs = b.Global.Config.As
diff --git a/config/serve.go b/config/serve.go
index 21196433..6f49d0da 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -86,6 +86,8 @@ func UpdateConfig(curC, newC *BgpConfigSet) ([]Neighbor, []Neighbor, []Neighbor,
if idx := inSlice(n, curC.Neighbors); idx < 0 {
added = append(added, n)
} else if !n.Equal(&curC.Neighbors[idx]) {
+ log.Debug("current neighbor config:", curC.Neighbors[idx])
+ log.Debug("new neighbor config:", n)
updated = append(updated, n)
}
}
diff --git a/server/fsm.go b/server/fsm.go
index 4132f3b1..c6cd01c7 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -207,7 +207,7 @@ func (fsm *FSM) bgpMessageStateUpdate(MessageType uint8, isIn bool) {
func NewFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingPolicy) *FSM {
adminState := ADMIN_STATE_UP
- if pConf.State.AdminDown {
+ if pConf.Config.AdminDown {
adminState = ADMIN_STATE_DOWN
}
pConf.State.SessionState = config.IntToSessionStateMap[int(bgp.BGP_FSM_IDLE)]
@@ -1288,6 +1288,8 @@ func (h *FSMHandler) changeAdminState(s AdminState) error {
}).Debug("admin state changed")
fsm.adminState = s
+ fsm.pConf.State.AdminDown = !fsm.pConf.State.AdminDown
+ fsm.pConf.Config.AdminDown = !fsm.pConf.Config.AdminDown
switch s {
case ADMIN_STATE_UP:
diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang
index 480bca9b..c15f3bc6 100644
--- a/tools/pyang_plugins/gobgp.yang
+++ b/tools/pyang_plugins/gobgp.yang
@@ -561,6 +561,16 @@ module gobgp {
uses gobgp-message-counter;
}
+ augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:config" {
+ description "additional state elements";
+
+ leaf admin-down {
+ type boolean;
+ description
+ "The config of administrative operation. If state, indicates the neighbor is disabled by the administrator";
+ }
+ }
+
augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
description "additional state elements";