Initial commit of interface

This commit is contained in:
James Page 2015-07-15 17:06:36 +01:00
commit be82dfb140
3 changed files with 37 additions and 0 deletions

9
copyright Normal file
View File

@ -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'

3
interface.yaml Normal file
View File

@ -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>

25
provides.py Normal file
View File

@ -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)