• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ip_lib.send_ip_addr_adv_notif函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.agent.linux.ip_lib.send_ip_addr_adv_notif函数的典型用法代码示例。如果您正苦于以下问题:Python send_ip_addr_adv_notif函数的具体用法?Python send_ip_addr_adv_notif怎么用?Python send_ip_addr_adv_notif使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了send_ip_addr_adv_notif函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _gateway_added

    def _gateway_added(self, ex_gw_port, interface_name):
        """Add Floating IP gateway port."""
        LOG.debug("add gateway interface(%s)", interface_name)
        ns_name = self.get_name()
        self.driver.plug(ex_gw_port['network_id'],
                         ex_gw_port['id'],
                         interface_name,
                         ex_gw_port['mac_address'],
                         bridge=self.agent_conf.external_network_bridge,
                         namespace=ns_name,
                         prefix=FIP_EXT_DEV_PREFIX)

        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port['fixed_ips'])
        self.driver.init_l3(interface_name, ip_cidrs, namespace=ns_name,
                            clean_connections=True)

        for fixed_ip in ex_gw_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)

        for subnet in ex_gw_port['subnets']:
            gw_ip = subnet.get('gateway_ip')
            if gw_ip:
                ipd = ip_lib.IPDevice(interface_name,
                                      namespace=ns_name)
                ipd.route.add_gateway(gw_ip)

        cmd = ['sysctl', '-w', 'net.ipv4.conf.%s.proxy_arp=1' % interface_name]
        # TODO(Carl) mlavelle's work has self.ip_wrapper
        ip_wrapper = ip_lib.IPWrapper(namespace=ns_name)
        ip_wrapper.netns.execute(cmd, check_exit_code=False)
开发者ID:abhilabh,项目名称:neutron,代码行数:33,代码来源:dvr_fip_ns.py


示例2: floating_ip_added_dist

 def floating_ip_added_dist(self, fip, fip_cidr):
     """Add floating IP to FIP namespace."""
     floating_ip = fip['floating_ip_address']
     fixed_ip = fip['fixed_ip_address']
     rule_pr = self.fip_ns.allocate_rule_priority()
     self.floating_ips_dict[floating_ip] = rule_pr
     fip_2_rtr_name = self.fip_ns.get_int_device_name(self.router_id)
     ip_rule = ip_lib.IPRule(namespace=self.ns_name)
     ip_rule.rule.add(ip=fixed_ip,
                      table=dvr_fip_ns.FIP_RT_TBL,
                      priority=rule_pr)
     #Add routing rule in fip namespace
     fip_ns_name = self.fip_ns.get_name()
     rtr_2_fip, _ = self.rtr_fip_subnet.get_pair()
     device = ip_lib.IPDevice(fip_2_rtr_name, namespace=fip_ns_name)
     device.route.add_route(fip_cidr, str(rtr_2_fip.ip))
     interface_name = (
         self.fip_ns.get_ext_device_name(
             self.fip_ns.agent_gateway_port['id']))
     ip_lib.send_ip_addr_adv_notif(fip_ns_name,
                                   interface_name,
                                   floating_ip,
                                   self.agent_conf)
     # update internal structures
     self.dist_fip_count = self.dist_fip_count + 1
开发者ID:BenoitKnecht,项目名称:neutron,代码行数:25,代码来源:dvr_local_router.py


示例3: update_gateway_port

    def update_gateway_port(self, agent_gateway_port):
        gateway_ip_not_changed = self.agent_gateway_port and (
            not self._check_for_gateway_ip_change(agent_gateway_port))
        self.agent_gateway_port = agent_gateway_port
        if gateway_ip_not_changed:
            return

        ns_name = self.get_name()
        interface_name = self.get_ext_device_name(agent_gateway_port['id'])
        for fixed_ip in agent_gateway_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)

        ipd = ip_lib.IPDevice(interface_name, namespace=ns_name)
        for subnet in agent_gateway_port['subnets']:
            gw_ip = subnet.get('gateway_ip')
            if gw_ip:
                is_gateway_not_in_subnet = not ipam_utils.check_subnet_ip(
                                                subnet.get('cidr'), gw_ip)
                if is_gateway_not_in_subnet:
                    ipd.route.add_route(gw_ip, scope='link')
                ipd.route.add_gateway(gw_ip)
            else:
                current_gateway = ipd.route.get_gateway()
                if current_gateway and current_gateway.get('gateway'):
                    ipd.route.delete_gateway(current_gateway.get('gateway'))
开发者ID:annp,项目名称:neutron,代码行数:28,代码来源:dvr_fip_ns.py


示例4: _gateway_added

    def _gateway_added(self, ex_gw_port, interface_name):
        """Add Floating IP gateway port."""
        LOG.debug("add gateway interface(%s)", interface_name)
        ns_name = self.get_name()
        self.driver.plug(
            ex_gw_port["network_id"],
            ex_gw_port["id"],
            interface_name,
            ex_gw_port["mac_address"],
            bridge=self.agent_conf.external_network_bridge,
            namespace=ns_name,
            prefix=FIP_EXT_DEV_PREFIX,
        )

        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port["fixed_ips"])
        self.driver.init_l3(interface_name, ip_cidrs, namespace=ns_name, clean_connections=True)

        for fixed_ip in ex_gw_port["fixed_ips"]:
            ip_lib.send_ip_addr_adv_notif(ns_name, interface_name, fixed_ip["ip_address"], self.agent_conf)

        for subnet in ex_gw_port["subnets"]:
            gw_ip = subnet.get("gateway_ip")
            if gw_ip:
                is_gateway_not_in_subnet = not ipam_utils.check_subnet_ip(subnet.get("cidr"), gw_ip)
                ipd = ip_lib.IPDevice(interface_name, namespace=ns_name)
                if is_gateway_not_in_subnet:
                    ipd.route.add_route(gw_ip, scope="link")
                ipd.route.add_gateway(gw_ip)

        cmd = ["sysctl", "-w", "net.ipv4.conf.%s.proxy_arp=1" % interface_name]
        # TODO(Carl) mlavelle's work has self.ip_wrapper
        ip_wrapper = ip_lib.IPWrapper(namespace=ns_name)
        ip_wrapper.netns.execute(cmd, check_exit_code=False)
开发者ID:dims,项目名称:neutron,代码行数:33,代码来源:dvr_fip_ns.py


示例5: _external_gateway_added

    def _external_gateway_added(self, ex_gw_port, interface_name,
                                ns_name, preserve_ips):
        self._plug_external_gateway(ex_gw_port, interface_name, ns_name)

        # Build up the interface and gateway IP addresses that
        # will be added to the interface.
        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port['fixed_ips'])

        gateway_ips = self._get_external_gw_ips(ex_gw_port)
        enable_ra_on_gw = False
        if self.use_ipv6 and not self.is_v6_gateway_set(gateway_ips):
            # There is no IPv6 gw_ip, use RouterAdvt for default route.
            enable_ra_on_gw = True
        self.driver.init_l3(interface_name,
                            ip_cidrs,
                            namespace=ns_name,
                            gateway_ips=gateway_ips,
                            extra_subnets=ex_gw_port.get('extra_subnets', []),
                            preserve_ips=preserve_ips,
                            enable_ra_on_gw=enable_ra_on_gw)
        for fixed_ip in ex_gw_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)
开发者ID:kongseokhwan,项目名称:kulcloud-iitp-neutron,代码行数:25,代码来源:router_info.py


示例6: _external_gateway_added

    def _external_gateway_added(self, ex_gw_port, interface_name, ns_name, preserve_ips):
        LOG.debug("External gateway added: port(%s), interface(%s), ns(%s)", ex_gw_port, interface_name, ns_name)
        self._plug_external_gateway(ex_gw_port, interface_name, ns_name)

        # Build up the interface and gateway IP addresses that
        # will be added to the interface.
        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port["fixed_ips"])

        gateway_ips = self._get_external_gw_ips(ex_gw_port)
        enable_ra_on_gw = False
        if self.use_ipv6 and not self.is_v6_gateway_set(gateway_ips):
            # There is no IPv6 gw_ip, use RouterAdvt for default route.
            enable_ra_on_gw = True

        self.driver.init_router_port(
            interface_name,
            ip_cidrs,
            namespace=ns_name,
            gateway_ips=gateway_ips,
            extra_subnets=ex_gw_port.get("extra_subnets", []),
            preserve_ips=preserve_ips,
            enable_ra_on_gw=enable_ra_on_gw,
            clean_connections=True,
        )
        for fixed_ip in ex_gw_port["fixed_ips"]:
            ip_lib.send_ip_addr_adv_notif(ns_name, interface_name, fixed_ip["ip_address"], self.agent_conf)
开发者ID:takeshineshiro,项目名称:neutron,代码行数:26,代码来源:router_info.py


示例7: _external_gateway_added

    def _external_gateway_added(self, ex_gw_port, interface_name,
                                ns_name, preserve_ips):
        LOG.debug("External gateway added: port(%s), interface(%s), ns(%s)",
                  ex_gw_port, interface_name, ns_name)
        self._plug_external_gateway(ex_gw_port, interface_name, ns_name)

        # Build up the interface and gateway IP addresses that
        # will be added to the interface.
        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port['fixed_ips'])

        gateway_ips, enable_ra_on_gw = self._get_external_gw_ips(ex_gw_port)
        self.driver.init_router_port(
            interface_name,
            ip_cidrs,
            namespace=ns_name,
            gateway_ips=gateway_ips,
            extra_subnets=ex_gw_port.get('extra_subnets', []),
            preserve_ips=preserve_ips,
            enable_ra_on_gw=enable_ra_on_gw,
            clean_connections=True)
        for fixed_ip in ex_gw_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)
开发者ID:javaos74,项目名称:neutron,代码行数:25,代码来源:router_info.py


示例8: _update_gateway_route

    def _update_gateway_route(self, agent_gateway_port,
                             interface_name, tbl_index):
        ns_name = self.get_name()
        ipd = ip_lib.IPDevice(interface_name, namespace=ns_name)
        # If the 'fg-' device doesn't exist in the namespace then trying
        # to send advertisements or configure the default route will just
        # throw exceptions.  Unsubscribe this external network so that
        # the next call will trigger the interface to be plugged.
        if not ipd.exists():
            LOG.warning('DVR: FIP gateway port with interface '
                        'name: %(device)s does not exist in the given '
                        'namespace: %(ns)s', {'device': interface_name,
                                              'ns': ns_name})
            msg = _('DVR: Gateway update route in FIP namespace failed, retry '
                    'should be attempted on next call')
            raise l3_exc.FloatingIpSetupException(msg)

        for fixed_ip in agent_gateway_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'])

        for subnet in agent_gateway_port['subnets']:
            gw_ip = subnet.get('gateway_ip')
            if gw_ip:
                is_gateway_not_in_subnet = not ipam_utils.check_subnet_ip(
                                                subnet.get('cidr'), gw_ip)
                if is_gateway_not_in_subnet:
                    ipd.route.add_route(gw_ip, scope='link')
                self._add_default_gateway_for_fip(gw_ip, ipd, tbl_index)
            else:
                current_gateway = ipd.route.get_gateway()
                if current_gateway and current_gateway.get('gateway'):
                    ipd.route.delete_gateway(current_gateway.get('gateway'))
开发者ID:igordcard,项目名称:neutron,代码行数:34,代码来源:dvr_fip_ns.py


示例9: _internal_network_added

    def _internal_network_added(self, ns_name, network_id, port_id, fixed_ips, mac_address, interface_name, prefix):
        LOG.debug("adding internal network: prefix(%s), port(%s)", prefix, port_id)
        self.driver.plug(network_id, port_id, interface_name, mac_address, namespace=ns_name, prefix=prefix)

        ip_cidrs = common_utils.fixed_ip_cidrs(fixed_ips)
        self.driver.init_router_port(interface_name, ip_cidrs, namespace=ns_name)
        for fixed_ip in fixed_ips:
            ip_lib.send_ip_addr_adv_notif(ns_name, interface_name, fixed_ip["ip_address"], self.agent_conf)
开发者ID:takeshineshiro,项目名称:neutron,代码行数:8,代码来源:router_info.py


示例10: send_garp

 def send_garp(self, event):
     """Send gratuitous ARP for given event."""
     ip_lib.send_ip_addr_adv_notif(
         self.namespace,
         event.interface,
         str(netaddr.IPNetwork(event.cidr).ip),
         log_exception=False
     )
开发者ID:cloudbase,项目名称:neutron,代码行数:8,代码来源:keepalived_state_change.py


示例11: test_no_ipv6_addr_notif

 def test_no_ipv6_addr_notif(self, spawn_n):
     ipv6_addr = 'fd00::1'
     config = mock.Mock()
     config.send_arp_for_ha = 3
     ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name,
                                   mock.sentinel.iface_name,
                                   ipv6_addr,
                                   config)
     self.assertFalse(spawn_n.called)
开发者ID:kongseokhwan,项目名称:kulcloud-iitp-neutron,代码行数:9,代码来源:test_ip_lib.py


示例12: add_floating_ip

    def add_floating_ip(self, fip, interface_name, device):
        if not self._add_fip_addr_to_device(fip, device):
            return lib_constants.FLOATINGIP_STATUS_ERROR

        # As GARP is processed in a distinct thread the call below
        # won't raise an exception to be handled.
        ip_lib.send_ip_addr_adv_notif(
            self.ns_name, interface_name, fip["floating_ip_address"], self.agent_conf.send_arp_for_ha
        )
        return lib_constants.FLOATINGIP_STATUS_ACTIVE
开发者ID:openstack,项目名称:neutron,代码行数:10,代码来源:legacy_router.py


示例13: _internal_network_added

    def _internal_network_added(self, ns_name, network_id, port_id,
                                fixed_ips, mac_address,
                                interface_name, prefix):
        self.driver.plug(network_id, port_id, interface_name, mac_address,
                         namespace=ns_name,
                         prefix=prefix)

        ip_cidrs = common_utils.fixed_ip_cidrs(fixed_ips)
        self.driver.init_l3(interface_name, ip_cidrs, namespace=ns_name)
        for fixed_ip in fixed_ips:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)
开发者ID:bgxavier,项目名称:neutron,代码行数:14,代码来源:router_info.py


示例14: test_send_ipv4_addr_adv_notif

    def test_send_ipv4_addr_adv_notif(self, spawn_n, mIPWrapper):
        spawn_n.side_effect = lambda f: f()
        ARPING_COUNT = 3
        address = "20.0.0.1"
        config = mock.Mock()
        config.send_arp_for_ha = ARPING_COUNT
        ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name, mock.sentinel.iface_name, address, config)

        self.assertTrue(spawn_n.called)
        mIPWrapper.assert_called_once_with(namespace=mock.sentinel.ns_name)

        ip_wrapper = mIPWrapper(namespace=mock.sentinel.ns_name)

        # Just test that arping is called with the right arguments
        arping_cmd = ["arping", "-A", "-I", mock.sentinel.iface_name, "-c", ARPING_COUNT, "-w", mock.ANY, address]
        ip_wrapper.netns.execute.assert_any_call(arping_cmd, check_exit_code=True)
开发者ID:tealover,项目名称:neutron,代码行数:16,代码来源:test_ip_lib.py


示例15: _external_gateway_added

    def _external_gateway_added(self, ex_gw_port, interface_name,
                                ns_name, preserve_ips):
        LOG.debug("External gateway added: port(%s), interface(%s), ns(%s)",
                  ex_gw_port, interface_name, ns_name)
        self._plug_external_gateway(ex_gw_port, interface_name, ns_name)

        # Build up the interface and gateway IP addresses that
        # will be added to the interface.
        ip_cidrs = common_utils.fixed_ip_cidrs(ex_gw_port['fixed_ips'])

        gateway_ips = self._get_external_gw_ips(ex_gw_port)
        enable_ra_on_gw = False
        if self.use_ipv6 and not self.is_v6_gateway_set(gateway_ips):
            # There is no IPv6 gw_ip, use RouterAdvt for default route.
            enable_ra_on_gw = True

        self._add_route_to_gw(ex_gw_port, device_name=interface_name,
                              namespace=ns_name, preserve_ips=preserve_ips)
        self.driver.init_router_port(
            interface_name,
            ip_cidrs,
            namespace=ns_name,
            extra_subnets=ex_gw_port.get('extra_subnets', []),
            preserve_ips=preserve_ips,
            clean_connections=True)

        device = ip_lib.IPDevice(interface_name, namespace=ns_name)
        current_gateways = set()
        for ip_version in (l3_constants.IP_VERSION_4,
                           l3_constants.IP_VERSION_6):
            gateway = device.route.get_gateway(ip_version=ip_version)
            if gateway and gateway.get('gateway'):
                current_gateways.add(gateway.get('gateway'))
        for ip in current_gateways - set(gateway_ips):
            device.route.delete_gateway(ip)
        for ip in gateway_ips:
            device.route.add_gateway(ip)

        if enable_ra_on_gw:
            self.driver.configure_ipv6_ra(ns_name, interface_name)

        for fixed_ip in ex_gw_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf)
开发者ID:biruce-openstack,项目名称:neutron,代码行数:46,代码来源:router_info.py


示例16: _internal_network_added

 def _internal_network_added(self, ns_name, network_id, port_id,
                             fixed_ips, mac_address,
                             interface_name):
     LOG.debug("adding internal network: port(%s)", port_id)
     #import ipdb;ipdb.set_trace()
     self.driver.plug_new(network_id, port_id, interface_name, fixed_ips,
                          mac_address, namespace=ns_name)
     ip_cidrs = common_utils.fixed_ip_cidrs(fixed_ips)
     self.driver.init_router_port(
         interface_name, ip_cidrs, namespace=ns_name)
     if interface_name not in consts.FTNT_PORTS:
         for fixed_ip in fixed_ips:
             # samsu: arp maynot needed in this case
             ip_lib.send_ip_addr_adv_notif(ns_name,
                                           interface_name,
                                           fixed_ip['ip_address'],
                                           self.agent_conf)
开发者ID:samsu,项目名称:networking-fortinet,代码行数:17,代码来源:router_info.py


示例17: _update_gateway_port

    def _update_gateway_port(self, agent_gateway_port, interface_name):
        if (self.agent_gateway_port and
            not self._check_for_gateway_ip_change(agent_gateway_port)):
                return

        ns_name = self.get_name()
        ipd = ip_lib.IPDevice(interface_name, namespace=ns_name)
        # If the 'fg-' device doesn't exist in the namespace then trying
        # to send advertisements or configure the default route will just
        # throw exceptions.  Unsubscribe this external network so that
        # the next call will trigger the interface to be plugged.
        if not ipd.exists():
            self.unsubscribe(agent_gateway_port['network_id'])
            LOG.warning(_LW('DVR: FIP gateway port with interface '
                            'name: %(device)s does not exist in the given '
                            'namespace: %(ns)s'), {'device': interface_name,
                                                   'ns': ns_name})
            msg = _('DVR: Gateway setup in FIP namespace failed, retry '
                    'should be attempted on next call')
            raise n_exc.FloatingIpSetupException(msg)

        for fixed_ip in agent_gateway_port['fixed_ips']:
            ip_lib.send_ip_addr_adv_notif(ns_name,
                                          interface_name,
                                          fixed_ip['ip_address'],
                                          self.agent_conf.send_arp_for_ha)

        for subnet in agent_gateway_port['subnets']:
            gw_ip = subnet.get('gateway_ip')
            if gw_ip:
                is_gateway_not_in_subnet = not ipam_utils.check_subnet_ip(
                                                subnet.get('cidr'), gw_ip)
                if is_gateway_not_in_subnet:
                    ipd.route.add_route(gw_ip, scope='link')
                ipd.route.add_gateway(gw_ip)
            else:
                current_gateway = ipd.route.get_gateway()
                if current_gateway and current_gateway.get('gateway'):
                    ipd.route.delete_gateway(current_gateway.get('gateway'))
        # Cache the agent gateway port after successfully configuring
        # the gateway, so that checking on self.agent_gateway_port
        # will be a valid check
        self.agent_gateway_port = agent_gateway_port
开发者ID:2020human,项目名称:neutron,代码行数:43,代码来源:dvr_fip_ns.py


示例18: floating_ip_added_dist

 def floating_ip_added_dist(self, fip, fip_cidr):
     """Add floating IP to FIP namespace."""
     floating_ip = fip['floating_ip_address']
     fixed_ip = fip['fixed_ip_address']
     self._add_floating_ip_rule(floating_ip, fixed_ip)
     fip_2_rtr_name = self.fip_ns.get_int_device_name(self.router_id)
     #Add routing rule in fip namespace
     fip_ns_name = self.fip_ns.get_name()
     if self.rtr_fip_subnet is None:
         self.rtr_fip_subnet = self.fip_ns.local_subnets.allocate(
             self.router_id)
     rtr_2_fip, __ = self.rtr_fip_subnet.get_pair()
     device = ip_lib.IPDevice(fip_2_rtr_name, namespace=fip_ns_name)
     device.route.add_route(fip_cidr, str(rtr_2_fip.ip))
     interface_name = (
         self.fip_ns.get_ext_device_name(
             self.fip_ns.agent_gateway_port['id']))
     ip_lib.send_ip_addr_adv_notif(fip_ns_name,
                                   interface_name,
                                   floating_ip)
开发者ID:AradhanaSingh,项目名称:neutron,代码行数:20,代码来源:dvr_local_router.py


示例19: floating_ip_added_dist

    def floating_ip_added_dist(self, fip, fip_cidr):
        """Add floating IP to respective namespace based on agent mode."""
        if fip.get(lib_constants.DVR_SNAT_BOUND):
            floating_ip_status = self.add_centralized_floatingip(fip, fip_cidr)
            return floating_ip_status
        if not self._check_if_floatingip_bound_to_host(fip):
            # TODO(Swami): Need to figure out what status
            # should be returned when the floating IP is
            # not destined for this agent and if the floating
            # IP is configured in a different compute host.
            # This should not happen once we fix the server
            # side code, but still a check to make sure if
            # the floating IP is intended for this host should
            # be done.
            return

        # dvr_no_external host should not process any floating IP route rules.
        if (self.agent_conf.agent_mode ==
                lib_constants.L3_AGENT_MODE_DVR_NO_EXTERNAL):
            return

        floating_ip = fip['floating_ip_address']
        fixed_ip = fip['fixed_ip_address']
        self._add_floating_ip_rule(floating_ip, fixed_ip)
        fip_2_rtr_name = self.fip_ns.get_int_device_name(self.router_id)
        # Add routing rule in fip namespace
        fip_ns_name = self.fip_ns.get_name()
        if self.rtr_fip_subnet is None:
            self.rtr_fip_subnet = self.fip_ns.local_subnets.allocate(
                self.router_id)
        rtr_2_fip, __ = self.rtr_fip_subnet.get_pair()
        device = ip_lib.IPDevice(fip_2_rtr_name, namespace=fip_ns_name)
        device.route.add_route(fip_cidr, str(rtr_2_fip.ip))
        interface_name = (
            self.fip_ns.get_ext_device_name(
                self.fip_ns.agent_gateway_port['id']))
        ip_lib.send_ip_addr_adv_notif(fip_ns_name,
                                      interface_name,
                                      floating_ip)
        return lib_constants.FLOATINGIP_STATUS_ACTIVE
开发者ID:noironetworks,项目名称:neutron,代码行数:40,代码来源:dvr_local_router.py


示例20: add_centralized_floatingip

 def add_centralized_floatingip(self, fip, fip_cidr):
     """Function to handle the centralized Floatingip addition."""
     if not self.get_ex_gw_port():
         return
     if not self._is_this_snat_host():
         return
     interface_name = self.get_snat_external_device_interface_name(
         self.get_ex_gw_port())
     device = ip_lib.IPDevice(
         interface_name, namespace=self.snat_namespace.name)
     try:
         device.addr.add(fip_cidr)
     except RuntimeError:
         LOG.warning("Unable to configure IP address for centralized "
                     "floating IP: %s", fip['id'])
         return lib_constants.FLOATINGIP_STATUS_ERROR
     self.process_floating_ip_nat_rules_for_centralized_floatingip()
     # Send a GARP message on the external interface for the
     # centralized floatingip configured.
     ip_lib.send_ip_addr_adv_notif(self.snat_namespace.name,
                                   interface_name,
                                   fip['floating_ip_address'])
     return lib_constants.FLOATINGIP_STATUS_ACTIVE
开发者ID:noironetworks,项目名称:neutron,代码行数:23,代码来源:dvr_edge_router.py



注:本文中的neutron.agent.linux.ip_lib.send_ip_addr_adv_notif函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ip_lib.vxlan_in_use函数代码示例发布时间:2022-05-27
下一篇:
Python ip_lib.iproute_arg_supported函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap