Initial commit of interface
This commit is contained in:
commit
be82dfb140
|
@ -0,0 +1,9 @@
|
|||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
|
||||
|
||||
Files: *
|
||||
Copyright: 2015, Canonical Ltd.
|
||||
License: GPL-3
|
||||
|
||||
License: GPL-3
|
||||
On Debian GNU/Linux system you can find the complete text of the
|
||||
GPL-3 license in '/usr/share/common-licenses/GPL-3'
|
|
@ -0,0 +1,3 @@
|
|||
name: neutron-plugin
|
||||
summary: Interface for intergrating Neutron SDN's with the nova-compute charm
|
||||
maintainer: James Page <james.page@ubuntu.com>
|
|
@ -0,0 +1,25 @@
|
|||
import json
|
||||
|
||||
from charmhelpers.core.reactive import hook
|
||||
from charmhelpers.core.reactive import RelationBase
|
||||
from charmhelpers.core.reactive import scopes
|
||||
|
||||
|
||||
class NeutronPluginProvides(RelationBase):
|
||||
scope = scopes.GLOBAL
|
||||
|
||||
@hook('{provides:neutron-plugin}-relation-{joined,changed}')
|
||||
def changed(self):
|
||||
self.set_state('{relation_name}.connected')
|
||||
|
||||
@hook('{provides:neutron-plugin}-relation-{broken,departed}')
|
||||
def broken(self):
|
||||
self.remove_state('{relation_name}.connected')
|
||||
|
||||
def configure_plugin(self, plugin, config):
|
||||
conversation = self.conversation()
|
||||
relation_info = {
|
||||
'neutron-plugin': plugin,
|
||||
'subordinate_configuration': json.dumps(config),
|
||||
}
|
||||
conversation.set_remote(**relation_info)
|
Loading…
Reference in New Issue