route_table.py (ec2-api-14.0.1) | : | route_table.py (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
# distributed under the License is distributed on an "AS IS" BASIS, | # distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | |||
# limitations under the License. | # limitations under the License. | |||
import collections | import collections | |||
import copy | import copy | |||
import netaddr | import netaddr | |||
from novaclient import exceptions as nova_exception | from novaclient import exceptions as nova_exception | |||
import six | ||||
from ec2api.api import common | from ec2api.api import common | |||
from ec2api.api import ec2utils | from ec2api.api import ec2utils | |||
from ec2api.api import vpn_connection as vpn_connection_api | from ec2api.api import vpn_connection as vpn_connection_api | |||
from ec2api import clients | from ec2api import clients | |||
from ec2api.db import api as db_api | from ec2api.db import api as db_api | |||
from ec2api import exception | from ec2api import exception | |||
from ec2api.i18n import _ | from ec2api.i18n import _ | |||
HOST_TARGET = 'host' | HOST_TARGET = 'host' | |||
skipping to change at line 576 | skipping to change at line 575 | |||
dst_ids = [route[id_key] | dst_ids = [route[id_key] | |||
for route in route_table['routes'] | for route in route_table['routes'] | |||
for id_key in ('gateway_id', 'network_interface_id') | for id_key in ('gateway_id', 'network_interface_id') | |||
if route.get(id_key) is not None] | if route.get(id_key) is not None] | |||
dst_ids.extend(route_table.get('propagating_gateways', [])) | dst_ids.extend(route_table.get('propagating_gateways', [])) | |||
destinations = {item['id']: item | destinations = {item['id']: item | |||
for item in db_api.get_items_by_ids(context, dst_ids) | for item in db_api.get_items_by_ids(context, dst_ids) | |||
if (item['vpc_id'] == route_table['vpc_id'] and | if (item['vpc_id'] == route_table['vpc_id'] and | |||
(ec2utils.get_ec2_id_kind(item['id']) != 'vgw' or | (ec2utils.get_ec2_id_kind(item['id']) != 'vgw' or | |||
item['id'] in vpn_connections))} | item['id'] in vpn_connections))} | |||
for vpn in six.itervalues(vpn_connections): | for vpn in vpn_connections.values(): | |||
if vpn['vpn_gateway_id'] in destinations: | if vpn['vpn_gateway_id'] in destinations: | |||
destinations[vpn['vpn_gateway_id']]['vpn_connection'] = vpn | destinations[vpn['vpn_gateway_id']]['vpn_connection'] = vpn | |||
return destinations | return destinations | |||
def _get_subnet_host_routes_and_gateway_ip(context, route_table, cidr_block, | def _get_subnet_host_routes_and_gateway_ip(context, route_table, cidr_block, | |||
destinations=None): | destinations=None): | |||
if not destinations: | if not destinations: | |||
destinations = _get_active_route_destinations(context, route_table) | destinations = _get_active_route_destinations(context, route_table) | |||
gateway_ip = str(netaddr.IPAddress( | gateway_ip = str(netaddr.IPAddress( | |||
netaddr.IPNetwork(cidr_block).first + 1)) | netaddr.IPNetwork(cidr_block).first + 1)) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |