summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/config/example_toml.go21
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py7
-rw-r--r--tools/route-server/quagga-rsconfig.go16
3 files changed, 24 insertions, 20 deletions
diff --git a/tools/config/example_toml.go b/tools/config/example_toml.go
index 877f9b51..50abc3cb 100644
--- a/tools/config/example_toml.go
+++ b/tools/config/example_toml.go
@@ -5,24 +5,23 @@ import (
"fmt"
"github.com/BurntSushi/toml"
"github.com/osrg/gobgp/config"
- "net"
)
func main() {
b := config.Bgp{
Global: config.Global{
- GlobalConfig: config.GlobalConfig{
+ Config: config.GlobalConfig{
As: 12332,
- RouterId: net.ParseIP("10.0.0.1"),
+ RouterId: "10.0.0.1",
},
},
Neighbors: config.Neighbors{
NeighborList: []config.Neighbor{
config.Neighbor{
- NeighborConfig: config.NeighborConfig{
+ Config: config.NeighborConfig{
PeerAs: 12333,
AuthPassword: "apple",
- NeighborAddress: net.ParseIP("192.168.177.33"),
+ NeighborAddress: "192.168.177.33",
},
AfiSafis: config.AfiSafis{
@@ -33,7 +32,7 @@ func main() {
},
ApplyPolicy: config.ApplyPolicy{
- ApplyPolicyConfig: config.ApplyPolicyConfig{
+ Config: config.ApplyPolicyConfig{
ImportPolicy: []string{"pd1"},
DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE,
},
@@ -41,18 +40,18 @@ func main() {
},
config.Neighbor{
- NeighborConfig: config.NeighborConfig{
+ Config: config.NeighborConfig{
PeerAs: 12334,
AuthPassword: "orange",
- NeighborAddress: net.ParseIP("192.168.177.32"),
+ NeighborAddress: "192.168.177.32",
},
},
config.Neighbor{
- NeighborConfig: config.NeighborConfig{
+ Config: config.NeighborConfig{
PeerAs: 12335,
AuthPassword: "grape",
- NeighborAddress: net.ParseIP("192.168.177.34"),
+ NeighborAddress: "192.168.177.34",
},
},
},
@@ -88,7 +87,7 @@ func policy() config.RoutingPolicy {
NeighborSetName: "ns1",
NeighborInfoList: []config.NeighborInfo{
config.NeighborInfo{
- Address: net.ParseIP("10.0.0.2"),
+ Address: "10.0.0.2",
}},
}
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py
index d8f619dd..42e4e65e 100644
--- a/tools/pyang_plugins/bgpyang2golang.py
+++ b/tools/pyang_plugins/bgpyang2golang.py
@@ -242,7 +242,12 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
emit_type_name = '[]' + t.golang_name
if is_container(child):
- print >> o, ' %s\t%s' % (emit_type_name, emit_type_name)
+ name = emit_type_name
+ if name.startswith(convert_to_golang(struct_name)) and name.endswith("Config"):
+ name = 'Config'
+ elif name.startswith(convert_to_golang(struct_name)) and name.endswith("State"):
+ name = 'State'
+ print >> o, ' %s\t%s' % (name, emit_type_name)
else:
print >> o, ' %s\t%s' % (val_name_go, emit_type_name)
diff --git a/tools/route-server/quagga-rsconfig.go b/tools/route-server/quagga-rsconfig.go
index a58e8601..b104af8a 100644
--- a/tools/route-server/quagga-rsconfig.go
+++ b/tools/route-server/quagga-rsconfig.go
@@ -34,11 +34,11 @@ func (qt *QuaggaConfig) Config() *bytes.Buffer {
buf.WriteString("hostname bgpd\n")
buf.WriteString("password zebra\n")
- buf.WriteString(fmt.Sprintf("router bgp %d\n", qt.config.NeighborConfig.PeerAs))
+ buf.WriteString(fmt.Sprintf("router bgp %d\n", qt.config.Config.PeerAs))
buf.WriteString(fmt.Sprintf("bgp router-id 192.168.0.%d\n", qt.id))
buf.WriteString(fmt.Sprintf("network 192.168.%d.0/24\n", qt.id))
- buf.WriteString(fmt.Sprintf("neighbor %s remote-as %d\n", qt.serverIP, qt.gobgpConfig.GlobalConfig.As))
- buf.WriteString(fmt.Sprintf("neighbor %s password %s\n", qt.serverIP, qt.config.NeighborConfig.AuthPassword))
+ buf.WriteString(fmt.Sprintf("neighbor %s remote-as %d\n", qt.serverIP, qt.gobgpConfig.Config.As))
+ buf.WriteString(fmt.Sprintf("neighbor %s password %s\n", qt.serverIP, qt.config.Config.AuthPassword))
buf.WriteString("log file /var/log/quagga/bgpd.log")
return buf
}
@@ -47,15 +47,15 @@ func create_config_files(nr int, outputDir string) {
quaggaConfigList := make([]*QuaggaConfig, 0)
gobgpConf := config.Bgp{}
- gobgpConf.Global.GlobalConfig.As = 65000
- gobgpConf.Global.GlobalConfig.RouterId = net.ParseIP("192.168.255.1")
+ gobgpConf.Global.Config.As = 65000
+ gobgpConf.Global.Config.RouterId = "192.168.255.1"
for i := 1; i < nr+1; i++ {
c := config.Neighbor{}
- c.NeighborConfig.PeerAs = 65000 + uint32(i)
- c.NeighborConfig.NeighborAddress = net.ParseIP(fmt.Sprintf("10.0.0.%d", i))
- c.NeighborConfig.AuthPassword = fmt.Sprintf("hoge%d", i)
+ c.Config.PeerAs = 65000 + uint32(i)
+ c.Config.NeighborAddress = fmt.Sprintf("10.0.0.%d", i)
+ c.Config.AuthPassword = fmt.Sprintf("hoge%d", i)
gobgpConf.Neighbors.NeighborList = append(gobgpConf.Neighbors.NeighborList, c)
q := NewQuaggaConfig(i, &gobgpConf.Global, &c, net.ParseIP("10.0.255.1"))