@@ -26,34 +26,57 @@ jobs:
26
26
run : |
27
27
sudo apt install cpanminus
28
28
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
+
30
57
- name : Download and Build Products Table
31
58
run : |
32
59
export TARGET="products/product.sql"
33
60
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 | \
36
63
grep JUNIPER-CHASSIS-DEFINES | \
37
64
grep -o 'mib=[^"]\+' | \
38
65
sed -e 's/mib=//' | \
39
66
grep -hi -E '(product|oid|JUNIPER-CHASSIS-DEFINES)' | \
40
67
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 ; \
43
70
done
71
+ sort -t " " -k 1,1 ${TARGET}.new.oids | sort -t " " -k 1,1 -u >> ${TARGET}.new
72
+ rm ${TARGET}.new.oids
44
73
echo '\.' >> ${TARGET}.new
45
74
mv ${TARGET}.new ${TARGET}
46
75
47
- - name : Download and Build Enterprises Table
76
+ - name : Combine complete SQL
48
77
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
+
57
80
- name : Commit files
58
81
run : |
59
82
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
73
96
# # if: always() && github.event.inputs.debug_enabled
74
97
# if: always() && ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
75
98
# # with:
76
- # # sudo: true
99
+ # # sudo: true
0 commit comments