Example #1
0
 def _parse_l3_vni_ranges(self):
     try:
         self.l3_vni_ranges = self.parse_l3_vni_ranges(
             cfg.CONF.VCFCONTROLLER.l3_vni_ranges)
     except Exception as e:
         LOG.exception(
             _LE("Failed to parse l3_vni_ranges. "
                 "Service terminated!: %s"), e)
         sys.exit(1)
     LOG.info(_("L3 vni ranges: %s"), self.l3_vni_ranges)
    def _add_interface_by_subnet(self, context, router, subnet_id, owner):
        subnet = self._core_plugin._get_subnet(context, subnet_id)
        if not subnet['gateway_ip']:
            msg = _('Subnet for router interface must have a gateway IP')
            raise common_exceptions.BadRequest(resource='router', msg=msg)

        self._check_for_dup_router_subnet(context, router,
                                          subnet['network_id'], subnet_id,
                                          subnet['cidr'])

        return [subnet]
 def _check_for_dup_router_subnet(self, context, router, network_id,
                                  subnet_id, subnet_cidr):
     try:
         # It's possible these ports are on the same network, but
         # different subnets.
         new_ipnet = netaddr.IPNetwork(subnet_cidr)
         for p in (rp.port for rp in router.attached_ports):
             for ip in p['fixed_ips']:
                 if ip['subnet_id'] == subnet_id:
                     msg = (_("Router already has a port on subnet %s") %
                            subnet_id)
                     raise common_exceptions.BadRequest(resource='router',
                                                        msg=msg)
                 # Ignore temporary Prefix Delegation CIDRs
                 if subnet_cidr == q_const.PROVISIONAL_IPV6_PD_PREFIX:
                     continue
                 sub_id = ip['subnet_id']
                 cidr = self._core_plugin.get_subnet(
                     context.elevated(), sub_id)['cidr']
                 ipnet = netaddr.IPNetwork(cidr)
                 match1 = netaddr.all_matching_cidrs(new_ipnet, [cidr])
                 match2 = netaddr.all_matching_cidrs(ipnet, [subnet_cidr])
                 if match1 or match2:
                     data = {
                         'subnet_cidr': subnet_cidr,
                         'subnet_id': subnet_id,
                         'cidr': cidr,
                         'sub_id': sub_id
                     }
                     msg = (_("Cidr %(subnet_cidr)s of subnet "
                              "%(subnet_id)s overlaps with cidr %(cidr)s "
                              "of subnet %(sub_id)s") % data)
                     raise common_exceptions.BadRequest(resource='router',
                                                        msg=msg)
     except exc.NoResultFound:
         pass
Example #4
0
    def release_segment(self, session, router_id):
        query = (session.query(self.model).filter_by(router_id=router_id))
        if query.first() is None:
            return
        vxlan_id = query.first().vxlan_vni

        inside = any(lo <= vxlan_id <= hi for lo, hi in self.l3_vni_ranges)

        info = {'type': self.get_type(), 'id': vxlan_id}
        with session.begin(subtransactions=True):
            query = (session.query(self.model).filter_by(vxlan_vni=vxlan_id))
            if inside:
                count = query.update({"allocated": False, 'router_id': None})
                if count:
                    LOG.debug("Releasing %(type)s tunnel %(id)s to pool", info)
            else:
                count = query.delete()
                if count:
                    LOG.debug("Releasing %(type)s tunnel %(id)s outside pool",
                              info)

        if not count:
            LOG.warning(_("%(type)s tunnel %(id)s not found"), info)
Example #5
0
class H3CSecurityGroupRuleDbNotFound(qexception.NotFound):
    message = _("H3CSecurityGroupRule %(h3c_security_group_rule_id)s "
                "could not be found")
Example #6
0
class BindSecurityGroupOverLimit(NeutronException):
    message = _("Only bind one security group per instance")
Example #7
0
class ServiceInsertionNotFound(qexception.NotFound):
    message = _("ServiceInsertion %(service_insertion_id)s not found")
Example #8
0
class LoadbalancerNotFound(qexception.NotFound):
    message = _("The Loadbalancer %(loadbalancer_id)s could not be found")
Example #9
0
class OperationNotSupported(NeutronException):
    message = _("OperationNotSupported")
Example #10
0
class InternalError(NeutronException):
    message = _("VCFC internal server error.")
Example #11
0
class H3CRouterBindFirewall(NeutronException):
    message = _("The router is bound to one of the tenant's firewalls.")
Example #12
0
class RouterBindResource(NeutronException):
    message = _("Failed to delete the vRouter because it has "
                "been bound to service resources.")
Example #13
0
class PoolSubnetNotBound(NeutronException):
    message = _("VCFC create pool failed, the subnet of vlan "
                "pool has not bound to a router.")
Example #14
0
class IpNotSupportAssigned(NeutronException):
    message = _("The ip address couldn't be assigned.")
Example #15
0
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#  License for the specific language governing permissions and limitations
#  under the License.

from networking_h3c._i18n import _
from oslo_config import cfg

CONTROLLER_OPTS = [
    cfg.StrOpt('url',
               default='https://127.0.0.1:8443',
               help=_('The H3C vcf controller api base url')),
    cfg.StrOpt('username', default='sdn', help=_('Controller username')),
    cfg.StrOpt('password', default='skyline', help=_('Controller password')),
    cfg.StrOpt('domain', default='sdn', help=_('Controller domain')),
    cfg.StrOpt('timeout', default=1800, help=_('Controller timeout')),
    cfg.IntOpt('retry',
               default=5,
               help=_('The retry times for connecting controller')),
    cfg.StrOpt('vnic_type',
               default='ovs',
               help=_('port binding vnic_type default is ovs')),
    cfg.BoolOpt('hybrid_vnic',
                default=True,
                help=_('Plug-in working in hybrid_vnic mode')),
    cfg.BoolOpt('ip_mac_binding', default=True, help=_('ipmac binding')),
    cfg.IntOpt('denyflow_age', default=300, help=_('denyflow_age')),
Example #16
0
class ForbiddenError(NeutronException):
    message = _("This operation is forbidden.")
Example #17
0
class BadRequests(NeutronException):
    message = _("Bad Request")
Example #18
0
class NoTunnelIdAvailable(NeutronException):
    message = _("Unable to allocate tunnel id "
                "for %(tunnel_type)s type tunnel.")
Example #19
0
class UnknownError(NeutronException):
    message = _("A unknown error occurred during request.")
Example #20
0
class RequestTimeoutError(ServiceUnavailable):
    message = _("%(resource)s request:  VCFC timeout!  URL = %(url)s")
Example #21
0
class HttpServiceUnavailable(NeutronException):
    message = _("HttpServiceUnavailable")
Example #22
0
class PoolCountExceeded(qexception.Conflict):
    message = _("Exceeded allowed count of Pool for tenant "
                "%(tenant_id)s. Only one Pool is supported per tenant.")
Example #23
0
class ServiceContextNotFound(qexception.NotFound):
    message = _("ServiceContext %(service_context_id)s could not be found")
Example #24
0
class JsonDecodingError(NeutronException):
    message = _("%(resource)s request:  Decoding json error! ")
Example #25
0
class ServiceNodeNotFound(qexception.NotFound):
    message = _("ServiceNode %(service_node_id)s not found")
Example #26
0
class HttpNotAuthError(NeutronException):
    message = _("VCFC Authorization failed")
Example #27
0
class ResourceNotFound(qexception.NotFound):
    message = _("Resource of Tenant %(Tenant_id)s should create first")
Example #28
0
class HttpNotFoundError(NeutronException):
    message = _("The requested content not found.")
Example #29
0
class PortIpInused(qexception.Conflict):
    message = _("The port ip %(port_ip)s is being used by "
                "floating ip %(floating_ip)s.")
Example #30
0
class ConflictError(NeutronException):
    message = _("This operation leaded to conflict.")