openwisp / django-netjsonconfig Goto Github PK
View Code? Open in Web Editor NEWConfiguration manager for embedded devices, implemented as a reusable django-app
Home Page: http://openwisp.org
License: Other
Configuration manager for embedded devices, implemented as a reusable django-app
Home Page: http://openwisp.org
License: Other
Improve the change implemented in 96f4d09 by supplying a patch to django-sortedm2m, see jazzband/django-sortedm2m#96.
Eg: $UUID, $KEY
Maybe is better to add this feature in netjsonconfig first.
The name Device
is misleading. Those are not necessarily devices but configurations.
Try to create a new device with no configuration, then click on "download", you will notice a 404.
It would be better to tell there's no configuration available yet and advice to create one.
The preview button gives an alert "no configuration available yet", we should add there an advice to create one.
Bug explanation: (openwisp-mailing-list) Error when using advanced mode template.
Django 1.11 has been released last week, it's time to start adding support for it in OpenWISP 2.
django-x509 was easy to upgrade, but there are a few errors in the tests of django-netjsonconfig.
When changing a configuration, it's possible to forget to save changes. A simple warning would improve usability a lot.
It would be very handy to have a new field JSON field that would allow to specify additional context variables (key>values) for each configuration.
This would allow to keep more logic in templates.
the last_ip
field is not always up to date. This is because the field is checked and updated only when the configuration is downloaded, while it should be done even when the checksum is requested.
With openwisp-utils being launched, all the shared code of openwisp-modules can be safely removed and used from the package.
When going into advanced mode, it would be nice to have the possibility to edit the JSON in full screen mode.
The hint "Want learn to use the advanced mode? Consult the netjsonconfig documentation." should be kept.
I think it would also be ok to have the full screen mode as default, but I leave this open for discussion.
The "visualize configuration" button only shows configurations already saved.
Currently it is not possible to visualize changes before saving. A "preview" feature would really be helpful.
"view on site" button in admin should be disabled as it points to nowhere.
Simplify custom template loading for Device change_form.html
Editing raw json it's currently uncomfortable for various reasons:
Something like this tool could improve usability a lot.
The help text "Choose items and order by drag & drop" in the sortedm2m widget is helpful but hard to see.
Users have suggested to make it more evident.
Test the new versions of django-reversions and django-sortedm2m and updated the requirements file.
VPN context is broken, variables automatically added via auto_cert option are not evaluated in the preview. Not sure about the resulting configuration, I have to check.
How to replicate:
In some cases it is possible that the value of config
field will default to None
. This should not be possible.
It would be very useful to set some templates to be enabled by default.
(see original mailing list discussion)
I thought about adding a way to specify tags to templates.
We could tag some templates as "dual-radio", some other templates as "WDS" and so on.
Then we could add these templates in the configuration of the OpenWRT/LEDE deamon (openwisp-config) which would then register the device with these templates preselected.
When creating a new configuration object, if one of the selected templates has the timezone set, the new configuration will override it because timezone is set by default on UTC and shown.
The setting NETJSONCONFIG_BACKENDS
only adds more backends to the default ones.
This limits the flexibility of the django-app and is counter intuitive compared to how other classic django settings work.
Same applies for the new NETJSONCONFIG_VPN_BACKENDS
.
It would be better to allow replacing all the entries entirely.
As a consequence, the behaviour of NETJSONCONFIG_DEFAULT_BACKEND
and NETJSONCONFIG_DEFAULT_VPN_BACKEND
would change slightly and would need to be documented (the default value is the first backend in the list, not a static value).
NETJSONCONFIG_BACKENDS
overridableNETJSONCONFIG_DEFAULT_BACKEND
properlyNETJSONCONFIG_VPN_BACKENDS
overridableNETJSONCONFIG_DEFAULT_VPN_BACKEND
properlyUpgrade to django-sortedm2m 1.2.0.
Since the next django release this customization won't be necessary anymore because we sent a patch to django: django/django@e972a7d
There are many advantages of using Vagrant to provide portable virtual environments. It's been widely in use these days by benefiting a developer. One just needs to run a vagrant up
command and it will isolate all the dependencies and provide a consistent environment. For more details https://www.vagrantup.com/docs/why-vagrant/ can be referred. This could perhaps be implemented in all the OpenWISP projects. Suggestions please.
Full screen mode covers preview config mode.
It's probably just a matter of adjusting z-index
css property so the ones of the preview is higher.
@gastonche would you like to address this?
More structure is needed in order to detect misconfigurations, see openwisp/openwisp-config#8
A better response could be:
registration-result:success
uuid:{uuid}
key:{key}
When the auto-create certificate feature is being used, the default pattern for creating common names fo new certificates is {mac_address}-{name}
.
This was a nice idea, too bad I forgot to think that in the real world most people will also use auto-registration with new devices which do not have a name yet, therefore they will get their mac-address as their name, the resulting common name therefore resulting in {mac_address}-{mac_address}
, which is redundant, ugly and useless.
What can we do to alleviate the problem without degrading the experience of those who don't use auto-registration or have some magic auto custom naming of their devices before they register?
We may edit the bit of code which assigns the common name to eliminate the second part ({name}
) if it's equal the first part {mac_address}
, I think that's simple and would work well enough.
There are few things I noticed after merging #43
To get the UUID you must copy a part of the URL, which sucks. It would be better to provide a way to easily copy it.
The following NetJSON:
{
"interfaces": [
{
"type": "virtual",
"name": "tap0",
"mac": "{{ mac_address }}"
}
]
}
Won't validate. This sucks big time!
We should find a solution for this problem. Maybe we can evaluate the variables with javascript. I don't know.
NETJSONCONFIG_CONTEXT
is not evaluated in templates variables.
EDIT: 31e40ac shows the problem, it may be caused by a bug in the underlying library (netjsonconfig).
We want to add a Device
model which will contain optional information about device model and operating system distribution. This information can be collected automatically during registration.
This is the first step towards adding more data collection features to OpenWISP 2 (geographic location, internal maps, monitoring data) that will be added at later steps in additional optional modules.
It would be very useful to be able to rollback previous states.
while trying to setup for development i encountered some problems mainly pertaining to packages that were not installed. on the migration stage i received errors about the following packages not being available or installed,
markupsafe, functools32, cryptography
and from my research i found out that it's due to some dependencies having updated their own, dependencies, like jinja having added markupsafe
as a dependency.
I have added these depends to the project requirements on my fork should i make a PR for that?
it may be useful to have a way to filter configurations that have a relationship with a specific template
Implement a simple http controller.
In rare cases, auto-registration may fail because of misconfiguration or bugs introduced during development.
It then may happen that even if the auto-registration fails, the device may be created anyway, eg: if the uncaught exception is triggered in the phase which adds templates (m2m relationship in django are saved after the main object has been created).
This is not good because it triggers other unexpected behaviour, a chain reaction which is hard to debug.
The ideal solution would be to ensure to catch any potential exception during all the critical phases of the autoregistration and if any of these phases fails, the system should log the error, trigger something like a 400 bad request and delete the newly created invalid device.
In some cases it is very useful to know the last ip from which the configuration was downloaded.
The configuration has at least 3 possible status:
How to reproduce:
Relevant stacktrace:
File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 46, in clean
self.validate_netjsonconfig_backend(self.backend_instance)
File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 72, in backend_instance
return self.get_backend_instance()
File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 79, in get_backend_instance
backend = self.backend_class
File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 68, in backend_class
return import_string(self.backend)
File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/module_loading.py", line 18, in import_string
six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/module_loading.py", line 15, in import_string
module_path, class_name = dotted_path.rsplit('.', 1)
ImportError: doesn't look like a module path
How to reproduce the issue: try to save a new device with name test device
.
Result: netjsonconfig validation complains test device is not a valid hostname and the validation error is shown in the configuration section.
Fix: it would be better to show this validation error relating directly to the name field
How to reproduce:
Add "visualize configuration" and "download configuration" buttons in Template admin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.