summaryrefslogtreecommitdiffhomepage
path: root/tools/config
diff options
context:
space:
mode:
Diffstat (limited to 'tools/config')
-rw-r--r--tools/config/example_toml.go118
1 files changed, 42 insertions, 76 deletions
diff --git a/tools/config/example_toml.go b/tools/config/example_toml.go
index 50abc3cb..01999f21 100644
--- a/tools/config/example_toml.go
+++ b/tools/config/example_toml.go
@@ -15,44 +15,39 @@ func main() {
RouterId: "10.0.0.1",
},
},
- Neighbors: config.Neighbors{
- NeighborList: []config.Neighbor{
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12333,
- AuthPassword: "apple",
- NeighborAddress: "192.168.177.33",
- },
- AfiSafis: config.AfiSafis{
-
- AfiSafiList: []config.AfiSafi{
- config.AfiSafi{AfiSafiName: "ipv4-unicast"},
- config.AfiSafi{AfiSafiName: "ipv6-unicast"},
- },
- },
- ApplyPolicy: config.ApplyPolicy{
+ Neighbors: []config.Neighbor{
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12333,
+ AuthPassword: "apple",
+ NeighborAddress: "192.168.177.33",
+ },
+ AfiSafis: []config.AfiSafi{
+ config.AfiSafi{AfiSafiName: "ipv4-unicast"},
+ config.AfiSafi{AfiSafiName: "ipv6-unicast"},
+ },
+ ApplyPolicy: config.ApplyPolicy{
- Config: config.ApplyPolicyConfig{
- ImportPolicy: []string{"pd1"},
- DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE,
- },
+ Config: config.ApplyPolicyConfig{
+ ImportPolicyList: []string{"pd1"},
+ DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE,
},
},
+ },
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12334,
- AuthPassword: "orange",
- NeighborAddress: "192.168.177.32",
- },
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12334,
+ AuthPassword: "orange",
+ NeighborAddress: "192.168.177.32",
},
+ },
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12335,
- AuthPassword: "grape",
- NeighborAddress: "192.168.177.34",
- },
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12335,
+ AuthPassword: "grape",
+ NeighborAddress: "192.168.177.34",
},
},
},
@@ -84,59 +79,34 @@ func policy() config.RoutingPolicy {
}
ns := config.NeighborSet{
- NeighborSetName: "ns1",
- NeighborInfoList: []config.NeighborInfo{
- config.NeighborInfo{
- Address: "10.0.0.2",
- }},
+ NeighborSetName: "ns1",
+ NeighborInfoList: []string{"10.0.0.2"},
}
cs := config.CommunitySet{
CommunitySetName: "community1",
- CommunityList: []config.Community{
- config.Community{Community: "65100:10"},
- },
+ CommunityList: []string{"65100:10"},
}
ecs := config.ExtCommunitySet{
ExtCommunitySetName: "ecommunity1",
- ExtCommunityList: []config.ExtCommunity{
- config.ExtCommunity{ExtCommunity: "RT:65001:200"},
- },
+ ExtCommunityList: []string{"RT:65001:200"},
}
as := config.AsPathSet{
AsPathSetName: "aspath1",
- AsPathList: []config.AsPath{
- config.AsPath{AsPath: "^65100"},
- },
+ AsPathList: []string{"^65100"},
}
bds := config.BgpDefinedSets{
-
- CommunitySets: config.CommunitySets{
- CommunitySetList: []config.CommunitySet{cs},
- },
-
- ExtCommunitySets: config.ExtCommunitySets{
- ExtCommunitySetList: []config.ExtCommunitySet{ecs},
- },
-
- AsPathSets: config.AsPathSets{
- AsPathSetList: []config.AsPathSet{as},
- },
+ CommunitySets: []config.CommunitySet{cs},
+ ExtCommunitySets: []config.ExtCommunitySet{ecs},
+ AsPathSets: []config.AsPathSet{as},
}
ds := config.DefinedSets{
-
- PrefixSets: config.PrefixSets{
- PrefixSetList: []config.PrefixSet{ps},
- },
-
- NeighborSets: config.NeighborSets{
- NeighborSetList: []config.NeighborSet{ns},
- },
-
+ PrefixSets: []config.PrefixSet{ps},
+ NeighborSets: []config.NeighborSet{ns},
BgpDefinedSets: bds,
}
@@ -185,7 +155,7 @@ func policy() config.RoutingPolicy {
BgpActions: config.BgpActions{
SetCommunity: config.SetCommunity{
SetCommunityMethod: config.SetCommunityMethod{
- Communities: []string{"65100:20"},
+ CommunitiesList: []string{"65100:20"},
},
Options: "ADD",
},
@@ -195,17 +165,13 @@ func policy() config.RoutingPolicy {
}
pd := config.PolicyDefinition{
- Name: "pd1",
- Statements: config.Statements{
- StatementList: []config.Statement{s},
- },
+ Name: "pd1",
+ Statements: []config.Statement{s},
}
p := config.RoutingPolicy{
- DefinedSets: ds,
- PolicyDefinitions: config.PolicyDefinitions{
- PolicyDefinitionList: []config.PolicyDefinition{pd},
- },
+ DefinedSets: ds,
+ PolicyDefinitions: []config.PolicyDefinition{pd},
}
return p