def _validate_routes_nexthop(self, cidrs, ips, routes, nexthop): #Note(nati): Nexthop should be connected, # so we need to check # nexthop belongs to one of cidrs of the router ports if not netaddr.all_matching_cidrs(nexthop, cidrs): raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is not connected with router')) #Note(nati) nexthop should not be same as fixed_ips if nexthop in ips: raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is used by router'))
def _validate_routes_nexthop(self, cidrs, ips, routes, nexthop): #Note(nati): Nexthop should be connected, # so we need to check # nexthop belongs to one of cidrs of the router ports extern_relay_cidr = cfg.CONF.l3gw_extern_net_ip_range if not netaddr.all_matching_cidrs(nexthop, cidrs): if (cfg.CONF.cascade_str == 'cascaded' and extern_relay_cidr and netaddr.all_matching_cidrs( nexthop, [extern_relay_cidr])): LOG.debug( _('nexthop(%s) is in extern_relay_cidr,' 'so not raise InvalidRoutes exception'), nexthop) return raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is not connected with router')) #Note(nati) nexthop should not be same as fixed_ips if nexthop in ips: raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is used by router'))
def _validate_routes_nexthop(self, context, ports, routes, nexthop): #Note(nati): Nexthop should be connected, # so we need to check # nexthop belongs to one of cidrs of the router ports cidrs = [] for port in ports: cidrs += [ self._core_plugin._get_subnet(context, ip['subnet_id'])['cidr'] for ip in port['fixed_ips'] ] if not netaddr.all_matching_cidrs(nexthop, cidrs): raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is not connected with router')) #Note(nati) nexthop should not be same as fixed_ips for port in ports: for ip in port['fixed_ips']: if nexthop == ip['ip_address']: raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is used by router'))
def _validate_routes_nexthop(self, cidrs, ips, routes, nexthop): # lets skip to check connected routes # lets keep it FR if nexthop in ips: raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is used by router'))
def _validate_routes_nexthop(cidrs, ips, routes, nexthop): # Note(nati) nexthop should not be same as fixed_ips if nexthop in ips: raise extraroute.InvalidRoutes( routes=routes, reason=_('the nexthop is used by router'))