Go to file
2024-04-10 15:19:16 +02:00
.vscode Added more consistency functions: 2020-03-23 16:17:17 +01:00
dump Migrated all simplex entities to simplexdb 2020-04-08 12:58:34 +02:00
dumpsimplex Migrated all simplex entities to simplexdb 2020-04-08 12:58:34 +02:00
public Changed name from exo-api to simplex-api 2020-01-16 18:36:20 +01:00
src Fix up namespace issues with variables in patch. 2022-06-29 15:57:41 +02:00
.dockerignore Initial commit 2019-08-24 17:43:06 +02:00
.eslintignore Initial commit 2019-08-24 17:43:06 +02:00
.eslintrc.js Initial commit 2019-08-24 17:43:06 +02:00
.gitignore Added support for transactions: 2019-09-22 20:24:16 +02:00
.mocharc.json Initial commit 2019-08-24 17:43:06 +02:00
.npmrc Initial commit 2019-08-24 17:43:06 +02:00
.prettierignore Initial commit 2019-08-24 17:43:06 +02:00
.prettierrc Initial commit 2019-08-24 17:43:06 +02:00
.yo-rc.json Initial commit 2019-08-24 17:43:06 +02:00
DEVELOPING.md Initial commit 2019-08-24 17:43:06 +02:00
docker-compose.yaml Updated version for postgresql 2020-04-08 15:58:54 +02:00
Dockerfile Initial commit 2019-08-24 17:43:06 +02:00
index.js Initial commit 2019-08-24 17:43:06 +02:00
index.ts Initial commit 2019-08-24 17:43:06 +02:00
LICENSE Updated license 2020-04-19 20:39:14 +02:00
package-lock.json Added operation for new ipv6 pools 2020-04-18 19:56:11 +02:00
package.json Added operation for new ipv6 pools 2020-04-18 19:56:11 +02:00
README.md fix links to new git repo 2024-04-10 15:19:16 +02:00
simplex-config.json Added more consistency functions: 2020-03-23 16:17:17 +01:00
simplex.md fix links to new git repo 2024-04-10 15:19:16 +02:00
tsconfig.json Initial commit 2019-08-24 17:43:06 +02:00

simplex-api

LoopBack

This project holds the Rest API used in eXO (Expansió de la Xarxa Oberta). In the moment of writing this README the only feature covered is the subscriptions management (registrations/cancels)

Specification

simplex.md

Configuration

In order to configure simplex custom options we have to modify simplex-config.json. Now we support those parameters:

  • staticRadGroup: An string which contains static IP Profile ID.
  • disableRadGroup: An string which contains Disabled Profile ID.
  • managementRadGroup: An string which contains Management Profile ID.
  • radius:
    • realm: Realm domain for your ISP i.g: exo.cat
    • daeHost: Dae NAS Host
    • daePort: Dae NAS port
    • daeSecret: Secret for radius packet
    • timeout: For receiving UDP response

Scripts

Before run any script you must build the solution. Please run npm run build.

Consistency

This script is used to ensure consistency between simplex datasources and RADIUS datasources. There are several functionalities covered:

  • syncradius: This ensures consistency between RADIUS and simplex tables
  • ipscircuit: Takes IPv4 and IPv6 from circuits and make them consistent in the IP pools
  • ipsradius: Takes IPv4 and IPv6 from RADIUS tables and make them consistent in the IP pools
  • voidsubs: It deletes all subscriptions without circuits
  • ipv6notation: Fixes bad ipv6notation in RADIUS radReply table

Usage: npm run consistency -- <action> [-f if we want to fix the issues]

Operations

This script is used in server side to perform operations in the database. Now supported options are:

  • initialsubs: This option creates available subscription ids between min and max. Syntax: npm run operations -- initialsubs -o "{"min": <int>, "max": <int> }"
  • addipv4range: This option creates ipv4 ranges in the pool. Syntax: npm run operations -- addipv4range -o "{"subnet": "<a.b.c.d/i>", "available": <boolean> }"
  • migrateipv4: This option changes ipv4 from circuits and radius tables. Syntax: npm run operations -- addipv4range -o "{"oldSubnet": "<a.b.c.d/i>", "newSubnet": "<a.b.c.d/i>", "available": <boolean>, "exceptions": {"<a.b.c.d>": true... } }"
  • removeipv4range: This option removes ipv4 subnet from pool. Syntax: npm run operations -- addipv4range -o "{"subnet": "<a.b.c.d/i>"}"

Contribute

This software is developed using the node.js runtime, so you need an environment with it. You also need a MySQL or mariaDB database running in your system. In this repo is explained how to use Docker to

You can start developing with these commands:

git clone https://farga.exo.cat/exo/simplex-api.git

cd simplex-api; npm install

npm run build

npm run start

You also need a valid database running in your computer.

Multiple datasources

We have moved our data (simplex entities) to a postgresql database. Now this project uses two different database systems:

  • mariaDB: For radius stuff
  • postgreSQL: For all simplex entities.

In order to create simplex data structure you should run:

npm run migrate

Using Docker to provide databases

It's a common practice the use of Docker container system to deploy the services needed in the development process. The next tips help you to run the environment using Docker:

  • It's necessary to have installed docker and docker-compose
  • You can install Docker in Debian using this guide: https://docs.docker.com/install/linux/docker-ce/debian/
  • You can install docker-compose:
    • sudo apt install python3-pip; sudo pip install docker-compose
  • Then simply run: docker-compose up

By default, the radius database is populated using /dump/radius.sql contents.

This method provides both databases.

License

This software is licensed under GNU Affero General Public License v3.0.

Copyright 2020 Roger Garcia