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.
19 from emuvim
.api
.openstack
.resources
.net
import Net
20 from emuvim
.api
.osm
.kafka
import Kafka
21 from emuvim
.api
.osm
.lcm
import LCM
22 from emuvim
.api
.osm
.mongo
import Mongo
23 from emuvim
.api
.osm
.mysql
import Mysql
24 from emuvim
.api
.osm
.nbi
import NBI
25 from emuvim
.api
.osm
.ro
import RO
26 from emuvim
.api
.osm
.zookeeper
import Zookeeper
30 def __init__(self
, net
,
33 vca_host
=os
.environ
.get('VCA_HOST'),
34 vca_secret
=os
.environ
.get('VCA_SECRET'),
35 osm_version
='releasefive-daily',
36 ip_start
='10.0.0.100'):
37 ip_int
= Net
.ip_2_int(ip_start
)
38 zookeeper_ip
= ip_start
39 kafka_ip
= Net
.int_2_ip(ip_int
+ 1)
40 mongo_ip
= Net
.int_2_ip(ip_int
+ 2)
41 nbi_ip
= Net
.int_2_ip(ip_int
+ 3)
42 ro_db_ip
= Net
.int_2_ip(ip_int
+ 4)
43 ro_ip
= Net
.int_2_ip(ip_int
+ 5)
44 lcm_ip
= Net
.int_2_ip(ip_int
+ 6)
46 name_prefix
= '%s-' % name
47 self
.zookeeper
= Zookeeper(net
, '%s/16' % zookeeper_ip
, name_prefix
=name_prefix
)
48 self
.kafka
= Kafka(net
, '%s/16' % kafka_ip
, zookeeper_ip
, name_prefix
=name_prefix
)
49 self
.mongo
= Mongo(net
, '%s/16' % mongo_ip
, name_prefix
=name_prefix
)
50 self
.nbi
= NBI(net
, '%s/16' % nbi_ip
, mongo_ip
, kafka_ip
, version
=osm_version
, name_prefix
=name_prefix
)
51 self
.ro_db
= Mysql(net
, '%s/16' % ro_db_ip
, name_prefix
=name_prefix
)
52 self
.ro
= RO(net
, '%s/16' % ro_ip
, ro_db_ip
, version
=osm_version
, name_prefix
=name_prefix
)
53 self
.lcm
= LCM(net
, '%s/16' % lcm_ip
, ro_ip
, mongo_ip
, kafka_ip
,
54 vca_host
, vca_secret
, version
=osm_version
, name_prefix
=name_prefix
)
56 net
.addLink(self
.zookeeper
.instance
, switch
)
57 net
.addLink(self
.kafka
.instance
, switch
)
58 net
.addLink(self
.mongo
.instance
, switch
)
59 net
.addLink(self
.nbi
.instance
, switch
)
60 net
.addLink(self
.ro_db
.instance
, switch
)
61 net
.addLink(self
.ro
.instance
, switch
)
62 net
.addLink(self
.lcm
.instance
, switch
)
65 self
.zookeeper
.start()
73 # forward api related calls
74 def onboard_vnfd(self
, *args
, **kwargs
):
75 return self
.nbi
.onboard_vnfd(*args
, **kwargs
)
77 def onboard_nsd(self
, *args
, **kwargs
):
78 return self
.nbi
.onboard_nsd(*args
, **kwargs
)
80 def register_emulated_api(self
, *args
, **kwargs
):
81 return self
.nbi
.register_emulated_api(*args
, **kwargs
)
84 return self
.nbi
.ns_list()
86 def ns_create(self
, *args
, **kwargs
):
87 return self
.nbi
.ns_create(*args
, **kwargs
)
89 def ns_delete(self
, *args
, **kwargs
):
90 return self
.nbi
.ns_delete(*args
, **kwargs
)
92 def ns_get(self
, *args
, **kwargs
):
93 return self
.nbi
.ns_get(*args
, **kwargs
)
95 def ns_action(self
, *args
, **kwargs
):
96 return self
.nbi
.ns_action(*args
, **kwargs
)
98 def ns_wait_until_all_in_status(self
, *args
, **kwargs
):
99 return self
.nbi
.ns_wait_until_all_in_status(*args
, **kwargs
)