summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-19 22:14:11 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-19 22:14:11 -0800
commit9b28f7d5caa24506f44adb765276960cb3a500f5 (patch)
tree0fb757032fb98d3ace68923bb53b6ff043c030f5
parentefff7f552f863fd3e895e091464ca63ff8990cba (diff)
Revert "test: add performance_test"
This reverts commit 34bd365bb4534f2321acea686996e2293727923c. Conflicts: server/peer.go test/performance_test/README.md test/performance_test/main.go test/performance_test/test.py
-rw-r--r--server/peer.go8
-rw-r--r--test/performance_test/README.md31
-rw-r--r--test/performance_test/main.go113
-rw-r--r--test/performance_test/test.py94
4 files changed, 0 insertions, 246 deletions
diff --git a/server/peer.go b/server/peer.go
index ee9c8bdd..b8b8d5a8 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -65,14 +65,6 @@ func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager, pol
return peer
}
-func (peer *Peer) Fsm() *FSM {
- return peer.fsm
-}
-
-func (peer *Peer) Outgoing() chan *bgp.BGPMessage {
- return peer.outgoing
-}
-
func (peer *Peer) ID() string {
return peer.conf.Config.NeighborAddress
}
diff --git a/test/performance_test/README.md b/test/performance_test/README.md
deleted file mode 100644
index f0edaea3..00000000
--- a/test/performance_test/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-Performance Test
-===
-
-[Hoofprints](https://github.com/sspies8684/hoofprints) inspired route-server performance test suite
-
-## Prerequisites
-
-Follow the 'Prerequisites' and 'Set up dependencies' section of [Scenario Test](https://github.com/osrg/gobgp/blob/master/test/scenario_test/README.md).
-
-## Create tester container
-
-```shell
-$ cd $GOPATH/src/github.com/osrg/gobgp
-$ sudo fab -f ./test/lib/base.py make_gobgp_ctn:tag=gobgp
-$ sudo fab -f ./test/performance_test/test.py make_tester_ctn:tag=tester,from_image=gobgp
-```
-
-## Run test
-
-```shell
-$ cd $GOPATH/src/github.com/osrg/gobgp/test/performance_test
-$ sudo PYTHONPATH=../ python test.py -t gobgp -n 1000 T1
-$ sudo PYTHONPATH=../ python test.py -t quagga -n 1000 T1
-```
-
-To test BIRD, pull BIRD docker image first.
-
-```shell
-$ docker pull osrg/bird
-$ sudo PYTHONPATH=../ python test.py -t bird -n 1000 T1
-```
diff --git a/test/performance_test/main.go b/test/performance_test/main.go
deleted file mode 100644
index aec15b54..00000000
--- a/test/performance_test/main.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2015 Nippon Telegraph and Telephone Corporation.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-// implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
- "fmt"
- "os"
- "time"
-
- log "github.com/Sirupsen/logrus"
- "github.com/jessevdk/go-flags"
- "github.com/osrg/gobgp/config"
- "github.com/osrg/gobgp/packet"
- "github.com/osrg/gobgp/server"
- "github.com/osrg/gobgp/table"
-)
-
-func newPeer(g config.Global, p config.Neighbor, incoming chan *server.FsmMsg) *server.Peer {
- tbl := table.NewTableManager([]bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv6_UC}, 0, 0)
- peer := server.NewPeer(g, p, tbl, table.NewRoutingPolicy())
- server.NewFSMHandler(peer.Fsm(), incoming, incoming, peer.Outgoing())
- return peer
-}
-
-func main() {
- var opts struct {
- NumPeer int `short:"n" long:"num-peer" description:"num of peers"`
- }
- args, err := flags.Parse(&opts)
- if err != nil {
- os.Exit(1)
- }
- if len(args) != 1 || args[0] != "T1" {
- log.Errorf("Usage: performance_test -n <num-peer> T1")
- os.Exit(1)
- }
-
- peerMap := make(map[string]*server.Peer)
- incoming := make(chan *server.FsmMsg, 1024)
- num := opts.NumPeer
- start := time.Now()
- for i := 0; i < num; i++ {
- localAddr := fmt.Sprintf("10.10.%d.%d", (i+2)/255, (i+2)%255)
- g := config.Global{
- Config: config.GlobalConfig{
- As: uint32(1001 + i),
- RouterId: localAddr,
- },
- }
- p := config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 1000,
- NeighborAddress: "10.10.0.1",
- },
- Transport: config.Transport{
- Config: config.TransportConfig{
- LocalAddress: localAddr,
- },
- },
- }
- peer := newPeer(g, p, incoming)
- peerMap[p.Transport.Config.LocalAddress] = peer
- }
- established := 0
- ticker := time.NewTicker(time.Second * 5)
- for {
- select {
- case msg := <-incoming:
- peer := peerMap[msg.MsgDst]
- switch msg.MsgType {
- case server.FSM_MSG_STATE_CHANGE:
- nextState := msg.MsgData.(bgp.FSMState)
- fsm := peer.Fsm()
- fsm.StateChange(nextState)
- server.NewFSMHandler(fsm, incoming, incoming, peer.Outgoing())
- if nextState == bgp.BGP_FSM_ESTABLISHED {
- established++
- }
- if num == established {
- goto END
- }
- }
- case <-ticker.C:
- now := time.Now()
- log.Infof("[%s] # of established: %d", now.Sub(start), established)
- }
- }
-END:
- end := time.Now()
- log.Infof("all established. elapsed time: %s", end.Sub(start))
- if args[0] == "T1" {
- return
- }
- for {
- select {
- case msg := <-incoming:
- fmt.Println(msg)
- }
- }
-}
diff --git a/test/performance_test/test.py b/test/performance_test/test.py
deleted file mode 100644
index 4d3e8cc8..00000000
--- a/test/performance_test/test.py
+++ /dev/null
@@ -1,94 +0,0 @@
-from lib.gobgp import *
-from lib.quagga import *
-from lib.bird import *
-from fabric.api import local
-from optparse import OptionParser
-import sys
-import os
-
-def make_tester_ctn(tag='tester', local_gobgp_path='', from_image='osrg/quagga'):
- if local_gobgp_path == '':
- local_gobgp_path = os.getcwd()
-
- c = CmdBuffer()
- c << 'FROM {0}'.format(from_image)
- c << 'ADD gobgp /go/src/github.com/osrg/gobgp/'
- c << 'RUN go get github.com/osrg/gobgp/test/performance_test'
- c << 'RUN go install github.com/osrg/gobgp/test/performance_test'
-
- rindex = local_gobgp_path.rindex('gobgp')
- if rindex < 0:
- raise Exception('{0} seems not gobgp dir'.format(local_gobgp_path))
-
- workdir = local_gobgp_path[:rindex]
- with lcd(workdir):
- local('echo \'{0}\' > Dockerfile'.format(str(c)))
- local('docker build -t {0} .'.format(tag))
- local('rm Dockerfile')
-
-
-class DummyPeer(object):
- def __init__(self, asn):
- self.asn = asn
-
-if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option("-t", "--target", dest="target_rs", default="gobgp")
- parser.add_option("-n", "--num-peer", dest="num_peer", type="int", default=1000)
- (options, args) = parser.parse_args()
-
- if options.target_rs == "gobgp":
- target = GoBGPContainer("target", 1000, "10.10.0.1", log_level='info')
- elif options.target_rs == "quagga":
- target = QuaggaBGPContainer("target", 1000, "10.10.0.1")
- elif options.target_rs == "bird":
- target = BirdContainer("target", 1000, "10.10.0.1")
- else:
- print 'Unknown target implementation:', options.target_rs
- sys.exit(1)
-
- if options.num_peer < 0 or options.num_peer > 255*255:
- print 'invalid number of peer'
- sys.exit(1)
-
- br = Bridge("br01", with_ip=False)
- tester = Container("tester", "tester")
- tester.shared_volumes.append(('/tmp', '/root/shared_volume'))
- tester.run()
- target.run()
- br.addif(tester)
- br.addif(target)
- target.local("ip a add 10.10.0.1/16 dev eth1")
-
- c = CmdBuffer()
- c << "#!/bin/sh"
- for i in range(options.num_peer):
- p = DummyPeer(i+1001)
- neigh_addr = '10.10.{0}.{1}/16'.format((i+2)/255, (i+2)%255)
- target.peers[p] = {'neigh_addr': neigh_addr,
- 'passwd': None,
- 'evpn': False,
- 'flowspec': False,
- 'is_rs_client': True,
- 'is_rr_client': False,
- 'cluster_id': None,
- 'policies': {},
- 'passive': True,
- 'local_addr': '10.10.0.1'}
- c << "ip a add {0} dev eth1".format(neigh_addr)
- with open('/tmp/setup_tester.sh', 'w') as f:
- f.write(str(c))
- local('chmod +x /tmp/setup_tester.sh')
- tester.local("/root/shared_volume/setup_tester.sh")
-
- c = CmdBuffer()
- c << "#!/bin/sh"
- c << "performance_test -n {0} {1} > /root/shared_volume/test.log".format(options.num_peer, ' '.join(args))
- with open('/tmp/start_test.sh', 'w') as f:
- f.write(str(c))
- local('chmod +x /tmp/start_test.sh')
-
- target.create_config()
- target.reload_config()
-
- tester.local("/root/shared_volume/start_test.sh")