~plumgrid-team/charms/trusty/nova-compute/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: james.page at ubuntu
  • Date: 2015-04-13 08:57:13 UTC
  • mfrom: (79.4.12 nova-compute)
  • Revision ID: james.page@ubuntu.com-20150413085713-ta2bukefgsd68p2g
[smukkamala,narindergupta,r=jamespage] Add support for Nuage VSP.

Show diffs side-by-side

added added

removed removed

Lines of Context:
320
320
 
321
321
 
322
322
class IdentityServiceContext(OSContextGenerator):
323
 
    interfaces = ['identity-service']
324
323
 
325
 
    def __init__(self, service=None, service_user=None):
 
324
    def __init__(self, service=None, service_user=None, rel_name='identity-service'):
326
325
        self.service = service
327
326
        self.service_user = service_user
 
327
        self.rel_name = rel_name
 
328
        self.interfaces = [self.rel_name]
328
329
 
329
330
    def __call__(self):
330
 
        log('Generating template context for identity-service', level=DEBUG)
 
331
        log('Generating template context for ' + self.rel_name, level=DEBUG)
331
332
        ctxt = {}
332
333
 
333
334
        if self.service and self.service_user:
341
342
 
342
343
            ctxt['signing_dir'] = cachedir
343
344
 
344
 
        for rid in relation_ids('identity-service'):
 
345
        for rid in relation_ids(self.rel_name):
345
346
            for unit in related_units(rid):
346
347
                rdata = relation_get(rid=rid, unit=unit)
347
348
                serv_host = rdata.get('service_host')
807
808
 
808
809
        return ovs_ctxt
809
810
 
 
811
    def nuage_ctxt(self):
 
812
        driver = neutron_plugin_attribute(self.plugin, 'driver',
 
813
                                          self.network_manager)
 
814
        config = neutron_plugin_attribute(self.plugin, 'config',
 
815
                                          self.network_manager)
 
816
        nuage_ctxt = {'core_plugin': driver,
 
817
                      'neutron_plugin': 'vsp',
 
818
                      'neutron_security_groups': self.neutron_security_groups,
 
819
                      'local_ip': unit_private_ip(),
 
820
                      'config': config}
 
821
 
 
822
        return nuage_ctxt
 
823
 
810
824
    def nvp_ctxt(self):
811
825
        driver = neutron_plugin_attribute(self.plugin, 'driver',
812
826
                                          self.network_manager)
890
904
            ctxt.update(self.n1kv_ctxt())
891
905
        elif self.plugin == 'Calico':
892
906
            ctxt.update(self.calico_ctxt())
 
907
        elif self.plugin == 'vsp':
 
908
            ctxt.update(self.nuage_ctxt())
893
909
 
894
910
        alchemy_flags = config('neutron-alchemy-flags')
895
911
        if alchemy_flags: