"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ec2api/api/customer_gateway.py" between
ec2-api-14.0.1.tar.gz and ec2-api-15.0.0.tar.gz

About: OpenStack EC2 API provides a standalone EC2 (and VPC) API service.
The "Zed" series (latest release).

customer_gateway.py  (ec2-api-14.0.1):customer_gateway.py  (ec2-api-15.0.0)
skipping to change at line 28 skipping to change at line 28
from ec2api import exception from ec2api import exception
from ec2api.i18n import _ from ec2api.i18n import _
"""Customer gateways related API implementation """Customer gateways related API implementation
""" """
Validator = common.Validator Validator = common.Validator
DEFAULT_BGP_ASN = 65000 DEFAULT_BGP_ASN = 65000
def create_customer_gateway(context, ip_address, type, bgp_asn=None): def create_customer_gateway(context, type, bgp_asn=None,
ip_address=None, public_ip=None):
if ip_address:
ip_addr = ip_address
elif (ip_address == None) and public_ip:
ip_addr = public_ip
elif (ip_address == None) and (public_ip == None):
raise exception.Unsupported("GW without ip not supported")
if bgp_asn and bgp_asn != DEFAULT_BGP_ASN: if bgp_asn and bgp_asn != DEFAULT_BGP_ASN:
raise exception.Unsupported("BGP dynamic routing is unsupported") raise exception.Unsupported("BGP dynamic routing is unsupported")
# testing output to get ec2 failures
customer_gateway = next((cgw for cgw in db_api.get_items(context, 'cgw') customer_gateway = next((cgw for cgw in db_api.get_items(context, 'cgw')
if cgw['ip_address'] == ip_address), None) if cgw['ip_address'] == ip_addr), None)
if not customer_gateway: if not customer_gateway:
customer_gateway = db_api.add_item(context, 'cgw', customer_gateway = db_api.add_item(context, 'cgw',
{'ip_address': ip_address}) {'ip_address': ip_addr})
return {'customerGateway': _format_customer_gateway(customer_gateway)} return {'customerGateway': _format_customer_gateway(customer_gateway)}
def delete_customer_gateway(context, customer_gateway_id): def delete_customer_gateway(context, customer_gateway_id):
customer_gateway = ec2utils.get_db_item(context, customer_gateway_id) customer_gateway = ec2utils.get_db_item(context, customer_gateway_id)
vpn_connections = db_api.get_items(context, 'vpn') vpn_connections = db_api.get_items(context, 'vpn')
if any(vpn['customer_gateway_id'] == customer_gateway['id'] if any(vpn['customer_gateway_id'] == customer_gateway['id']
for vpn in vpn_connections): for vpn in vpn_connections):
raise exception.IncorrectState( raise exception.IncorrectState(
reason=_('The customer gateway is in use.')) reason=_('The customer gateway is in use.'))
db_api.delete_item(context, customer_gateway['id']) db_api.delete_item(context, customer_gateway['id'])
 End of changes. 4 change blocks. 
3 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)