Skip to content

Commit d41bcb6

Browse files
authored
weekly download of IEEE upstream files, auto build netdisco lookup tables sql
1 parent 7639c7f commit d41bcb6

File tree

12 files changed

+372320
-192018
lines changed

12 files changed

+372320
-192018
lines changed

.github/workflows/update_tables.yml

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,57 @@ jobs:
2626
run: |
2727
sudo apt install cpanminus
2828
cpanm Text::CSV
29-
29+
30+
- name: Download upstream content
31+
run: |
32+
curl -sL https://www.iana.org/assignments/enterprise-numbers.txt > ieee/SMI/enterprise-numbers.txt
33+
curl -sL https://standards-oui.ieee.org/oui/oui.csv > ieee/MA/MA-L.csv
34+
curl -sL https://standards-oui.ieee.org/oui28/mam.csv > ieee/MA/MA-M.csv
35+
curl -sL https://standards-oui.ieee.org/oui36/oui36.csv > ieee/MA/MA-S.csv
36+
37+
- name: Build Enterprises Table
38+
run: |
39+
export TARGET="ieee/SMI/enterprise.sql"
40+
echo 'DELETE FROM "enterprise";' > ${TARGET}.new
41+
echo 'COPY "enterprise" ("enterprise_number", "organization") FROM STDIN;' >> ${TARGET}.new
42+
cat ieee/SMI/enterprise-numbers.txt | ieee/SMI/smi-to-enterprise-table.pl >> ${TARGET}.new
43+
echo '\.' >> ${TARGET}.new
44+
mv ${TARGET}.new ${TARGET}
45+
46+
- name: Build Manufacturers Table
47+
run: |
48+
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
49+
export TARGET="ieee/MA/manufacturer.sql"
50+
echo 'DELETE FROM "manufacturer";' > ${TARGET}.new
51+
echo 'COPY "manufacturer" ("company", "abbrev", "base", "bits", "first", "last", "range") FROM STDIN;' >> ${TARGET}.new
52+
{ cat ieee/MA/MA-L.csv; sed 1d ieee/MA/MA-M.csv; sed 1d ieee/MA/MA-S.csv; } | \
53+
ieee/MA/ma-to-manufacturer-table.pl >> ${TARGET}.new
54+
echo '\.' >> ${TARGET}.new
55+
mv ${TARGET}.new ${TARGET}
56+
3057
- name: Download and Build Products Table
3158
run: |
3259
export TARGET="products/product.sql"
3360
echo 'DELETE FROM "product";' > ${TARGET}.new
34-
echo 'COPY "product" ("oid", "mib", "leaf", "description") FROM STDIN;' >> ${TARGET}.new
35-
curl --silent --location "https://mibbrowser.online/mibdb_search.php?all=1" | \
61+
echo 'COPY "product" ("oid", "mib", "leaf", "descr") FROM STDIN;' >> ${TARGET}.new
62+
curl -sL https://mibbrowser.online/mibdb_search.php?all=1 | \
3663
grep JUNIPER-CHASSIS-DEFINES | \
3764
grep -o 'mib=[^"]\+' | \
3865
sed -e 's/mib=//' | \
3966
grep -hi -E '(product|oid|JUNIPER-CHASSIS-DEFINES)' | \
4067
while read mib; do \
41-
curl --silent --location "https://mibbrowser.online/mibs_json/$mib.json" | \
42-
products/pysmi-json-to-products-table.py >> ${TARGET}.new; \
68+
curl -sL "https://mibbrowser.online/mibs_json/$mib.json" | \
69+
products/pysmi-json-to-products-table.py >> ${TARGET}.new.oids; \
4370
done
71+
sort -t " " -k 1,1 ${TARGET}.new.oids | sort -t " " -k 1,1 -u >> ${TARGET}.new
72+
rm ${TARGET}.new.oids
4473
echo '\.' >> ${TARGET}.new
4574
mv ${TARGET}.new ${TARGET}
4675
47-
- name: Download and Build Enterprises Table
76+
- name: Combine complete SQL
4877
run: |
49-
export TARGET="ieee/SMI/enterprise.sql"
50-
echo 'DELETE FROM "enterprise";' > ${TARGET}.new
51-
echo 'COPY "enterprise" ("enterprise_number", "organization") FROM STDIN;' >> ${TARGET}.new
52-
curl --silent --location "https://www.iana.org/assignments/enterprise-numbers.txt" | \
53-
ieee/SMI/smi-to-enterprise-table.pl >> ${TARGET}.new
54-
echo '\.' >> ${TARGET}.new
55-
mv ${TARGET}.new ${TARGET}
56-
78+
cat ieee/OUI/oui.sql ieee/SMI/enterprise.sql ieee/MA/manufacturer.sql products/product.sql > bootstrap/netdisco-lookup-tables.sql
79+
5780
- name: Commit files
5881
run: |
5982
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -73,4 +96,4 @@ jobs:
7396
## if: always() && github.event.inputs.debug_enabled
7497
# if: always() && ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
7598
## with:
76-
## sudo: true
99+
## sudo: true

0 commit comments

Comments
 (0)