Exemplo n.º 1
0
def add_ethernet(request):
    """Serve ethernet connection create form."""
    form = None

    if request.method == 'POST':
        form = AddEthernetForm(request.POST)
        if form.is_valid():
            name = form.cleaned_data['name']
            interface = form.cleaned_data['interface']
            zone = form.cleaned_data['zone']
            ipv4_method = form.cleaned_data['ipv4_method']
            ipv4_address = form.cleaned_data['ipv4_address']
            ipv4_netmask = form.cleaned_data['ipv4_netmask']
            ipv4_gateway = form.cleaned_data['ipv4_gateway']
            ipv4_dns = form.cleaned_data['ipv4_dns']
            ipv4_second_dns = form.cleaned_data['ipv4_second_dns']

            network.add_ethernet_connection(
                name, interface, zone, ipv4_method, ipv4_address, ipv4_netmask,
                ipv4_gateway, ipv4_dns, ipv4_second_dns)
            return redirect(reverse_lazy('networks:index'))
    else:
        form = AddEthernetForm()

    return TemplateResponse(request, 'connections_create.html',
                            {'title': _('Adding New Ethernet Connection'),
                             'subsubmenu': subsubmenu,
                             'form': form})
Exemplo n.º 2
0
 def setUp(cls):
     cls.ethernet_uuid = network.add_ethernet_connection(
         'plinth_test_eth', 'internal',
         'auto', '')
     cls.wifi_uuid = network.add_wifi_connection(
         'plinth_test_wifi', 'external',
         'plinthtestwifi', 'adhoc', 'open', '',
         'auto', '')
Exemplo n.º 3
0
 def setUp(cls):
     connection = network.add_ethernet_connection('plinth_test_eth',
                                                  'internal', 'auto', '')
     cls.ethernet_uuid = connection['connection']['uuid']
     connection = network.add_wifi_connection('plinth_test_wifi',
                                              'external', 'plinthtestwifi',
                                              'adhoc', 'open', '', 'auto',
                                              '')
     cls.wifi_uuid = connection['connection']['uuid']
Exemplo n.º 4
0
 def setUp(cls):
     cls.ethernet_uuid = network.add_ethernet_connection(
         'plinth_test_eth', 'eth0', 'internal', 'auto', '')
     cls.wifi_uuid = network.add_wifi_connection('plinth_test_wifi',
                                                 'wlan0', 'external',
                                                 'plinthtestwifi', 'adhoc',
                                                 'open', '', 'auto', '')
     cls.pppoe_uuid = network.add_pppoe_connection('plinth_test_pppoe',
                                                   'eth1', 'internal',
                                                   'x-user', 'x-password')
Exemplo n.º 5
0
 def setUp(cls):
     cls.ethernet_uuid = network.add_ethernet_connection(
         'plinth_test_eth', 'eth0', 'internal',
         'auto', '', '', '', '', '')
     cls.wifi_uuid = network.add_wifi_connection(
         'plinth_test_wifi', 'wlan0', 'external',
         'plinthtestwifi', 'adhoc', 'open', '',
         'auto', '', '', '', '', '')
     cls.pppoe_uuid = network.add_pppoe_connection(
         'plinth_test_pppoe', 'eth1', 'internal',
         'x-user', 'x-password')
Exemplo n.º 6
0
def add_ethernet(request):
    """Serve ethernet connection create form."""
    form = None

    if request.method == "POST":
        form = AddEthernetForm(request.POST)
        if form.is_valid():
            name = form.cleaned_data["name"]
            zone = form.cleaned_data["zone"]
            ipv4_method = form.cleaned_data["ipv4_method"]
            ipv4_address = form.cleaned_data["ipv4_address"]

            network.add_ethernet_connection(name, zone, ipv4_method, ipv4_address)
            return redirect(reverse_lazy("networks:index"))
    else:
        form = AddEthernetForm()

    return TemplateResponse(
        request,
        "connections_create.html",
        {"title": _("Adding New Ethernet Connection"), "subsubmenu": subsubmenu, "form": form},
    )
Exemplo n.º 7
0
 def setUp(cls):
     cls.ethernet_uuid = network.add_ethernet_connection("plinth_test_eth", "eth0", "internal", "auto", "")
     cls.wifi_uuid = network.add_wifi_connection(
         "plinth_test_wifi", "wlan0", "external", "plinthtestwifi", "adhoc", "open", "", "auto", ""
     )