Skip to content

Commit 32d5629

Browse files
committed
Merge branch 'master' into documentation
2 parents cb1a088 + b3188c9 commit 32d5629

File tree

132 files changed

+1197
-1428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1197
-1428
lines changed

.github/workflows/python_linter.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
###########################
3+
###########################
4+
## Linter GitHub Actions ##
5+
###########################
6+
###########################
7+
name: Python Linter
8+
9+
#
10+
# Documentation:
11+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
12+
#
13+
14+
#############################
15+
# Start the job on all push #
16+
#############################
17+
on:
18+
push:
19+
branches: [ master ]
20+
pull_request:
21+
branches: [ master ]
22+
23+
###############
24+
# Set the Job #
25+
###############
26+
jobs:
27+
python-lint:
28+
# Name the Job
29+
name: Python Linter
30+
# Set the agent to run on
31+
runs-on: ubuntu-latest
32+
33+
###################
34+
# Python versions #
35+
###################
36+
strategy:
37+
matrix:
38+
python-version: [3.6, 3.7, 3.8]
39+
40+
##################
41+
# Load all steps #
42+
##################
43+
steps:
44+
45+
##########################
46+
# Checkout the code base #
47+
##########################
48+
- name: Checkout Code
49+
uses: actions/checkout@v2
50+
51+
#########################
52+
# Pick a Python version #
53+
#########################
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
##############################
60+
# Set up a Python virtualenv #
61+
##############################
62+
- name: Set up Python virtual environment
63+
run: |
64+
# Create a virtualenv
65+
python -m venv python${{ matrix.python-version }}-venv
66+
# Activate virtualenv
67+
source python${{ matrix.python-version }}-venv/bin/activate
68+
69+
########################
70+
# Install dependencies #
71+
########################
72+
- name: Install dependencies
73+
run: |
74+
# Activate virtualenv
75+
source python${{ matrix.python-version }}-venv/bin/activate
76+
# Upgrade pip
77+
python -m pip install --upgrade pip
78+
# Install linters and other python modules
79+
pip install pylint pycodestyle flake8 black mypy isort setuptools wheel pytest
80+
81+
########################
82+
# Install requirements #
83+
########################
84+
- name: Install requirements
85+
run: |
86+
# Activate virtualenv
87+
source python${{ matrix.python-version }}-venv/bin/activate
88+
# Install requirements
89+
pip install -r requirements.txt
90+
91+
################################
92+
# Run Linter against code base #
93+
################################
94+
- name: Python Code Quality and Lint
95+
run: |
96+
# Activate virtualenv
97+
source python${{ matrix.python-version }}-venv/bin/activate
98+
# Module to be tested
99+
module=nets
100+
# pylint
101+
for file in $(find $module -type f); do
102+
if [ ${file: -3} == ".py" ]; then
103+
echo Running: pylint $file
104+
pylint $file
105+
if [ "$?" = "0" ]; then echo "Pylint ok"; else echo "Pylint error"; exit $exit_code; fi
106+
fi
107+
done;
108+
# pycodestyle
109+
for file in $(find $module -type f); do
110+
if [ ${file: -3} == ".py" ]; then
111+
echo Running: pycodestyle $file
112+
pycodestyle $file
113+
if [ "$?" = "0" ]; then echo "pycodestyle ok"; else echo "pycodestyle error"; exit $exit_code; fi
114+
fi
115+
done;
116+
# flake8
117+
for file in $(find $module -type f); do
118+
if [ ${file: -3} == ".py" ]; then
119+
echo Running: flake8 $file
120+
flake8 $file
121+
if [ "$?" = "0" ]; then echo "Flake8 ok"; else echo "Flake8 error"; exit $exit_code; fi
122+
fi
123+
done;
124+
# black
125+
#for file in $(find $module -type f); do
126+
# if [ ${file: -3} == ".py" ]; then
127+
# echo Running: black --check $file
128+
# black --check $file
129+
# if [ "$?" = "0" ]; then echo "Black ok"; else echo "Black error"; exit $exit_code; fi
130+
# fi
131+
#done;
132+
# mypy
133+
#for file in $(find $module -type f); do
134+
# if [ ${file: -3} == ".py" ]; then
135+
# echo Running: mypy $file
136+
# mypy $file
137+
# if [ "$?" = "0" ]; then echo "mypy ok"; else echo "mypy error"; exit $exit_code; fi
138+
# fi
139+
#done;
140+
# isort
141+
for file in $(find $module -type f); do
142+
if [ ${file: -3} == ".py" ]; then
143+
echo Running: isort -rc $file -c --diff
144+
isort -rc $file -c --diff --project $file
145+
if [ "$?" = "0" ]; then echo "isort ok"; else echo "isort error"; exit $exit_code; fi
146+
fi
147+
done;

.github/workflows/shell_linter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Shell Linter
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
shell-lint:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
16+
17+
# Steps represent a sequence of tasks that will be executed as part of the job
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v2
21+
22+
- name: Shell Linter
23+
uses: reviewdog/action-shellcheck@v1
24+
with:
25+
github_token: ${{ secrets.github_token }}
26+
reporter: github-pr-review # Change reporter.
27+
path: "." # Optional.
28+
pattern: "*.sh" # Optional.
29+
exclude: "./.git/*" # Optional.
30+
fail_on_error: true
31+
level: "info"
32+
shellcheck_flags: --severity=style --external-sources
33+
filter_mode: "nofilter"

nets/3routers/nodeconf/h1/start.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

3-
BASE_DIR=/home/user/mytests/ospf3routers/nodeconf
43
NODE_NAME=h1
54
GW_NAME=r1
65
IF_NAME=$NODE_NAME-$GW_NAME

nets/3routers/nodeconf/h2/start.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

3-
BASE_DIR=/home/user/mytests/ospf3routers/nodeconf
43
NODE_NAME=h2
54
GW_NAME=r2
65
IF_NAME=$NODE_NAME-$GW_NAME

nets/3routers/nodeconf/h3/start.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

3-
BASE_DIR=/home/user/mytests/ospf3routers/nodeconf
43
NODE_NAME=h3
54
GW_NAME=r3
65
IF_NAME=$NODE_NAME-$GW_NAME

nets/3routers/nodeconf/r1/start.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ sysctl -w net.ipv4.ip_forward=1
1212
#sysctl -w net.ipv4.conf.default.rp_filter=0
1313
#the following for loop also disables all and default
1414
for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
15-
echo 0 > $i
15+
echo 0 > "$i"
1616
done
1717

1818

1919
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
2020
chown frr:frrvty $BASE_DIR/$NODE_NAME
2121
#chown quagga:quagga $BASE_DIR/$NODE_NAME
2222

23-
$FRR_PATH/zebra -f $PWD/$BASE_DIR/$NODE_NAME/zebra.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/zebra.pid
23+
$FRR_PATH/zebra -f "$PWD"/$BASE_DIR/$NODE_NAME/zebra.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/zebra.pid
2424

2525
sleep 1
2626

27-
$FRR_PATH/ospfd -f $PWD/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/ospfd.pid
27+
$FRR_PATH/ospfd -f "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.pid

nets/3routers/nodeconf/r2/start.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ sysctl -w net.ipv4.ip_forward=1
1212
#sysctl -w net.ipv4.conf.default.rp_filter=0
1313
#the following for loop also disables all and default
1414
for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
15-
echo 0 > $i
15+
echo 0 > "$i"
1616
done
1717

1818

1919
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
2020
chown frr:frrvty $BASE_DIR/$NODE_NAME
2121
#chown quagga:quagga $BASE_DIR/$NODE_NAME
2222

23-
$FRR_PATH/zebra -f $PWD/$BASE_DIR/$NODE_NAME/zebra.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/zebra.pid
23+
$FRR_PATH/zebra -f "$PWD"/$BASE_DIR/$NODE_NAME/zebra.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/zebra.pid
2424

2525
sleep 1
2626

27-
$FRR_PATH/ospfd -f $PWD/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/ospfd.pid
27+
$FRR_PATH/ospfd -f "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.pid

nets/3routers/nodeconf/r3/start.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ sysctl -w net.ipv4.ip_forward=1
1212
#sysctl -w net.ipv4.conf.default.rp_filter=0
1313
#the following for loop also disables all and default
1414
for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
15-
echo 0 > $i
15+
echo 0 > "$i"
1616
done
1717

1818

1919
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
2020
chown frr:frrvty $BASE_DIR/$NODE_NAME
2121
#chown quagga:quagga $BASE_DIR/$NODE_NAME
2222

23-
$FRR_PATH/zebra -f $PWD/$BASE_DIR/$NODE_NAME/zebra.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/zebra.pid
23+
$FRR_PATH/zebra -f "$PWD"/$BASE_DIR/$NODE_NAME/zebra.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/zebra.pid
2424

2525
sleep 1
2626

27-
$FRR_PATH/ospfd -f $PWD/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/ospfd.pid
27+
$FRR_PATH/ospfd -f "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.conf -d -z "$PWD"/$BASE_DIR/$NODE_NAME/zebra.sock -i "$PWD"/$BASE_DIR/$NODE_NAME/ospfd.pid

0 commit comments

Comments
 (0)