def update_flowspec_vrf_table(self, flowspec_family, route_dist, rules,
                                  actions=None, is_withdraw=False):
        """Update a BGP route in the VRF table for Flow Specification.

        ``flowspec_family`` specifies one of the flowspec family name.

        ``route_dist`` specifies a route distinguisher value.

        ``rules`` specifies NLRIs of Flow Specification as
        a dictionary type value.

        `` actions`` specifies Traffic Filtering Actions of
        Flow Specification as a dictionary type value.

        If `is_withdraw` is False, which is the default, add a BGP route
        to the VRF table identified by `route_dist`.
        If `is_withdraw` is True, remove a BGP route from the VRF table.
        """
        from ryu.services.protocols.bgp.core import BgpCoreError
        from ryu.services.protocols.bgp.api.prefix import (
            FLOWSPEC_FAMILY_VPNV4,
            FLOWSPEC_FAMILY_VPNV6,
            FLOWSPEC_FAMILY_L2VPN,
        )

        if flowspec_family == FLOWSPEC_FAMILY_VPNV4:
            vrf_table = self._tables.get((route_dist, VRF_RF_IPV4_FLOWSPEC))
            prefix = FlowSpecIPv4NLRI.from_user(**rules)
            try:
                communities = create_v4flowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))
        elif flowspec_family == FLOWSPEC_FAMILY_VPNV6:
            vrf_table = self._tables.get((route_dist, VRF_RF_IPV6_FLOWSPEC))
            prefix = FlowSpecIPv6NLRI.from_user(**rules)
            try:
                communities = create_v6flowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))
        elif flowspec_family == FLOWSPEC_FAMILY_L2VPN:
            vrf_table = self._tables.get((route_dist, VRF_RF_L2VPN_FLOWSPEC))
            prefix = FlowSpecL2VPNNLRI.from_user(route_dist, **rules)
            try:
                communities = create_l2vpnflowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))
        else:
            raise BgpCoreError(
                desc='Unsupported flowspec_family %s' % flowspec_family)

        if vrf_table is None:
            raise BgpCoreError(
                desc='VRF table does not exist: route_dist=%s, '
                     'flowspec_family=%s' % (route_dist, flowspec_family))

        # We do not check if we have a path to given prefix, we issue
        # withdrawal. Hence multiple withdrawals have not side effect.
        vrf_table.insert_vrffs_path(
            nlri=prefix, communities=communities,
            is_withdraw=is_withdraw)
def update_flowspec_vrf_table ( self , flowspec_family , route_dist , rules , actions = None , is_withdraw = False ) : from ryu . services . protocols . bgp . core import BgpCoreError from ryu . services . protocols . bgp . api . prefix import ( FLOWSPEC_FAMILY_VPNV4 , FLOWSPEC_FAMILY_VPNV6 , FLOWSPEC_FAMILY_L2VPN , ) if flowspec_family == FLOWSPEC_FAMILY_VPNV4 : vrf_table = self . _tables . get ( ( route_dist , VRF_RF_IPV4_FLOWSPEC ) ) prefix = FlowSpecIPv4NLRI . from_user ( ** rules ) try : communities = create_v4flowspec_actions ( actions ) except ValueError as e : raise BgpCoreError ( desc = str ( e ) ) elif flowspec_family == FLOWSPEC_FAMILY_VPNV6 : vrf_table = self . _tables . get ( ( route_dist , VRF_RF_IPV6_FLOWSPEC ) ) prefix = FlowSpecIPv6NLRI . from_user ( ** rules ) try : communities = create_v6flowspec_actions ( actions ) except ValueError as e : raise BgpCoreError ( desc = str ( e ) ) elif flowspec_family == FLOWSPEC_FAMILY_L2VPN : vrf_table = self . _tables . get ( ( route_dist , VRF_RF_L2VPN_FLOWSPEC ) ) prefix = FlowSpecL2VPNNLRI . from_user ( route_dist , ** rules ) try : communities = create_l2vpnflowspec_actions ( actions ) except ValueError as e : raise BgpCoreError ( desc = str ( e ) ) else : raise BgpCoreError ( desc = 'Unsupported flowspec_family %s' % flowspec_family ) if vrf_table is None : raise BgpCoreError ( desc = 'VRF table does not exist: route_dist=%s, ' 'flowspec_family=%s' % ( route_dist , flowspec_family ) ) vrf_table . insert_vrffs_path ( nlri = prefix , communities = communities , is_withdraw = is_withdraw )
Update a BGP route in the VRF table for Flow Specification.

        ``flowspec_family`` specifies one of the flowspec family name.

        ``route_dist`` specifies a route distinguisher value.

        ``rules`` specifies NLRIs of Flow Specification as
        a dictionary type value.

        `` actions`` specifies Traffic Filtering Actions of
        Flow Specification as a dictionary type value.

        If `is_withdraw` is False, which is the default, add a BGP route
        to the VRF table identified by `route_dist`.
        If `is_withdraw` is True, remove a BGP route from the VRF table.