def validate_changes(changes): for k, v in changes.iteritems(): if k not in (MULTI_EXIT_DISC, ENABLED): raise ConfigValueError(desc="Unknown field to change: %s" % k) if k == MULTI_EXIT_DISC: validate_med(v) elif k == ENABLED: validate_enabled(v) return changes
def validate_changes(changes): for k, v in changes.iteritems(): if k not in (MULTI_EXIT_DISC, ENABLED): raise ConfigValueError(desc="Unknown field to change: %s" % k) if k == MULTI_EXIT_DISC: validate_med(v) elif k == ENABLED: validate_enabled(v) return changes
def _init_opt_settings(self, **kwargs): self._settings[CAP_REFRESH] = compute_optional_conf(CAP_REFRESH, DEFAULT_CAP_REFRESH, **kwargs) self._settings[CAP_ENHANCED_REFRESH] = compute_optional_conf( CAP_ENHANCED_REFRESH, DEFAULT_CAP_ENHANCED_REFRESH, **kwargs ) self._settings[CAP_MBGP_IPV4] = compute_optional_conf(CAP_MBGP_IPV4, DEFAULT_CAP_MBGP_IPV4, **kwargs) self._settings[CAP_MBGP_IPV6] = compute_optional_conf(CAP_MBGP_IPV6, DEFAULT_CAP_MBGP_IPV6, **kwargs) self._settings[CAP_MBGP_VPNV4] = compute_optional_conf(CAP_MBGP_VPNV4, DEFAULT_CAP_MBGP_VPNV4, **kwargs) self._settings[CAP_MBGP_VPNV6] = compute_optional_conf(CAP_MBGP_VPNV6, DEFAULT_CAP_MBGP_VPNV6, **kwargs) self._settings[HOLD_TIME] = compute_optional_conf(HOLD_TIME, DEFAULT_HOLD_TIME, **kwargs) self._settings[ENABLED] = compute_optional_conf(ENABLED, DEFAULT_ENABLED, **kwargs) self._settings[MAX_PREFIXES] = compute_optional_conf(MAX_PREFIXES, DEFAULT_MAX_PREFIXES, **kwargs) self._settings[ADVERTISE_PEER_AS] = compute_optional_conf( ADVERTISE_PEER_AS, DEFAULT_ADVERTISE_PEER_AS, **kwargs ) self._settings[IN_FILTER] = compute_optional_conf(IN_FILTER, DEFAULT_IN_FILTER, **kwargs) self._settings[OUT_FILTER] = compute_optional_conf(OUT_FILTER, DEFAULT_OUT_FILTER, **kwargs) self._settings[IS_ROUTE_SERVER_CLIENT] = compute_optional_conf( IS_ROUTE_SERVER_CLIENT, DEFAULT_IS_ROUTE_SERVER_CLIENT, **kwargs ) self._settings[CHECK_FIRST_AS] = compute_optional_conf(CHECK_FIRST_AS, DEFAULT_CHECK_FIRST_AS, **kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # We do not have valid default LOCAL_ADDRESS and LOCAL_PORT value. # If no LOCAL_ADDRESS/PORT is provided then we will bind to system # default. self._settings[LOCAL_ADDRESS] = compute_optional_conf(LOCAL_ADDRESS, None, **kwargs) self._settings[LOCAL_PORT] = compute_optional_conf(LOCAL_PORT, None, **kwargs) self._settings[PEER_NEXT_HOP] = compute_optional_conf(PEER_NEXT_HOP, None, **kwargs) self._settings[PASSWORD] = compute_optional_conf(PASSWORD, None, **kwargs) # RTC configurations. self._settings[CAP_RTC] = compute_optional_conf(CAP_RTC, DEFAULT_CAP_RTC, **kwargs) # Default RTC_AS is local (router) AS. from ryu.services.protocols.bgp.core_manager import CORE_MANAGER default_rt_as = CORE_MANAGER.common_conf.local_as self._settings[RTC_AS] = compute_optional_conf(RTC_AS, default_rt_as, **kwargs) # Since ConfWithId' default values use str(self) and repr(self), we # call super method after we have initialized other settings. super(NeighborConf, self)._init_opt_settings(**kwargs)
def _init_opt_settings(self, **kwargs): self._settings[CAP_REFRESH] = compute_optional_conf( CAP_REFRESH, DEFAULT_CAP_REFRESH, **kwargs) self._settings[CAP_ENHANCED_REFRESH] = compute_optional_conf( CAP_ENHANCED_REFRESH, DEFAULT_CAP_ENHANCED_REFRESH, **kwargs) self._settings[CAP_MBGP_IPV4] = compute_optional_conf( CAP_MBGP_IPV4, DEFAULT_CAP_MBGP_IPV4, **kwargs) self._settings[CAP_MBGP_VPNV4] = compute_optional_conf( CAP_MBGP_VPNV4, DEFAULT_CAP_MBGP_VPNV4, **kwargs) self._settings[CAP_MBGP_VPNV6] = compute_optional_conf( CAP_MBGP_VPNV6, DEFAULT_CAP_MBGP_VPNV6, **kwargs) self._settings[HOLD_TIME] = compute_optional_conf( HOLD_TIME, DEFAULT_HOLD_TIME, **kwargs) self._settings[ENABLED] = compute_optional_conf( ENABLED, DEFAULT_ENABLED, **kwargs) self._settings[MAX_PREFIXES] = compute_optional_conf( MAX_PREFIXES, DEFAULT_MAX_PREFIXES, **kwargs) self._settings[ADVERTISE_PEER_AS] = compute_optional_conf( ADVERTISE_PEER_AS, DEFAULT_ADVERTISE_PEER_AS, **kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # We do not have valid default LOCAL_ADDRESS and LOCAL_PORT value. # If no LOCAL_ADDRESS/PORT is provided then we will bind to system # default. self._settings[LOCAL_ADDRESS] = compute_optional_conf( LOCAL_ADDRESS, None, **kwargs) self._settings[LOCAL_PORT] = compute_optional_conf( LOCAL_PORT, None, **kwargs) # RTC configurations. self._settings[CAP_RTC] = \ compute_optional_conf(CAP_RTC, DEFAULT_CAP_RTC, **kwargs) # Default RTC_AS is local (router) AS. from ryu.services.protocols.bgp.core_manager import \ CORE_MANAGER default_rt_as = CORE_MANAGER.common_conf.local_as self._settings[RTC_AS] = \ compute_optional_conf(RTC_AS, default_rt_as, **kwargs) # Since ConfWithId' default values use str(self) and repr(self), we # call super method after we have initialized other settings. super(NeighborConf, self)._init_opt_settings(**kwargs)
def _init_opt_settings(self, **kwargs): self._settings[CAP_REFRESH] = compute_optional_conf( CAP_REFRESH, DEFAULT_CAP_REFRESH, **kwargs) self._settings[CAP_ENHANCED_REFRESH] = compute_optional_conf( CAP_ENHANCED_REFRESH, DEFAULT_CAP_ENHANCED_REFRESH, **kwargs) self._settings[CAP_MBGP_IPV4] = compute_optional_conf( CAP_MBGP_IPV4, DEFAULT_CAP_MBGP_IPV4, **kwargs) self._settings[CAP_MBGP_VPNV4] = compute_optional_conf( CAP_MBGP_VPNV4, DEFAULT_CAP_MBGP_VPNV4, **kwargs) self._settings[CAP_MBGP_VPNV6] = compute_optional_conf( CAP_MBGP_VPNV6, DEFAULT_CAP_MBGP_VPNV6, **kwargs) self._settings[HOLD_TIME] = compute_optional_conf( HOLD_TIME, DEFAULT_HOLD_TIME, **kwargs) self._settings[ENABLED] = compute_optional_conf( ENABLED, DEFAULT_ENABLED, **kwargs) self._settings[MAX_PREFIXES] = compute_optional_conf( MAX_PREFIXES, DEFAULT_MAX_PREFIXES, **kwargs) self._settings[ADVERTISE_PEER_AS] = compute_optional_conf( ADVERTISE_PEER_AS, DEFAULT_ADVERTISE_PEER_AS, **kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # RTC configurations. self._settings[CAP_RTC] = \ compute_optional_conf(CAP_RTC, DEFAULT_CAP_RTC, **kwargs) # Default RTC_AS is local (router) AS. from ryu.services.protocols.bgp.core_manager import \ CORE_MANAGER default_rt_as = CORE_MANAGER.common_conf.local_as self._settings[RTC_AS] = \ compute_optional_conf(RTC_AS, default_rt_as, **kwargs) # Since ConfWithId' default values use str(self) and repr(self), we # call super method after we have initialized other settings. super(NeighborConf, self)._init_opt_settings(**kwargs)
def _init_opt_settings(self, **kwargs): super(VrfConf, self)._init_opt_settings(**kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # Current we we only support VRF for IPv4 and IPv6 with default IPv4 vrf_rf = kwargs.pop(VRF_RF, VRF_RF_IPV4) if vrf_rf and validate_vrf_rf(vrf_rf): self._settings[VRF_RF] = vrf_rf import_maps = kwargs.pop(IMPORT_MAPS, []) self._settings[IMPORT_MAPS] = import_maps
def _init_opt_settings(self, **kwargs): super(VrfConf, self)._init_opt_settings(**kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # Current we we only support VRF for IPv4 and IPv6 with default IPv4 vrf_rf = kwargs.pop(VRF_RF, VRF_RF_IPV4) if vrf_rf and validate_vrf_rf(vrf_rf): self._settings[VRF_RF] = vrf_rf import_maps = kwargs.pop(IMPORT_MAPS, []) self._settings[IMPORT_MAPS] = import_maps
def _init_opt_settings(self, **kwargs): self._settings[CAP_REFRESH] = compute_optional_conf( CAP_REFRESH, DEFAULT_CAP_REFRESH, **kwargs) self._settings[CAP_ENHANCED_REFRESH] = compute_optional_conf( CAP_ENHANCED_REFRESH, DEFAULT_CAP_ENHANCED_REFRESH, **kwargs) self._settings[CAP_FOUR_OCTET_AS_NUMBER] = compute_optional_conf( CAP_FOUR_OCTET_AS_NUMBER, DEFAULT_CAP_FOUR_OCTET_AS_NUMBER, **kwargs) self._settings[CAP_MBGP_IPV4] = compute_optional_conf( CAP_MBGP_IPV4, DEFAULT_CAP_MBGP_IPV4, **kwargs) self._settings[CAP_MBGP_IPV6] = compute_optional_conf( CAP_MBGP_IPV6, DEFAULT_CAP_MBGP_IPV6, **kwargs) self._settings[CAP_MBGP_VPNV4] = compute_optional_conf( CAP_MBGP_VPNV4, DEFAULT_CAP_MBGP_VPNV4, **kwargs) self._settings[CAP_MBGP_EVPN] = compute_optional_conf( CAP_MBGP_EVPN, DEFAULT_CAP_MBGP_EVPN, **kwargs) self._settings[CAP_MBGP_VPNV6] = compute_optional_conf( CAP_MBGP_VPNV6, DEFAULT_CAP_MBGP_VPNV6, **kwargs) self._settings[CAP_MBGP_IPV4FS] = compute_optional_conf( CAP_MBGP_IPV4FS, DEFAULT_CAP_MBGP_IPV4FS, **kwargs) self._settings[CAP_MBGP_IPV6FS] = compute_optional_conf( CAP_MBGP_IPV6FS, DEFAULT_CAP_MBGP_IPV6FS, **kwargs) self._settings[CAP_MBGP_VPNV4FS] = compute_optional_conf( CAP_MBGP_VPNV4FS, DEFAULT_CAP_MBGP_VPNV4FS, **kwargs) self._settings[CAP_MBGP_VPNV6FS] = compute_optional_conf( CAP_MBGP_VPNV6FS, DEFAULT_CAP_MBGP_VPNV6FS, **kwargs) self._settings[CAP_MBGP_L2VPNFS] = compute_optional_conf( CAP_MBGP_L2VPNFS, DEFAULT_CAP_MBGP_L2VPNFS, **kwargs) self._settings[HOLD_TIME] = compute_optional_conf( HOLD_TIME, DEFAULT_HOLD_TIME, **kwargs) self._settings[ENABLED] = compute_optional_conf( ENABLED, DEFAULT_ENABLED, **kwargs) self._settings[MAX_PREFIXES] = compute_optional_conf( MAX_PREFIXES, DEFAULT_MAX_PREFIXES, **kwargs) self._settings[ADVERTISE_PEER_AS] = compute_optional_conf( ADVERTISE_PEER_AS, DEFAULT_ADVERTISE_PEER_AS, **kwargs) self._settings[IN_FILTER] = compute_optional_conf( IN_FILTER, DEFAULT_IN_FILTER, **kwargs) self._settings[OUT_FILTER] = compute_optional_conf( OUT_FILTER, DEFAULT_OUT_FILTER, **kwargs) self._settings[IS_ROUTE_SERVER_CLIENT] = compute_optional_conf( IS_ROUTE_SERVER_CLIENT, DEFAULT_IS_ROUTE_SERVER_CLIENT, **kwargs) self._settings[IS_ROUTE_REFLECTOR_CLIENT] = compute_optional_conf( IS_ROUTE_REFLECTOR_CLIENT, DEFAULT_IS_ROUTE_REFLECTOR_CLIENT, **kwargs) self._settings[CHECK_FIRST_AS] = compute_optional_conf( CHECK_FIRST_AS, DEFAULT_CHECK_FIRST_AS, **kwargs) self._settings[IS_NEXT_HOP_SELF] = compute_optional_conf( IS_NEXT_HOP_SELF, DEFAULT_IS_NEXT_HOP_SELF, **kwargs) self._settings[CONNECT_MODE] = compute_optional_conf( CONNECT_MODE, DEFAULT_CONNECT_MODE, **kwargs) # We do not have valid default MED value. # If no MED attribute is provided then we do not have to use MED. # If MED attribute is provided we have to validate it and use it. med = kwargs.pop(MULTI_EXIT_DISC, None) if med and validate_med(med): self._settings[MULTI_EXIT_DISC] = med # We do not have valid default SOO value. # If no SOO attribute is provided then we do not have to use SOO. # If SOO attribute is provided we have to validate it and use it. soos = kwargs.pop(SITE_OF_ORIGINS, None) if soos and validate_soo_list(soos): self._settings[SITE_OF_ORIGINS] = soos # We do not have valid default LOCAL_ADDRESS and LOCAL_PORT value. # If no LOCAL_ADDRESS/PORT is provided then we will bind to system # default. self._settings[LOCAL_ADDRESS] = compute_optional_conf( LOCAL_ADDRESS, None, **kwargs) self._settings[LOCAL_PORT] = compute_optional_conf( LOCAL_PORT, None, **kwargs) # We use the global defined local (router) AS as the default # local AS. from ryu.services.protocols.bgp.core_manager import CORE_MANAGER g_local_as = CORE_MANAGER.common_conf.local_as self._settings[LOCAL_AS] = compute_optional_conf( LOCAL_AS, g_local_as, **kwargs) self._settings[PEER_NEXT_HOP] = compute_optional_conf( PEER_NEXT_HOP, None, **kwargs) self._settings[PASSWORD] = compute_optional_conf( PASSWORD, None, **kwargs) # RTC configurations. self._settings[CAP_RTC] = compute_optional_conf( CAP_RTC, DEFAULT_CAP_RTC, **kwargs) # Default RTC_AS is local (router) AS. self._settings[RTC_AS] = compute_optional_conf(RTC_AS, g_local_as, **kwargs) # Since ConfWithId' default values use str(self) and repr(self), we # call super method after we have initialized other settings. super(NeighborConf, self)._init_opt_settings(**kwargs)