2 # Copyright (c) 2019 Erik Schilling
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from emuvim
.api
.openstack
.openstack_api_endpoint
import OpenstackApiEndpoint
21 from emuvim
.api
.osm
.kafka
import Kafka
22 from emuvim
.api
.osm
.lcm
import LCM
23 from emuvim
.api
.osm
.mongo
import Mongo
24 from emuvim
.api
.osm
.mysql
import Mysql
25 from emuvim
.api
.osm
.nbi
import NBI
26 from emuvim
.api
.osm
.ro
import RO
27 from emuvim
.api
.osm
.zookeeper
import Zookeeper
28 from emuvim
.dcemulator
.net
import DCNetwork
31 from mininet
.log
import setLogLevel
36 with
open('osm_component_startup_%d.csv' % time
.time(), 'w') as csvfile
:
37 fieldnames
= ['other', 'zookeeper', 'kafka', 'mongo', 'nbi', 'ro_db', 'ro', 'lcm']
38 writer
= csv
.DictWriter(csvfile
, fieldnames
=fieldnames
)
41 for i
in range(COUNT
):
43 net
= DCNetwork(monitor
=False, enable_learning
=True)
46 dc1
= net
.addDatacenter("dc1")
47 api
= OpenstackApiEndpoint("0.0.0.0", 6001)
48 api
.connect_datacenter(dc1
)
49 api
.connect_dc_network(net
)
51 s1
= net
.addSwitch('s1')
53 zookeeper_ip
= '10.0.0.96'
54 kafka_ip
= '10.0.0.97'
55 mongo_ip
= '10.0.0.98'
57 ro_db_ip
= '10.0.0.100'
61 d1
= net
.addDocker('d1', dimage
='ubuntu:trusty')
63 VERSION
= 'releasefive-daily'
65 zookeeper
= Zookeeper(net
, zookeeper_ip
)
66 kafka
= Kafka(net
, kafka_ip
, zookeeper_ip
)
67 mongo
= Mongo(net
, mongo_ip
)
68 nbi
= NBI(net
, nbi_ip
, mongo_ip
, kafka_ip
)
69 ro_db
= Mysql(net
, ro_db_ip
)
70 ro
= RO(net
, ro_ip
, ro_db_ip
, version
=VERSION
)
71 lcm
= LCM(net
, lcm_ip
, ro_ip
, mongo_ip
, kafka_ip
)
74 net
.addLink(zookeeper
.instance
, s1
)
75 net
.addLink(kafka
.instance
, s1
)
76 net
.addLink(mongo
.instance
, s1
)
77 net
.addLink(nbi
.instance
, s1
)
78 net
.addLink(ro_db
.instance
, s1
)
79 net
.addLink(ro
.instance
, s1
)
80 net
.addLink(lcm
.instance
, s1
)
85 other_end
= time
.time()
87 zookeeper_started
= time
.time()
89 kafka_started
= time
.time()
91 mongo_started
= time
.time()
93 nbi_started
= time
.time()
95 ro_db_started
= time
.time()
97 ro_started
= time
.time()
99 lcm_started
= time
.time()
102 'other': other_end
- start
,
103 'zookeeper': zookeeper_started
- other_end
,
104 'kafka': kafka_started
- zookeeper_started
,
105 'mongo': mongo_started
- kafka_started
,
106 'nbi': nbi_started
- mongo_started
,
107 'ro_db': ro_db_started
- nbi_started
,
108 'ro': ro_started
- ro_db_started
,
109 'lcm': lcm_started
- ro_started
,