Add BGPVPN-ROUTER-ASSOCIATION to heat plugin

This patch adds the BGPVPN-ROUTER-ASSOCIATION resource to heat.
Change-Id: Id242864f782033cfa532fc23c9118bd3b63b6af8
Partially-Implements: blueprint heat-support-bgpvpn-association
This commit is contained in:
Mathieu Rohon
2016年02月19日 02:47:42 +00:00
parent de6ab06f6a
commit 3c3ccb05fc

View File

@@ -47,3 +47,12 @@ Heat Orchestration Template (HOT) example
properties:
bgpvpn_id: { get_resource: BGPVPN1 }
network_id: { get_resource: Net1 }
Router1:
type: OS::Neutron::Router
BGPVPN_ROUTER_assoc1:
type: OS::Neutron::BGPVPN-ROUTER-ASSOCIATION
properties:
bgpvpn_id: { get_resource: BGPVPN1 }
router_id: { get_resource: Router1 }

View File

@@ -204,8 +204,88 @@ class BGPVPNNetAssoc(neutron.NeutronResource):
self.resource_id, self.properties['bgpvpn_id'])
class BGPVPNRouterAssoc(neutron.NeutronResource):
"""A resource for BGPVPNRouterAssoc in neutron.
"""
PROPERTIES = (
BGPVPN_ID, ROUTER_ID
) = (
'bgpvpn_id', 'router_id'
)
ATTRIBUTES = (
SHOW, STATUS
) = (
'show', 'status'
)
properties_schema = {
BGPVPN_ID: properties.Schema(
properties.Schema.STRING,
_('ID for the bgpvpn.'),
required=True,
),
ROUTER_ID: properties.Schema(
properties.Schema.STRING,
_('Router which shall be associated with the BGPVPN.'),
required=True,
)
}
attributes_schema = {
STATUS: attributes.Schema(
_('Status of bgpvpn.'),
),
SHOW: attributes.Schema(
_('All attributes.')
),
}
def validate(self):
super(BGPVPNRouterAssoc, self).validate()
def handle_create(self):
self.props = self.prepare_properties(self.properties,
self.physical_resource_name())
body = self.props.copy()
body.pop('bgpvpn_id')
router_assoc = self.neutron().create_router_association(
self.props['bgpvpn_id'],
{'router_association': body})
self.resource_id_set(router_assoc['router_association']['id'])
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
raise NotImplemented()
def handle_delete(self):
try:
self.neutron().delete_router_association(
self.resource_id, self.properties['bgpvpn_id'])
except Exception as ex:
self.client_plugin().ignore_not_found(ex)
else:
return True
def _confirm_delete(self):
while True:
try:
self._show_resource()
except exception.NotFound:
return
def _show_resource(self):
return self.neutron().show_router_association(
self.resource_id, self.properties['bgpvpn_id'])
def resource_mapping():
return {
'OS::Neutron::BGPVPN': BGPVPN,
'OS::Neutron::BGPVPN-NET-ASSOCIATION': BGPVPNNetAssoc,
'OS::Neutron::BGPVPN-ROUTER-ASSOCIATION': BGPVPNRouterAssoc,
}
Reference in New Issue
openstack/networking-bgpvpn
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.