Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e9acb7a
feat: Move towards class based Schema definitions
EntraptaJ Jan 30, 2021
b87a793
style(lint): Fix ESLint errors
EntraptaJ Jan 30, 2021
64fda2a
feat(Validation): Handle validation and errors properly
EntraptaJ Jan 30, 2021
51e908d
feat(Validation): Setup a reusable validator function for ID referneces.
EntraptaJ Jan 30, 2021
117036e
feat: Shitty crappy worst code I've ever written, but let's see if it…
EntraptaJ Jan 30, 2021
4a689c7
fix: Remove for now
EntraptaJ Jan 30, 2021
45d6912
feat: Attempt 2
EntraptaJ Jan 30, 2021
16764db
fix: Lets try thsi
EntraptaJ Jan 30, 2021
1d6a15d
fix: Minor change
EntraptaJ Jan 30, 2021
6dd2031
feat: Clean up error handling
EntraptaJ Jan 30, 2021
02c5bcb
fix: Fix error schema
EntraptaJ Jan 30, 2021
4fdcfd0
feat: Provide the line of the actual invalid ID
EntraptaJ Jan 30, 2021
fa87f76
fix: Test
EntraptaJ Jan 30, 2021
dd1cf99
fix: Ztesting
EntraptaJ Jan 30, 2021
a2d79e8
fix: Fix Contact ID
EntraptaJ Jan 30, 2021
75e166c
fix: Change Toronto contact
EntraptaJ Jan 30, 2021
6ef20b5
fix: Refactor classes and enums
EntraptaJ Jan 30, 2021
94f7e39
feat: Move to deviceId and deviceInterface properties so we can valid…
EntraptaJ Jan 30, 2021
be62017
feat: Handle lower level validations properly and get the correct lin…
EntraptaJ Jan 30, 2021
f9b7ced
feat: Exit the process so the Action errors
EntraptaJ Jan 30, 2021
8b317c9
fix: Change Toronto contact (Expecting this to fail)
EntraptaJ Jan 30, 2021
6557315
fix: TypeCheck error and log messgae if error
EntraptaJ Jan 30, 2021
4b971c1
fix: Use valid Toronto contactId
EntraptaJ Jan 30, 2021
a970bc5
feat(Tests): Clean up Network and add parent network includes child n…
EntraptaJ Jan 31, 2021
49d5acc
fix(ci): Use Node 15
EntraptaJ Jan 31, 2021
4f69171
chore(Toronto P2P): Change Toronto Point to Point network
EntraptaJ Jan 31, 2021
16208c3
fix(Toronto P2P): Use valid network prefix
EntraptaJ Jan 31, 2021
dc56ec1
chore(Toronto Router 1): Change Toronto Router 1 ID
EntraptaJ Jan 31, 2021
3368546
fix(Toronto Cabniet 1): Fix the device ID
EntraptaJ Jan 31, 2021
287568d
feat(IPAM-Errors): Support multiple validation errors on a single load
EntraptaJ Jan 31, 2021
3f1b91b
fix: Move Circuit Side(A|Z)ID To top level of circuit
EntraptaJ Jan 31, 2021
f48a194
fix: Oops
EntraptaJ Jan 31, 2021
290e775
feat: Better Types, Option for scoped containers, more tests, cleanup
EntraptaJ Feb 1, 2021
ec8c803
fix(IPAM-Test.yaml): Fix the test purpose validation error
EntraptaJ Feb 1, 2021
47ea715
fix(IPAM-Tests): Use the resovled path for testing the error
EntraptaJ Feb 1, 2021
7eade34
fix: Turns out this isn't needed afterall
EntraptaJ Feb 1, 2021
f7d1a01
tests(IPAM): Add a test case for one invalid deviceId and one invalid…
EntraptaJ Feb 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": ["error"],

"no-useless-constructor": "off",

// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
"keyword-spacing": "off",
"@typescript-eslint/keyword-spacing": ["error"],
Expand All @@ -47,7 +49,12 @@
"@typescript-eslint/explicit-function-return-type": "error",

// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-explicit-any": [
"error",
{
"ignoreRestArgs": true
}
],

// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
"@typescript-eslint/no-non-null-assertion": "error",
Expand Down
66 changes: 43 additions & 23 deletions .github/workflows/Code Quality.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
name: Code Quality

on: [push, pull_request]
on: [push]

jobs:
Prettier:
name: Prettier
strategy:
matrix:
os: ['ubuntu-latest']
node: ['14.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npm run prettier
# Prettier:
# name: Prettier
# strategy:
# matrix:
# os: ['ubuntu-latest']
# node: ['14.x']
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/[email protected]
# - uses: actions/[email protected]
# with:
# node-version: ${{ matrix.node }}
# registry-url: 'https://registry.npmjs.org'
# - name: Install dependencies
# run: npm ci
# - name: Run Prettier
# run: npm run prettier

# ESLint:
# name: ESLint
# strategy:
# matrix:
# os: ['ubuntu-latest']
# node: ['14.x']
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/[email protected]
# - uses: actions/[email protected]
# with:
# node-version: ${{ matrix.node }}
# registry-url: 'https://registry.npmjs.org'
# - name: Install dependencies
# run: npm ci
# - name: Run ESLint
# run: npm run lint

ESLint:
name: ESLint
Check:
name: IPAM Checker
strategy:
matrix:
os: ['ubuntu-latest']
node: ['14.x']
node: ['15.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
Expand All @@ -36,5 +54,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Setup Matcher
run: echo "::add-matcher::./schemas/problem-matcher.json"
- name: Run IPAM Checker
run: npm run runBin runActions.ts
2 changes: 1 addition & 1 deletion .github/workflows/Push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node: ['14.x']
node: ['15.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
Expand Down
32 changes: 32 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "docs/CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"docs/CHANGELOG.md",
"package.json",
"package-lock.json"
]
}
],
"@semantic-release/github"
],
"branches": [
"master"
]
}
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"restart": true,

"cwd": "${workspaceFolder}",
"env": {
"LOG_MODE": "DEBUG"
},
"runtimeExecutable": "npx",
"runtimeArgs": ["nodemon"]
}
Expand Down
13 changes: 11 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"yaml.schemas": {
"/workspace/schemas/IPAM.json": ["ipam.yml", "ipam.yaml", "IPAM.yaml", "IPAM.yml", "**/fixtures/*.yml", "**/fixtures/*.yaml"]
"/workspace/schemas/IPAM.json": [
"ipam.yml",
"ipam.yaml",
"IPAM.yaml",
"IPAM.yml",
"**/fixtures/*.yml",
"**/fixtures/*.yaml",
"IPAM-Test.yaml",
"Playground/*.yaml"
]
}
}
}
54 changes: 54 additions & 0 deletions IPAM-Test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
communities:
- name: Toronto
id: tor
contactId: tor.todo1
sites:
- id: tor.c1
name: Toronto Cabniet 12
devices:
- id: tor.c1.rt1
name: Torotno Cabinet 1 Router 1

- id: tor.c2
name: Toronto Cabniet 2
devices:
- id: tor.c2.rt1
name: Torotno Cabinet 2 Router 1

circuits:
- id: tor.clink
sideAID: tor.c1
sideZID: tor.c2
speed: 10G

circuitLocations:
- id: tor.c1
address: Front Street
provider: Bell
communuityId: tor
demarcSpeed: 10G

- id: tor.c2
address: Front Street
provider: Bell
communuityId: tor
demarcSpeed: 10G

contacts:
- id: tor.todo1
name: TODO

networks:
- prefix: 1.0.0.0/23
networks:
- prefix: 1.0.0.0/30
hosts:
- ip: 1.0.0.1
description: Toronto Cabniet 1
contactId: tor.todo1
deviceId: tor.c1.rt1
deviceInterface: TenGigE0/0/0/1
- ip: 1.0.0.2
description: Toronto Cabniet 2
deviceId: tor.c2.rt1
deviceInterface: TenGigE0/0/0/2
56 changes: 56 additions & 0 deletions Playground/Devices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
communities:
- name: Toronto
id: tor
contactId: tor.todo1
sites:
- id: tor.c1
name: Toronto Cabniet 12
devices:
- id: tor.c1.rt1
name: Torotno Cabinet 1 Router 1

- id: tor.c2
name: Toronto Cabniet 2
devices:
- id: tor.c2.rt1
name: Torotno Cabinet 2 Router 1

circuits:
- id: tor.clink
sideA:
id: tor.c1
sideZ:
id: tor.c2
speed: 10G

circuitLocations:
- id: tor.c1
address: Front Street
provider: Bell
communuityId: tor
demarcSpeed: 10G

- id: tor.c2
address: Front Street
provider: Bell
communuityId: tor
demarcSpeed: 10G

contacts:
- id: tor.todo1
name: TODO

networks:
- prefix: 1.0.0.0/23
networks:
- prefix: 1.0.0.0/30
hosts:
- ip: 1.0.0.1
description: Toronto Cabniet 1
contactId: tor.todo1
deviceId: tor.c1.rt0
deviceInterface: TenGigE0/0/0/1
- ip: 1.0.0.2
description: Toronto Cabniet 2
deviceId: tor.c2.rt1
deviceInterface: TenGigE0/0/0/2
15 changes: 15 additions & 0 deletions Playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Replacements

Replace devices.id & devices.interface with `deviceInterface` & `

Search

```
device:\n\s+id: (\S+)$\n\s\s((.*)(?=interface).*(?<=interface: )(\S+))
```

Replace

```
deviceId: $1\n$3deviceInterface: $4
```
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# KristianFJones/TS-AutoNetwork

TODO
This is a module created for the ISP I work at [K-Net](https://github.com/knetca), it's a custom build [IP Address Management (IPAM)](https://en.wikipedia.org/wiki/IP_address_management) system that is stored as a [YAML](https://en.wikipedia.org/wiki/YAML#:~:text=YAML%20(a%20recursive%20acronym%20for,is%20being%20stored%20or%20transmitted.) file as is intended to be the root source of truth for all network related services and new automation systems.

## IPAM YAML File

The IPAM YAML defines the following arrays

- Communities each site within a community, and the devices at each site.

- Circuits the unique ID for referencing within network prefixes, the sideA and sizeZ include the ID which is a refernce to a "circuitLocation", and the speed of the "EVC"

- Circuit Locations which is what "circuit providers" think of as the circuit, which includes the circuit provider, the circuit ID that is referenced in "circuits", the address that is provided to the circuit provider, the phyiscal demarc speed.

- Networks, which has a prefix or "network", and can optionally have: a circuit id reference attached, a nsServer array contianing the authoritive nsServers for forwarding reverse DNS, contactId referencing a contact, or children networks.

- Contacts, which are currently unused, but will contain the name, email, and contact information for staff and for automated systems such as processing abuse emails.

## Usage

Expand All @@ -19,15 +33,15 @@ Follow these steps to open this project in a container:
2. To use this repository, you can either open the repository in an isolated Docker volume:

- Press <kbd>F1</kbd> and select the **Remote-Containers: Open Repository in Container...** command.
- Enter `K-FOSS/TS-Core-Template`
- Enter `KristianFJones/TS-AutoNetwork`
- The VS Code window (instance) will reload, clone the source code, and start building the dev container. A progress notification provides status updates.

Or open a locally cloned copy of the code:

- Clone this repository to your local filesystem.
- `git clone https://github.com/K-FOSS/TS-Core-Template.git`
- `git clone https://github.com/KristianFJones/TS-AutoNetwork.git`
- Open the project folder in Visual Studio Code.
- `code ./TS-Core-Template`
- `code ./TS-AutoNetwork`
- Reopen in Container

- When you open the project folder in Visual Studio Code you should be prompted with a notification asking if you would like to reopen in container.
Expand Down
3 changes: 0 additions & 3 deletions demo/.vscode/extensions.json

This file was deleted.

5 changes: 0 additions & 5 deletions demo/.vscode/settings.json

This file was deleted.

Loading