diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 861ea83..43402a2 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -1,5 +1,7 @@ name: Backend Testing -on: [push, pull_request] +on: + - push + - pull_request jobs: backend: @@ -9,9 +11,9 @@ jobs: matrix: node-version: [14.x] redis-version: [5, 6] - poetry-version: [1.1.4] - python-version: [3.6, 3.8] - os: [ubuntu-20.04] + poetry-version: [1.1.11] + python-version: [3.8, 3.9] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -29,7 +31,7 @@ jobs: poetry-version: ${{ matrix.poetry-version }} - name: Install Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index d727ba7..b79cb44 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,5 +1,7 @@ name: Frontend Testing -on: [push, pull_request] +on: + - push + - pull_request jobs: frontend: @@ -8,7 +10,7 @@ jobs: fail-fast: false matrix: node-version: [14.x] - os: [ubuntu-20.04] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} env: working-directory: ./hyperglass/ui @@ -25,11 +27,14 @@ jobs: working-directory: ${{ env.working-directory }} run: yarn install - - name: TypeScript - run: ./.tests/pre-commit-frontend.sh --typescript + - name: Formatting (Prettier) + run: yarn format:check - - name: ESLint - run: ./.tests/pre-commit-frontend.sh --eslint + - name: Lint (ESLint) + run: yarn lint - - name: Prettier - run: ./.tests/pre-commit-frontend.sh --prettier + - name: Types (TypeScript) + run: yarn typecheck + + - name: Tests (Jest) + run: yarn test diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index 2ed684e..c685dc0 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -1,5 +1,7 @@ name: Installer Testing -on: [push, pull_request] +on: + - push + - pull_request jobs: installer: @@ -7,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -15,4 +17,4 @@ jobs: uses: actions/checkout@v2 - name: Run hyperglass - run: "sudo bash ./install.sh" + run: 'sudo bash ./install.sh' diff --git a/.tests/ga-backend-app.sh b/.tests/ga-backend-app.sh index 5bea96f..c27deed 100755 --- a/.tests/ga-backend-app.sh +++ b/.tests/ga-backend-app.sh @@ -6,18 +6,21 @@ export POETRY_HYPERGLASS_UI_BUILD_TIMEOUT="600" echo "[INFO] Set build timeout to $POETRY_HYPERGLASS_UI_BUILD_TIMEOUT seconds" echo "[INFO] Starting setup..." -poetry run hyperglass setup -d &> $LOG_FILE +poetry run hyperglass setup -d &>$LOG_FILE echo "[SUCCESS] Setup completed." sleep 2 +echo "[INFO] Copying directives.yaml file..." +cp ./hyperglass/examples/directives.yaml $HOME/hyperglass/directives.yaml + echo "[INFO] Copying devices.yaml file..." cp ./hyperglass/examples/devices.yaml $HOME/hyperglass/devices.yaml echo "[INFO] Setting listen_address..." -echo "listen_address: 127.0.0.1" >> $HOME/hyperglass/hyperglass.yaml +echo "listen_address: 127.0.0.1" >>$HOME/hyperglass/hyperglass.yaml echo "[INFO] Starting UI build." -poetry run hyperglass build-ui &> $LOG_FILE +poetry run hyperglass build-ui &>$LOG_FILE if [[ ! $? == 0 ]]; then echo "[ERROR] Failed to build hyperglass ui." @@ -29,7 +32,7 @@ else fi echo "[INFO] Starting hyperglass..." -poetry run hyperglass start &> $LOG_FILE & +poetry run hyperglass start &>$LOG_FILE & sleep 120 if [[ ! $? == 0 ]]; then diff --git a/hyperglass/examples/commands.yaml b/hyperglass/examples/commands.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/hyperglass/examples/devices.yaml b/hyperglass/examples/devices.yaml index 7775004..2b1c4ba 100644 --- a/hyperglass/examples/devices.yaml +++ b/hyperglass/examples/devices.yaml @@ -1,89 +1,12 @@ --- routers: - - name: sfo_router01 - address: 10.0.0.1 - network: - name: primary - display_name: Main Network + - name: Example Device + address: 127.0.0.1 + group: Test credential: - username: user1 - password: secret1 - display_name: San Francisco, CA - port: 22 - nos: cisco_ios - vrfs: - - name: default - display_name: Global - ipv4: - source_address: 192.0.2.1 - access_list: - - network: 10.0.0.0/8 - action: deny - - network: 192.168.0.0/16 - action: deny - - network: 172.16.0.0/12 - action: deny - - network: 0.0.0.0/0 - action: permit - ge: 8 - le: 24 - ipv6: - source_address: 2001:db8::1 - access_list: - - network: ::/0 - action: permit - ge: 32 - le: 64 - - name: customer_a - display_name: Customer A - ipv4: - source_address: 192.168.1.1 - access_list: - - network: 192.0.2.0/24 - action: deny - - network: 10.0.0.0/8 - action: permit - ipv6: null - proxy: null - - name: atl_router01 - address: 10.0.0.2 - network: - name: secondary - display_name: That Other Network - credential: - username: user2 - password: secret2 - display_name: Atlanta, GA - port: 22 - nos: juniper - vrfs: - - name: default - display_name: Global - ipv4: - source_address: 192.0.2.2 - access_list: - - network: 10.0.0.0/8 - action: deny - - network: 192.168.0.0/16 - action: deny - - network: 172.16.0.0/12 - action: deny - - network: 0.0.0.0/0 - action: permit - ge: 8 - le: 24 - ipv6: - source_address: 2001:db8::2 - access_list: - - network: ::/0 - action: permit - ge: 32 - le: 64 - proxy: - name: server01 - address: 10.11.6.204 - port: 22 - credential: - username: user1 - password: secret1 - nos: linux_ssh + username: test + password: test + platform: juniper + directives: + - '*' + - juniper_bgp_route diff --git a/hyperglass/examples/directives.yaml b/hyperglass/examples/directives.yaml new file mode 100644 index 0000000..029ab80 --- /dev/null +++ b/hyperglass/examples/directives.yaml @@ -0,0 +1,17 @@ +juniper_bgp_route: + name: BGP Route + groups: + - Global + rules: + - condition: '1.0.0.1/32' + action: deny + - condition: '0.0.0.0/0' + ge: 8 + le: 25 + command: 'show route protocol bgp table inet.0 {target} detail' + - condition: '::/0' + ge: 16 + le: 64 + command: 'show route protocol bgp table inet6.0 {target} detail' + field: + description: IP Address or Prefix diff --git a/hyperglass/ui/package.json b/hyperglass/ui/package.json index b9f84c9..ab154b5 100644 --- a/hyperglass/ui/package.json +++ b/hyperglass/ui/package.json @@ -11,6 +11,7 @@ "start": "next start", "typecheck": "tsc --noEmit", "format": "prettier --config ./.prettierrc -c -w .", + "format:check": "prettier --config ./.prettierrc -c .", "build": "export NODE_OPTIONS=--openssl-legacy-provider; next build && next export -o ../hyperglass/static/ui", "test": "jest" },