func (b *BGPEntity) Delete() bool {
	config := b.Get()
	if config == nil {
		return true
	}
	cmd := "no router bgp " + config.BgpAs()
	return b.Configure(cmd)
}
Delete deletes the BGP instance on the node.
Returns true(bool) if the commands complete successfully
package module
import (
	"net"
	"regexp"
	"strconv"
	"github.com/aristanetworks/goeapi"
)
type BgpNetworkEntry map[string]string
type BgpConfig struct {
	asNumber     string
	routerID     string
	shutdown     string
	maxPaths     string
	maxEcmpPaths string
	networks     []BgpNetworkEntry
}
func (b *BgpConfig) BgpAs() string {
	return b.asNumber
}
func (b *BgpConfig) RouterID() string {
	return b.routerID
}
func (b *BgpConfig) Shutdown() string {
	return b.shutdown
}
func (b *BgpConfig) MaximumPaths() string {
	return b.maxPaths
}
func (b *BgpConfig) MaximumEcmpPaths() string {
	return b.maxEcmpPaths
}
func (b *BgpConfig) Networks() []BgpNetworkEntry {
	return b.networks
}
func (b BgpNetworkEntry) Prefix() string {
	return b["prefix"]
}
func (b BgpNetworkEntry) MaskLen() string {
	return b["masklen"]
}
func (b BgpNetworkEntry) RouteMap() string {
	return b["route_map"]
}
type BGPEntity struct {
	neighbors *BgpNeighborsEntity
	*AbstractBaseEntity
}
func Bgp(node *goeapi.Node) *BGPEntity {
	return &BGPEntity{AbstractBaseEntity: &AbstractBaseEntity{node}}
}
func (b *BGPEntity) Get() *BgpConfig {
	config, err := b.GetBlock(`^router bgp .*`)
	if err != nil {
		return nil
	}
	var bgp = new(BgpConfig)
	bgp.asNumber = b.parseAS(config)
	bgp.routerID = b.parseRouterID(config)
	bgp.shutdown = strconv.FormatBool(b.parseShutdown(config))
	bgp.networks = b.parseNetworks(config)
	m := b.parseMaxPaths(config)
	bgp.maxPaths = m["maximum_paths"]
	bgp.maxEcmpPaths = m["maximum_ecmp_paths"]
	return bgp
}
func (b *BGPEntity) Neighbors() *BgpNeighborsEntity {
	if b.neighbors == nil {
		b.neighbors = BgpNeighbors(b.AbstractBaseEntity.node)
	}
	return b.neighbors
}
func (b *BGPEntity) parseAS(config string) string {
	re := regexp.MustCompile(`(?m)^router bgp (\d+)`)
	match := re.FindStringSubmatch(config)
	if match == nil {
		return ""
	}
	return match[1]
}
func (b *BGPEntity) parseRouterID(config string) string {
	re := regexp.MustCompile(`(?m)router-id ([^\s]+)`)
	match := re.FindStringSubmatch(config)
	if match == nil {
		return ""
	}
	return match[1]
}
func (b *BGPEntity) parseMaxPaths(config string) map[string]string {
	var maxPaths string
	var maxEcmp string
	re := regexp.MustCompile(`maximum-paths\s+(\d+)(?:\s+ecmp\s+(\d+))?`)
	if match := re.FindStringSubmatch(config); match != nil {
		maxPaths = match[1]
		maxEcmp = match[2]
	}
	return map[string]string{
		"maximum_paths":      maxPaths,
		"maximum_ecmp_paths": maxEcmp,
	}
}
func (b *BGPEntity) parseShutdown(config string) bool {
	matched, _ := regexp.MatchString(`(?m)no shutdown`, config)
	if matched {
		return false
	}
	return !matched
}
func (b *BGPEntity) parseNetworks(config string) []BgpNetworkEntry {
	reNet := regexp.MustCompile(`(?m)network (.+)/(\d+)(?: route-map (\w+))*`)
	matches := reNet.FindAllStringSubmatch(config, -1)
	if matches == nil {
		return nil
	}
	resource := make([]BgpNetworkEntry, len(matches))
	for idx, line := range matches {
		resource[idx] = BgpNetworkEntry{
			"prefix":    line[1],
			"masklen":   line[2],
			"route_map": line[3],
		}
	}
	return resource
}
func (b *BGPEntity) GetSection() string {
	config, err := b.GetBlock(`^router bgp .*`)
	if err != nil {
		return ""
	}
	return config
}
func (b *BGPEntity) ConfigureBgp(cmd string) bool {
	config := b.Get()
	if config == nil {
		return false
	}
	commands := []string{
		"router bgp " + config.BgpAs(),
		cmd,
	}
	return b.Configure(commands...)
}
func (b *BGPEntity) Create(bgpAS int) bool {
	if !(0 < bgpAS && bgpAS < 65535) {
		return false
	}
	cmd := "router bgp " + strconv.Itoa(bgpAS)
	return b.Configure(cmd)
}