# Path: bgpvpn_dashboard/common/bgpvpn.py
# ROUTE_TARGET_HELP = _("A single BGP Route Target or a "
#                       "comma-separated list of BGP Route Target. Example: "
#                       "64512:1 or 64512:1,64512:2,64512:3")
# RT_FORMAT_ATTRIBUTES = ('route_targets', 'import_targets', 'export_targets')
# def format_rt(route_targets):
# 
# Path: networking_bgpvpn/neutron/services/common/constants.py
# BGPVPN_RES = bgpvpn.BGPVPN_RES
# BGPVPN_L3 = bgpvpn.BGPVPN_L3
# BGPVPN_L2 = bgpvpn.BGPVPN_L2
# BGPVPN_TYPES = bgpvpn.BGPVPN_TYPES
# UINT32_REGEX = bgpvpn.UINT32_REGEX
# UINT16_REGEX = bgpvpn.UINT16_REGEX
# UINT8_REGEX = bgpvpn.UINT8_REGEX
# IP4_REGEX = bgpvpn.IP4_REGEX
# RTRD_REGEX = bgpvpn.RTRD_REGEX
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py
# LOG = logging.getLogger(__name__)
# class CommonData(forms.SelfHandlingForm):
# class EditDataBgpVpn(CommonData):
# class CreateNetworkAssociation(forms.SelfHandlingForm):
#     def __init__(self, request, *args, **kwargs):
#     def _del_attributes(attributes, data):
#     def handle(self, request, data):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, request, *args, **kwargs):
#     def handle(self, request, data):
#     def _set_params(self, data):


from django.core.validators import RegexValidator
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import forms
from openstack_dashboard import api
from bgpvpn_dashboard.common import bgpvpn as bgpvpn_common
from networking_bgpvpn.neutron.services.common import constants
from bgpvpn_dashboard.dashboards.project.bgpvpn import forms \
    as project_forms
else:
    msg = _("Bug, inconsistency between neutron-lib and "
            "networking-bgpvpn for RTRD regex")
    raise Exception(msg)
RTRDS_REGEX = '^%s( *, *%s)*$' % (RTRD_REGEX, RTRD_REGEX)


class CommonData(project_forms.CommonData):
    route_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Route targets is not valid"))],
        label=_("Route targets"),
        required=False,
        help_text=bgpvpn_common.ROUTE_TARGET_HELP)

    import_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Import targets is not valid"))],
        label=_("Import targets"),
        required=False,
        help_text=bgpvpn_common.ROUTE_TARGET_HELP + ' To use only on import.')

    export_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Export targets is not valid"))],
        label=_("Export targets"),
        required=False,

# Path: bgpvpn_dashboard/common/bgpvpn.py
# ROUTE_TARGET_HELP = _("A single BGP Route Target or a "
#                       "comma-separated list of BGP Route Target. Example: "
#                       "64512:1 or 64512:1,64512:2,64512:3")
# RT_FORMAT_ATTRIBUTES = ('route_targets', 'import_targets', 'export_targets')
# def format_rt(route_targets):
# 
# Path: networking_bgpvpn/neutron/services/common/constants.py
# BGPVPN_RES = bgpvpn.BGPVPN_RES
# BGPVPN_L3 = bgpvpn.BGPVPN_L3
# BGPVPN_L2 = bgpvpn.BGPVPN_L2
# BGPVPN_TYPES = bgpvpn.BGPVPN_TYPES
# UINT32_REGEX = bgpvpn.UINT32_REGEX
# UINT16_REGEX = bgpvpn.UINT16_REGEX
# UINT8_REGEX = bgpvpn.UINT8_REGEX
# IP4_REGEX = bgpvpn.IP4_REGEX
# RTRD_REGEX = bgpvpn.RTRD_REGEX
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py
# LOG = logging.getLogger(__name__)
# class CommonData(forms.SelfHandlingForm):
# class EditDataBgpVpn(CommonData):
# class CreateNetworkAssociation(forms.SelfHandlingForm):
#     def __init__(self, request, *args, **kwargs):
#     def _del_attributes(attributes, data):
#     def handle(self, request, data):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, request, *args, **kwargs):
#     def handle(self, request, data):
#     def _set_params(self, data):


# Path: bgpvpn_dashboard/dashboards/admin/bgpvpn/forms.py
from django.core.validators import RegexValidator
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import forms
from openstack_dashboard import api
from bgpvpn_dashboard.common import bgpvpn as bgpvpn_common
from networking_bgpvpn.neutron.services.common import constants
from bgpvpn_dashboard.dashboards.project.bgpvpn import forms \
    as project_forms

else:
    msg = _("Bug, inconsistency between neutron-lib and "
            "networking-bgpvpn for RTRD regex")
    raise Exception(msg)
RTRDS_REGEX = '^%s( *, *%s)*$' % (RTRD_REGEX, RTRD_REGEX)


class CommonData(project_forms.CommonData):
    route_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Route targets is not valid"))],
        label=_("Route targets"),
        required=False,
        help_text=bgpvpn_common.ROUTE_TARGET_HELP)

    import_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Import targets is not valid"))],
        label=_("Import targets"),
        required=False,
        help_text=bgpvpn_common.ROUTE_TARGET_HELP + ' To use only on import.')

    export_targets = forms.CharField(
        max_length=255,
        validators=[RegexValidator(regex=RTRDS_REGEX,
                                   message=_("Export targets is not valid"))],
        label=_("Export targets"),
        required=False,

        help_text=bgpvpn_common.ROUTE_TARGET_HELP + ' To use only on export.')