diff options
-rw-r--r-- | test/scenario_test/docker_control.py | 24 | ||||
-rw-r--r-- | test/scenario_test/quagga-rsconfig.go | 61 | ||||
-rw-r--r-- | test/scenario_test/route_server_malformed_test.py | 3 |
3 files changed, 43 insertions, 45 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py index 70b494fa..be3be4d0 100644 --- a/test/scenario_test/docker_control.py +++ b/test/scenario_test/docker_control.py @@ -312,7 +312,7 @@ def get_notification_from_exabgp_log(): return err_mgs -def make_config(quagga_num, go_path, bridge): +def make_config(quagga_num, go_path, bridge, peer_opts=""): if go_path != "": print "specified go path is [ " + go_path + " ]." if os.path.isdir(go_path): @@ -321,11 +321,11 @@ def make_config(quagga_num, go_path, bridge): print "specified go path do not use." pwd = local("pwd", capture=True) cmd = go_path + "go run " + pwd + "/quagga-rsconfig.go -n " + str(quagga_num) +\ - " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts local(cmd, capture=True) -def make_config_append(quagga_num, go_path, bridge): +def make_config_append(quagga_num, go_path, bridge, peer_opts=""): if go_path != "": print "specified go path is [ " + go_path + " ]." if os.path.isdir(go_path): @@ -334,7 +334,7 @@ def make_config_append(quagga_num, go_path, bridge): print "specified go path do not use." pwd = local("pwd", capture=True) cmd = go_path + "go run " + pwd + "/quagga-rsconfig.go -a " + str(quagga_num) +\ - " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts local(cmd, capture=True) @@ -441,7 +441,7 @@ def init_ipv6_test_env_executor(quagga_num, use_local, go_path, log_debug=False) print "complete initialization of test environment." -def init_malformed_test_env_executor(conf_file, use_local, log_debug=False): +def init_malformed_test_env_executor(conf_file, use_local, go_path, log_debug=False): print "start initialization of exabgp test environment." if docker_container_check() or bridge_setting_check(): @@ -450,18 +450,12 @@ def init_malformed_test_env_executor(conf_file, use_local, log_debug=False): docker_containers_destroy() print "make gobgp test environment." + peer_opts = "--none-peer" create_config_dir() bridge_setting_for_docker_connection(BRIDGES) - pwd = local("pwd", capture=True) - gobgp_file = pwd + "/exabgp_test_conf/gobgpd.conf" - cmd = "cp " + gobgp_file + " " + CONFIG_DIRR - local(cmd, capture=True) - quagga_dir = CONFIG_DIRR + "q1" - cmd = "mkdir " + quagga_dir - local(cmd, capture=True) - quagga_file = pwd + "/exabgp_test_conf/quagga.conf" - cmd = "cp " + quagga_file + " " + quagga_dir + "/bgpd.conf" - local(cmd, capture=True) + make_config(1, go_path, BRIDGE_0) + make_config_append(100, go_path, BRIDGE_0, peer_opts) + # run gobgp docker container docker_container_run_gobgp(BRIDGE_0) # run exabgp docker container diff --git a/test/scenario_test/quagga-rsconfig.go b/test/scenario_test/quagga-rsconfig.go index 83b6e663..49fd24ea 100644 --- a/test/scenario_test/quagga-rsconfig.go +++ b/test/scenario_test/quagga-rsconfig.go @@ -80,7 +80,7 @@ func (qt *QuaggaConfig) IPv6Config() *bytes.Buffer { return buf } -func create_config_files(nr int, outputDir string, IPVersion string) { +func create_config_files(nr int, outputDir string, IPVersion string, nonePeer bool) { quaggaConfigList := make([]*QuaggaConfig, 0) gobgpConf := config.Bgp{ @@ -100,17 +100,19 @@ func create_config_files(nr int, outputDir string, IPVersion string) { Timers: config.Timers{HoldTime: 30, KeepaliveInterval: 10, IdleHoldTimeAfterReset: 10}, } gobgpConf.NeighborList = append(gobgpConf.NeighborList, c) - q := NewQuaggaConfig(i, &gobgpConf.Global, &c, net.ParseIP(serverAddress[IPVersion])) - quaggaConfigList = append(quaggaConfigList, q) - os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, i), 0755) - var err error - if IPVersion == "IPv6" { - err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.IPv6Config().Bytes(), 0644) - } else { - err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.IPv4Config().Bytes(), 0644) - } - if err != nil { - log.Fatal(err) + if !nonePeer { + q := NewQuaggaConfig(i, &gobgpConf.Global, &c, net.ParseIP(serverAddress[IPVersion])) + quaggaConfigList = append(quaggaConfigList, q) + os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, i), 0755) + var err error + if IPVersion == "IPv6" { + err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.IPv6Config().Bytes(), 0644) + } else { + err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, i), q.IPv4Config().Bytes(), 0644) + } + if err != nil { + log.Fatal(err) + } } } @@ -124,7 +126,7 @@ func create_config_files(nr int, outputDir string, IPVersion string) { } } -func append_config_files(ar int, outputDir string, IPVersion string) { +func append_config_files(ar int, outputDir string, IPVersion string, nonePeer bool) { gobgpConf := config.Bgp{ Global: config.Global{ @@ -140,21 +142,23 @@ func append_config_files(ar int, outputDir string, IPVersion string) { TransportOptions: config.TransportOptions{PassiveMode: true}, Timers: config.Timers{HoldTime: 30, KeepaliveInterval: 10, IdleHoldTimeAfterReset: 10}, } - q := NewQuaggaConfig(ar, &gobgpConf.Global, &c, net.ParseIP(serverAddress[IPVersion])) - os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, ar), 0755) - var err error - if IPVersion == "IPv6" { - err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, ar), q.IPv6Config().Bytes(), 0644) - } else { - err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, ar), q.IPv4Config().Bytes(), 0644) - } - if err != nil { - log.Fatal(err) + if !nonePeer { + q := NewQuaggaConfig(ar, &gobgpConf.Global, &c, net.ParseIP(serverAddress[IPVersion])) + os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, ar), 0755) + var err error + if IPVersion == "IPv6" { + err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, ar), q.IPv6Config().Bytes(), 0644) + } else { + err = ioutil.WriteFile(fmt.Sprintf("%s/q%d/bgpd.conf", outputDir, ar), q.IPv4Config().Bytes(), 0644) + } + if err != nil { + log.Fatal(err) + } } newConf := config.Bgp{} _, d_err := toml.DecodeFile(fmt.Sprintf("%s/gobgpd.conf", outputDir), &newConf) if d_err != nil { - log.Fatal(err) + log.Fatal(d_err) } newConf.NeighborList = append(newConf.NeighborList, c) var buffer bytes.Buffer @@ -162,7 +166,7 @@ func append_config_files(ar int, outputDir string, IPVersion string) { encoder.Encode(newConf) e_err := ioutil.WriteFile(fmt.Sprintf("%s/gobgpd.conf", outputDir), buffer.Bytes(), 0644) if e_err != nil { - log.Fatal(err) + log.Fatal(e_err) } } @@ -173,15 +177,14 @@ func main() { AppendClient int `short:"a" long:"append" description:"specifing the add client number" default:"0"` IPVersion string `short:"v" long:"ip-version" description:"specifing the use ip version" default:"IPv4"` NetIdentifier int `short:"i" long:"net-identifer" description:"specifing the use network identifier" default:"0"` + NonePeer bool `long:"none-peer" description:"disable make quagga config"` } parser := flags.NewParser(&opts, flags.Default) - _, err := parser.Parse() if err != nil { fmt.Print(err) os.Exit(1) } - if opts.OutputDir == "" { opts.OutputDir, _ = filepath.Abs(".") } else { @@ -204,11 +207,11 @@ func main() { } if opts.AppendClient == 0 { - create_config_files(opts.ClientNumber, opts.OutputDir, opts.IPVersion) + create_config_files(opts.ClientNumber, opts.OutputDir, opts.IPVersion, opts.NonePeer) } else { if _, err := os.Stat(fmt.Sprintf("%s/gobgpd.conf", opts.OutputDir)); os.IsNotExist(err) { log.Fatal(err) } - append_config_files(opts.AppendClient, opts.OutputDir, opts.IPVersion) + append_config_files(opts.AppendClient, opts.OutputDir, opts.IPVersion, opts.NonePeer) } } diff --git a/test/scenario_test/route_server_malformed_test.py b/test/scenario_test/route_server_malformed_test.py index 0e63c060..3902fc68 100644 --- a/test/scenario_test/route_server_malformed_test.py +++ b/test/scenario_test/route_server_malformed_test.py @@ -75,10 +75,11 @@ def test_malformed_packet(): use_local = parser_option.use_local log_debug = parser_option.gobgp_log_debug + go_path = parser_option.go_path for pkey in pattern: conf_file = pwd + "/exabgp_test_conf/" + pkey if os.path.isfile(conf_file) is True: - fab.init_malformed_test_env_executor(pkey, use_local, log_debug) + fab.init_malformed_test_env_executor(pkey, use_local, go_path, log_debug) print "please wait (" + str(initial_wait_time) + " second)" time.sleep(initial_wait_time) yield check_func, pkey, pattern[pkey] |