Interface with quagga
Use the interface-bgp to interface with the quagga charm.
This commit is contained in:
parent
5f9683541f
commit
12a86bbd3d
|
@ -1,6 +1,9 @@
|
|||
options:
|
||||
bgp-peer-ips:
|
||||
asn:
|
||||
default:
|
||||
type: string
|
||||
type: int
|
||||
description: |
|
||||
Space delimited IPs of BGP peers.
|
||||
BGP Autonomous System Number for the OpenStack networks being advertised.
|
||||
This setting is primarily used for testing. In production use ASNs are
|
||||
configured post-deployment via the OpenStack client when creating bgp
|
||||
speakers.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
includes:
|
||||
- layer:openstack-principle
|
||||
- interface:rabbitmq
|
||||
- interface:bgp
|
||||
#repo: https://github.com/openstack/charm-neutron-dynamic-routing
|
||||
options:
|
||||
basic:
|
||||
|
|
|
@ -89,23 +89,6 @@ class TransportURLAdapter(os_adapters.RabbitMQRelationAdapter):
|
|||
return self.ssl_port or 5672
|
||||
|
||||
|
||||
class BGPPeerRelationAdapter(os_adapters.OpenStackRelationAdapter):
|
||||
|
||||
"""
|
||||
STub Adapter for the BGPPeerProvides relation interface.
|
||||
"""
|
||||
|
||||
interface_type = 'bgp'
|
||||
|
||||
@property
|
||||
def provider_ip(self):
|
||||
return ch_ip.get_relation_ip('provider')
|
||||
|
||||
@property
|
||||
def speaker_ip(self):
|
||||
return ch_ip.get_relation_ip('speaker')
|
||||
|
||||
|
||||
class DRAgentCharm(charms_openstack.charm.OpenStackCharm):
|
||||
"""DRAgentCharm provides the specialisation of the OpenStackCharm
|
||||
functionality to manage a dragent unit.
|
||||
|
@ -123,7 +106,6 @@ class DRAgentCharm(charms_openstack.charm.OpenStackCharm):
|
|||
adapters_class = os_adapters.OpenStackRelationAdapters
|
||||
adapters_class.relation_adapters = {
|
||||
'amqp': TransportURLAdapter,
|
||||
'bgp': BGPPeerRelationAdapter,
|
||||
}
|
||||
|
||||
restart_map = {
|
||||
|
|
|
@ -15,3 +15,7 @@ extra-bindings:
|
|||
requires:
|
||||
amqp:
|
||||
interface: rabbitmq
|
||||
provides:
|
||||
bgp-speaker:
|
||||
interface: bgp
|
||||
optional: true
|
||||
|
|
|
@ -33,6 +33,21 @@ charm.use_defaults(
|
|||
'update-status')
|
||||
|
||||
|
||||
@reactive.when('charm.installed')
|
||||
def debug():
|
||||
if not hookenv.config('debug'):
|
||||
return
|
||||
for key, value in reactive.get_states().items():
|
||||
print(key, value)
|
||||
|
||||
|
||||
# Use for testing with the quagga charm
|
||||
@reactive.when('endpoint.bgp-speaker.joined')
|
||||
def publish_bgp_info(endpoint):
|
||||
endpoint.publish_info(asn=hookenv.config('asn'),
|
||||
passive=True)
|
||||
|
||||
|
||||
@reactive.when('amqp.connected')
|
||||
def setup_amqp_req(amqp):
|
||||
"""Use the amqp interface to request access to the amqp broker using our
|
||||
|
@ -43,15 +58,11 @@ def setup_amqp_req(amqp):
|
|||
dragent.assess_status()
|
||||
|
||||
|
||||
# Note that because of the way reactive.when works, (which is to 'find' the
|
||||
# __code__ segment of the decorated function, it's very, very difficult to add
|
||||
# other kinds of decorators here. This rules out adding other things into the
|
||||
# charm args list. It is also CPython dependent.
|
||||
@reactive.when('amqp.available')
|
||||
def render_stuff(amqp):
|
||||
"""Render the configuration for Barbican when all the interfaces are
|
||||
def render_stuff(*args):
|
||||
"""Render the configuration for dyanmic routing when all the interfaces are
|
||||
available.
|
||||
"""
|
||||
hookenv.log("about to call the render_configs with {}".format(amqp))
|
||||
dragent.render_configs(amqp)
|
||||
hookenv.log("about to call the render_configs with {}".format(args))
|
||||
dragent.render_configs(args)
|
||||
dragent.assess_status()
|
||||
|
|
Loading…
Reference in New Issue