# 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

    fields_order = ['name', 'tenant_id', 'type',
                    'route_targets', 'import_targets', 'export_targets']

    def __init__(self, request, *args, **kwargs):
        super(CreateBgpVpn, self).__init__(request, *args, **kwargs)
        tenant_choices = [('', _("Select a project"))]
        tenants, has_more = api.keystone.tenant_list(request)
        for tenant in tenants:
            if tenant.enabled:
                tenant_choices.append((tenant.id, tenant.name))
        self.fields['tenant_id'].choices = tenant_choices
        self.action = 'create'


class EditDataBgpVpn(CommonData):
    bgpvpn_id = forms.CharField(label=_("ID"), widget=forms.TextInput(
        attrs={'readonly': 'readonly'}))
    type = forms.CharField(label=_("Type"), widget=forms.TextInput(
        attrs={'readonly': 'readonly'}))
    tenant_id = forms.CharField(widget=forms.HiddenInput())

    fields_order = ['name', 'bgpvpn_id', 'tenant_id', 'type',
                    'route_targets', 'import_targets', 'export_targets']

    def __init__(self, request, *args, **kwargs):
        super(EditDataBgpVpn, self).__init__(request, *args, **kwargs)
        self.action = 'update'



# 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


    fields_order = ['name', 'tenant_id', 'type',
                    'route_targets', 'import_targets', 'export_targets']

    def __init__(self, request, *args, **kwargs):
        super(CreateBgpVpn, self).__init__(request, *args, **kwargs)
        tenant_choices = [('', _("Select a project"))]
        tenants, has_more = api.keystone.tenant_list(request)
        for tenant in tenants:
            if tenant.enabled:
                tenant_choices.append((tenant.id, tenant.name))
        self.fields['tenant_id'].choices = tenant_choices
        self.action = 'create'


class EditDataBgpVpn(CommonData):
    bgpvpn_id = forms.CharField(label=_("ID"), widget=forms.TextInput(
        attrs={'readonly': 'readonly'}))
    type = forms.CharField(label=_("Type"), widget=forms.TextInput(
        attrs={'readonly': 'readonly'}))
    tenant_id = forms.CharField(widget=forms.HiddenInput())

    fields_order = ['name', 'bgpvpn_id', 'tenant_id', 'type',
                    'route_targets', 'import_targets', 'export_targets']

    def __init__(self, request, *args, **kwargs):
        super(EditDataBgpVpn, self).__init__(request, *args, **kwargs)
        self.action = 'update'



class CreateNetworkAssociation(project_forms.CreateNetworkAssociation):