Giter VIP home page Giter VIP logo

netjsonconfig's People

Contributors

aagman945 avatar aryamanz29 avatar aryanbhasin avatar atb00ker avatar cappe87 avatar codesankalp avatar daffytheduck avatar devkapilbansal avatar edoput avatar fredrikblau avatar kishan-dhakan avatar kkreitmair avatar lehone-hp avatar lpalgarvio avatar marfgold1 avatar masap avatar nemesifier avatar noumbissivalere avatar okraits avatar pandafy avatar praptisharma28 avatar r9295 avatar tkaefer avatar waleko avatar wizanyx avatar yasharora102 avatar yashikajotwani12 avatar zachantre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netjsonconfig's Issues

Add a special renderer for OpenWRT

A special renderer can convert any custom section of a netjson DeviceConfiguration object to UCI config files. We could call this something like CustomOptionsRenderer, OptionsRenderer or something similar.

Proper sphinx documentation

When the OpenWISP Firmware backend will be added (#18) the project will need a dedicated documentation website in order to properly explain the usage of the two backends.

Special cases that really need to be documented:

  • bridges example
  • suggest to define bridges after bridge_members have been defined
  • wireless interfaces "network" attribute
  • default renderer
  • openwisp backend features (see #18)
  • update README.rst
  • update CONTRIBUTING.rst to link docs
  • mode attribute of file inclusion feature

[schema] Different profiles for radio settings

It's necessary to improve the schema for radio settings.

The simplest approach is to enable different channels depending on the 802.11 version.

eg:

  • for 802.11g show only 2 GHz channels
  • for 802.11a show only 5GHz channels
  • for 802.11n show both 2.4GHz and 5GHz channels and allow 40mhz channel width

Improve wireless definition

The wireless section should be an object, not an array (the NetJSON spec needs to be fixed).

Multiple SSIDs should be defined by defining more wireless interfaces.

Wireless interfaces in /etc/config/wireless should contain the ifname attribute.

Add backend for OpenWISP Firmware 1.3.x

The backend should be able to replicate the configuration generated by OpenWISP Manager.

  • uci files in /uci/
  • install script
  • uninstall script
  • tc script
  • vpn script up
  • vpn script down
  • cron

Include files in render() output

Including files in the render method output would be useful to preview the results of the conversion.

The problem is this would make the UCI output invalid, but this can be dealt with by clearly separating the two sections so that the files can be easily removed programmatically if ever needed.

[OpenWrt] Routing schema needs improvement

The routing schema of the OpenWrt backend is pretty basic, it would be better to add the remaining OpenWRT route options to be consistent with all the other features.

Add a write() method

This is a consequence of #32, since generate() won't be writing to disk anymore we should provide a method to write to disk that requires a name and a path.

Bridging issues

Trying different combinations with bridges yelds very strange (and wrong) results.

Generation of bridged interfaces must be improved.

  • the whole __find_bridges idea is quite a bad one. It would be better to remove that code altoghether and find a simpler solution.
  • bridges should be defined only in /etc/config/network.
  • in /etc/config/wireless the attached networks can be defined with a custom attribute, like networks.
  • the bridge schema should require the presence of bridge_members

Interfaces with no addresses

Interfaces with no addresses should not be entirely ignored.

Eg:

{
    "interfaces": [
        {
            "name": "eth0",
            "type": "ethernet"
        }
    ]
}

should generate:

package network

config interface 'eth0'
    option ifname 'eth0'
    option proto 'none'

[File inclusion] add support for representing a text file as an array of lines

The only way to add strings containing new lines in JSON is to use the escaped form \n.

Therefore to add a file with multiple lines in netjsonconfig now one has to do:

{
    "files": [
        {
            "path": "/root/.ssh/authorized_keys",
            "contents": "sshkey1\nsshkey2\nsshkey3"
        }
    ]
}

It would be nice to add support to an array representation, each element of the array representing a line of a file:

{
    "files": [
        {
            "path": "/root/.ssh/authorized_keys",
            "contents": [
                "sshkey1",
                "sshkey2",
                "sshkey3"
            ]
        }
    ]
}

This would also improve readability a great deal.

Add command line tool

Possible usage:

netjsonconfig --backend openwrt --method render <file>

Pass JSON string directly:

netjsonconfig -b openwrt -m render "<JSON>"

[OpenWrt] Wifi interface does not inherit "disabled" attribute

Consider the following:

{
    "disabled": true,
    "name": "wlan0",
    "type": "wireless",
    "wireless": {
        "radio": "radio0",
        "mode": "station",
        "ssid": "mywifi"
    }
}

One would expect that since the interface is disabled, the wifi interface won't be brought up.

Unfortunately that is not the case, because WirelessRenderer does not inherit this attribute.

[schema] Simplify ciphers / improve encryption

ciphers should be handled automatically when selecting the encryption setting, but it should be possible to override it.

It should also appear in the OpenWRT schema, because other firmwares do not give such a granular control.

[schema] Add "none" to encryption choices

Currently there's no "none" choice for encryption, which makes it a bit harder to choose "no encryption" when using autogenerated UIs.

A "none" option is needed, but this will require combining more schemas.

Allow omitting { "type": "DeviceConfiguration" }

Since this library will only deal with NetJSON DeviceConfiguration objects, we should not require config params to pass { "type": "DeviceConfiguration" } because it's a waste of time.

Therefore we should allow this:

o = OpenWrt({
    "interfaces": [
        {
            "name": "eth0",
            "type": "ethernet",
            "addresses": [
                {
                    "proto": "dhcp",
                    "family": "ipv4"
                }
            ]
        }
    ]
})

the actual required config will still be valid:

o = OpenWrt({
    "type": "DeviceConfiguration",
    "interfaces": [
        {
            "name": "eth0",
            "type": "ethernet",
            "addresses": [
                {
                    "proto": "dhcp",
                    "family": "ipv4"
                }
            ]
        }
    ]
})

Add file inclusion feature

We need a way to include arbitrary only (text) files in configuration packages.

The files should be contained in the generated archive but not in the render output (which would make the configuration output invalid).

Set date in tar.gz files

Dates in the configuration archive are not set (default to beginning of the unix epoch).

It would be better to set the date to the time at which they were generated.

Switch to GPLv3

This library should be licensed as GPLv3 as it could be a desirable feature to include in proprietary software, but we do not want proprietary software to take advantage of this kind of feature without contributing back in some way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.